summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2012-10-20 09:12:13 +0200
committerAndrea Diamantini <adjam7@gmail.com>2012-12-10 02:48:05 +0100
commite33410d3b55ce3143343dfde5132dade7e3bd24e (patch)
treeba2620411996bfedfe21378fbd239ac610938b45
parentFix url choice by up/down keys (diff)
downloadrekonq-e33410d3b55ce3143343dfde5132dade7e3bd24e.tar.xz
Enable incognito mode by calling "rekonq --incognito URL" :)
-rw-r--r--src/application.cpp61
-rw-r--r--src/main.cpp3
2 files changed, 48 insertions, 16 deletions
diff --git a/src/application.cpp b/src/application.cpp
index bd48a748..679fd1d8 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -107,6 +107,12 @@ int Application::newInstance()
kDebug() << "are there arguments? " << areThereArguments;
kDebug() << "is rekonq crashed? " << hasToBeRecoveredFromCrash;
+ bool incognito = args->isSet("incognito");
+ bool webapp = args->isSet("webapp");
+
+ kDebug() << "INCOGNITO: " << incognito;
+ kDebug() << "WEBAPPS: " << webapp;
+
if (areThereArguments)
{
// prepare URLS to load
@@ -146,18 +152,24 @@ int Application::newInstance()
{
// No windows in the current desktop? No windows at all?
// Create a new one and load there sites...
- loadUrl(urlList.at(0), Rekonq::NewWindow);
+ if (incognito)
+ loadUrl(urlList.at(0), Rekonq::NewPrivateWindow);
+ else
+ loadUrl(urlList.at(0), Rekonq::NewWindow);
}
else
{
- if (!ReKonfig::openExternalLinksInNewWindow())
- {
- loadUrl(urlList.at(0), Rekonq::NewFocusedTab);
- }
+ if (incognito)
+ loadUrl(urlList.at(0), Rekonq::NewPrivateWindow);
else
- {
- loadUrl(urlList.at(0), Rekonq::NewWindow);
- }
+ if (!ReKonfig::openExternalLinksInNewWindow())
+ {
+ loadUrl(urlList.at(0), Rekonq::NewFocusedTab);
+ }
+ else
+ {
+ loadUrl(urlList.at(0), Rekonq::NewWindow);
+ }
if (!tabWindow()->isActiveWindow())
KWindowSystem::demandAttention(tabWindow()->winId(), true);
@@ -173,10 +185,13 @@ int Application::newInstance()
else
{
for (int i = 1; i < urlList.count(); ++i)
- loadUrl(urlList.at(i), Rekonq::NewWindow);
+ if (incognito)
+ loadUrl(urlList.at(i), Rekonq::NewPrivateWindow);
+ else
+ loadUrl(urlList.at(i), Rekonq::NewWindow);
}
}
- else
+ else // ok, NO arguments
{
if (isFirstLoad)
{
@@ -188,6 +203,11 @@ int Application::newInstance()
switch (ReKonfig::startupBehaviour())
{
case 0: // open home page
+ if (incognito)
+ {
+ loadUrl(KUrl(ReKonfig::homePage()), Rekonq::NewPrivateWindow);
+ break;
+ }
restoreOk = SessionManager::self()->restoreJustThePinnedTabs();
if (restoreOk)
loadUrl(KUrl(ReKonfig::homePage()) , Rekonq::NewTab);
@@ -195,6 +215,11 @@ int Application::newInstance()
loadUrl(KUrl(ReKonfig::homePage()) , Rekonq::NewWindow);
break;
case 1: // open new tab page
+ if (incognito)
+ {
+ loadUrl(KUrl("about:home"), Rekonq::NewPrivateWindow);
+ break;
+ }
restoreOk = SessionManager::self()->restoreJustThePinnedTabs();
if (restoreOk)
loadUrl(KUrl("about:home"), Rekonq::NewTab);
@@ -202,6 +227,11 @@ int Application::newInstance()
loadUrl(KUrl("about:home"), Rekonq::NewWindow);
break;
case 2: // restore session
+ if (incognito)
+ {
+ loadUrl(KUrl("about:home"), Rekonq::NewPrivateWindow);
+ break;
+ }
if (SessionManager::self()->restoreSessionFromScratch())
{
break;
@@ -214,25 +244,28 @@ int Application::newInstance()
}
else
{
+ Rekonq::OpenType type = incognito ? Rekonq::NewPrivateWindow : Rekonq::NewWindow;
+
switch (ReKonfig::newTabsBehaviour())
{
case 0: // new tab page
- loadUrl(KUrl("about:home") , Rekonq::NewWindow);
+ loadUrl(KUrl("about:home") , type);
break;
case 2: // homepage
- loadUrl(KUrl(ReKonfig::homePage()) , Rekonq::NewWindow);
+ loadUrl(KUrl(ReKonfig::homePage()) , type);
break;
case 1: // blank page
default:
- loadUrl(KUrl("about:blank") , Rekonq::NewWindow);
+ loadUrl(KUrl("about:blank") , type);
break;
}
}
}
+ // ok, now last stuffs...
if (isFirstLoad)
{
- if (hasToBeRecoveredFromCrash)
+ if (hasToBeRecoveredFromCrash && !incognito)
{
QTimer::singleShot(1000, tabWindow()->currentWebWindow(), SLOT(showCrashMessageBar()));
}
diff --git a/src/main.cpp b/src/main.cpp
index 07963467..c54e5bd2 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -65,8 +65,7 @@ extern "C" KDE_EXPORT int kdemain(int argc, char **argv)
// adding options
options.add("incognito" , ki18n("Open in incognito mode"));
- options.add("webapp=URL" , ki18n("Open URL as web app (in a simple window, as separate process)"));
- options.add("window" , ki18n("Open a standalone window (i.e. WITHOUT the tabbar)"));
+ options.add("webapp" , ki18n("Open URL as web app (in a simple window)"));
options.add("+[URL]" , ki18n("Location to open"));
// Register the supported options