summaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp97
1 files changed, 44 insertions, 53 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 519081d6..82f95cfa 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -92,7 +92,6 @@
MainWindow::MainWindow()
: KXmlGuiWindow()
, m_view(new MainView(this))
- , m_searchBar(new SearchBar(this))
, m_findBar(new FindBar(this))
, m_sidePanel(0)
{
@@ -119,8 +118,8 @@ MainWindow::MainWindow()
// then, setup our actions
setupActions();
- // setting up toolbars: this has to be done BEFORE setupGUI!!
- setupToolBars();
+ // setting up toolbars && location bar: this has to be done BEFORE setupGUI!!
+ setupBars();
// Bookmark Menu
KActionMenu *bmMenu = Application::bookmarkProvider()->bookmarkActionMenu();
@@ -165,10 +164,6 @@ void MainWindow::postLaunch()
connect(m_view, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int)));
connect(m_view, SIGNAL(printRequested(QWebFrame *)), this, SLOT(printRequested(QWebFrame *)));
- // "status bar" messages (new notifyMessage system)
- connect(m_view, SIGNAL(showStatusBarMessage(const QString&, Rekonq::Notify)), this, SLOT(notifyMessage(const QString&, Rekonq::Notify)));
- connect(m_view, SIGNAL(linkHovered(const QString&)), this, SLOT(notifyMessage(const QString&)));
-
// update toolbar actions signals
connect(m_view, SIGNAL(tabsChanged()), this, SLOT(slotUpdateActions()));
connect(m_view, SIGNAL(currentChanged(int)), this, SLOT(slotUpdateActions()));
@@ -195,7 +190,7 @@ QSize MainWindow::sizeHint() const
}
-void MainWindow::setupToolBars()
+void MainWindow::setupBars()
{
KAction *a;
@@ -205,13 +200,6 @@ void MainWindow::setupToolBars()
a->setDefaultWidget(m_view->urlBarStack());
actionCollection()->addAction(QLatin1String("url_bar"), a);
- // search bar
- a = new KAction(i18n("Search Bar"), this);
- a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_K));
- a->setDefaultWidget(m_searchBar);
- connect(m_searchBar, SIGNAL(search(const KUrl&)), this, SLOT(loadUrl(const KUrl&)));
- actionCollection()->addAction(QLatin1String("search_bar"), a);
-
// bookmarks bar
KAction *bookmarkBarAction = Application::bookmarkProvider()->bookmarkToolBarAction();
a = actionCollection()->addAction(QLatin1String("bookmarks_bar"), bookmarkBarAction);
@@ -295,7 +283,7 @@ void MainWindow::setupActions()
a = new KAction(KIcon("view-media-artist"), i18n("Private &Browsing"), this);
a->setCheckable(true);
actionCollection()->addAction(QLatin1String("private_browsing"), a);
- connect(a, SIGNAL(triggered(bool)) , this, SLOT(slotPrivateBrowsing(bool)));
+ connect(a, SIGNAL(triggered(bool)), this, SLOT(slotPrivateBrowsing(bool)));
// ================ history related actions
m_historyBackAction = new KAction(KIcon("go-previous"), i18n("Back"), this);
@@ -360,7 +348,7 @@ void MainWindow::setupHistoryMenu()
// setting history menu position
menuBar()->insertMenu(actionCollection()->action("bookmarks"), historyMenu);
- // setting initial actions
+ // setting initial actions
QList<QAction*> historyActions;
historyActions.append(actionCollection()->action("history_back"));
historyActions.append(actionCollection()->action("history_forward"));
@@ -375,6 +363,23 @@ void MainWindow::slotUpdateConfiguration()
mainView()->showTabBar();
mainView()->setMakeBackTab( ReKonfig::openTabsBack() );
+ // "status bar" messages (new notifyMessage system)
+ if(ReKonfig::showUrlsPopup())
+ {
+ connect(m_view, SIGNAL(showStatusBarMessage(const QString&, Rekonq::Notify)),
+ this, SLOT(notifyMessage(const QString&, Rekonq::Notify)));
+ connect(m_view, SIGNAL(linkHovered(const QString&)),
+ this, SLOT(notifyMessage(const QString&)));
+ }
+ else
+ {
+ disconnect(m_view, SIGNAL(showStatusBarMessage(const QString&, Rekonq::Notify)),
+ this, SLOT(notifyMessage(const QString&, Rekonq::Notify)));
+ disconnect(m_view, SIGNAL(linkHovered(const QString&)),
+ this, SLOT(notifyMessage(const QString&)));
+ }
+
+
// =========== Fonts ==============
QWebSettings *defaultSettings = QWebSettings::globalSettings();
@@ -483,10 +488,10 @@ void MainWindow::slotUpdateWindowTitle(const QString &title)
void MainWindow::slotFileOpen()
{
QString filePath = KFileDialog::getOpenFileName(KUrl(),
- i18n("Web Resources (*.html *.htm *.svg *.png *.gif *.svgz); All files (*.*)"),
+ i18n("*.html *.htm *.svg *.png *.gif *.svgz|Web Resources (*.html *.htm *.svg *.png *.gif *.svgz)\n" \
+ "*.*|All files (*.*)"),
this,
- i18n("Open Web Resource")
- );
+ i18n("Open Web Resource"));
if (filePath.isEmpty())
return;
@@ -531,7 +536,7 @@ void MainWindow::printRequested(QWebFrame *frame)
void MainWindow::slotPrivateBrowsing(bool enable)
{
QWebSettings *settings = QWebSettings::globalSettings();
- if (enable)
+ if (enable && !settings->testAttribute(QWebSettings::PrivateBrowsingEnabled))
{
QString title = i18n("Are you sure you want to turn on private browsing?");
QString text = "<b>" + title + i18n("</b><br><br>When private browsing is turned on,"
@@ -542,8 +547,8 @@ void MainWindow::slotPrivateBrowsing(bool enable)
" Until you close the window, you can still click the Back and Forward buttons" \
" to return to the web pages you have opened.");
- int button = KMessageBox::questionYesNo(this, text, title);
- if (button == KMessageBox::Ok)
+ int button = KMessageBox::questionYesNo(this, text, title);
+ if (button == KMessageBox::Yes)
{
settings->setAttribute(QWebSettings::PrivateBrowsingEnabled, true);
}
@@ -577,15 +582,9 @@ void MainWindow::slotFindNext()
if (!currentTab() && m_lastSearch.isEmpty())
return;
- QWebPage::FindFlags options;
+ QWebPage::FindFlags options = QWebPage::FindWrapsAroundDocument;
if (m_findBar->matchCase())
- {
- options = QWebPage::FindCaseSensitively | QWebPage::FindWrapsAroundDocument;
- }
- else
- {
- options = QWebPage::FindWrapsAroundDocument;
- }
+ options |= QWebPage::FindCaseSensitively;
if (!currentTab()->findText(m_lastSearch, options))
{
@@ -599,15 +598,9 @@ void MainWindow::slotFindPrevious()
if (!currentTab() && m_lastSearch.isEmpty())
return;
- QWebPage::FindFlags options;
+ QWebPage::FindFlags options = QWebPage::FindBackward | QWebPage::FindWrapsAroundDocument;
if (m_findBar->matchCase())
- {
- options = QWebPage::FindCaseSensitively | QWebPage::FindBackward | QWebPage::FindWrapsAroundDocument;
- }
- else
- {
- options = QWebPage::FindBackward | QWebPage::FindWrapsAroundDocument;
- }
+ options |= QWebPage::FindCaseSensitively;
if (!currentTab()->findText(m_lastSearch, options))
{
@@ -718,8 +711,8 @@ void MainWindow::slotToggleInspector(bool enable)
if (enable)
{
int result = KMessageBox::questionYesNo(this,
- i18n("The web inspector will only work correctly for pages that were loaded after enabling.\n"
- "Do you want to reload all pages?"),
+ i18n("The web inspector will only work correctly for pages that were loaded after enabling.\n" \
+ "Do you want to reload all pages?"),
i18n("Web Inspector")
);
@@ -810,17 +803,16 @@ bool MainWindow::queryClose()
int answer = KMessageBox::questionYesNoCancel(
this,
- i18np( "Are you sure you want to close the window?\n"
- "You have 1 tab open",
- "Are you sure you want to close the window?\n"
- "You have %1 tabs open",
- m_view->count()),
- i18n("Are you sure you want to close the window?"),
- KStandardGuiItem::quit(),
- KGuiItem(i18n("C&lose Current Tab"), KIcon("tab-close")),
- KStandardGuiItem::cancel(),
- "confirmClosingMultipleTabs"
- );
+ i18np("Are you sure you want to close the window?\n" \
+ "You have 1 tab open",
+ "Are you sure you want to close the window?\n" \
+ "You have %1 tabs open",
+ m_view->count()),
+ i18n("Are you sure you want to close the window?"),
+ KStandardGuiItem::quit(),
+ KGuiItem(i18n("C&lose Current Tab"), KIcon("tab-close")),
+ KStandardGuiItem::cancel(),
+ "confirmClosingMultipleTabs");
switch (answer)
{
@@ -891,7 +883,6 @@ void MainWindow::notifyMessage(const QString &msg, Rekonq::Notify status)
m_popup->setView(msg);
int h = KGlobalSettings::generalFont().pointSize();
- kWarning() << "h: " << h;
// setting popus in bottom-left position
int x = geometry().x();