Added notifications and canceling to xdxf download dialog
[mdictionary] / src / plugins / xdxf / XdxfDictDownloadProgressDialog.cpp
index f4962ad..8a34fce 100644 (file)
 
 #include "XdxfDictDownloadProgressDialog.h"
 
-XdxfDictDownloadProgressDialog::XdxfDictDownloadProgressDialog(QString title, QWidget*parent):
+XdxfDictDownloadProgressDialog::XdxfDictDownloadProgressDialog(QWidget*parent):
     QDialog(parent) {
     verticalLayout = new QVBoxLayout(this);
     setLayout(verticalLayout);
 
-    setWindowTitle(title);
     downloadProgressBar = new QProgressBar(this);
     downloadProgressBar->setMinimum(0);
     downloadProgressBar->setMaximum(0);
     downloadProgressBar->setTextVisible(true);
 
-  //  cancelButton = new QPushButton(tr("Cancel"),this);
+    cancelButton = new QPushButton(tr("Cancel"),this);
+
+    connect(cancelButton, SIGNAL(clicked()),
+            this, SIGNAL(cancelDownloading()));
 
 
     #ifndef Q_WS_MAEMO_5
             downloadLabel = new QLabel(this);
-            downloadLabel->setText(title);
             verticalLayout->addWidget(downloadLabel, 0, Qt::AlignCenter);
     #endif
 
     verticalLayout->addWidget(downloadProgressBar);
-    //erticalLayout->addWidget(cancelButton);
+    verticalLayout->addWidget(cancelButton);
 
     setModal(true);
+
+    #ifndef Q_WS_MAEMO_5
+        setMinimumWidth(350);
+    #endif
 }
 
 
+void XdxfDictDownloadProgressDialog::setText(QString text) {
+    setWindowTitle(text);
+    #ifndef Q_WS_MAEMO_5
+        downloadLabel->setText(text);
+    #endif
+}
+
 void XdxfDictDownloadProgressDialog::reject() {
     return;
 }