korganizer
actionmanager.h
Go to the documentation of this file.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
00028 #ifndef KORG_ACTIONMANAGER_H
00029 #define KORG_ACTIONMANAGER_H
00030
00031 #include "korganizer_export.h"
00032 #include <korganizer/part.h>
00033
00034 #include <kurl.h>
00035
00036 #include <QObject>
00037 #include <QDateTime>
00038
00039 namespace KCal
00040 {
00041 class Calendar;
00042 class CalendarResources;
00043 class Incidence;
00044 class ResourceCalendar;
00045 }
00046 namespace KOrg
00047 {
00048 class MainWindow;
00049 }
00050
00051 class KAction;
00052 class KActionCollection;
00053 class KRecentFilesAction;
00054 class KSelectAction;
00055 class KToggleAction;
00056 class KConfigGroup;
00057 class KTemporaryFile;
00058 class KXMLGUIClient;
00059 class CalendarView;
00060 class KOrganizer;
00061 class KOWindowList;
00062 class ImportDialog;
00063 class ResourceView;
00064 namespace KCal {
00065 class HTMLExportSettings;
00066 }
00067
00068 using namespace KCal;
00069
00076 class KORGANIZERPRIVATE_EXPORT ActionManager : public QObject
00077 {
00078 Q_OBJECT
00079 public:
00080 ActionManager( KXMLGUIClient *client, CalendarView *widget,
00081 QObject *parent, KOrg::MainWindow *mainWindow,
00082 bool isPart );
00083 virtual ~ActionManager();
00084
00086 void init();
00087
00088 CalendarView *view() const { return mCalendarView; }
00089
00093 void createCalendarLocal();
00094
00098 void createCalendarResources();
00099
00103 void saveCalendar();
00104
00109 bool saveResourceCalendar();
00110
00111 public slots:
00116 bool addResource( const KUrl &mUrl );
00117
00125 bool openURL( const KUrl &url, bool merge = false );
00126
00128 bool saveURL();
00129
00131 bool saveAsURL( const KUrl &kurl );
00132
00134 bool saveModifiedURL();
00135
00136 void exportHTML();
00137 void exportHTML( HTMLExportSettings * );
00138
00139 public:
00141 KUrl url() const { return mURL; }
00142
00144 static KOrg::MainWindow *findInstance( const KUrl &url );
00145
00147 bool openURL( const QString &url );
00148
00150 bool mergeURL( const QString &url );
00151
00153 bool saveAsURL( const QString &url );
00154
00156 void closeUrl();
00157
00159 QString getCurrentURLasString() const;
00160
00167 virtual bool deleteIncidence( const QString &uid, bool force = false );
00168
00169 bool editIncidence( const QString &uid );
00170
00176 bool addIncidence( const QString &ical );
00177
00178 bool showIncidence( const QString &uid );
00179
00185 bool showIncidenceContext( const QString &uid );
00186
00188 struct ResourceRequestReply {
00189 bool vCalInOK;
00190 QString vCalOut;
00191 bool vCalOutOK;
00192 bool isFree;
00193 QDateTime start;
00194 QDateTime end;
00195 };
00196
00197 public slots:
00198 virtual ResourceRequestReply resourceRequest( const QList<QPair<QDateTime, QDateTime> > &busy,
00199 const QByteArray &resource,
00200 const QString &vCalIn );
00201
00202 void openEventEditor( const QString &);
00203 void openEventEditor( const QString &summary,
00204 const QString &description,
00205 const QStringList &attachments );
00206 void openEventEditor( const QString &summary,
00207 const QString &description,
00208 const QStringList &attachments,
00209 const QStringList &attendees );
00210 void openEventEditor( const QString &summary,
00211 const QString &description,
00212 const QString &uri,
00213 const QString &file,
00214 const QStringList &attendees,
00215 const QString &attachmentMimetype );
00216
00217 void openTodoEditor( const QString &);
00218 void openTodoEditor( const QString &summary,
00219 const QString &description,
00220 const QStringList &attachments );
00221 void openTodoEditor( const QString &summary,
00222 const QString &description,
00223 const QStringList &attachments,
00224 const QStringList &attendees );
00225 void openTodoEditor( const QString &summary,
00226 const QString &description,
00227 const QString &uri,
00228 const QString &file,
00229 const QStringList &attendees,
00230 const QString &attachmentMimetype );
00231
00232 void openJournalEditor( const QDate &date );
00233 void openJournalEditor( const QString &text, const QDate &date );
00234 void openJournalEditor( const QString &text );
00235
00236
00237
00238
00239
00240 void showJournalView();
00241 void showTodoView();
00242 void showEventView();
00243
00244 void goDate( const QDate &);
00245 void goDate( const QString &);
00246 void showDate( const QDate &date );
00247
00248 public:
00249 QString localFileName();
00250
00251 bool queryClose();
00252
00253 signals:
00257 void actionNew( const KUrl &url = KUrl() );
00258
00264 void configChanged();
00265
00270 void closingDown();
00271
00273 void resourceAdded( ResourceCalendar * );
00274
00275 public slots:
00280 void updateConfig();
00281
00282 void setDestinationPolicy();
00283
00284 void processIncidenceSelection( Incidence * );
00285 void keyBindings();
00286
00291 void readSettings();
00292
00296 void writeSettings();
00297
00298
00299 void saveProperties( KConfigGroup &);
00300 void readProperties( const KConfigGroup &);
00301
00302 void loadParts();
00303
00304 void importCalendar( const KUrl &url );
00305
00306 protected slots:
00307 void setItems( const QStringList & );
00308
00310 void file_new();
00311
00313 void file_open();
00314
00319 void file_open( const KUrl &url );
00320
00322 void file_icalimport();
00323
00325 void file_merge();
00326
00328 void file_revert();
00329
00331 void file_archive();
00332
00334 void file_save();
00335
00337 void file_saveas();
00338
00340 void file_close();
00341
00343 void configureDateTime();
00344
00346 void showTip();
00347
00349 void showTipOnStart();
00350
00351 void downloadNewStuff();
00352 void uploadNewStuff();
00353
00354 void toggleDateNavigator();
00355 void toggleTodoView();
00356 void toggleEventViewer();
00357 void toggleResourceView();
00358
00360 void checkAutoSave();
00361
00363 void slotAutoArchivingSettingsModified();
00364
00366 void slotAutoArchive();
00367
00368 void setTitle();
00369
00370 void updateUndoAction( const QString & );
00371
00372 void updateRedoAction( const QString & );
00373
00374 void slotImportDialogFinished( ImportDialog * );
00375
00376 protected:
00378 KUrl getSaveURL();
00379
00380 void showStatusMessageOpen( const KUrl &url, bool merge );
00381
00382 void initCalendar( Calendar *cal );
00383
00387 QWidget *dialogParent();
00388
00389 private slots:
00390 void dumpText( const QString & );
00391
00392 void slotChangeComboActionItem(int);
00393
00394 private:
00395 class ActionStringsVisitor;
00396
00398 void initActions();
00399 void enableIncidenceActions( bool enable );
00400
00401 KOrg::Part::List mParts;
00402 KUrl mURL;
00403 QString mFile;
00404 QString mLastUrl;
00405
00406 KTemporaryFile *mTempFile;
00407 QTimer *mAutoSaveTimer;
00408 QTimer *mAutoArchiveTimer;
00409
00410
00411 static KOWindowList *mWindowList;
00412
00413
00414 KRecentFilesAction *mRecent;
00415
00416 KToggleAction *mDateNavigatorShowAction;
00417 KToggleAction *mTodoViewShowAction;
00418 KToggleAction *mResourceViewShowAction;
00419 KToggleAction *mEventViewerShowAction;
00420
00421 QAction *mShowIncidenceAction;
00422 QAction *mEditIncidenceAction;
00423 QAction *mDeleteIncidenceAction;
00424
00425 QAction *mCutAction;
00426 QAction *mCopyAction;
00427 QAction *mDeleteAction;
00428 QAction *mNextXDays;
00429 QAction *mPublishEvent;
00430 KAction *mForwardEvent;
00431
00432 QAction *mUndoAction;
00433 QAction *mRedoAction;
00434
00435 KSelectAction *mFilterAction;
00436
00437 KXMLGUIClient *mGUIClient;
00438 KActionCollection *mACollection;
00439 CalendarView *mCalendarView;
00440 KOrg::MainWindow *mMainWindow;
00441 bool mIsPart;
00442
00443 bool mHtmlExportSync;
00444
00445
00446 Calendar *mCalendar;
00447 CalendarResources *mCalendarResources;
00448
00449 ResourceView *mResourceView;
00450
00451 bool mIsClosing;
00452 };
00453
00454 #endif