]> ToastFreeware Gitweb - toast/confclerk.git/blobdiff - src/mvc/conferencemodel.cpp
Bump copyright years.
[toast/confclerk.git] / src / mvc / conferencemodel.cpp
index 94880c83b2516e71260b6de21e38f3feaa566ba1..1976252fa6507aaa5f356932991bac8beb5750a1 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2010 Ixonos Plc.
- * Copyright (C) 2011 Philipp Spitzer, gregor herrmann
+ * Copyright (C) 2011-2024 Philipp Spitzer, gregor herrmann, Stefan Stahl
  *
  * This file is part of ConfClerk.
  *
@@ -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
@@ -77,9 +79,8 @@ void ConferenceModel::newConferenceBegin()
 {
 }
 
-void ConferenceModel::newConferenceEnd(const QString& title)
-{
-    Q_UNUSED(title);
+void ConferenceModel::newConferenceEnd(int conferenceId) {
+    Q_UNUSED(conferenceId);
     reinit();
 }