Adjust shown event time when displayTimeShift is set.
[debian/confclerk.git] / src / mvc / conferencemodel.cpp
index c03761cfd96d9c3193d87287600c0217b8264677..604d98fc89cfdb123c1eb8b538bbc87bf4036d6d 100644 (file)
@@ -39,19 +39,21 @@ QVariant ConferenceModel::data(const QModelIndex& index, int role) const
     if (role != Qt::DisplayRole) {
         return QVariant();
     }
-
     return conferences[index.row()].title();
+}
 
-    try {
-        const Conference& c = conferenceFromIndex(index);
-        return c.title();
-    } catch (OrmNoObjectException&) {
-        return QVariant();
+const Conference& ConferenceModel::conferenceFromIndex(const QModelIndex& index) const
+{
+    if (index.parent().isValid()
+        or index.column() != 0
+        or index.row() >= conferences.size())
+    {
+        throw OrmNoObjectException();
     }
-
+    return conferences[index.row()];
 }
 
-const Conference& ConferenceModel::conferenceFromIndex(const QModelIndex& index) const
+Conference& ConferenceModel::conferenceFromIndex(const QModelIndex& index)
 {
     if (index.parent().isValid()
         or index.column() != 0