some 'delegate' drawing optimizations
[toast/confclerk.git] / src / sql / sqlengine.cpp
index 14c68fc..fcaceb2 100644 (file)
@@ -6,7 +6,6 @@
 #include <QDateTime>
 
 #include <QDir>
-#include <appsettings.h>
 #include "sqlengine.h"
 #include <track.h>
 #include <conference.h>
@@ -94,13 +93,11 @@ void SqlEngine::addConferenceToDB(QHash<QString,QString> &aConference)
                              .arg(aConference["days"]) \
                              .arg(-QTime::fromString(aConference["day_change"],TIME_FORMAT).secsTo(QTime(0,0))) \
                              .arg(-QTime::fromString(aConference["timeslot_duration"],TIME_FORMAT).secsTo(QTime(0,0)));
+                             values.append(QString(", '%1'").arg(confsList.count()>0?"0":"1"));
 
-            QString query = QString("INSERT INTO CONFERENCE (title,subtitle,venue,city,start,end,days,day_change,timeslot_duration) VALUES (%1)").arg(values);
+            QString query = QString("INSERT INTO CONFERENCE (title,subtitle,venue,city,start,end,days,day_change,timeslot_duration,active) VALUES (%1)").arg(values);
             QSqlQuery result (query, db);
             aConference["id"] = result.lastInsertId().toString(); // 'id' is assigned automatically
-
-            if(!AppSettings::confId()) // default conf Id isn't set yet => set it up
-                AppSettings::setConfId(confId);
         }
     }
 }
@@ -155,7 +152,6 @@ void SqlEngine::addEventToDB(QHash<QString,QString> &aEvent)
     }
 }
 
-
 void SqlEngine::addPersonToDB(QHash<QString,QString> &aPerson)
 {
     QSqlDatabase db = QSqlDatabase::database();
@@ -240,7 +236,8 @@ bool SqlEngine::createTables(QSqlDatabase &aDatabase)
             "end INTEGER NOT NULL, "
             "days INTEGER, "
             "day_change INTEGER, "
-            "timeslot_duration INTEGER);");
+            "timeslot_duration INTEGER, "
+            "active INTEGER DEFAULT 0);");
 
         query.exec("CREATE TABLE TRACK ( "
             "id INTEGER  PRIMARY KEY AUTOINCREMENT  NOT NULL, "
@@ -291,14 +288,6 @@ bool SqlEngine::createTables(QSqlDatabase &aDatabase)
             "FOREIGN KEY(xid_event) REFERENCES EVENT(id), "
             "FOREIGN KEY(xid_room) REFERENCES ROOM(id));");
 
-        query.exec("CREATE TABLE EVENT_CONFLICT ( "
-            "xid_conference INTEGER NOT NULL, "
-            "xid_event INTEGER NOT NULL, "
-            "conflict_event INTEGER NOT NULL, "
-            "UNIQUE ( xid_conference, xid_event, conflict_event ) ON CONFLICT IGNORE, "
-            "FOREIGN KEY(xid_conference) REFERENCES CONFERENCE(id), "
-            "FOREIGN KEY(xid_event) REFERENCES EVENT(id));");
-
         query.exec("CREATE TABLE LINK ( "
             "id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "
             "xid_conference INTEGER NOT NULL, "