From cb887e5e7e44db8982bb332c8f145d6e590e9531 Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Thu, 2 Jul 2015 07:12:33 +0200 Subject: [PATCH] Some fixes and additions. --- resources/text/CHANGELOG | 5 ++-- src/gui/dialogs/formsettings.ui | 24 +++++++++++++++---- src/network-web/downloaditem.ui | 13 +++++++--- src/network-web/downloadmanager.cpp | 37 ++++++++++++++++++----------- src/network-web/downloadmanager.h | 3 ++- 5 files changed, 58 insertions(+), 24 deletions(-) diff --git a/resources/text/CHANGELOG b/resources/text/CHANGELOG index 7db11c3fc..79931026f 100644 --- a/resources/text/CHANGELOG +++ b/resources/text/CHANGELOG @@ -2,14 +2,15 @@

2.5.0

Added:

2.4.2

Fixed: diff --git a/src/gui/dialogs/formsettings.ui b/src/gui/dialogs/formsettings.ui index 80a2afef6..669b6bbe0 100755 --- a/src/gui/dialogs/formsettings.ui +++ b/src/gui/dialogs/formsettings.ui @@ -88,7 +88,7 @@ - 3 + 7 @@ -465,7 +465,7 @@ MySQL backend will automatically use database with name "rssguard". Do QTabWidget::North - 1 + 0 @@ -497,8 +497,8 @@ MySQL backend will automatically use database with name "rssguard". Do 0 0 - 208 - 238 + 776 + 425 @@ -1728,5 +1728,21 @@ MySQL backend will automatically use database with name "rssguard". Do + + m_rbDownloadsAskEachFile + toggled(bool) + m_btnDownloadsTargetDirectory + setDisabled(bool) + + + 348 + 77 + + + 968 + 50 + + + diff --git a/src/network-web/downloaditem.ui b/src/network-web/downloaditem.ui index d081c436d..17346c276 100644 --- a/src/network-web/downloaditem.ui +++ b/src/network-web/downloaditem.ui @@ -6,8 +6,8 @@ 0 0 - 404 - 45 + 413 + 206 @@ -46,7 +46,7 @@ - + 0 @@ -58,6 +58,13 @@ + + + + + + + diff --git a/src/network-web/downloadmanager.cpp b/src/network-web/downloadmanager.cpp index a39f5f792..cfdc0e967 100755 --- a/src/network-web/downloadmanager.cpp +++ b/src/network-web/downloadmanager.cpp @@ -113,7 +113,7 @@ void DownloadItem::getFileName() { stop(); m_ui->m_progressDownload->setVisible(false); - m_ui->m_lblFilename->setText(tr("Cancelled")); + m_ui->m_lblLocalFilename->setText(tr("Selection if local file cancelled.")); m_canceledFileSelect = true; return; } @@ -123,7 +123,9 @@ void DownloadItem::getFileName() { qApp->settings()->setValue(GROUP(Downloads), Downloads::TargetExplicitDirectory, QDir::toNativeSeparators(QFileInfo(chosen_filename).absolutePath())); qApp->downloadManager()->setDownloadDirectory(file_info.absoluteDir().absolutePath()); - m_ui->m_lblFilename->setText(file_info.fileName()); + + // TODO: Probably not needed. + //m_ui->m_lblFilename->setText(file_info.fileName()); } m_output.setFileName(chosen_filename); @@ -139,7 +141,7 @@ void DownloadItem::getFileName() { return; } - m_ui->m_lblFilename->setText(QFileInfo(m_output.fileName()).fileName()); + updateInfoAndUrlLabel(); if (m_requestFileName) { downloadReadyRead(); @@ -336,7 +338,7 @@ void DownloadItem::downloadProgress(qint64 bytes_received, qint64 bytes_total) { m_ui->m_progressDownload->setMaximum(totalValue); emit progress(currentValue, totalValue); - updateInfoLabel(); + updateDownloadInfoLabel(); } qint64 DownloadItem::bytesTotal() const { @@ -371,7 +373,7 @@ double DownloadItem::currentSpeed() const { } } -void DownloadItem::updateInfoLabel() { +void DownloadItem::updateDownloadInfoLabel() { if (m_reply->error() != QNetworkReply::NoError) { return; } @@ -429,14 +431,21 @@ void DownloadItem::finished() { m_ui->m_btnOpenFile->setEnabled(true); m_ui->m_btnOpenFolder->setEnabled(true); m_output.close(); - updateInfoLabel(); + updateDownloadInfoLabel(); emit statusChanged(); emit downloadFinished(); - qApp->showGuiMessage(tr("Download finished"), - tr("File '%1' is downloaded.\nClick here to open parent directory.").arg(QDir::toNativeSeparators(m_output.fileName())), - QSystemTrayIcon::Information, 0, false, QIcon(), this, SLOT(openFolder())); + if (downloadedSuccessfully()) { + qApp->showGuiMessage(tr("Download finished"), + tr("File '%1' is downloaded.\nClick here to open parent directory.").arg(QDir::toNativeSeparators(m_output.fileName())), + QSystemTrayIcon::Information, 0, false, QIcon(), this, SLOT(openFolder())); + } +} + +void DownloadItem::updateInfoAndUrlLabel() { + m_ui->m_lblRemoteFilename->setText(tr("URL: %1").arg(m_url.toString())); + m_ui->m_lblLocalFilename->setText(tr("Local file: %1").arg(QDir::toNativeSeparators(m_output.fileName()))); } DownloadManager::DownloadManager(QWidget *parent) : TabContent(parent), m_ui(new Ui::DownloadManager), @@ -525,11 +534,9 @@ void DownloadManager::handleUnsupportedContent(QNetworkReply *reply) { DownloadItem *item = new DownloadItem(reply, this); addItem(item); - if (item->m_canceledFileSelect) { - return; + if (!item->m_canceledFileSelect) { + qApp->mainForm()->tabWidget()->showDownloadManager(); } - - qApp->mainForm()->tabWidget()->showDownloadManager(); } void DownloadManager::addItem(DownloadItem *item) { @@ -669,8 +676,10 @@ void DownloadManager::load() { if (!url.isEmpty() && !file_name.isEmpty()) { DownloadItem *item = new DownloadItem(0, this); item->m_output.setFileName(file_name); - item->m_ui->m_lblFilename->setText(QFileInfo(item->m_output.fileName()).fileName()); item->m_url = url; + + item->updateInfoAndUrlLabel(); + item->m_ui->m_btnStopDownload->setVisible(false); item->m_ui->m_btnStopDownload->setEnabled(false); item->m_ui->m_btnTryAgain->setVisible(!done); diff --git a/src/network-web/downloadmanager.h b/src/network-web/downloadmanager.h index e8af5f5af..ea522af12 100644 --- a/src/network-web/downloadmanager.h +++ b/src/network-web/downloadmanager.h @@ -71,9 +71,10 @@ class DownloadItem : public QWidget { void downloadFinished(); private: + void updateInfoAndUrlLabel(); void getFileName(); void init(); - void updateInfoLabel(); + void updateDownloadInfoLabel(); QString saveFileName(const QString &directory) const; Ui::DownloadItem *m_ui;