]> ToastFreeware Gitweb - toast/confclerk.git/blobdiff - src/mvc/eventmodel.cpp
update for the search
[toast/confclerk.git] / src / mvc / eventmodel.cpp
index abd688f3092a5f3643c95e23519c8045ddfa66ee..629581563b6e8495047f7aab53b3d1087022d895 100644 (file)
@@ -2,6 +2,8 @@
 #include <conference.h>
 #include <track.h>
 
+const QString EventModel::COMMA_SEPARATOR = ", ";
+
 EventModel::EventModel()
 {
     mEvents.clear();
@@ -182,16 +184,28 @@ void EventModel::loadFavEvents(const QDate &aDate, int aConferenceId)
     createTimeGroups();
 }
 
-void EventModel::loadSearchResultEvents(const QDate &aDate, int aConferenceId)
+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;
-        mEvents = Event::getSearchResultByDate(QDate(aDate.year(), aDate.month(), aDate.day()), aConferenceId, "start");
+        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)