korganizer

actionmanager.h
1 /*
2  This file is part of KOrganizer.
3 
4  Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
5  Copyright (c) 2002 Don Sanders <sanders@kde.org>
6  Copyright (c) 2003,2004 Cornelius Schumacher <schumacher@kde.org>
7  Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
8 
9  This program is free software; you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation; either version 2 of the License, or
12  (at your option) any later version.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 
23  As a special exception, permission is given to link this program
24  with any edition of TQt, and distribute the resulting executable,
25  without including the source code for TQt in the source distribution.
26 */
27 #ifndef KORG_ACTIONMANAGER_H
28 #define KORG_ACTIONMANAGER_H
29 
30 #include <tqobject.h>
31 #include <kurl.h>
32 #include <korganizer/part.h>
33 #include <tdemacros.h>
34 
35 #include "kcalendariface.h"
36 
37 namespace KCal
38 {
39  class Calendar;
40  class CalendarResources;
41  class Incidence;
42  class ResourceCalendar;
43 }
44 namespace KOrg {
45  class MainWindow;
46 }
47 
48 class TDEAction;
49 class TDEActionCollection;
50 class TDERecentFilesAction;
51 class TDESelectAction;
52 class TDEToggleAction;
53 class TDEConfig;
54 class TDEProcess;
55 class KTempFile;
56 class KXMLGUIClient;
57 class CalendarView;
58 class KOrganizer;
59 class KONewStuff;
60 class KOWindowList;
61 class PreviewDialog;
62 class ResourceView;
63 class HTMLExportSettings;
64 
65 using namespace KCal;
66 
73 class TDE_EXPORT ActionManager : public TQObject, public KCalendarIface
74 {
75  TQ_OBJECT
76 
77  public:
78  ActionManager( KXMLGUIClient *client, CalendarView *widget,
79  TQObject *parent, KOrg::MainWindow *mainWindow,
80  bool isPart );
81  virtual ~ActionManager();
82 
84  void init();
85 
86  CalendarView *view() const { return mCalendarView; }
87 
91  void createCalendarLocal();
96  void createCalendarResources();
97 
101  void saveCalendar();
102 
107  bool saveResourceCalendar();
108 
112  void loadResourceCalendar();
113 
114  public slots:
116  bool addResource( const KURL &mUrl );
121  bool openURL( const KURL &url, bool merge = false );
123  bool saveURL();
125  bool saveAsURL( const KURL &kurl );
127  bool saveModifiedURL();
128 
129  void exportHTML();
130  void exportHTML( HTMLExportSettings * );
131  public:
133  KURL url() const { return mURL; }
134 
136  static KOrg::MainWindow* findInstance( const KURL &url );
138  bool openURL( const TQString &url );
140  bool mergeURL( const TQString &url );
142  bool saveAsURL( const TQString &url );
144  void closeURL();
146  TQString getCurrentURLasString() const;
153  virtual bool deleteIncidence( const TQString& uid, bool force = false );
154 
155  bool editIncidence( const TQString &uid );
156  bool editIncidence( const TQString &uid, const TQDate &date );
157 
163  bool addIncidence( const TQString& ical );
164 
166  virtual ResourceRequestReply resourceRequest( const TQValueList<TQPair<TQDateTime, TQDateTime> >& busy,
167  const TQCString& resource,
168  const TQString& vCalIn );
169 
170  void openEventEditor( const TQString& );
171  void openEventEditor( const TQString& summary,
172  const TQString& description,
173  const TQString& attachment );
174  void openEventEditor( const TQString& summary,
175  const TQString& description,
176  const TQString& attachment,
177  const TQStringList& attendees );
178  void openEventEditor( const TQString& summary,
179  const TQString& description,
180  const TQString& uri,
181  const TQString& file,
182  const TQStringList& attendees,
183  const TQString& attachmentMimetype );
184 
185  void openTodoEditor( const TQString& );
186  void openTodoEditor( const TQString& summary,
187  const TQString& description,
188  const TQString& attachment );
189  void openTodoEditor( const TQString& summary,
190  const TQString& description,
191  const TQString& attachment,
192  const TQStringList& attendees );
193  void openTodoEditor( const TQString& summary,
194  const TQString& description,
195  const TQString& uri,
196  const TQString& file,
197  const TQStringList& attendees,
198  const TQString& attachmentMimetype,
199  bool isTask );
200 
201  void openJournalEditor( const TQDate& date );
202  void openJournalEditor( const TQString& text, const TQDate& date );
203  void openJournalEditor( const TQString& text );
204  //TODO:
205  // void openJournalEditor( const TQString& summary,
206  // const TQString& description,
207  // const TQString& attachment );
208 
209  void showJournalView();
210  void showTodoView();
211  void showEventView();
212 
213  void goDate( const TQDate& );
214  void goDate( const TQString& );
215  void showDate( const TQDate &date );
216 
217  TQString localFileName();
218 
219  bool queryClose();
220 
221  void loadProfile( const TQString & path );
222 
223  void saveToProfile( const TQString & path ) const;
224 
225  bool handleCommandLine();
226 
227  signals:
231  void actionNew( const KURL &url = KURL() );
232 
239 
244  void closingDown();
245 
248 
249  public slots:
254  void updateConfig();
255 
256  void setDestinationPolicy();
257 
258  void processIncidenceSelection( Incidence *incidence, const TQDate &date );
259  void keyBindings();
260 
265  void readSettings();
266 
270  void writeSettings();
271 
272  /* Session management */
273  void saveProperties( TDEConfig * );
274  void readProperties( TDEConfig * );
275 
276  void loadParts();
277 
278  void importCalendar( const KURL &url );
279 
280  protected slots:
281 
283  void file_new();
284 
286  void file_open();
287 
290  void file_open( const KURL &url );
291 
293  void file_icalimport();
294 
296  void file_merge();
297 
299  void file_revert();
300 
302  void file_archive();
303 
305  void file_save();
306 
308  void file_saveas();
309 
311  void file_close();
312 
314  void configureDateTime();
315 
317  void showTip();
318 
320  void showTipOnStart();
321 
322  void downloadNewStuff();
323  void uploadNewStuff();
324 
325  void toggleResourceButtons();
326 
327  void toggleDateNavigator();
328  void toggleTodoView();
329  void toggleEventViewer();
330  void toggleResourceView();
331 
333  void checkAutoSave();
334 
336  void slotAutoArchivingSettingsModified();
337 
339  void slotAutoArchive();
340 
341  void configureDateTimeFinished(TDEProcess *);
342 
343  void setTitle();
344 
345  void updateUndoAction( const TQString & );
346 
347  void updateRedoAction( const TQString & );
348 
349  void slotPreviewDialogFinished( PreviewDialog * );
350 
351  protected:
353  KURL getSaveURL();
354 
355  void showStatusMessageOpen( const KURL &url, bool merge );
356 
357  void initCalendar( Calendar *cal );
358 
362  TQWidget *dialogParent();
363 
364  private slots:
365  void dumpText( const TQString & ); // only for debugging purposes
366 
367  private:
368  class ActionStringsVisitor;
369 
371  void initActions();
372  void enableIncidenceActions( bool enable );
373 
374  TQPair<ResourceCalendar *, TQString> viewSubResourceCalendar();
375  bool isWritable( ResourceCalendar *res, const TQString &subRes, const TQString &contentsType );
376 
377  KOrg::Part::List mParts; // List of parts loaded
378  KURL mURL; // URL of calendar file
379  TQString mFile; // Local name of calendar file
380  TQString mLastUrl; // URL of last loaded calendar.
381 
382  KTempFile *mTempFile;
383  TQTimer *mAutoSaveTimer; // used if calendar is to be autosaved
384  TQTimer *mAutoArchiveTimer; // used for the auto-archiving feature
385 
386  // list of all existing KOrganizer instances
387  static KOWindowList *mWindowList;
388 
389  // Actions
390  TDERecentFilesAction *mRecent;
391  TDEToggleAction *mResourceButtonsAction;
392 
393  TDEToggleAction *mDateNavigatorShowAction;
394  TDEToggleAction *mTodoViewShowAction;
395  TDEToggleAction *mResourceViewShowAction;
396  TDEToggleAction *mEventViewerShowAction;
397 // TDEToggleAction *mToggleAlarmAction;
398 
399  TDEAction *mShowIncidenceAction;
400  TDEAction *mEditIncidenceAction;
401  TDEAction *mDeleteIncidenceAction;
402 // TDEAction *mAssignResourceAction;
403 
404  TDEAction *mCutAction;
405  TDEAction *mCopyAction;
406  TDEAction *mDeleteAction;
407  TDEAction *mNextXDays;
408  TDEAction *mPublishEvent;
409  TDEAction *mForwardEvent;
410 
411  TDEAction *mSendInvitation;
412  TDEAction *mSendCancel;
413  TDEAction *mSendStatusUpdate;
414 
415  TDEAction *mRequestChange;
416  TDEAction *mRequestUpdate;
417 
418  TDEAction *mUndoAction;
419  TDEAction *mRedoAction;
420 
421  TDESelectAction *mFilterAction;
422 
423  KXMLGUIClient *mGUIClient;
424  TDEActionCollection *mACollection;
425  CalendarView *mCalendarView;
426  KOrg::MainWindow *mMainWindow;
427  bool mIsPart;
428 
429  KONewStuff *mNewStuff;
430  bool mHtmlExportSync;
431 
432  // Either mCalendar *or* mCalendarResources is set.
433  Calendar *mCalendar;
434  CalendarResources *mCalendarResources;
435 
436  ResourceView *mResourceView;
437 
438  bool mIsClosing;
439 };
440 
441 #endif
The ActionManager creates all the actions in KOrganizer.
Definition: actionmanager.h:74
void closingDown()
Emitted when the topwidget is closing down, so that any attached child windows can also close.
void actionNew(const KURL &url=KURL())
Emitted when the "New" action is activated.
void configChanged()
When change is made to options dialog, the topwidget will catch this and emit this signal which notif...
void resourceAdded(ResourceCalendar *)
Indicates that a new resource was added.
KURL url() const
Get current URL.
This is the main calendar widget.
Definition: calendarview.h:82
Interface class for calendar requests.
This class manages a list of KOrganizer instances, each associated with a window displaying a calenda...
Definition: kowindowlist.h:44
interface for korganizer main window
Definition: mainwindow.h:41
This is the main class for KOrganizer.
Definition: korganizer.h:66
This class provides a view of calendar resources.
Definition: resourceview.h:96
This file is a generic DCOP interface, shared between KDE applications.
bool view(TQWidget *parent, Attachment *attachment)