From 7c981aa978bea7551aec99bc3c68a23cd6c8df00 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 22 Oct 2010 00:04:47 +0200 Subject: This commit implements the new private browsign mode for rekonq: - it implements a new KAaction in the Application class to trace changes on - stops session management and save it, restoring last visited sites on restoring mormal mode - implements necessary changes to iconmanager, urlbar & application Please, note that the private browsing mode will definitely work just on KDE SC 4.6, cause of the needed changes in kdewebkit to eg handle cookies and so on.. . Hope you like it :) --- src/mainwindow.cpp | 46 ++++++---------------------------------------- 1 file changed, 6 insertions(+), 40 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 555e58ae..7b4cf8a3 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -408,11 +408,9 @@ void MainWindow::setupActions() actionCollection()->addAction(QL1S("page_source"), a); connect(a, SIGNAL(triggered(bool)), this, SLOT(viewPageSource())); - a = new KAction(KIcon("view-media-artist"), i18n("Private &Browsing"), this); - a->setCheckable(true); + a = Application::instance()->privateBrowsingAction(); actionCollection()->addAction(QL1S("private_browsing"), a); - connect(a, SIGNAL(triggered(bool)), this, SLOT(privateBrowsing(bool))); - + a = new KAction(KIcon("edit-clear"), i18n("Clear Private Data..."), this); actionCollection()->addAction(QL1S("clear_private_data"), a); connect(a, SIGNAL(triggered(bool)), this, SLOT(clearPrivateData())); @@ -728,42 +726,6 @@ void MainWindow::printRequested(QWebFrame *frame) } -void MainWindow::privateBrowsing(bool enable) -{ - QWebSettings *settings = QWebSettings::globalSettings(); - if (enable && !settings->testAttribute(QWebSettings::PrivateBrowsingEnabled)) - { - QString title = i18n("Are you sure you want to turn on private browsing?"); - QString text = i18n("%1" - "

When private browsing is turned on," - " web pages are not added to the history," - " new cookies are not stored, current cookies cannot be accessed," - " site icons will not be stored, the session will not be saved." - " Until you close the window, you can still click the Back and Forward buttons" - " to return to the web pages you have opened.

", title); - - int button = KMessageBox::warningContinueCancel(this, text, title); - if (button == KMessageBox::Continue) - { - settings->setAttribute(QWebSettings::PrivateBrowsingEnabled, true); - m_view->urlBar()->setPrivateMode(true); - } - else - { - actionCollection()->action( QL1S("private_browsing") )->setChecked(false); - } - } - else - { - settings->setAttribute(QWebSettings::PrivateBrowsingEnabled, false); - m_view->urlBar()->setPrivateMode(false); - - m_lastSearch.clear(); - m_view->reloadAllTabs(); - } -} - - void MainWindow::find(const QString & search) { if (!currentTab()) @@ -1349,6 +1311,10 @@ bool MainWindow::queryClose() if(Application::instance()->sessionSaving()) return true; + // smooth private browsing mode + if(QWebSettings::globalSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)) + return true; + if (m_view->count() > 1) { int answer = KMessageBox::questionYesNoCancel( -- cgit v1.2.1