korganizer

actionmanager.h

00001 /*
00002     This file is part of KOrganizer.
00003 
00004     Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
00005     Copyright (c) 2002 Don Sanders <sanders@kde.org>
00006     Copyright (c) 2003,2004 Cornelius Schumacher <schumacher@kde.org>
00007     Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
00008 
00009     This program is free software; you can redistribute it and/or modify
00010     it under the terms of the GNU General Public License as published by
00011     the Free Software Foundation; either version 2 of the License, or
00012     (at your option) any later version.
00013 
00014     This program is distributed in the hope that it will be useful,
00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00017     GNU General Public License for more details.
00018 
00019     You should have received a copy of the GNU General Public License
00020     along with this program; if not, write to the Free Software
00021     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00022 
00023     As a special exception, permission is given to link this program
00024     with any edition of Qt, and distribute the resulting executable,
00025     without including the source code for Qt in the source distribution.
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 {
00046   class MainWindow;
00047 }
00048 
00049 class KAction;
00050 class KActionCollection;
00051 class KRecentFilesAction;
00052 class KSelectAction;
00053 class KToggleAction;
00054 class KConfig;
00055 class KProcess;
00056 class KTempFile;
00057 class KXMLGUIClient;
00058 class CalendarView;
00059 class KOrganizer;
00060 class KONewStuff;
00061 class KOWindowList;
00062 class ImportDialog;
00063 class ResourceView;
00064 class HTMLExportSettings;
00065 
00066 using namespace KCal;
00067 
00074 class KDE_EXPORT ActionManager : public QObject, public KCalendarIface
00075 {
00076     Q_OBJECT
00077   public:
00078     ActionManager( KXMLGUIClient *client, CalendarView *widget,
00079                    QObject *parent, KOrg::MainWindow *mainWindow,
00080                    bool isPart );
00081     virtual ~ActionManager();
00082 
00084     void init();
00085 
00086     CalendarView *view() const { return mCalendarView; }
00087 
00091     void createCalendarLocal();
00096     void createCalendarResources();
00097 
00101     void saveCalendar();
00102 
00107     bool saveResourceCalendar();
00108 
00109   public slots:
00111     bool addResource( const KURL &mUrl );
00116     bool openURL( const KURL &url, bool merge = false );
00118     bool saveURL();
00120     bool saveAsURL( const KURL &kurl );
00122     bool saveModifiedURL();
00123 
00124     void exportHTML();
00125     void exportHTML( HTMLExportSettings * );
00126   public:
00128     KURL url() const { return mURL; }
00129 
00131     static KOrg::MainWindow* findInstance( const KURL &url );
00133     bool openURL( const QString &url );
00135     bool mergeURL( const QString &url );
00137     bool saveAsURL( const QString &url );
00139     void closeURL();
00141     QString getCurrentURLasString() const;
00148     virtual bool deleteIncidence( const QString& uid, bool force = false );
00149 
00150     bool editIncidence( const QString& uid );
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    //TODO:
00199    // void openJournalEditor( const QString& summary,
00200    //                         const QString& description,
00201    //                         const QString& attachment );
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 * );
00251     void keyBindings();
00252 
00257     void readSettings();
00258 
00262     void writeSettings();
00263 
00264     /* Session management */
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 & );  // only for debugging purposes
00358 
00359   private:
00360     class ActionStringsVisitor;
00361 
00363     void initActions();
00364     void enableIncidenceActions( bool enable );
00365 
00366     KOrg::Part::List mParts; // List of parts loaded
00367     KURL mURL;      // URL of calendar file
00368     QString mFile;  // Local name of calendar file
00369     QString mLastUrl;  // URL of last loaded calendar.
00370 
00371     KTempFile *mTempFile;
00372     QTimer *mAutoSaveTimer;   // used if calendar is to be autosaved
00373     QTimer *mAutoArchiveTimer; // used for the auto-archiving feature
00374 
00375     // list of all existing KOrganizer instances
00376     static KOWindowList *mWindowList;
00377 
00378     // Actions
00379     KRecentFilesAction *mRecent;
00380     KToggleAction *mResourceButtonsAction;
00381 
00382     KToggleAction *mDateNavigatorShowAction;
00383     KToggleAction *mTodoViewShowAction;
00384     KToggleAction *mResourceViewShowAction;
00385     KToggleAction *mEventViewerShowAction;
00386 //     KToggleAction *mToggleAlarmAction;
00387 
00388     KAction *mShowIncidenceAction;
00389     KAction *mEditIncidenceAction;
00390     KAction *mDeleteIncidenceAction;
00391 //     KAction *mAssignResourceAction;
00392 
00393     KAction *mCutAction;
00394     KAction *mCopyAction;
00395     KAction *mDeleteAction;
00396     KAction *mNextXDays;
00397     KAction *mPublishEvent;
00398     KAction *mForwardEvent;
00399 
00400     KAction *mUndoAction;
00401     KAction *mRedoAction;
00402 
00403     KSelectAction *mFilterAction;
00404 
00405     KXMLGUIClient *mGUIClient;
00406     KActionCollection *mACollection;
00407     CalendarView *mCalendarView;
00408     KOrg::MainWindow *mMainWindow;
00409     bool mIsPart;
00410 
00411     KONewStuff *mNewStuff;
00412     bool mHtmlExportSync;
00413 
00414     // Either mCalendar *or* mCalendarResources is set.
00415     Calendar *mCalendar;
00416     CalendarResources *mCalendarResources;
00417 
00418     ResourceView *mResourceView;
00419 
00420     bool mIsClosing;
00421 };
00422 
00423 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys