summaryrefslogtreecommitdiff
path: root/utils/themeeditor/gui/fontdownloader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utils/themeeditor/gui/fontdownloader.cpp')
-rw-r--r--utils/themeeditor/gui/fontdownloader.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/utils/themeeditor/gui/fontdownloader.cpp b/utils/themeeditor/gui/fontdownloader.cpp
index 693f4a5b20..adc2e98ab3 100644
--- a/utils/themeeditor/gui/fontdownloader.cpp
+++ b/utils/themeeditor/gui/fontdownloader.cpp
@@ -34,10 +34,13 @@
34 34
35FontDownloader::FontDownloader(QWidget *parent, QString path) : 35FontDownloader::FontDownloader(QWidget *parent, QString path) :
36 QDialog(parent), 36 QDialog(parent),
37 ui(new Ui::FontDownloader), dir(path), reply(0) 37 ui(new Ui::FontDownloader), dir(path), reply(0), cancelled(false)
38{ 38{
39 ui->setupUi(this); 39 ui->setupUi(this);
40 40
41 QObject::connect(ui->cancelButton, SIGNAL(clicked()),
42 this, SLOT(cancel()));
43
41 manager = new QNetworkAccessManager(); 44 manager = new QNetworkAccessManager();
42 45
43 if(!dir.exists()) 46 if(!dir.exists())
@@ -91,12 +94,18 @@ FontDownloader::~FontDownloader()
91 94
92void FontDownloader::cancel() 95void FontDownloader::cancel()
93{ 96{
97 cancelled = true;
98
94 if(reply) 99 if(reply)
95 { 100 {
96 reply->abort(); 101 reply->abort();
97 reply->deleteLater(); 102 reply->deleteLater();
98 reply = 0; 103 reply = 0;
99 } 104 }
105 fout.close();
106 fout.remove();
107
108 close();
100} 109}
101 110
102void FontDownloader::dataReceived() 111void FontDownloader::dataReceived()
@@ -115,7 +124,11 @@ void FontDownloader::progress(qint64 bytes, qint64 available)
115 124
116void FontDownloader::finished() 125void FontDownloader::finished()
117{ 126{
127 if(cancelled)
128 return;
129
118 fout.close(); 130 fout.close();
131
119 reply->deleteLater(); 132 reply->deleteLater();
120 reply = 0; 133 reply = 0;
121 ui->label->setText(tr("Download complete")); 134 ui->label->setText(tr("Download complete"));