Connection selection dialog bug fix for selectremotedlg
authorTorste Aikio <zokier@zokier.laptop>
Tue, 6 Jul 2010 11:08:09 +0000 (14:08 +0300)
committerTorste Aikio <zokier@zokier.laptop>
Tue, 6 Jul 2010 11:08:09 +0000 (14:08 +0300)
src/remotedbmgr.h
src/selectremotedlg.cpp
src/selectremotedlg.h

index 11765d8..95750fa 100644 (file)
@@ -15,6 +15,7 @@ public:
     RemoteDBMgr();
     ~RemoteDBMgr();
 
+public slots:
     void getDBAsync();
 
 signals:
index 2ffc121..6b191a1 100644 (file)
@@ -53,6 +53,11 @@ SelectRemoteDlg::SelectRemoteDlg(QWidget *parent)
 SelectRemoteDlg::~SelectRemoteDlg()
 {
     delete layout;
+    if (onlinePollerThread != NULL) {
+        onlinePollerThread->quit();
+        delete onlinePollerThread;
+        onlinePollerThread = NULL;
+    }
 }
 
 void SelectRemoteDlg::setDB(RemoteDB *db)
@@ -108,10 +113,26 @@ void SelectRemoteDlg::downloadRemote()
     }
 }
 
+void SelectRemoteDlg::getDB()
+{
+    if (onlinePollerThread != NULL) {
+        onlinePollerThread->quit();
+        delete onlinePollerThread;
+        onlinePollerThread = NULL;
+    }
+    remoteDBMgr.getDBAsync();
+}
+
 void SelectRemoteDlg::refreshDB()
 {
     setBusy(true);
-    remoteDBMgr.getDBAsync();
+    if (onlinePollerThread != NULL) {
+        delete onlinePollerThread;
+    }
+    onlinePollerThread = new OnlinePollerThread(this);
+    connect(onlinePollerThread, SIGNAL(online()),
+            this, SLOT(getDB()));
+    onlinePollerThread->run();
 }
 
 void SelectRemoteDlg::showEvent(QShowEvent *event)
index 8433318..109a7ef 100644 (file)
@@ -29,6 +29,7 @@ public:
 
 public slots:
     void refreshDB();
+    void getDB();
 
 private slots:
     void alphabetItemChanged(QListWidgetItem *current,
@@ -53,6 +54,7 @@ private:
     QListWidget *modelList;
     QPushButton *downloadBtn;
     RemoteDB *remoteDB;
+    OnlinePollerThread *onlinePollerThread;
 
     void setBusy(bool busy = true);
 };