+ clearModel();
+ // check for existence of the conference in the DB
+ if(Conference::getAll().count())
+ {
+ mEvents = Event::nowEvents(aConferenceId, "start");
+ }
+ createTimeGroups();
+}
+
+void EventModel::loadConflictEvents(int aEventId, int aConferenceId)
+{
+ clearModel();
+ // check for existence of the conference in the DB
+ if(Conference::getAll().count())
+ {
+ mEvents = Event::conflictEvents(aEventId, aConferenceId);
+ }
+ createTimeGroups();
+}
+
+void EventModel::updateModel(int aEventId)
+{
+ for(int i=0; i<mEvents.count(); i++)
+ {
+ if(mEvents[i].id() == aEventId)
+ mEvents[i] = Event::getById(aEventId,Conference::activeConference());
+ }
+
+ // find the ModelIndex for given aEventId
+ for(int i=0; i<mGroups.count(); i++)
+ {
+ QModelIndex groupIndex = index(i,0,QModelIndex());
+ for(int j=0; j<mGroups[i].mChildCount; j++)
+ {
+ QModelIndex eventIndex = index(j,0,groupIndex);
+ if(static_cast<Event*>(eventIndex.internalPointer())->id() == aEventId)
+ {
+ emit(dataChanged(groupIndex,groupIndex));
+ emit(dataChanged(eventIndex,eventIndex));
+ }
+ }
+ }