Go to the documentation of this file.
26 #include <tqguardedptr.h>
30 #include <tdeuniqueapplication.h>
33 namespace KCal { class Event; }
48 class KAlarmApp : public TDEUniqueApplication
54 virtual int newInstance();
55 static KAlarmApp* getInstance();
56 bool checkCalendarDaemon() { return initCheck(); }
57 bool haveSystemTray() const { return mHaveSystemTray; }
58 bool wantRunInSystemTray() const;
59 bool alarmsDisabledIfStopped() const { return mDisableAlarmsIfStopped; }
60 bool speechEnabled() const { return mSpeechEnabled; }
61 bool korganizerEnabled() const { return mKOrganizerEnabled; }
62 bool restoreSession();
63 bool sessionClosingDown() const { return mSessionClosingDown; }
64 void quitIf() { quitIf(0); }
65 void doQuit(TQWidget* parent);
66 static void displayFatalError( const TQString& message);
67 void addWindow(TrayWindow* w) { mTrayWindow = w; }
68 void removeWindow(TrayWindow*);
69 TrayWindow* trayWindow() const { return mTrayWindow; }
70 MainWindow* trayMainWindow() const;
71 bool displayTrayIcon( bool show, MainWindow* = 0);
72 bool trayIconDisplayed() const { return !!mTrayWindow; }
73 bool editNewAlarm(MainWindow* = 0);
74 virtual void commitData(TQSessionManager&);
76 void* execAlarm( KAEvent&, const KAAlarm&, bool reschedule, bool allowDefer = true, bool noPreAction = false);
77 void alarmShowing( KAEvent&, KAAlarm::Type, const DateTime&);
78 void alarmCompleted( const KAEvent&);
79 bool deleteEvent( const TQString& eventID) { return handleEvent(eventID, EVENT_CANCEL); }
80 void commandMessage(ShellProcess*, TQWidget* parent);
82 bool scheduleEvent(KAEvent::Action, const TQString& text, const TQDateTime&,
83 int lateCancel, int flags, const TQColor& bg, const TQColor& fg,
84 const TQFont&, const TQString& audioFile, float audioVolume,
85 int reminderMinutes, const KARecurrence& recurrence,
86 int repeatInterval, int repeatCount,
87 uint mailFromID = 0, const EmailAddressList& mailAddresses = EmailAddressList(),
88 const TQString& mailSubject = TQString(),
89 const TQStringList& mailAttachments = TQStringList());
90 bool handleEvent( const TQString& calendarFile, const TQString& eventID) { return handleEvent(calendarFile, eventID, EVENT_HANDLE); }
91 bool triggerEvent( const TQString& calendarFile, const TQString& eventID) { return handleEvent(calendarFile, eventID, EVENT_TRIGGER); }
92 bool deleteEvent( const TQString& calendarFile, const TQString& eventID) { return handleEvent(calendarFile, eventID, EVENT_CANCEL); }
96 void trayIconToggled();
101 void slotPreferencesChanged();
102 void slotCommandOutput(TDEProcess*, char* buffer, int bufflen);
103 void slotLogProcExited(ShellProcess*);
104 void slotCommandExited(ShellProcess*);
105 void slotSystemTrayTimer();
106 void slotExpiredPurged();
116 ProcData(ShellProcess* p, ShellProcess* logp, KAEvent* e, KAAlarm* a, int f = 0);
118 enum { PRE_ACTION = 0x01, POST_ACTION = 0x02, RESCHEDULE = 0x04, ALLOW_DEFER = 0x08,
119 TEMP_FILE = 0x10, EXEC_IN_XTERM = 0x20 };
120 bool preAction() const { return flags & PRE_ACTION; }
121 bool postAction() const { return flags & POST_ACTION; }
122 bool reschedule() const { return flags & RESCHEDULE; }
123 bool allowDefer() const { return flags & ALLOW_DEFER; }
124 bool tempFile() const { return flags & TEMP_FILE; }
125 bool execInXterm() const { return flags & EXEC_IN_XTERM; }
126 ShellProcess* process;
127 TQGuardedPtr<ShellProcess> logProcess;
130 TQGuardedPtr<TQWidget> messageBoxParent;
131 TQStringList tempFiles;
136 DcopTQEntry(EventFunc f, const TQString& id) : function(f), eventId(id) { }
137 DcopTQEntry( const KAEvent& e, EventFunc f = EVENT_HANDLE) : function(f), event(e) { }
144 bool initCheck( bool calendarOnly = false);
145 void quitIf( int exitCode, bool force = false);
146 void redisplayAlarms();
147 bool checkSystemTray();
148 void changeStartOfDay();
150 bool handleEvent( const TQString& calendarFile, const TQString& eventID, EventFunc);
151 bool handleEvent( const TQString& eventID, EventFunc);
152 void rescheduleAlarm( KAEvent&, const KAAlarm&, bool updateCalAndDisplay);
153 void cancelAlarm( KAEvent&, KAAlarm::Type, bool updateCalAndDisplay);
154 ShellProcess* doShellCommand( const TQString& command, const KAEvent&, const KAAlarm*, int flags = 0);
155 TQString createTempScriptFile( const TQString& command, bool insertShell, const KAEvent&, const KAAlarm&);
156 void commandErrorMsg( const ShellProcess*, const KAEvent&, const KAAlarm*, int flags = 0);
158 static KAlarmApp* theInstance;
159 static int mActiveCount;
160 static int mFatalError;
161 static TQString mFatalMessage;
163 DcopHandler* mDcopHandler;
165 DcopHandlerOld* mDcopHandlerOld;
167 TrayWindow* mTrayWindow;
169 TQColor mPrefsExpiredColour;
170 int mPrefsExpiredKeepDays;
171 TQValueList<ProcData*> mCommandProcesses;
172 TQValueList<DcopTQEntry> mDcopQueue;
173 int mPendingQuitCode;
175 bool mProcessingQueue;
176 bool mHaveSystemTray;
178 bool mSavedNoSystemTray;
179 bool mCheckingSystemTray;
180 bool mSessionClosingDown;
181 bool mOldRunInSystemTray;
182 bool mDisableAlarmsIfStopped;
183 bool mRefreshExpiredAlarms;
185 bool mKOrganizerEnabled;
188 inline KAlarmApp* theApp() { return KAlarmApp::getInstance(); }
represents calendar alarms and events
Provides read and write access to calendar files.
KAEvent corresponds to a KCal::Event instance.
MessageWin: A window to display an alarm message.
|