Fixed problems with special html characters and entities in Norwegian version.
[jenirok] / src / gui / resultwindow.cpp
index 2640bbe..07349ff 100644 (file)
@@ -30,7 +30,7 @@
 #include "sourcecoreconfig.h"
 
 ResultWindow::ResultWindow(QWidget* parent): QMainWindow(parent),
-source_(0), list_(0), connectionManager_(0)
+sourceId_(Source::SOURCE_NONE), source_(0), list_(0), connectionManager_(0)
 {
     setAttribute(Qt::WA_Maemo5StackedWindow);
     setWindowTitle(tr("Search results"));
@@ -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,7 +83,7 @@ void ResultWindow::search(SearchDialog::SearchDetails& details)
                                                                           Source::SearchDetails const&, bool)));
     }
 
-    SourceCoreConfig* config = SourceCoreConfig::getCoreConfig(sourceId);
+    SourceCoreConfig* config = SourceCoreConfig::getCoreConfig(sourceId_);
 
     Q_ASSERT(config != 0);
 
@@ -207,6 +215,8 @@ void ResultWindow::setVisible(bool visible)
     if(!visible && source_)
     {
         source_->abort();
+
+
     }
 }