diff --git a/src/downloads/downloadmanager.cpp b/src/downloads/downloadmanager.cpp index 4a021ae84..f3e596ed1 100644 --- a/src/downloads/downloadmanager.cpp +++ b/src/downloads/downloadmanager.cpp @@ -28,10 +28,10 @@ #include "webpage.h" #include "downloadfilehelper.h" -DownloadManager::DownloadManager(QWidget* parent) : - QWidget(parent) - ,ui(new Ui::DownloadManager) - ,m_isClosing(false) +DownloadManager::DownloadManager(QWidget* parent) + : QWidget(parent) + , ui(new Ui::DownloadManager) + , m_isClosing(false) { setWindowFlags(windowFlags() ^ Qt::WindowMaximizeButtonHint); ui->setupUi(this); @@ -60,6 +60,7 @@ void DownloadManager::loadSettings() settings.beginGroup("DownloadManager"); m_downloadPath = settings.value("defaultDownloadPath", "").toString(); m_lastDownloadPath = settings.value("lastDownloadPath", QDir::homePath() + "/").toString(); + m_closeOnFinish = settings.value("CloseManagerOnFinish", false).toBool(); m_useNativeDialog = settings.value("useNativeDialog", #ifdef Q_WS_WIN false @@ -200,8 +201,10 @@ void DownloadManager::downloadFinished(bool success) if (downloadingAllFilesFinished) { if (success && qApp->activeWindow() != this) { mApp->desktopNotifications()->notify(QPixmap(":icons/notifications/download.png"), tr("Download Finished"), tr("All files have been successfuly downloaded.")); - raise(); - activateWindow(); + if (!m_closeOnFinish) { + raise(); + activateWindow(); + } } ui->speedLabel->clear(); setWindowTitle(tr("Download Manager")); @@ -211,6 +214,8 @@ void DownloadManager::downloadFinished(bool success) win7.setProgressState(win7.NoProgress); } #endif + if (m_closeOnFinish) + close(); } } diff --git a/src/downloads/downloadmanager.h b/src/downloads/downloadmanager.h index 9d3450334..3ee829f01 100644 --- a/src/downloads/downloadmanager.h +++ b/src/downloads/downloadmanager.h @@ -91,6 +91,7 @@ private: QString m_downloadPath; bool m_useNativeDialog; bool m_isClosing; + bool m_closeOnFinish; }; #endif // DOWNLOADMANAGER_H diff --git a/src/plugins/clicktoflash.cpp b/src/plugins/clicktoflash.cpp index 7230e534b..c9abd1046 100644 --- a/src/plugins/clicktoflash.cpp +++ b/src/plugins/clicktoflash.cpp @@ -101,9 +101,13 @@ void ClickToFlash::ensurePluginVisible() // I don't know any other method how to show our plugin // and adjust it on the proper position in page - m_page->mainFrame()->setZoomFactor(m_page->mainFrame()->zoomFactor() + 1); - m_page->mainFrame()->setZoomFactor(m_page->mainFrame()->zoomFactor() - 1); + // Scheduling adjustingPage rather than actually changing zoomFactor + // right now, as it is CPU intensive when there is lot of click2flash + // objects on page + + m_page->scheduleAdjustPage(); } + void ClickToFlash::customContextMenuRequested(const QPoint &pos) { QMenu menu; diff --git a/src/preferences/preferences.cpp b/src/preferences/preferences.cpp index 2e20b80a2..204bc926c 100644 --- a/src/preferences/preferences.cpp +++ b/src/preferences/preferences.cpp @@ -213,6 +213,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent) : //DOWNLOADS settings.beginGroup("DownloadManager"); ui->downLoc->setText( settings.value("defaultDownloadPath","").toString() ); + ui->closeDownManOnFinish->setChecked( settings.value("CloseManagerOnFinish", false).toBool() ); ui->downlaodNativeSystemDialog->setChecked( settings.value("useNativeDialog", #ifdef Q_WS_WIN false @@ -584,6 +585,7 @@ void Preferences::saveSettings() settings.setValue("defaultDownloadPath",""); else settings.setValue("defaultDownloadPath", ui->downLoc->text()); + settings.setValue("CloseManagerOnFinish", ui->closeDownManOnFinish->isChecked()); settings.setValue("useNativeDialog", ui->downlaodNativeSystemDialog->isChecked()); settings.endGroup(); diff --git a/src/preferences/preferences.ui b/src/preferences/preferences.ui index dd1de1f7b..4e2b23595 100644 --- a/src/preferences/preferences.ui +++ b/src/preferences/preferences.ui @@ -1464,7 +1464,7 @@ - + Qt::Vertical @@ -1513,7 +1513,7 @@ - + Use native system file dialog @@ -1521,6 +1521,13 @@ + + + + Close download manager when downloading finishes + + + diff --git a/src/webview/webpage.cpp b/src/webview/webpage.cpp index 56c9ea2ea..300e42027 100644 --- a/src/webview/webpage.cpp +++ b/src/webview/webpage.cpp @@ -36,13 +36,13 @@ WebPage::WebPage(WebView* parent, QupZilla* mainClass) , m_view(parent) , m_blockAlerts(false) , m_secureStatus(false) -// ,m_isOpeningNextWindowAsNewTab(false) +// , m_isOpeningNextWindowAsNewTab(false) { setForwardUnsupportedContent(true); setPluginFactory(new WebPluginFactory(this)); history()->setMaximumItemCount(20); connect(this, SIGNAL(unsupportedContent(QNetworkReply*)), SLOT(handleUnsupportedContent(QNetworkReply*))); - connect(this, SIGNAL(loadStarted()), this, SLOT(loadingStarted())); +// connect(this, SIGNAL(loadStarted()), this, SLOT(loadingStarted())); connect(this, SIGNAL(loadProgress(int)), this, SLOT(progress(int))); connect(this, SIGNAL(loadFinished(bool)), this, SLOT(finished())); connect(m_view, SIGNAL(urlChanged(QUrl)), this, SLOT(urlChanged(QUrl))); @@ -52,6 +52,7 @@ void WebPage::urlChanged(const QUrl &url) { Q_UNUSED(url) m_adBlockedEntries.clear(); + m_blockAlerts = false; } void WebPage::progress(int prog) @@ -68,15 +69,22 @@ void WebPage::progress(int prog) void WebPage::finished() { progress(100); + + if (m_adjustingScheduled) { + m_adjustingScheduled = false; + mainFrame()->setZoomFactor(mainFrame()->zoomFactor() + 1); + mainFrame()->setZoomFactor(mainFrame()->zoomFactor() - 1); + } + QTimer::singleShot(100, this, SLOT(cleanBlockedObjects())); } -void WebPage::loadingStarted() -{ +//void WebPage::loadingStarted() +//{ // m_adBlockedEntries.clear(); - m_blockAlerts = false; - //m_SslCert.clear(); -} +// m_blockAlerts = false; +// m_SslCert.clear(); +//} void WebPage::handleUnsupportedContent(QNetworkReply* reply) { diff --git a/src/webview/webpage.h b/src/webview/webpage.h index 7a2b87381..14990ae99 100644 --- a/src/webview/webpage.h +++ b/src/webview/webpage.h @@ -66,13 +66,15 @@ public: QupZilla* qupzilla() { return p_QupZilla; } + void scheduleAdjustPage() { m_adjustingScheduled = true; } + signals: void privacyChanged(bool status); protected slots: QWebPage* createWindow(QWebPage::WebWindowType type); void handleUnsupportedContent(QNetworkReply* url); - void loadingStarted(); +// void loadingStarted(); void progress(int prog); void finished(); @@ -98,6 +100,7 @@ private: bool m_blockAlerts; bool m_secureStatus; + bool m_adjustingScheduled; // bool m_isOpeningNextWindowAsNewTab; };