Some error banner delays fixed.
[jenirok] / src / daemon / calllistener.h
index 8d098c8..0cd70ed 100644 (file)
@@ -26,8 +26,6 @@
 #include <QtDBus/QDBusObjectPath>
 #include "informationbox.h"
 #include "eniro.h"
-#include "contactmanager.h"
-#include "connectionmanager.h"
 
 class CallListener: public QObject
 {
@@ -36,11 +34,18 @@ class CallListener: public QObject
 public:
     CallListener();
     ~CallListener();
-    void begin();
+    bool begin();
     void end();
     static const int REQUEST_TIMEOUT = 10000;
-    static const int BANNER_DELAY = 400;
-    static const int NUMBER_OF_RETRIES = 3;
+    static const int BANNER_DELAY = 350;
+    static const int SEARCH_RETRIES = 2;
+    static const int CONNECT_RETRIES = 3;
+    static const int CONNECTION_LOOKUP_RETRIES = 15;
+    static const int WAIT_BETWEEN_RETRIES = 1000;
+    static const int ERROR_BANNER_TIMEOUT = 4500;
+
+protected:
+    virtual void timerEvent(QTimerEvent* event);
 
 private slots:
     void requestFinished(QVector <Eniro::Result> const& results, Eniro::SearchDetails const& details, bool error);
@@ -54,17 +59,23 @@ private:
     void search(Eniro::SearchDetails const& details);
     void showResult(QString const& text);
     void showDelayedResult(QString const& text, int delay);
+    void searchInit();
+    void searchClose();
+    bool handleConnection();
+    void showError(QString const& msg, int delay = 0);
+    void sleep(int ms);
     QString createResult(QString const& name, QString const& street, QString const& city);
     QString timedMessage_;
     Eniro* eniro_;
-    ContactManager* contactManager_;
-    ConnectionManager* connectionManager_;
     bool closeConnection_;
+    bool initialized_;
     InformationBox* box_;
     QLabel* label_;
     static QDBusConnection systemBus_;
     int retries_;
     QString currentSearch_;
+    Eniro::Site site_;
+    int timer_;
 };
 
 #endif // CALLLISTENER_H