Added multi-dictionary handling
[mdictionary] / trunk / tests / mDictionaryTests / CommonDictInterfaceMock.h
index 1dc77e5..c4d0db0 100644 (file)
@@ -35,6 +35,7 @@ class CommonDictInterfaceMock : public CommonDictInterface
 public:
     QString fromv, tov, namev, typev, infoNotev;
     bool available,stopped;
+    uint _hash;
     CommonDictInterfaceMock(QObject* parent = 0) :
             CommonDictInterface(parent) {}
 
@@ -47,22 +48,23 @@ public:
     QDialog* settingsDialog() {return 0;}
     CommonDictInterface* getNew(const Settings *) const { return 0;}
     bool isAvailable() const {return available;}
-    uint hash() const { return namev.length() + 10*typev.length();}
+    uint hash() const { return _hash;}
+    void setHash(uint h) {_hash = h;}
     void stop() {stopped = 1;}
     QString search(QString key) {}
     QList<Translation*> searchWordList(QString word, int limit) {
+        qDebug() << "search " << this->thread()->currentThreadId();
         stopped = 0;
         QList<Translation*> list;
 
         TranslationMock *tm = new TranslationMock();
-        tm->_key = fromv;
-        tm->_translation = tov;
+        tm->_key = langFrom();
+        tm->_translation = langTo();
         TranslationMock *tm1 = new TranslationMock();
-        tm1->_key = namev;
-        tm1->_translation = typev;
+        tm1->_key = name();
+        tm1->_translation = type();
         list << tm << tm1;
 
-        Q_EMIT finalTranslation();
         return list;
     }