Added call log and German translation.
[jenirok] / src / gui / resultwindow.cpp
index 2640bbe..adbd404 100644 (file)
@@ -56,11 +56,19 @@ void ResultWindow::search(SearchDialog::SearchDetails& details)
         list_->clear();
     }
 
-    Source::SourceId sourceId = Source::stringToId(Settings::instance()->get("source"));
+    Source::SourceId id = Source::stringToId(Settings::instance()->get("source"));
 
-    if(!source_)
+    if(!source_ || id != sourceId_)
     {
-        source_ = Source::getSource(sourceId);
+        sourceId_ = id;
+
+        if(source_)
+        {
+            delete source_;
+            source_ = 0;
+        }
+
+        source_ = Source::getSource(sourceId_);
         Q_ASSERT(source_ != 0);
         source_->setTimeout(REQUEST_TIMEOUT);
 
@@ -75,28 +83,13 @@ void ResultWindow::search(SearchDialog::SearchDetails& details)
                                                                           Source::SearchDetails const&, bool)));
     }
 
-    SourceCoreConfig* config = SourceCoreConfig::getCoreConfig(sourceId);
+    SourceCoreConfig* config = SourceCoreConfig::getCoreConfig(sourceId_);
 
     Q_ASSERT(config != 0);
 
     config->apply(source_);
     delete config;
 
-    Source::SearchType type;
-
-    switch(details.type)
-    {
-    case 0:
-        type = Source::PERSONS;
-        break;
-    case 1:
-        type = Source::YELLOW_PAGES;
-        break;
-    default:
-        qDebug() << "Unknown search type: " << details.type;
-        return;
-    }
-
     show();
     setAttribute(Qt::WA_Maemo5ShowProgressIndicator, true);
 
@@ -108,7 +101,7 @@ void ResultWindow::search(SearchDialog::SearchDetails& details)
     connectionManager_->connect();
 
     source_->abort();
-    source_->search(Source::SearchDetails(details.name, details.location, type));
+    source_->search(Source::SearchDetails(details.name, details.location, details.type));
 
 }
 
@@ -207,6 +200,8 @@ void ResultWindow::setVisible(bool visible)
     if(!visible && source_)
     {
         source_->abort();
+
+
     }
 }