summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-07-22 05:19:28 (GMT)
committerMontel Laurent <montel@kde.org>2016-07-22 05:19:28 (GMT)
commit823fa746aa3db89185b0008c2672ab3e0befdcab (patch)
tree0de7189c124c5d3b86a6eaa1f0cf607a485c1d04
parentcc1f7f0ee59fdad2f4a5a649f6d7eb08b2c7bde6 (diff)
Continue to port to kdiagram
-rw-r--r--src/freebusyganttproxymodel.cpp19
-rw-r--r--src/visualfreebusywidget.cpp7
2 files changed, 25 insertions, 1 deletions
diff --git a/src/freebusyganttproxymodel.cpp b/src/freebusyganttproxymodel.cpp
index f65425b..6739f66 100644
--- a/src/freebusyganttproxymodel.cpp
+++ b/src/freebusyganttproxymodel.cpp
@@ -21,8 +21,11 @@
#include "freebusyganttproxymodel.h"
#include "CalendarSupport/FreeBusyItemModel"
+#ifdef KDIAGRAM_SUPPORT
+#include <KGantt/KGanttGraphicsView>
+#else
#include <KDGantt2/KDGanttGraphicsView>
-
+#endif
#include <KCalCore/FreeBusyPeriod>
#include <KLocalizedString>
@@ -47,8 +50,13 @@ QVariant FreeBusyGanttProxyModel::data(const QModelIndex &index, int role) const
// if the index is not valid, then its a toplevel item, which is an attendee
if (!source_index.parent().isValid()) {
switch (role) {
+#ifdef KDIAGRAM_SUPPORT
+ case KGantt::ItemTypeRole:
+ return KGantt::TypeMulti;
+#else
case KDGantt::ItemTypeRole:
return KDGantt::TypeMulti;
+#endif
case Qt::DisplayRole:
return source_index.data(Qt::DisplayRole);
default:
@@ -63,12 +71,21 @@ QVariant FreeBusyGanttProxyModel::data(const QModelIndex &index, int role) const
value<KCalCore::FreeBusyPeriod>();
switch (role) {
+#ifdef KDIAGRAM_SUPPORT
+ case KGantt::ItemTypeRole:
+ return KGantt::TypeTask;
+ case KGantt::StartTimeRole:
+ return period.start().toTimeSpec(timeSpec).dateTime();
+ case KGantt::EndTimeRole:
+ return period.end().toTimeSpec(timeSpec).dateTime();
+#else
case KDGantt::ItemTypeRole:
return KDGantt::TypeTask;
case KDGantt::StartTimeRole:
return period.start().toTimeSpec(timeSpec).dateTime();
case KDGantt::EndTimeRole:
return period.end().toTimeSpec(timeSpec).dateTime();
+#endif
case Qt::BackgroundRole:
return QColor(Qt::red);
case Qt::ToolTipRole:
diff --git a/src/visualfreebusywidget.cpp b/src/visualfreebusywidget.cpp
index 7c44dfd..54da514 100644
--- a/src/visualfreebusywidget.cpp
+++ b/src/visualfreebusywidget.cpp
@@ -22,10 +22,17 @@
#include "freebusyganttproxymodel.h"
#include "CalendarSupport/FreeBusyItemModel"
+#ifdef KDIAGRAM_SUPPORT
+#include <KGantt/KGanttGraphicsView>
+#include <KGantt/KGanttView>
+#include <KGantt/KGanttDateTimeGrid>
+#include <KGantt/KGanttAbstractRowController>
+#else
#include <KDGantt2/KDGanttGraphicsView>
#include <KDGantt2/KDGanttView>
#include <KDGantt2/KDGanttDateTimeGrid>
#include <KDGantt2/KDGanttAbstractRowController>
+#endif
#include <KComboBox>
#include "incidenceeditor_debug.h"