Waste less space in nested layouts.
[kdepim.git] / kalarm / dbushandler.h
blob8e4b81cddb13da0fcf690ac18c982d4f62102082
1 /*
2 * dbushandler.h - handler for D-Bus calls by other applications
3 * Program: kalarm
4 * Copyright © 2001,2002,2004-2007,2009 by David Jarvie <djarvie@kde.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #ifndef DBUSHANDLER_H
22 #define DBUSHANDLER_H
24 #include <QWidget>
25 #include <kcal/duration.h>
27 #include "datetime.h"
28 #include "kalarmiface.h"
29 class KUrl;
30 class KARecurrence;
33 class DBusHandler : public QObject, public KAlarmIface
35 Q_OBJECT
36 Q_CLASSINFO("D-Bus Interface", "org.kde.kalarm.kalarm")
37 public:
38 DBusHandler();
40 public Q_SLOTS:
41 Q_SCRIPTABLE bool cancelEvent(const QString& eventId);
42 Q_SCRIPTABLE bool triggerEvent(const QString& eventId);
44 Q_SCRIPTABLE bool scheduleMessage(const QString& message, const QString& startDateTime, int lateCancel, unsigned flags,
45 const QString& bgColor, const QString& fgColor, const QString& font,
46 const QString& audioUrl, int reminderMins, const QString& recurrence,
47 int subRepeatInterval, int subRepeatCount);
48 Q_SCRIPTABLE bool scheduleMessage(const QString& message, const QString& startDateTime, int lateCancel, unsigned flags,
49 const QString& bgColor, const QString& fgColor, const QString& font,
50 const QString& audioUrl, int reminderMins, int recurType, int recurInterval, int recurCount);
51 Q_SCRIPTABLE bool scheduleMessage(const QString& message, const QString& startDateTime, int lateCancel, unsigned flags,
52 const QString& bgColor, const QString& fgColor, const QString& font,
53 const QString& audioUrl, int reminderMins, int recurType, int recurInterval, const QString& endDateTime);
54 Q_SCRIPTABLE bool scheduleFile(const QString& url, const QString& startDateTime, int lateCancel, unsigned flags, const QString& bgColor,
55 const QString& audioUrl, int reminderMins, const QString& recurrence,
56 int subRepeatInterval, int subRepeatCount);
57 Q_SCRIPTABLE bool scheduleFile(const QString& url, const QString& startDateTime, int lateCancel, unsigned flags, const QString& bgColor,
58 const QString& audioUrl, int reminderMins, int recurType, int recurInterval, int recurCount);
59 Q_SCRIPTABLE bool scheduleFile(const QString& url, const QString& startDateTime, int lateCancel, unsigned flags, const QString& bgColor,
60 const QString& audioUrl, int reminderMins, int recurType, int recurInterval, const QString& endDateTime);
61 Q_SCRIPTABLE bool scheduleCommand(const QString& commandLine, const QString& startDateTime, int lateCancel, unsigned flags,
62 const QString& recurrence, int subRepeatInterval, int subRepeatCount);
63 Q_SCRIPTABLE bool scheduleCommand(const QString& commandLine, const QString& startDateTime, int lateCancel, unsigned flags,
64 int recurType, int recurInterval, int recurCount);
65 Q_SCRIPTABLE bool scheduleCommand(const QString& commandLine, const QString& startDateTime, int lateCancel, unsigned flags,
66 int recurType, int recurInterval, const QString& endDateTime);
67 Q_SCRIPTABLE bool scheduleEmail(const QString& fromID, const QString& addresses, const QString& subject, const QString& message,
68 const QString& attachments, const QString& startDateTime, int lateCancel, unsigned flags,
69 const QString& recurrence, int subRepeatInterval, int subRepeatCount);
70 Q_SCRIPTABLE bool scheduleEmail(const QString& fromID, const QString& addresses, const QString& subject, const QString& message,
71 const QString& attachments, const QString& startDateTime, int lateCancel, unsigned flags,
72 int recurType, int recurInterval, int recurCount);
73 Q_SCRIPTABLE bool scheduleEmail(const QString& fromID, const QString& addresses, const QString& subject, const QString& message,
74 const QString& attachments, const QString& startDateTime, int lateCancel, unsigned flags,
75 int recurType, int recurInterval, const QString& endDateTime);
76 Q_SCRIPTABLE bool scheduleAudio(const QString& audioUrl, int volumePercent, const QString& startDateTime, int lateCancel,
77 unsigned flags, const QString& recurrence, int subRepeatInterval, int subRepeatCount);
78 Q_SCRIPTABLE bool scheduleAudio(const QString& audioUrl, int volumePercent, const QString& startDateTime, int lateCancel,
79 unsigned flags, int recurType, int recurInterval, int recurCount);
80 Q_SCRIPTABLE bool scheduleAudio(const QString& audioUrl, int volumePercent, const QString& startDateTime, int lateCancel,
81 unsigned flags, int recurType, int recurInterval, const QString& endDateTime);
82 Q_SCRIPTABLE bool edit(const QString& eventID);
83 Q_SCRIPTABLE bool editNew(int type);
84 Q_SCRIPTABLE bool editNew(const QString& templateName);
86 private:
87 static bool scheduleMessage(const QString& message, const KDateTime& start, int lateCancel, unsigned flags,
88 const QString& bgColor, const QString& fgColor, const QString& fontStr,
89 const KUrl& audioFile, int reminderMins, const KARecurrence&,
90 const KCal::Duration& subRepeatDuration = KCal::Duration(0), int subRepeatCount = 0);
91 static bool scheduleFile(const KUrl& file, const KDateTime& start, int lateCancel, unsigned flags, const QString& bgColor,
92 const KUrl& audioFile, int reminderMins, const KARecurrence&,
93 const KCal::Duration& subRepeatDuration = KCal::Duration(0), int subRepeatCount = 0);
94 static bool scheduleCommand(const QString& commandLine, const KDateTime& start, int lateCancel, unsigned flags,
95 const KARecurrence&, const KCal::Duration& subRepeatDuration = KCal::Duration(0), int subRepeatCount = 0);
96 static bool scheduleEmail(const QString& fromID, const QString& addresses, const QString& subject, const QString& message,
97 const QString& attachments, const KDateTime& start, int lateCancel, unsigned flags,
98 const KARecurrence&, const KCal::Duration& subRepeatDuration = KCal::Duration(0), int subRepeatCount = 0);
99 static bool scheduleAudio(const QString& audioUrl, int volumePercent, const KDateTime& start, int lateCancel, unsigned flags,
100 const KARecurrence&, const KCal::Duration& subRepeatDuration = KCal::Duration(0), int subRepeatCount = 0);
101 static KDateTime convertDateTime(const QString& dateTime, const KDateTime& = KDateTime());
102 static unsigned convertStartFlags(const KDateTime& start, unsigned flags);
103 static QColor convertBgColour(const QString& bgColor);
104 static bool convertRecurrence(KDateTime& start, KARecurrence&, const QString& startDateTime, const QString& icalRecurrence, int subRepeatInterval, KCal::Duration& subRepeatDuration);
105 static bool convertRecurrence(KDateTime& start, KARecurrence&, const QString& startDateTime, int recurType, int recurInterval, int recurCount);
106 static bool convertRecurrence(KDateTime& start, KARecurrence&, const QString& startDateTime, int recurType, int recurInterval, const QString& endDateTime);
107 static bool convertRecurrence(KARecurrence&, const KDateTime& start, int recurType, int recurInterval, int recurCount, const KDateTime& end);
110 #endif // DBUSHANDLER_H