]> ToastFreeware Gitweb - toast/confclerk.git/blobdiff - src/mvc/eventmodel.cpp
update for the search
[toast/confclerk.git] / src / mvc / eventmodel.cpp
index c877f02568f912a04f0b098a1bc042f09d526d13..629581563b6e8495047f7aab53b3d1087022d895 100644 (file)
@@ -2,6 +2,8 @@
 #include <conference.h>
 #include <track.h>
 
+const QString EventModel::COMMA_SEPARATOR = ", ";
+
 EventModel::EventModel()
 {
     mEvents.clear();
@@ -182,6 +184,30 @@ void EventModel::loadFavEvents(const QDate &aDate, int aConferenceId)
     createTimeGroups();
 }
 
+int EventModel::loadSearchResultEvents(const QDate &aDate, int aConferenceId)
+{
+    clearModel();
+    // check for existence of the conference in the DB
+    if(Conference::getAll().count())
+    {
+        qDebug() << "Loading search result Data: [" << Conference::getById(aConferenceId).title() << "] " << aDate;
+        try{
+            mEvents = Event::getSearchResultByDate(QDate(aDate.year(), aDate.month(), aDate.day()), aConferenceId, "start");
+        }
+        catch( OrmException &e  ){
+            qDebug() << "Event::getSearchResultByDate failed: " << e.text();
+        }
+        catch(...){
+            qDebug() << "Event::getSearchResultByDate failed";
+        }
+
+    }
+
+    createTimeGroups();
+
+    return mEvents.count();
+}
+
 void EventModel::loadEventsByTrack(const QDate &aDate, int aConferenceId)
 {
     clearModel();