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 
00194     void openJournalEditor( const QDate& date );
00195     void openJournalEditor( const QString& text, const QDate& date );
00196     void openJournalEditor( const QString& text );
00197    //TODO:
00198    // void openJournalEditor( const QString& summary,
00199    //                         const QString& description,
00200    //                         const QString& attachment );
00201 
00202     void showJournalView();
00203     void showTodoView();
00204     void showEventView();
00205 
00206     void goDate( const QDate& );
00207     void goDate( const QString& );
00208     void showDate( const QDate &date );
00209 
00210     QString localFileName();
00211 
00212     bool queryClose();
00213 
00214     void loadProfile( const QString & path );
00215 
00216     void saveToProfile( const QString & path ) const;
00217 
00218   signals:
00222     void actionNew( const KURL &url = KURL() );
00223 
00229     void configChanged();
00230 
00235     void closingDown();
00236 
00238     void resourceAdded( ResourceCalendar * );
00239 
00240   public slots:
00245     void updateConfig();
00246 
00247     void setDestinationPolicy();
00248 
00249     void processIncidenceSelection( Incidence * );
00250     void keyBindings();
00251 
00256     void readSettings();
00257 
00261     void writeSettings();
00262 
00263     /* Session management */
00264     void saveProperties( KConfig * );
00265     void readProperties( KConfig * );
00266 
00267     void loadParts();
00268 
00269     void importCalendar( const KURL &url );
00270 
00271   protected slots:
00272 
00274     void file_new();
00275 
00277     void file_open();
00278 
00281     void file_open( const KURL &url );
00282 
00284     void file_icalimport();
00285 
00287     void file_merge();
00288 
00290     void file_revert();
00291 
00293     void file_archive();
00294 
00296     void file_save();
00297 
00299     void file_saveas();
00300 
00302     void file_close();
00303 
00305     void configureDateTime();
00306 
00308     void showTip();
00309 
00311     void showTipOnStart();
00312 
00313     void downloadNewStuff();
00314     void uploadNewStuff();
00315 
00316     void toggleResourceButtons();
00317 
00318     void toggleDateNavigator();
00319     void toggleTodoView();
00320     void toggleEventViewer();
00321     void toggleResourceView();
00322 
00324     void checkAutoSave();
00325 
00327     void slotAutoArchivingSettingsModified();
00328 
00330     void slotAutoArchive();
00331 
00332     void configureDateTimeFinished(KProcess *);
00333 
00334     void setTitle();
00335 
00336     void updateUndoAction( const QString & );
00337 
00338     void updateRedoAction( const QString & );
00339 
00340     void slotImportDialogFinished( ImportDialog * );
00341 
00342   protected:
00344     KURL getSaveURL();
00345 
00346     void showStatusMessageOpen( const KURL &url, bool merge );
00347 
00348     void initCalendar( Calendar *cal );
00349 
00353     QWidget *dialogParent();
00354 
00355   private slots:
00356     void dumpText( const QString & );  // only for debugging purposes
00357 
00358   private:
00359     class ActionStringsVisitor;
00360 
00362     void initActions();
00363     void enableIncidenceActions( bool enable );
00364 
00365     KOrg::Part::List mParts; // List of parts loaded
00366     KURL mURL;      // URL of calendar file
00367     QString mFile;  // Local name of calendar file
00368     QString mLastUrl;  // URL of last loaded calendar.
00369 
00370     KTempFile *mTempFile;
00371     QTimer *mAutoSaveTimer;   // used if calendar is to be autosaved
00372     QTimer *mAutoArchiveTimer; // used for the auto-archiving feature
00373 
00374     // list of all existing KOrganizer instances
00375     static KOWindowList *mWindowList;
00376 
00377     // Actions
00378     KRecentFilesAction *mRecent;
00379     KToggleAction *mResourceButtonsAction;
00380 
00381     KToggleAction *mDateNavigatorShowAction;
00382     KToggleAction *mTodoViewShowAction;
00383     KToggleAction *mResourceViewShowAction;
00384     KToggleAction *mEventViewerShowAction;
00385 //     KToggleAction *mToggleAlarmAction;
00386 
00387     KAction *mShowIncidenceAction;
00388     KAction *mEditIncidenceAction;
00389     KAction *mDeleteIncidenceAction;
00390 //     KAction *mAssignResourceAction;
00391 
00392     KAction *mCutAction;
00393     KAction *mCopyAction;
00394     KAction *mDeleteAction;
00395     KAction *mNextXDays;
00396     KAction *mPublishEvent;
00397     KAction *mForwardEvent;
00398 
00399     KAction *mUndoAction;
00400     KAction *mRedoAction;
00401 
00402     KSelectAction *mFilterAction;
00403 
00404     KXMLGUIClient *mGUIClient;
00405     KActionCollection *mACollection;
00406     CalendarView *mCalendarView;
00407     KOrg::MainWindow *mMainWindow;
00408     bool mIsPart;
00409 
00410     KONewStuff *mNewStuff;
00411     bool mHtmlExportSync;
00412 
00413     // Either mCalendar *or* mCalendarResources is set.
00414     Calendar *mCalendar;
00415     CalendarResources *mCalendarResources;
00416 
00417     ResourceView *mResourceView;
00418 
00419     bool mIsClosing;
00420 };
00421 
00422 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys