Commit 841a3bc9 authored by JanKusanagi's avatar JanKusanagi

Don't report attachment successfully downloaded when it was aborted

parent e47ec5ee
......@@ -30,6 +30,7 @@ DownloadWidget::DownloadWidget(QString fileUrl,
this->setFrameStyle(QFrame::StyledPanel | QFrame::Raised);
m_downloading = false;
m_aborted = false;
QFont infoFont;
......@@ -114,6 +115,7 @@ void DownloadWidget::resetWidget()
m_downloadedFile.close();
m_downloading = false;
m_aborted = false;
}
......@@ -214,9 +216,13 @@ void DownloadWidget::cancelDownload()
if (confirmation == 0)
{
m_aborted = true;
m_networkReply->abort();
m_infoLabel->setText(tr("Download aborted"));
const QString abortMessage = tr("Download aborted");
m_infoLabel->setText(abortMessage);
m_pumpController->showStatusMessageAndLogIt(abortMessage
+ QStringLiteral("."));
resetWidget();
}
else
......@@ -228,7 +234,8 @@ void DownloadWidget::cancelDownload()
void DownloadWidget::completeDownload(QString url)
{
if (url == m_fileUrl) // Ensure completed download is this download
if (url == m_fileUrl // Ensure completed download is this download
&& !m_aborted) // And wasn't aborted
{
m_infoLabel->setText(tr("Download completed"));
resetWidget(); // This also closes the file
......
......@@ -77,6 +77,7 @@ private:
QNetworkReply *m_networkReply;
QFile m_downloadedFile;
bool m_downloading;
bool m_aborted;
};
#endif // DOWNLOADWIDGET_H
......@@ -48,7 +48,7 @@ int main(int argc, char *argv[])
{
QApplication dianaraApp(argc, argv);
dianaraApp.setApplicationName("Dianara");
dianaraApp.setApplicationVersion("1.4.2-dev+2");
dianaraApp.setApplicationVersion("1.4.2-dev+3");
dianaraApp.setOrganizationName("JanCoding");
dianaraApp.setOrganizationDomain("jancoding.wordpress.com");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment