31 #include <kalarmcal/kaevent.h>
33 #include <akonadi/collection.h>
34 #include <akonadi/item.h>
37 #include <kmimetype.h>
43 using namespace KAlarmCal;
45 namespace KCal {
class Event; }
49 class KActionCollection;
62 enum FileType { Unknown, TextPlain, TextFormatted, TextApplication, Image };
77 enum UpdateError { ERR_ADD, ERR_MODIFY, ERR_DELETE, ERR_REACTIVATE, ERR_TEMPLATE };
82 MainWindow* displayMainWindowSelected(Akonadi::Item::Id = -1);
84 MainWindow* displayMainWindowSelected(
const QString& eventId = QString());
86 bool readConfigWindowSize(
const char* window, QSize&,
int* splitterWidth = 0);
87 void writeConfigWindowSize(
const char* window,
const QSize&,
int splitterWidth = -1);
91 FileType fileType(
const KMimeType::Ptr& mimetype);
98 FileErr_Nonexistent, FileErr_Directory, FileErr_Unreadable, FileErr_NotTextImage,
102 FileErr checkFileExists(QString& filename, KUrl&);
103 bool showFileErrMessage(
const QString& filename, FileErr, FileErr blankError,
QWidget* errmsgParent);
106 QString pathOrUrl(
const QString& url);
108 QString browseFile(
const QString& caption, QString& defaultDir,
const QString& initialFile = QString(),
109 const QString& filter = QString(), KFile::Modes mode = 0,
QWidget* parent = 0);
110 bool editNewAlarm(
const QString& templateName,
QWidget* parent = 0);
112 void editNewAlarm(KAEvent::SubAction,
QWidget* parent = 0,
const AlarmText* = 0);
113 void editNewAlarm(
const KAEvent* preset,
QWidget* parent = 0);
114 void editAlarm(KAEvent*,
QWidget* parent = 0);
117 void updateEditedAlarm(
EditAlarmDlg*, KAEvent&, Akonadi::Collection&);
119 bool editAlarmById(
const QString& eventID,
QWidget* parent = 0);
120 void updateEditedAlarm(
EditAlarmDlg*, KAEvent&, AlarmResource*);
122 void viewAlarm(
const KAEvent*,
QWidget* parent = 0);
124 void editNewTemplate(
const KAEvent* preset,
QWidget* parent = 0);
125 void editTemplate(KAEvent*,
QWidget* parent = 0);
128 KToggleAction* createAlarmEnableAction(
QObject* parent);
129 KAction* createStopPlayAction(
QObject* parent);
130 KToggleAction* createSpreadWindowsAction(
QObject* parent);
134 KAEvent::List templateList();
135 void outputAlarmWarnings(
QWidget* parent,
const KAEvent* = 0);
136 void refreshAlarms();
137 void refreshAlarmsIfQueued();
138 QString runKMail(
bool minimise);
141 QStringList dontShowErrors(
const EventId&);
142 bool dontShowErrors(
const EventId&,
const QString& tag);
143 void setDontShowErrors(
const EventId&,
const QStringList& tags = QStringList());
144 void setDontShowErrors(
const EventId&,
const QString& tag);
146 QStringList dontShowErrors(
const QString& eventId);
147 bool dontShowErrors(
const QString& eventId,
const QString& tag);
148 void setDontShowErrors(
const QString& eventId,
const QStringList& tags = QStringList());
150 void setDontShowErrors(
const QString& eventId,
const QString& tag);
155 NO_RESOURCE_PROMPT = 0x02,
156 ALLOW_KORG_UPDATE = 0x04
159 UpdateStatus addEvent(KAEvent&, Akonadi::Collection* = 0,
QWidget* msgParent = 0,
int options = ALLOW_KORG_UPDATE,
bool showKOrgErr =
true);
161 UpdateStatus addEvent(KAEvent&, AlarmResource* = 0,
QWidget* msgParent = 0,
int options = ALLOW_KORG_UPDATE,
bool showKOrgErr =
true);
163 UpdateStatus addEvents(QVector<KAEvent>&,
QWidget* msgParent = 0,
bool allowKOrgUpdate =
true,
bool showKOrgErr =
true);
165 bool addArchivedEvent(KAEvent&, Akonadi::Collection* = 0);
166 UpdateStatus addTemplate(KAEvent&, Akonadi::Collection* = 0,
QWidget* msgParent = 0);
168 bool addArchivedEvent(KAEvent&, AlarmResource* = 0);
169 UpdateStatus addTemplate(KAEvent&, AlarmResource* = 0,
QWidget* msgParent = 0);
171 UpdateStatus modifyEvent(KAEvent& oldEvent, KAEvent& newEvent,
QWidget* msgParent = 0,
bool showKOrgErr =
true);
172 UpdateStatus updateEvent(KAEvent&,
QWidget* msgParent = 0,
bool archiveOnDelete =
true);
173 UpdateStatus updateTemplate(KAEvent&,
QWidget* msgParent = 0);
174 UpdateStatus deleteEvent(KAEvent&,
bool archive =
true,
QWidget* msgParent = 0,
bool showKOrgErr =
true);
176 UpdateStatus deleteEvents(QVector<KAEvent>&,
bool archive =
true,
QWidget* msgParent = 0,
bool showKOrgErr =
true);
177 UpdateStatus deleteTemplates(
const KAEvent::List& events,
QWidget* msgParent = 0);
178 inline UpdateStatus deleteTemplate(KAEvent& event,
QWidget* msgParent = 0)
179 { KAEvent::List e; e += &event;
return deleteTemplates(e, msgParent); }
181 UpdateStatus deleteEvents(KAEvent::List&,
bool archive =
true,
QWidget* msgParent = 0,
bool showKOrgErr =
true);
182 UpdateStatus deleteTemplates(
const QStringList& eventIDs,
QWidget* msgParent = 0);
183 inline UpdateStatus deleteTemplate(
const QString& eventID,
QWidget* msgParent = 0)
184 {
return deleteTemplates(QStringList(eventID), msgParent); }
186 void deleteDisplayEvent(
const QString& eventID);
188 UpdateStatus reactivateEvent(KAEvent&, Akonadi::Collection* = 0,
QWidget* msgParent = 0,
bool showKOrgErr =
true);
189 UpdateStatus reactivateEvents(QVector<KAEvent>&, QVector<EventId>& ineligibleIDs, Akonadi::Collection* = 0,
QWidget* msgParent = 0,
bool showKOrgErr =
true);
190 UpdateStatus enableEvents(QVector<KAEvent>&,
bool enable,
QWidget* msgParent = 0);
193 UpdateStatus reactivateEvent(KAEvent&, AlarmResource* = 0,
QWidget* msgParent = 0,
bool showKOrgErr =
true);
194 UpdateStatus reactivateEvents(KAEvent::List&, QStringList& ineligibleIDs, AlarmResource* = 0,
QWidget* msgParent = 0,
bool showKOrgErr =
true);
195 UpdateStatus enableEvents(KAEvent::List&,
bool enable,
QWidget* msgParent = 0);
196 KAEvent::List getSortedActiveEvents(
const KDateTime& startTime = KDateTime(),
const KDateTime& endTime = KDateTime());
198 void purgeArchive(
int purgeDays);
199 void displayUpdateError(
QWidget* parent, UpdateStatus, UpdateError,
int nAlarms,
int nKOrgAlarms = 1,
bool showKOrgError =
true);
200 void displayKOrgUpdateError(
QWidget* parent, UpdateError, UpdateStatus korgError,
int nAlarms);
201 QStringList checkRtcWakeConfig(
bool checkEventExists =
false);
202 void deleteRtcWakeConfig();
203 void cancelRtcWake(
QWidget* msgParent,
const QString& eventId = QString());
204 bool setRtcWakeTime(
unsigned triggerTime,
QWidget* parent);
211 QString conversionPrompt(
const QString& calendarName,
const QString& calendarVersion,
bool whole);
214 Akonadi::Collection invalidCollection();
218 void setTestModeConditions();
219 void setSimulatedSystemTime(
const KDateTime&);
226 #endif // FUNCTIONS_H
Unique event identifier for Akonadi.
bool caseInsensitiveLessThan(const QString &s1, const QString &s2)