From 1df70c152d9621a6b4ec41af19260e737f7ef58b Mon Sep 17 00:00:00 2001 From: Domrachev Alexandr Date: Thu, 18 Jun 2009 22:39:08 +0400 Subject: MainWindow::slotPrivateBrowsing fix Don't show private browsing confirmation dialog when disabling private browsing. Private browsing activation confirm dialog fix. --- src/mainwindow.cpp | 8 ++++---- src/mainwindow.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index abc3fcd5..20ee31f8 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -288,7 +288,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); @@ -524,7 +524,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 = "" + title + i18n("

When private browsing is turned on," @@ -535,8 +535,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); } diff --git a/src/mainwindow.h b/src/mainwindow.h index 411cbe6c..7fcc432c 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -102,7 +102,6 @@ private slots: void slotFileOpen(); void slotFilePrintPreview(); void slotFilePrint(); - void slotPrivateBrowsing(bool); void slotFileSaveAs(); void printRequested(QWebFrame *frame); @@ -120,6 +119,7 @@ private slots: // Tools Menu slots void slotToggleInspector(bool enable); + void slotPrivateBrowsing(bool enable); // Settings Menu slots void slotShowMenubar(bool enable); -- cgit v1.2.1 From 63de0263e68f31dd9535e6e92932260b0ab6111a Mon Sep 17 00:00:00 2001 From: Domrachev Alexandr Date: Thu, 18 Jun 2009 22:47:32 +0400 Subject: MainWindow::slotFind{Next, Previous} code clean --- src/mainwindow.cpp | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 20ee31f8..d0405ea9 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -570,15 +570,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)) { @@ -592,15 +586,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)) { -- cgit v1.2.1 From 0ed1a768789d208a93d747e9d0bac581ab69d1cb Mon Sep 17 00:00:00 2001 From: Domrachev Alexandr Date: Thu, 18 Jun 2009 22:57:11 +0400 Subject: File filter fix in MainView::slotFileOpen dialog. --- src/mainwindow.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d0405ea9..94411794 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -476,10 +476,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; -- cgit v1.2.1 From 2e7d5ea7f5f4dcb24a446fc112a80d1811a3ec14 Mon Sep 17 00:00:00 2001 From: Domrachev Alexandr Date: Thu, 18 Jun 2009 23:03:47 +0400 Subject: Some text reformatting --- src/mainview.cpp | 7 +++---- src/mainwindow.cpp | 27 +++++++++++++-------------- 2 files changed, 16 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/mainview.cpp b/src/mainview.cpp index 6f3ad926..8862ee47 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -480,11 +480,10 @@ void MainView::slotCloseTab(int index) { if (tab->isModified()) { - int risp = KMessageBox::questionYesNo(this , + int risp = KMessageBox::questionYesNo(this, i18n("You have modified this page and when closing it you would lose the modification.\n" - "Do you really want to close this page?\n"), - i18n("Do you really want to close this page?") - ); + "Do you really want to close this page?\n"), + i18n("Do you really want to close this page?")); if (risp == KMessageBox::No) return; } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 94411794..aed1ef9c 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -476,7 +476,7 @@ void MainWindow::slotUpdateWindowTitle(const QString &title) void MainWindow::slotFileOpen() { QString filePath = KFileDialog::getOpenFileName(KUrl(), - i18n("*.html *.htm *.svg *.png *.gif *.svgz|Web Resources (*.html *.htm *.svg *.png *.gif *.svgz)\n"\ + i18n("*.html *.htm *.svg *.png *.gif *.svgz|Web Resources (*.html *.htm *.svg *.png *.gif *.svgz)\n" \ "*.*|All files (*.*)"), this, i18n("Open Web Resource")); @@ -704,8 +704,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") ); @@ -834,17 +834,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) { -- cgit v1.2.1 From af7c11bf0ee92d8ac262d346e5c7cdb76e1d42a9 Mon Sep 17 00:00:00 2001 From: Domrachev Alexandr Date: Fri, 19 Jun 2009 01:08:56 +0400 Subject: Remove unused variable declaration --- src/urlbar.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/urlbar.h b/src/urlbar.h index 32d09af4..24fea38f 100644 --- a/src/urlbar.h +++ b/src/urlbar.h @@ -81,7 +81,6 @@ private: LineEdit *m_lineEdit; - QIcon m_currentIcon; KUrl m_currentUrl; int m_progress; }; -- cgit v1.2.1 From 76d86dde4d9e5801ccbdce66f8ccaa86ccbd77d0 Mon Sep 17 00:00:00 2001 From: Domrachev Alexandr Date: Fri, 19 Jun 2009 01:18:23 +0400 Subject: Application::icon() changed to static --- src/application.cpp | 2 +- src/application.h | 2 +- src/history.cpp | 2 +- src/mainview.cpp | 4 ++-- src/mainwindow.cpp | 2 +- src/urlbar.cpp | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/application.cpp b/src/application.cpp index 94821653..6f479d62 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -184,7 +184,7 @@ BookmarkProvider *Application::bookmarkProvider() } -KIcon Application::icon(const KUrl &url) const +KIcon Application::icon(const KUrl &url) { KIcon icon = KIcon(QWebSettings::iconForUrl(url)); if (icon.isNull()) diff --git a/src/application.h b/src/application.h index a5658703..7f3e6f3b 100644 --- a/src/application.h +++ b/src/application.h @@ -77,7 +77,7 @@ public: MainWindow *mainWindow(); WebView *newWebView(Rekonq::OpenType type = Rekonq::Default); - KIcon icon(const KUrl &url) const; + static KIcon icon(const KUrl &url); static KUrl guessUrlFromString(const QString &url); diff --git a/src/history.cpp b/src/history.cpp index dcfe4c21..9ed479a2 100644 --- a/src/history.cpp +++ b/src/history.cpp @@ -500,7 +500,7 @@ QVariant HistoryModel::data(const QModelIndex &index, int role) const case Qt::DecorationRole: if (index.column() == 0) { - return Application::instance()->icon(item.url); + return Application::icon(item.url); } } return QVariant(); diff --git a/src/mainview.cpp b/src/mainview.cpp index 8862ee47..d15444ab 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -593,7 +593,7 @@ void MainView::webViewIconChanged() int index = webViewIndex(webView); if (-1 != index) { - QIcon icon = Application::instance()->icon(webView->url()); + QIcon icon = Application::icon(webView->url()); QLabel *label = animatedLoading(index, false); QMovie *movie = label->movie(); delete movie; @@ -643,7 +643,7 @@ void MainView::aboutToShowRecentTabsMenu() { KAction *action = new KAction(m_recentlyClosedTabsMenu); action->setData(m_recentlyClosedTabs.at(i)); - QIcon icon = Application::instance()->icon(m_recentlyClosedTabs.at(i)); + QIcon icon = Application::icon(m_recentlyClosedTabs.at(i)); action->setIcon(icon); action->setText(m_recentlyClosedTabs.at(i).prettyUrl()); m_recentlyClosedTabsMenu->addAction(action); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index aed1ef9c..b60e3469 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -766,7 +766,7 @@ void MainWindow::slotAboutToShowBackMenu() QWebHistoryItem item = history->backItems(history->count()).at(i); KAction *action = new KAction(this); action->setData(-1*(historyCount - i - 1)); - QIcon icon = Application::instance()->icon(item.url()); + QIcon icon = Application::icon(item.url()); action->setIcon(icon); action->setText(item.title()); m_historyBackMenu->addAction(action); diff --git a/src/urlbar.cpp b/src/urlbar.cpp index 0204d321..d107ba1a 100644 --- a/src/urlbar.cpp +++ b/src/urlbar.cpp @@ -137,11 +137,11 @@ void UrlBar::slotUpdateUrl() { if (count()) { - changeUrl(0, Application::instance()->icon(m_currentUrl), m_currentUrl); + changeUrl(0, Application::icon(m_currentUrl), m_currentUrl); } else { - insertUrl(0, Application::instance()->icon(m_currentUrl), m_currentUrl); + insertUrl(0, Application::icon(m_currentUrl), m_currentUrl); } setCurrentIndex(0); -- cgit v1.2.1