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     bool editIncidence( const QString &uid, const QDate &date );
00152 
00158     bool addIncidence( const QString& ical );
00159 
00161     virtual ResourceRequestReply resourceRequest( const QValueList<QPair<QDateTime, QDateTime> >& busy,
00162                                                   const QCString& resource,
00163                                                   const QString& vCalIn );
00164 
00165     void openEventEditor( const QString& );
00166     void openEventEditor( const QString& summary,
00167                           const QString& description,
00168                           const QString& attachment );
00169     void openEventEditor( const QString& summary,
00170                           const QString& description,
00171                           const QString& attachment,
00172                           const QStringList& attendees );
00173     void openEventEditor( const QString& summary,
00174                           const QString& description,
00175                           const QString& uri,
00176                           const QString& file,
00177                           const QStringList& attendees,
00178                           const QString& attachmentMimetype );
00179 
00180     void openTodoEditor( const QString& );
00181     void openTodoEditor( const QString& summary,
00182                          const QString& description,
00183                          const QString& attachment );
00184     void openTodoEditor( const QString& summary,
00185                          const QString& description,
00186                          const QString& attachment,
00187                          const QStringList& attendees );
00188     void openTodoEditor( const QString& summary,
00189                          const QString& description,
00190                          const QString& uri,
00191                          const QString& file,
00192                          const QStringList& attendees,
00193                          const QString& attachmentMimetype,
00194                          bool isTask );
00195 
00196     void openJournalEditor( const QDate& date );
00197     void openJournalEditor( const QString& text, const QDate& date );
00198     void openJournalEditor( const QString& text );
00199    //TODO:
00200    // void openJournalEditor( const QString& summary,
00201    //                         const QString& description,
00202    //                         const QString& attachment );
00203 
00204     void showJournalView();
00205     void showTodoView();
00206     void showEventView();
00207 
00208     void goDate( const QDate& );
00209     void goDate( const QString& );
00210     void showDate( const QDate &date );
00211 
00212     QString localFileName();
00213 
00214     bool queryClose();
00215 
00216     void loadProfile( const QString & path );
00217 
00218     void saveToProfile( const QString & path ) const;
00219 
00220   signals:
00224     void actionNew( const KURL &url = KURL() );
00225 
00231     void configChanged();
00232 
00237     void closingDown();
00238 
00240     void resourceAdded( ResourceCalendar * );
00241 
00242   public slots:
00247     void updateConfig();
00248 
00249     void setDestinationPolicy();
00250 
00251     void processIncidenceSelection( Incidence *incidence, const QDate &date );
00252     void keyBindings();
00253 
00258     void readSettings();
00259 
00263     void writeSettings();
00264 
00265     /* Session management */
00266     void saveProperties( KConfig * );
00267     void readProperties( KConfig * );
00268 
00269     void loadParts();
00270 
00271     void importCalendar( const KURL &url );
00272 
00273   protected slots:
00274 
00276     void file_new();
00277 
00279     void file_open();
00280 
00283     void file_open( const KURL &url );
00284 
00286     void file_icalimport();
00287 
00289     void file_merge();
00290 
00292     void file_revert();
00293 
00295     void file_archive();
00296 
00298     void file_save();
00299 
00301     void file_saveas();
00302 
00304     void file_close();
00305 
00307     void configureDateTime();
00308 
00310     void showTip();
00311 
00313     void showTipOnStart();
00314 
00315     void downloadNewStuff();
00316     void uploadNewStuff();
00317 
00318     void toggleResourceButtons();
00319 
00320     void toggleDateNavigator();
00321     void toggleTodoView();
00322     void toggleEventViewer();
00323     void toggleResourceView();
00324 
00326     void checkAutoSave();
00327 
00329     void slotAutoArchivingSettingsModified();
00330 
00332     void slotAutoArchive();
00333 
00334     void configureDateTimeFinished(KProcess *);
00335 
00336     void setTitle();
00337 
00338     void updateUndoAction( const QString & );
00339 
00340     void updateRedoAction( const QString & );
00341 
00342     void slotImportDialogFinished( ImportDialog * );
00343 
00344   protected:
00346     KURL getSaveURL();
00347 
00348     void showStatusMessageOpen( const KURL &url, bool merge );
00349 
00350     void initCalendar( Calendar *cal );
00351 
00355     QWidget *dialogParent();
00356 
00357   private slots:
00358     void dumpText( const QString & );  // only for debugging purposes
00359 
00360   private:
00361     class ActionStringsVisitor;
00362 
00364     void initActions();
00365     void enableIncidenceActions( bool enable );
00366 
00367     KOrg::Part::List mParts; // List of parts loaded
00368     KURL mURL;      // URL of calendar file
00369     QString mFile;  // Local name of calendar file
00370     QString mLastUrl;  // URL of last loaded calendar.
00371 
00372     KTempFile *mTempFile;
00373     QTimer *mAutoSaveTimer;   // used if calendar is to be autosaved
00374     QTimer *mAutoArchiveTimer; // used for the auto-archiving feature
00375 
00376     // list of all existing KOrganizer instances
00377     static KOWindowList *mWindowList;
00378 
00379     // Actions
00380     KRecentFilesAction *mRecent;
00381     KToggleAction *mResourceButtonsAction;
00382 
00383     KToggleAction *mDateNavigatorShowAction;
00384     KToggleAction *mTodoViewShowAction;
00385     KToggleAction *mResourceViewShowAction;
00386     KToggleAction *mEventViewerShowAction;
00387 //     KToggleAction *mToggleAlarmAction;
00388 
00389     KAction *mShowIncidenceAction;
00390     KAction *mEditIncidenceAction;
00391     KAction *mDeleteIncidenceAction;
00392 //     KAction *mAssignResourceAction;
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     // Either mCalendar *or* mCalendarResources is set.
00423     Calendar *mCalendar;
00424     CalendarResources *mCalendarResources;
00425 
00426     ResourceView *mResourceView;
00427 
00428     bool mIsClosing;
00429 };
00430 
00431 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys