diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2017-02-23 17:19:32 +0100 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2017-02-23 17:19:32 +0100 |
commit | abd011f7cf8d298b8bbbe30eedb329094d43c0b9 (patch) | |
tree | 300909ce22e5c356a4735dbedaf795a594055c9e /src/forms/downloaddialog.cpp | |
parent | Minor features (diff) | |
download | smolbote-abd011f7cf8d298b8bbbe30eedb329094d43c0b9.tar.xz |
Download manager improvements
Added shortcut for download dialog
Dialog has proper title
Settings replaces ~ with home location
Showing download item details
Diffstat (limited to 'src/forms/downloaddialog.cpp')
-rw-r--r-- | src/forms/downloaddialog.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/forms/downloaddialog.cpp b/src/forms/downloaddialog.cpp index 59756bf..7d26c4b 100644 --- a/src/forms/downloaddialog.cpp +++ b/src/forms/downloaddialog.cpp @@ -27,12 +27,15 @@ #include <QListWidget> #include <QLabel> #include "webengine/downloaditemform.h" +#include "settings.h" DownloadDialog::DownloadDialog(QWidget *parent) : QDialog(parent), ui(new Ui::DownloadDialog) { ui->setupUi(this); + + connect(ui->listWidget, SIGNAL(currentRowChanged(int)), this, SLOT(showItemDetails(int))); } DownloadDialog::~DownloadDialog() @@ -42,8 +45,12 @@ DownloadDialog::~DownloadDialog() void DownloadDialog::addDownload(QWebEngineDownloadItem *item) { + Settings settings; + qDebug("download item: %s", qUtf8Printable(item->url().toString())); - QString filepath = QFileDialog::getSaveFileName(this, tr("Save")); + qDebug("download path: %s", qUtf8Printable(settings.value("downloads/path").toString())); + + QString filepath = QFileDialog::getSaveFileName(this, tr("Save"), settings.value("downloads/path").toString()); if(filepath.isEmpty()) { // user cancelled the save dialog @@ -64,3 +71,10 @@ void DownloadDialog::addDownload(QWebEngineDownloadItem *item) item->accept(); this->show(); } + +void DownloadDialog::showItemDetails(int index) +{ + DownloadItemForm *form = qobject_cast<DownloadItemForm *>(ui->listWidget->itemWidget(ui->listWidget->item(index))); + ui->mimeType_label->setText(form->item()->mimeType()); + ui->path_label->setText(form->item()->path()); +} |