fixed problem with storing conference ID to AppSettings
authorpavelpa <pavelpa@localhost>
Fri, 22 Jan 2010 14:11:38 +0000 (14:11 +0000)
committerpavelpa <pavelpa@localhost>
Fri, 22 Jan 2010 14:11:38 +0000 (14:11 +0000)
src/gui/mainwindow.cpp

index a1dfe56206234a219c5a721b94cd0b3755c2fbbf..025593c9cf961d8dc9af9f0d2f924c98a6d127f2 100644 (file)
@@ -177,9 +177,17 @@ void MainWindow::importSchedule()
 {
     ImportScheduleDialog dialog(mSqlEngine,this);
     dialog.exec();
-    
-    if(Conference::getAll().count())
+
+    QList<Conference> confs = Conference::getAll();
+    if(!confs.count()) // no conference(s) in the DB
+    {
+        AppSettings::setConfId(0); // no conference in the DB
+    }
+    else
     {
+        if(AppSettings::confId() == 0)
+            AppSettings::setConfId(confs[0].id());
+
         // 'dayNavigator' emits signal 'dateChanged' after setting valid START:END dates
         QDate aStartDate = Conference::getById(AppSettings::confId()).start();
         QDate aEndDate = Conference::getById(AppSettings::confId()).end();