32 #include <kalarmcal/kaevent.h>
34 #include <kuniqueapplication.h>
41 namespace KCal {
class Event; }
43 namespace Akonadi {
class Collection; }
49 class OrgKdeKSpeechInterface;
51 using namespace KAlarmCal;
59 virtual int newInstance();
62 bool wantShowInSystemTray()
const;
65 OrgKdeKSpeechInterface* kspeechInterface(QString& error)
const;
67 bool restoreSession();
71 static void displayFatalError(
const QString& message);
76 bool displayTrayIcon(
bool show,
MainWindow* = 0);
79 virtual void commitData(QSessionManager&);
81 void* execAlarm(KAEvent&,
const KAAlarm&,
bool reschedule,
bool allowDefer =
true,
bool noPreAction =
false);
82 ShellProcess* execCommandAlarm(
const KAEvent&,
const KAAlarm&,
const QObject* receiver = 0,
const char* slot = 0);
83 void alarmCompleted(
const KAEvent&);
87 void notifyAudioPlaying(
bool playing);
88 void setSpreadWindowsState(
bool spread);
90 bool scheduleEvent(KAEvent::SubAction,
const QString&
text,
const KDateTime&,
91 int lateCancel, KAEvent::Flags flags,
const QColor& bg,
const QColor& fg,
92 const QFont&,
const QString& audioFile,
float audioVolume,
93 int reminderMinutes,
const KARecurrence& recurrence,
94 int repeatInterval,
int repeatCount,
96 uint mailFromID = 0,
const KCalCore::Person::List& mailAddresses = KCalCore::Person::List(),
100 const QString& mailSubject = QString(),
101 const QStringList& mailAttachments = QStringList());
103 bool dbusTriggerEvent(
const EventId& eventID) {
return dbusHandleEvent(eventID, EVENT_TRIGGER); }
104 bool dbusDeleteEvent(
const EventId& eventID) {
return dbusHandleEvent(eventID, EVENT_CANCEL); }
106 bool dbusTriggerEvent(
const QString& eventID) {
return dbusHandleEvent(eventID, EVENT_TRIGGER); }
107 bool dbusDeleteEvent(
const QString& eventID) {
return dbusHandleEvent(eventID, EVENT_CANCEL); }
113 void setAlarmsEnabled(
bool);
115 void purgeNewArchivedDefault(
const Akonadi::Collection&);
116 void atLoginEventAdded(
const KAEvent&);
120 void spreadWindows(
bool);
121 void emailSent(
KAMail::JobData&,
const QStringList& errmsgs,
bool copyerr =
false);
124 void trayIconToggled();
125 void alarmEnabledToggled(
bool);
126 void audioPlaying(
bool);
127 void spreadWindowsToggled(
bool);
128 void execAlarmSuccess();
138 void checkNextDueAlarm();
139 void checkKtimezoned();
140 void slotShowInSystemTrayChanged();
141 void changeStartOfDay();
142 void slotWorkTimeChanged(
const QTime& start,
const QTime& end,
const QBitArray& days);
143 void slotHolidaysChanged(
const KHolidays::HolidayRegion&);
144 void slotFeb29TypeChanged(Feb29Type);
145 void checkWritableCalendar();
146 void slotMessageFontChanged(
const QFont&);
147 void setArchivePurgeDays();
148 void slotPurge() { purge(mArchivedPurgeDays); }
150 void purgeAfterDelay();
153 void slotDBusServiceUnregistered(
const QString& serviceName);
164 ProcData(
ShellProcess*, KAEvent*, KAAlarm*,
int flags = 0);
166 enum { PRE_ACTION = 0x01, POST_ACTION = 0x02, RESCHEDULE = 0x04, ALLOW_DEFER = 0x08,
167 TEMP_FILE = 0x10, EXEC_IN_XTERM = 0x20, DISP_OUTPUT = 0x40 };
168 bool preAction()
const {
return flags & PRE_ACTION; }
169 bool postAction()
const {
return flags & POST_ACTION; }
170 bool reschedule()
const {
return flags & RESCHEDULE; }
171 bool allowDefer()
const {
return flags & ALLOW_DEFER; }
172 bool tempFile()
const {
return flags & TEMP_FILE; }
173 bool execInXterm()
const {
return flags & EXEC_IN_XTERM; }
174 bool dispOutput()
const {
return flags & DISP_OUTPUT; }
179 QStringList tempFiles;
185 ActionQEntry(EventFunc f,
const EventId&
id) : function(f), eventId(id) { }
187 ActionQEntry(EventFunc f,
const QString&
id) : function(f), eventId(id) { }
189 ActionQEntry(
const KAEvent& e, EventFunc f = EVENT_HANDLE) : function(f), event(e) { }
202 bool initCheck(
bool calendarOnly =
false,
bool waitForCollection =
false, Akonadi::Collection::Id = -1);
204 bool initCheck(
bool calendarOnly =
false);
206 bool quitIf(
int exitCode,
bool force =
false);
207 bool checkSystemTray();
208 void startProcessQueue();
209 void queueAlarmId(
const KAEvent&);
211 bool dbusHandleEvent(
const EventId&, EventFunc);
212 bool handleEvent(
const EventId&, EventFunc,
bool checkDuplicates =
false);
214 bool dbusHandleEvent(
const QString& eventID, EventFunc);
215 bool handleEvent(
const QString& eventID, EventFunc);
217 int rescheduleAlarm(KAEvent&,
const KAAlarm&,
bool updateCalAndDisplay,
218 const KDateTime& nextDt = KDateTime());
219 bool cancelAlarm(KAEvent&, KAAlarm::Type,
bool updateCalAndDisplay);
220 bool cancelReminderAndDeferral(KAEvent&);
221 ShellProcess* doShellCommand(
const QString& command,
const KAEvent&,
const KAAlarm*,
222 int flags = 0,
const QObject* receiver = 0,
const char* slot = 0);
223 QString composeXTermCommand(
const QString& command,
const KAEvent&,
const KAAlarm*,
224 int flags, QString& tempScriptFile)
const;
225 QString createTempScriptFile(
const QString& command,
bool insertShell,
const KAEvent&,
const KAAlarm&)
const;
226 void commandErrorMsg(
const ShellProcess*,
const KAEvent&,
const KAAlarm*,
int flags = 0);
227 void purge(
int daysToKeep);
228 QStringList scheduledAlarmList();
231 static int mActiveCount;
232 static int mFatalError;
233 static QString mFatalMessage;
237 bool mLoginAlarmsDone;
241 QColor mPrefsArchivedColour;
242 int mArchivedPurgeDays;
243 int mPurgeDaysQueued;
245 QQueue<ActionQEntry> mActionQueue;
246 mutable OrgKdeKSpeechInterface* mKSpeech;
247 int mPendingQuitCode;
250 bool mProcessingQueue;
252 bool mSessionClosingDown;
253 bool mOldShowInSystemTray;
256 bool mKOrganizerEnabled;
261 #endif // KALARMAPP_H
void rescheduleAlarm(KAEvent &e, const KAAlarm &a)
bool alarmsEnabled() const
virtual QByteArray text(quint32 serialNumber) const =0
bool dbusDeleteEvent(const QString &eventID)
bool trayIconDisplayed() const
static KAlarmApp * getInstance()
bool dbusTriggerEvent(const QString &eventID)
bool korganizerEnabled() const
void notifyAudioStopped()
void addWindow(TrayWindow *w)
Unique event identifier for Akonadi.
bool sessionClosingDown() const
TrayWindow * trayWindow() const
bool speechEnabled() const