00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef KORG_ACTIONMANAGER_H
00028 #define KORG_ACTIONMANAGER_H
00029
00030 #include <qobject.h>
00031 #include <kurl.h>
00032 #include <korganizer/part.h>
00033 #include <kdepimmacros.h>
00034
00035 #include "kcalendariface.h"
00036
00037 namespace KCal
00038 {
00039 class Calendar;
00040 class CalendarResources;
00041 class Incidence;
00042 class ResourceCalendar;
00043 }
00044 namespace KOrg {
00045 class MainWindow;
00046 }
00047
00048 class KAction;
00049 class KActionCollection;
00050 class KRecentFilesAction;
00051 class KSelectAction;
00052 class KToggleAction;
00053 class KConfig;
00054 class KProcess;
00055 class KTempFile;
00056 class KXMLGUIClient;
00057 class CalendarView;
00058 class KOrganizer;
00059 class KONewStuff;
00060 class KOWindowList;
00061 class ImportDialog;
00062 class ResourceView;
00063 class HTMLExportSettings;
00064
00065 using namespace KCal;
00066
00073 class KDE_EXPORT ActionManager : public QObject, public KCalendarIface
00074 {
00075 Q_OBJECT
00076 public:
00077 ActionManager( KXMLGUIClient *client, CalendarView *widget,
00078 QObject *parent, KOrg::MainWindow *mainWindow,
00079 bool isPart );
00080 virtual ~ActionManager();
00081
00083 void init();
00084
00085 CalendarView *view() const { return mCalendarView; }
00086
00090 void createCalendarLocal();
00095 void createCalendarResources();
00096
00100 void saveCalendar();
00101
00106 bool saveResourceCalendar();
00107
00108 public slots:
00110 bool addResource( const KURL &mUrl );
00115 bool openURL( const KURL &url, bool merge = false );
00117 bool saveURL();
00119 bool saveAsURL( const KURL &kurl );
00121 bool saveModifiedURL();
00122
00123 void exportHTML();
00124 void exportHTML( HTMLExportSettings * );
00125 public:
00127 KURL url() const { return mURL; }
00128
00130 static KOrg::MainWindow* findInstance( const KURL &url );
00132 bool openURL( const QString &url );
00134 bool mergeURL( const QString &url );
00136 bool saveAsURL( const QString &url );
00138 void closeURL();
00140 QString getCurrentURLasString() const;
00147 virtual bool deleteIncidence( const QString& uid, bool force = false );
00148
00149 bool editIncidence( const QString &uid );
00150 bool editIncidence( const QString &uid, const QDate &date );
00151
00157 bool addIncidence( const QString& ical );
00158
00160 virtual ResourceRequestReply resourceRequest( const QValueList<QPair<QDateTime, QDateTime> >& busy,
00161 const QCString& resource,
00162 const QString& vCalIn );
00163
00164 void openEventEditor( const QString& );
00165 void openEventEditor( const QString& summary,
00166 const QString& description,
00167 const QString& attachment );
00168 void openEventEditor( const QString& summary,
00169 const QString& description,
00170 const QString& attachment,
00171 const QStringList& attendees );
00172 void openEventEditor( const QString& summary,
00173 const QString& description,
00174 const QString& uri,
00175 const QString& file,
00176 const QStringList& attendees,
00177 const QString& attachmentMimetype );
00178
00179 void openTodoEditor( const QString& );
00180 void openTodoEditor( const QString& summary,
00181 const QString& description,
00182 const QString& attachment );
00183 void openTodoEditor( const QString& summary,
00184 const QString& description,
00185 const QString& attachment,
00186 const QStringList& attendees );
00187 void openTodoEditor( const QString& summary,
00188 const QString& description,
00189 const QString& uri,
00190 const QString& file,
00191 const QStringList& attendees,
00192 const QString& attachmentMimetype,
00193 bool isTask );
00194
00195 void openJournalEditor( const QDate& date );
00196 void openJournalEditor( const QString& text, const QDate& date );
00197 void openJournalEditor( const QString& text );
00198
00199
00200
00201
00202
00203 void showJournalView();
00204 void showTodoView();
00205 void showEventView();
00206
00207 void goDate( const QDate& );
00208 void goDate( const QString& );
00209 void showDate( const QDate &date );
00210
00211 QString localFileName();
00212
00213 bool queryClose();
00214
00215 void loadProfile( const QString & path );
00216
00217 void saveToProfile( const QString & path ) const;
00218
00219 signals:
00223 void actionNew( const KURL &url = KURL() );
00224
00230 void configChanged();
00231
00236 void closingDown();
00237
00239 void resourceAdded( ResourceCalendar * );
00240
00241 public slots:
00246 void updateConfig();
00247
00248 void setDestinationPolicy();
00249
00250 void processIncidenceSelection( Incidence *incidence, const QDate &date );
00251 void keyBindings();
00252
00257 void readSettings();
00258
00262 void writeSettings();
00263
00264
00265 void saveProperties( KConfig * );
00266 void readProperties( KConfig * );
00267
00268 void loadParts();
00269
00270 void importCalendar( const KURL &url );
00271
00272 protected slots:
00273
00275 void file_new();
00276
00278 void file_open();
00279
00282 void file_open( const KURL &url );
00283
00285 void file_icalimport();
00286
00288 void file_merge();
00289
00291 void file_revert();
00292
00294 void file_archive();
00295
00297 void file_save();
00298
00300 void file_saveas();
00301
00303 void file_close();
00304
00306 void configureDateTime();
00307
00309 void showTip();
00310
00312 void showTipOnStart();
00313
00314 void downloadNewStuff();
00315 void uploadNewStuff();
00316
00317 void toggleResourceButtons();
00318
00319 void toggleDateNavigator();
00320 void toggleTodoView();
00321 void toggleEventViewer();
00322 void toggleResourceView();
00323
00325 void checkAutoSave();
00326
00328 void slotAutoArchivingSettingsModified();
00329
00331 void slotAutoArchive();
00332
00333 void configureDateTimeFinished(KProcess *);
00334
00335 void setTitle();
00336
00337 void updateUndoAction( const QString & );
00338
00339 void updateRedoAction( const QString & );
00340
00341 void slotImportDialogFinished( ImportDialog * );
00342
00343 protected:
00345 KURL getSaveURL();
00346
00347 void showStatusMessageOpen( const KURL &url, bool merge );
00348
00349 void initCalendar( Calendar *cal );
00350
00354 QWidget *dialogParent();
00355
00356 private slots:
00357 void dumpText( const QString & );
00358
00359 private:
00360 class ActionStringsVisitor;
00361
00363 void initActions();
00364 void enableIncidenceActions( bool enable );
00365 QPair<ResourceCalendar *, QString> viewSubResourceCalendar();
00366
00367 KOrg::Part::List mParts;
00368 KURL mURL;
00369 QString mFile;
00370 QString mLastUrl;
00371
00372 KTempFile *mTempFile;
00373 QTimer *mAutoSaveTimer;
00374 QTimer *mAutoArchiveTimer;
00375
00376
00377 static KOWindowList *mWindowList;
00378
00379
00380 KRecentFilesAction *mRecent;
00381 KToggleAction *mResourceButtonsAction;
00382
00383 KToggleAction *mDateNavigatorShowAction;
00384 KToggleAction *mTodoViewShowAction;
00385 KToggleAction *mResourceViewShowAction;
00386 KToggleAction *mEventViewerShowAction;
00387
00388
00389 KAction *mShowIncidenceAction;
00390 KAction *mEditIncidenceAction;
00391 KAction *mDeleteIncidenceAction;
00392
00393
00394 KAction *mCutAction;
00395 KAction *mCopyAction;
00396 KAction *mDeleteAction;
00397 KAction *mNextXDays;
00398 KAction *mPublishEvent;
00399 KAction *mForwardEvent;
00400
00401 KAction *mSendInvitation;
00402 KAction *mSendCancel;
00403 KAction *mSendStatusUpdate;
00404
00405 KAction *mRequestChange;
00406 KAction *mRequestUpdate;
00407
00408 KAction *mUndoAction;
00409 KAction *mRedoAction;
00410
00411 KSelectAction *mFilterAction;
00412
00413 KXMLGUIClient *mGUIClient;
00414 KActionCollection *mACollection;
00415 CalendarView *mCalendarView;
00416 KOrg::MainWindow *mMainWindow;
00417 bool mIsPart;
00418
00419 KONewStuff *mNewStuff;
00420 bool mHtmlExportSync;
00421
00422
00423 Calendar *mCalendar;
00424 CalendarResources *mCalendarResources;
00425
00426 ResourceView *mResourceView;
00427
00428 bool mIsClosing;
00429 };
00430
00431 #endif