From 131eef5c9df0f26934fd0dc64fc4891ae70c3d4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mladen=20Pejakovi=C4=87?= Date: Sat, 22 Feb 2014 14:57:22 +0100 Subject: [PATCH] Open links in private window. --- src/lib/app/mainapplication.cpp | 6 ++++++ src/lib/rss/rssmanager.cpp | 1 + src/lib/webview/webview.cpp | 1 + 3 files changed, 8 insertions(+) diff --git a/src/lib/app/mainapplication.cpp b/src/lib/app/mainapplication.cpp index feefef5e7..506e52c92 100644 --- a/src/lib/app/mainapplication.cpp +++ b/src/lib/app/mainapplication.cpp @@ -1064,6 +1064,8 @@ Speller* MainApplication::speller() void MainApplication::startPrivateBrowsing() { + const QUrl url = qobject_cast(sender())->data().toUrl(); + QStringList args; foreach (const QString &arg, arguments()) { if (arg.startsWith(QLatin1Char('-')) && @@ -1075,6 +1077,10 @@ void MainApplication::startPrivateBrowsing() args.append(QLatin1String("--private-browsing")); + if (!url.isEmpty()) { + args << url.toEncoded(); + } + if (!QProcess::startDetached(applicationFilePath(), args)) { qWarning() << "MainApplication: Cannot start new browser process for private browsing!" << applicationFilePath() << args; } diff --git a/src/lib/rss/rssmanager.cpp b/src/lib/rss/rssmanager.cpp index aa5b1355f..b66600bc3 100644 --- a/src/lib/rss/rssmanager.cpp +++ b/src/lib/rss/rssmanager.cpp @@ -256,6 +256,7 @@ void RSSManager::customContextMenuRequested(const QPoint &position) QMenu menu; menu.addAction(tr("Open link in current tab"), getQupZilla(), SLOT(loadActionUrl()))->setData(link); menu.addAction(tr("Open link in new tab"), this, SLOT(loadFeedInNewTab()))->setData(link); + menu.addAction(tr("Open link in &private window"), mApp, SLOT(startPrivateBrowsing()))->setData(link); //Prevent choosing first option with double rightclick QPoint pos = treeWidget->viewport()->mapToGlobal(position); diff --git a/src/lib/webview/webview.cpp b/src/lib/webview/webview.cpp index 0034c3393..804f25521 100644 --- a/src/lib/webview/webview.cpp +++ b/src/lib/webview/webview.cpp @@ -1010,6 +1010,7 @@ void WebView::createLinkContextMenu(QMenu* menu, const QWebHitTestResult &hitTes connect(act, SIGNAL(ctrlTriggered()), this, SLOT(userDefinedOpenUrlInBgTab())); menu->addAction(act); menu->addAction(QIcon::fromTheme("window-new"), tr("Open link in new &window"), this, SLOT(openUrlInNewWindow()))->setData(hitTest.linkUrl()); + menu->addAction(QIcon(":icons/locationbar/privatebrowsing.png"), tr("Open link in &private window"), mApp, SLOT(startPrivateBrowsing()))->setData(hitTest.linkUrl()); menu->addSeparator(); QVariantList bData;