From 02d9b5fe590303e540c1ff9111e0cfe3194f7e7d Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 25 Sep 2012 18:02:23 +0200 Subject: New Private Browsing mode :D --- src/download/downloadmanager.cpp | 17 ++++++----------- src/download/downloadmanager.h | 2 +- 2 files changed, 7 insertions(+), 12 deletions(-) (limited to 'src/download') diff --git a/src/download/downloadmanager.cpp b/src/download/downloadmanager.cpp index 560ddb9d..0ee4d672 100644 --- a/src/download/downloadmanager.cpp +++ b/src/download/downloadmanager.cpp @@ -135,10 +135,6 @@ void DownloadManager::init() DownloadItem* DownloadManager::addDownload(KIO::CopyJob *job) { - QWebSettings *globalSettings = QWebSettings::globalSettings(); - if (globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled)) - return 0; - KIO::CopyJob *cJob = qobject_cast(job); QString downloadFilePath = KStandardDirs::locateLocal("appdata" , "downloads"); @@ -162,10 +158,6 @@ DownloadItem* DownloadManager::addDownload(KIO::CopyJob *job) DownloadItem* DownloadManager::addKGetDownload(const QString &srcUrl, const QString &destUrl) { - QWebSettings *globalSettings = QWebSettings::globalSettings(); - if (globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled)) - return 0; - QString downloadFilePath = KStandardDirs::locateLocal("appdata" , "downloads"); QFile downloadFile(downloadFilePath); if (!downloadFile.open(QFile::WriteOnly | QFile::Append)) @@ -224,7 +216,7 @@ void DownloadManager::removeDownloadItem(int index) // 1. KGet Integration // 2. Save downloads history bool DownloadManager::downloadResource(const KUrl &srcUrl, const KIO::MetaData &metaData, - QWidget *parent, bool forceDirRequest, const QString &suggestedName) + QWidget *parent, bool forceDirRequest, const QString &suggestedName, bool registerDownload) { KUrl destUrl; @@ -259,7 +251,8 @@ bool DownloadManager::downloadResource(const KUrl &srcUrl, const KIO::MetaData & QDBusMessage transfer = kget.call(QL1S("addTransfer"), srcUrl.prettyUrl(), destUrl.prettyUrl(), true); - addKGetDownload(srcUrl.pathOrUrl(), destUrl.pathOrUrl()); + if (registerDownload) + addKGetDownload(srcUrl.pathOrUrl(), destUrl.pathOrUrl()); return true; } @@ -273,6 +266,8 @@ bool DownloadManager::downloadResource(const KUrl &srcUrl, const KIO::MetaData & job->ui()->setWindow((parent ? parent->window() : 0)); job->ui()->setAutoErrorHandlingEnabled(true); - addDownload(job); + if (registerDownload) + addDownload(job); + return true; } diff --git a/src/download/downloadmanager.h b/src/download/downloadmanager.h index 5ac4d628..22998567 100644 --- a/src/download/downloadmanager.h +++ b/src/download/downloadmanager.h @@ -70,7 +70,7 @@ public: bool clearDownloadsHistory(); bool downloadResource(const KUrl &url, const KIO::MetaData &metaData = KIO::MetaData(), - QWidget *parent = 0, bool forceDirRequest = false, const QString &suggestedName = QString()); + QWidget *parent = 0, bool forceDirRequest = false, const QString &suggestedName = QString(), bool registerDownload = true); void downloadLinksWithKGet(const QVariant &contentList); -- cgit v1.2.1