diff --git a/src/lib/app/mainmenu.cpp b/src/lib/app/mainmenu.cpp index 4a4754ccc..6a83ca2fa 100644 --- a/src/lib/app/mainmenu.cpp +++ b/src/lib/app/mainmenu.cpp @@ -164,13 +164,6 @@ void MainMenu::closeWindow() callSlot("closeWindow"); } -void MainMenu::savePageAs() -{ - if (m_window) { - m_window->weView()->savePageAs(); - } -} - void MainMenu::sendLink() { const QUrl mailUrl = QUrl::fromEncoded("mailto:%20?body=" + QUrl::toPercentEncoding(m_window->weView()->url().toEncoded()) + "&subject=" + QUrl::toPercentEncoding(m_window->weView()->title())); @@ -526,7 +519,6 @@ void MainMenu::init() ADD_ACTION("File/OpenFile", m_menuFile, QIcon::fromTheme(QSL("document-open")), tr("Open &File..."), SLOT(openFile()), "Ctrl+O"); ADD_ACTION("File/CloseWindow", m_menuFile, QIcon::fromTheme(QSL("window-close")), tr("Close Window"), SLOT(closeWindow()), "Ctrl+Shift+W"); m_menuFile->addSeparator(); - ADD_ACTION("File/SavePageAs", m_menuFile, QIcon::fromTheme(QSL("document-save")), tr("&Save Page As..."), SLOT(savePageAs()), "Ctrl+S"); ADD_ACTION("File/SendLink", m_menuFile, QIcon::fromTheme(QSL("mail-message-new")), tr("Send Link..."), SLOT(sendLink()), ""); ADD_ACTION("File/Print", m_menuFile, QIcon::fromTheme(QSL("document-print")), tr("&Print..."), SLOT(printPage()), "Ctrl+P"); m_menuFile->addSeparator(); diff --git a/src/lib/app/mainmenu.h b/src/lib/app/mainmenu.h index d0d766d82..bf5a7295e 100644 --- a/src/lib/app/mainmenu.h +++ b/src/lib/app/mainmenu.h @@ -59,7 +59,6 @@ private slots: void openFile(); void closeWindow(); void toggleOfflineMode(); - void savePageAs(); void sendLink(); void printPage(); diff --git a/src/lib/downloads/downloaditem.cpp b/src/lib/downloads/downloaditem.cpp index d3feb6b8c..9331b4b3b 100644 --- a/src/lib/downloads/downloaditem.cpp +++ b/src/lib/downloads/downloaditem.cpp @@ -280,7 +280,6 @@ void DownloadItem::customContextMenuRequested(const QPoint &pos) menu.addAction(tr("Open Folder"), this, SLOT(openFolder())); menu.addSeparator(); - //menu.addAction(tr("Go to Download Page"), this, SLOT(goToDownloadPage()))->setEnabled(!m_downloadPage.isEmpty()); menu.addAction(QIcon::fromTheme("edit-copy"), tr("Copy Download Link"), this, SLOT(copyDownloadLink())); menu.addSeparator(); menu.addAction(QIcon::fromTheme("process-stop"), tr("Cancel downloading"), this, SLOT(stop()))->setEnabled(m_downloading); @@ -292,20 +291,6 @@ void DownloadItem::customContextMenuRequested(const QPoint &pos) menu.exec(mapToGlobal(pos)); } -void DownloadItem::goToDownloadPage() -{ -#if QTWEBENGINE_DISABLED - BrowserWindow* qz = mApp->getWindow(); - - if (qz) { - qz->tabWidget()->addView(m_downloadPage, Qz::NT_SelectedTab); - } - else { - mApp->createWindow(Qz::BW_NewWindow, m_downloadPage); - } -#endif -} - void DownloadItem::copyDownloadLink() { QApplication::clipboard()->setText(m_downUrl.toString()); diff --git a/src/lib/downloads/downloaditem.h b/src/lib/downloads/downloaditem.h index 15e3bc75b..b0d02e1c9 100644 --- a/src/lib/downloads/downloaditem.h +++ b/src/lib/downloads/downloaditem.h @@ -67,7 +67,6 @@ private slots: void customContextMenuRequested(const QPoint &pos); void clear(); - void goToDownloadPage(); void copyDownloadLink(); private: diff --git a/src/lib/downloads/downloadmanager.cpp b/src/lib/downloads/downloadmanager.cpp index bc635a592..2d70321a0 100644 --- a/src/lib/downloads/downloadmanager.cpp +++ b/src/lib/downloads/downloadmanager.cpp @@ -222,22 +222,6 @@ void DownloadManager::download(QWebEngineDownloadItem *downloadItem) return; } -#if QTWEBENGINE_DISABLED - // Get download page - QUrl downloadPage; - WebView* view = qobject_cast(info.page->view()); - if (!info.page->url().isEmpty()) { - downloadPage = info.page->url(); - } - else if (info.page->history()->canGoBack()) { - downloadPage = info.page->history()->backItem().url(); - } - // Close empty tab - else if (view && info.page->history()->count() == 0) { - view->closeView(); - } -#endif - QString fileName = QFileInfo(downloadItem->path()).fileName(); // Set download path and accept diff --git a/src/lib/preferences/preferences.cpp b/src/lib/preferences/preferences.cpp index 0d4bbf2fc..1e6ad2cf5 100644 --- a/src/lib/preferences/preferences.cpp +++ b/src/lib/preferences/preferences.cpp @@ -333,10 +333,18 @@ Preferences::Preferences(BrowserWindow* window) else { ui->useDefined->setChecked(true); } + ui->useExternalDownManager->setChecked(settings.value("UseExternalManager", false).toBool()); + ui->externalDownExecutable->setText(settings.value("ExternalManagerExecutable", "").toString()); + ui->externalDownArguments->setText(settings.value("ExternalManagerArguments", "").toString()); + + connect(ui->useExternalDownManager, SIGNAL(toggled(bool)), this, SLOT(useExternalDownManagerChanged(bool))); + connect(ui->useDefined, SIGNAL(toggled(bool)), this, SLOT(downLocChanged(bool))); connect(ui->downButt, SIGNAL(clicked()), this, SLOT(chooseDownPath())); + connect(ui->chooseExternalDown, SIGNAL(clicked()), this, SLOT(chooseExternalDownloadManager())); downLocChanged(ui->useDefined->isChecked()); + useExternalDownManagerChanged(ui->useExternalDownManager->isChecked()); settings.endGroup(); //FONTS @@ -485,6 +493,16 @@ Preferences::Preferences(BrowserWindow* window) QzTools::setWmClass("Preferences", this); } +void Preferences::chooseExternalDownloadManager() +{ + QString path = QzTools::getOpenFileName("Preferences-ExternalDownloadManager", this, tr("Choose executable location..."), QDir::homePath()); + if (path.isEmpty()) { + return; + } + + ui->externalDownExecutable->setText(path); +} + void Preferences::showStackedPage(QListWidgetItem* item) { if (!item) { @@ -655,6 +673,13 @@ void Preferences::openJsOptions() dialog->open(); } +void Preferences::useExternalDownManagerChanged(bool state) +{ + ui->externalDownExecutable->setEnabled(state); + ui->externalDownArguments->setEnabled(state); + ui->chooseExternalDown->setEnabled(state); +} + void Preferences::openSearchEnginesManager() { SearchEnginesDialog* dialog = new SearchEnginesDialog(this); @@ -875,6 +900,10 @@ void Preferences::saveSettings() settings.setValue("defaultDownloadPath", ui->downLoc->text()); } settings.setValue("CloseManagerOnFinish", ui->closeDownManOnFinish->isChecked()); + settings.setValue("UseExternalManager", ui->useExternalDownManager->isChecked()); + settings.setValue("ExternalManagerExecutable", ui->externalDownExecutable->text()); + settings.setValue("ExternalManagerArguments", ui->externalDownArguments->text()); + settings.endGroup(); //FONTS diff --git a/src/lib/preferences/preferences.h b/src/lib/preferences/preferences.h index 18a32b2f7..182f60f5e 100644 --- a/src/lib/preferences/preferences.h +++ b/src/lib/preferences/preferences.h @@ -60,6 +60,7 @@ private slots: void showAcceptLanguage(); void chooseUserStyleClicked(); void deleteHtml5storage(); + void chooseExternalDownloadManager(); void openUserAgentManager(); void openJsOptions(); void openSearchEnginesManager(); @@ -70,6 +71,7 @@ private slots: void allowCacheChanged(bool state); void showPassManager(bool state); void setManualProxyConfigurationEnabled(bool state); + void useExternalDownManagerChanged(bool state); void useDifferentProxyForHttpsChanged(bool state); void showTabPreviewsChanged(bool state); void changeCachePathClicked(); diff --git a/src/lib/preferences/preferences.ui b/src/lib/preferences/preferences.ui index c3421cf27..907909009 100644 --- a/src/lib/preferences/preferences.ui +++ b/src/lib/preferences/preferences.ui @@ -1969,7 +1969,70 @@ - + + + + <b>External download manager</b> + + + + + + + Use external download manager + + + + + + + QFormLayout::AllNonFixedFieldsGrow + + + + + Executable: + + + + + + + Arguments: + + + + + + + Leave blank if unsure + + + + + + + + + + + + ... + + + + + + + + + <b>%d</b> will be replaced with URL to be downloaded + + + + + + Qt::Vertical diff --git a/src/lib/webengine/webview.cpp b/src/lib/webengine/webview.cpp index 5c585c065..deafc2085 100644 --- a/src/lib/webengine/webview.cpp +++ b/src/lib/webengine/webview.cpp @@ -464,30 +464,6 @@ void WebView::copyLinkToClipboard() } } -void WebView::savePageAs() -{ -#if QTWEBENGINE_DISABLED - if (url().isEmpty() || url().toString() == QLatin1String("about:blank")) { - return; - } - - QNetworkRequest request(url()); - QString suggestedFileName = QzTools::getFileNameFromUrl(url()); - if (!suggestedFileName.contains(QLatin1Char('.'))) { - suggestedFileName.append(QLatin1String(".html")); - } - - DownloadManager::DownloadInfo info; - info.page = page(); - info.suggestedFileName = suggestedFileName; - info.askWhatToDo = false; - info.forceChoosingPath = true; - - DownloadManager* dManager = mApp->downloadManager(); - dManager->download(request, info); -#endif -} - void WebView::openUrlInNewTab(const QUrl &url, Qz::NewTabPositionFlags position) { QNetworkRequest request(url); @@ -731,9 +707,6 @@ void WebView::createPageContextMenu(QMenu* menu) menu->addAction(pageAction(QWebEnginePage::Stop)); menu->addSeparator(); menu->addAction(QIcon::fromTheme("bookmark-new"), tr("Book&mark page"), this, SLOT(bookmarkLink())); -#if QTWEBENGINE_DISABLED - menu->addAction(QIcon::fromTheme("document-save"), tr("&Save page as..."), this, SLOT(savePageAs())); -#endif menu->addAction(QIcon::fromTheme("edit-copy"), tr("&Copy page link"), this, SLOT(copyLinkToClipboard()))->setData(url()); menu->addAction(QIcon::fromTheme("mail-message-new"), tr("Send page link..."), this, SLOT(sendPageByMail())); menu->addSeparator(); diff --git a/src/lib/webengine/webview.h b/src/lib/webengine/webview.h index d74afa49e..3d8518f0b 100644 --- a/src/lib/webengine/webview.h +++ b/src/lib/webengine/webview.h @@ -101,7 +101,6 @@ public slots: void showSource(); void sendPageByMail(); - void savePageAs(); void openUrlInNewTab(const QUrl &url, Qz::NewTabPositionFlags position);