Added some sort of Ovi Maps integration. All translations updated.
[jenirok] / src / common / source.h
index 34cd356..7ebe969 100644 (file)
@@ -23,6 +23,7 @@
 #include <QtCore/QString>
 #include <QtCore/QTimerEvent>
 #include <QtCore/QUrl>
+#include <QtCore/QByteArray>
 #include <QtNetwork/QHttp>
 
 class Source : public QObject
@@ -38,9 +39,10 @@ public:
         QString street;
         QString city;
         QString number;
+        QString country;
     };
 
-    enum SearchType {YELLOW_PAGES, PERSONS};
+    enum SearchType {YELLOW_PAGES, PERSONS, BOTH};
 
     struct SearchDetails
     {
@@ -54,8 +56,8 @@ public:
 
 
     enum Error {NO_ERROR, CONNECTION_FAILURE, INVALID_LOGIN, TIMEOUT};
-    enum SourceId {ENIRO, MOBIL1881};
-    static int const SOURCE_COUNT = 2;
+    enum SourceId {ENIRO, MOBIL1881, DASTELEFONBUCH};
+    static int const SOURCE_COUNT = 3;
 
     struct SourceDetails
     {
@@ -74,6 +76,7 @@ public:
     static Source* getSource();
     virtual void abort();
     virtual void search(SearchDetails const& details) = 0;
+    virtual void getSearchTypes(QList<SearchType>& types) const;
     void setMaxResults(unsigned int results);
     unsigned int getMaxResults() const;
     void setTimeout(unsigned int ms);
@@ -91,9 +94,11 @@ signals:
 protected:
     void setError(Error error, QString const& errorString = "");
     virtual void timerEvent(QTimerEvent *te);
-    QString ucFirst(QString& string);
-    QString& cleanUpNumber(QString& number);
-    QString& stripTags(QString& string);
+    static QString ucFirst(QString& string);
+    static QString& cleanUpNumber(QString& number);
+    static QString& stripTags(QString& string);
+    static QString& htmlEntityDecode(QString& string);
+    static bool isPhoneNumber(QString const& string);
     void fixUrl(QUrl& url);
     QHttp http_;
 
@@ -102,7 +107,7 @@ private slots:
 
 private:
     Q_DISABLE_COPY(Source);
-    virtual void handleHttpData(int id, QString const& data) = 0;
+    virtual void handleHttpData(int id, QByteArray const& data) = 0;
     virtual void handleHttpError(int id) = 0;
     unsigned int maxResults_;
     unsigned int timeout_;