Small fix to connection selector.
[jenirok] / src / gui / mainwindow.cpp
index 7c0221a..8a5c71d 100644 (file)
@@ -32,6 +32,8 @@
 #include "daemon.h"
 #include "settings.h"
 #include "db.h"
+#include "source.h"
+#include "sourcecoreconfig.h"
 
 namespace
 {
@@ -156,7 +158,7 @@ void MainWindow::toggleDaemon()
     }
     else
     {
-        QMaemo5InformationBox::information(this, readyText);
+        QMaemo5InformationBox::information(this, readyText, 800);
         toggleButton_->setText(buttonText);
         toggleButton_->setIcon(QIcon(running_ ? START_ICON : CLOSE_ICON));
         running_ = !running_;
@@ -166,16 +168,17 @@ void MainWindow::toggleDaemon()
 
 void MainWindow::openSearch()
 {
-    DB::connect();
+    Source::SourceId sourceId = Source::stringToId(Settings::instance()->get("source"));
+    SourceCoreConfig* config = SourceCoreConfig::getCoreConfig(sourceId);
 
-    QString username = Settings::instance()->get("eniro_username");
-    QString password = Settings::instance()->get("eniro_password");
+    Q_ASSERT(config != 0);
 
-    DB::disconnect();
+    bool readyToSearch = config->readyToSearch();
+    delete config;
 
-    if(username.isEmpty() || password.isEmpty())
+    if(!readyToSearch)
     {
-        QMessageBox::information(this, tr("Info"), tr("You need to set Eniro login details in settings before using this feature."));
+        QMessageBox::information(this, tr("Info"), tr("You need to set login details or other options in settings before using this feature."));
         return;
     }