21 #ifndef EVENTLISTMODEL_H
22 #define EVENTLISTMODEL_H
26 #include "alarmresources.h"
28 #include <kalarmcal/kacalendar.h>
29 #include <kalarmcal/kaevent.h>
31 #include <QAbstractTableModel>
32 #include <QSortFilterProxyModel>
37 namespace KCal {
class Event; }
39 using namespace KAlarmCal;
47 TimeColumn, TimeToColumn, RepeatColumn, ColourColumn,
TypeColumn, TextColumn,
52 StatusRole = Qt::UserRole,
61 virtual int rowCount(
const QModelIndex& parent = QModelIndex())
const;
62 virtual int columnCount(
const QModelIndex& parent = QModelIndex())
const;
63 virtual QModelIndex index(
int row,
int column = 0,
const QModelIndex& parent = QModelIndex())
const;
64 virtual QVariant data(
const QModelIndex&,
int role = Qt::DisplayRole)
const;
65 virtual bool setData(
const QModelIndex&,
const QVariant& value,
int role = Qt::EditRole);
66 virtual QVariant headerData(
int section, Qt::Orientation,
int role = Qt::DisplayRole)
const;
67 virtual Qt::ItemFlags flags(
const QModelIndex&)
const;
68 static int iconWidth() {
return mIconSize.width(); }
69 QModelIndex eventIndex(
const KAEvent*)
const;
70 QModelIndex eventIndex(
const QString& eventId)
const;
71 void addEvent(KAEvent*);
72 void addEvents(
const KAEvent::List&);
75 bool updateEvent(
const QString& oldId, KAEvent* newEvent);
78 void removeResource(AlarmResource*);
79 KAEvent* event(
int row)
const;
80 static KAEvent* event(
const QModelIndex&);
81 void updateCommandError(
const QString& eventId);
83 static void resourceStatusChanged(AlarmResource*, AlarmResources::Change);
89 void haveEventsStatus(
bool have);
92 void slotUpdateTimeTo();
93 void slotUpdateArchivedColour(
const QColor&);
94 void slotUpdateDisabledColour(
const QColor&);
95 void slotUpdateHolidays();
96 void slotUpdateWorkingHours();
97 void slotResourceLoaded(AlarmResource*,
bool active);
98 void slotResourceStatusChanged(AlarmResource*, AlarmResources::Change);
102 bool updateEvent(
int row);
103 void removeEvent(
int row);
104 int findEvent(
const QString& eventId)
const;
105 void updateHaveEvents(
bool have) { mHaveEvents = have; emit haveEventsStatus(have); }
106 QString repeatText(
const KAEvent*)
const;
107 QString repeatOrder(
const KAEvent*)
const;
108 QPixmap* eventIcon(
const KAEvent*)
const;
109 QString whatsThisText(
int column)
const;
113 static QPixmap* mTextIcon;
114 static QPixmap* mFileIcon;
115 static QPixmap* mCommandIcon;
116 static QPixmap* mEmailIcon;
117 static QPixmap* mAudioIcon;
118 static QSize mIconSize;
119 static int mTimeHourPos;
121 KAEvent::List mEvents;
122 CalEvent::Types mStatus;
125 using QObject::event;
134 KAEvent* event(
int row)
const;
135 KAEvent* event(
const QModelIndex&)
const;
136 QModelIndex eventIndex(
const KAEvent*)
const;
137 QModelIndex eventIndex(
const QString& eventId)
const;
140 void slotDataChanged(
const QModelIndex&,
const QModelIndex&);
143 using QObject::event;
146 #endif // EVENTLISTMODEL_H
void removeEvent(const KAEvent *event)
void removeEvent(const QString &eventId)
bool updateEvent(KAEvent *event)
bool updateEvent(const QString &eventId)