mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
Preferences: Bring back external download manager option
This commit is contained in:
parent
695475b2e4
commit
5e0ca7fed8
@ -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();
|
||||
|
@ -59,7 +59,6 @@ private slots:
|
||||
void openFile();
|
||||
void closeWindow();
|
||||
void toggleOfflineMode();
|
||||
void savePageAs();
|
||||
void sendLink();
|
||||
void printPage();
|
||||
|
||||
|
@ -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());
|
||||
|
@ -67,7 +67,6 @@ private slots:
|
||||
void customContextMenuRequested(const QPoint &pos);
|
||||
void clear();
|
||||
|
||||
void goToDownloadPage();
|
||||
void copyDownloadLink();
|
||||
|
||||
private:
|
||||
|
@ -222,22 +222,6 @@ void DownloadManager::download(QWebEngineDownloadItem *downloadItem)
|
||||
return;
|
||||
}
|
||||
|
||||
#if QTWEBENGINE_DISABLED
|
||||
// Get download page
|
||||
QUrl downloadPage;
|
||||
WebView* view = qobject_cast<WebView*>(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
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
@ -1969,7 +1969,70 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0" colspan="4">
|
||||
<item row="10" column="0" colspan="4">
|
||||
<widget class="QLabel" name="label_51">
|
||||
<property name="text">
|
||||
<string><b>External download manager</b></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0" colspan="4">
|
||||
<widget class="QCheckBox" name="useExternalDownManager">
|
||||
<property name="text">
|
||||
<string>Use external download manager</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="1" colspan="3">
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_52">
|
||||
<property name="text">
|
||||
<string>Executable:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_53">
|
||||
<property name="text">
|
||||
<string>Arguments:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="externalDownArguments">
|
||||
<property name="placeholderText">
|
||||
<string>Leave blank if unsure</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="externalDownExecutable"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="MacToolButton" name="chooseExternalDown">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="label_64">
|
||||
<property name="text">
|
||||
<string><b>%d</b> will be replaced with URL to be downloaded</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="9" column="0" colspan="4">
|
||||
<spacer name="verticalSpacer_10">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
|
@ -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();
|
||||
|
@ -101,7 +101,6 @@ public slots:
|
||||
|
||||
void showSource();
|
||||
void sendPageByMail();
|
||||
void savePageAs();
|
||||
|
||||
void openUrlInNewTab(const QUrl &url, Qz::NewTabPositionFlags position);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user