summaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-10-22 00:04:47 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-10-22 00:10:28 +0200
commit7c981aa978bea7551aec99bc3c68a23cd6c8df00 (patch)
tree4db8b374676927afe7915a0cc034b477beeb3ebf /src/mainwindow.cpp
parentThis commit fixes icons handling for "rekonq pages" (eg: about urls). (diff)
downloadrekonq-7c981aa978bea7551aec99bc3c68a23cd6c8df00.tar.xz
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 :)
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp46
1 files changed, 6 insertions, 40 deletions
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("<b>%1</b>"
- "<p>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.</p>", 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(