korganizer Library API Documentation

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 Cornelius Schumacher <schumacher@kde.org>
00007 
00008     This program is free software; you can redistribute it and/or modify
00009     it under the terms of the GNU General Public License as published by
00010     the Free Software Foundation; either version 2 of the License, or
00011     (at your option) any later version.
00012 
00013     This program is distributed in the hope that it will be useful,
00014     but WITHOUT ANY WARRANTY; without even the implied warranty of
00015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016     GNU General Public License for more details.
00017 
00018     You should have received a copy of the GNU General Public License
00019     along with this program; if not, write to the Free Software
00020     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00021 
00022     As a special exception, permission is given to link this program
00023     with any edition of Qt, and distribute the resulting executable,
00024     without including the source code for Qt in the source distribution.
00025 */
00026 #ifndef KORG_ACTIONMANAGER_H
00027 #define KORG_ACTIONMANAGER_H
00028 
00029 #include <qobject.h>
00030 
00031 #include <kaction.h>
00032 #include <klocale.h>
00033 #include <kurl.h>
00034 
00035 #include <korganizer/part.h>
00036 #include <korganizer/mainwindow.h>
00037 
00038 #include "calendarview.h"
00039 #include "kcalendariface.h"
00040 
00041 namespace KCal
00042 {
00043   class Calendar;
00044   class CalendarResources;
00045 }
00046 
00047 class KAction;
00048 class KActionCollection;
00049 class KProcess;
00050 class KTempFile;
00051 class KXMLGUIClient;
00052 class CalendarView;
00053 class KOrganizer;
00054 class KONewStuff;
00055 class KOWindowList;
00056 
00057 using namespace KCal;
00058 
00065 class ActionManager : public QObject, public KCalendarIface
00066 {
00067     Q_OBJECT
00068   public:
00069     ActionManager( KXMLGUIClient *client, CalendarView *widget,
00070                    QObject *parent, KOrg::MainWindow *mainWindow,
00071                    bool isPart );
00072     virtual ~ActionManager();
00073 
00075     void init();
00076 
00077     CalendarView *view() const { return mCalendarView; }
00078 
00082     void createCalendarLocal();
00087     void createCalendarResources();
00088 
00092     void saveCalendar();
00093 
00098     bool saveResourceCalendar();
00099 
00104     bool openURL( const KURL &url, bool merge = false );
00106     bool mergeURL( const KURL &url );
00108     bool saveURL();
00110     bool saveAsURL( const KURL &kurl );
00112     bool saveModifiedURL();
00114     KURL url() const { return mURL; }
00115 
00117     static KOrg::MainWindow* findInstance( const KURL &url );
00119     bool openURL( QString url );
00121     bool mergeURL( QString url );
00123     bool saveAsURL( QString url );
00125     void closeURL();
00127     QString getCurrentURLasString() const;
00129     virtual bool deleteEvent( QString uid );
00130 
00132     bool eventRequest( QString request, QCString receiver, QString ical );
00134     bool eventReply( QString ical );
00135 
00137     virtual ResourceRequestReply resourceRequest( const QValueList<QPair<QDateTime, QDateTime> >& busy,
00138                                                   const QCString& resource,
00139                                                   const QString& vCalIn );
00140 
00141     void openEventEditor( QString );
00142     void openEventEditor( QString summary, QString description,
00143                           QString attachment );
00144 
00145     void openTodoEditor( QString );
00146     void openTodoEditor( QString summary, QString description,
00147                          QString attachment );
00148 
00149     void showTodoView();
00150     void showEventView();
00151 
00152     QString localFileName();
00153 
00154     bool queryClose();
00155 
00156   signals:
00160     void actionNew( const KURL &url = KURL() );
00161 
00165     void actionKeyBindings();
00166 
00172     void configChanged();
00173 
00178     void closingDown();
00179 
00183     void filterActivated( int );
00184 
00185   public slots:
00190     void updateConfig();
00191 
00192     void setDestinationPolicy();
00193 
00194     void processIncidenceSelection( Incidence * );
00195     void keyBindings();
00196 
00201     void readSettings();
00202 
00206     void writeSettings();
00207 
00208     /* Session management */
00209     void saveProperties( KConfig * );
00210     void readProperties( KConfig * );
00211 
00212     void loadParts();
00213 
00214     void importResource( const QString &url );
00215 
00216   protected slots:
00217 
00219     void file_new();
00220 
00222     void file_open();
00223 
00225     void file_openRecent( const KURL &url );
00226 
00228     void file_import();
00229 
00231     void file_merge();
00232 
00234     void file_revert();
00235 
00237     void file_archive();
00238 
00240     void file_save();
00241 
00243     void file_saveas();
00244 
00246     void file_close();
00247 
00249     void configureDateTime();
00250 
00252     void showTip();
00253 
00255     void showTipOnStart();
00256 
00257     void downloadNewStuff();
00258     void uploadNewStuff();
00259 
00260     void toggleFilterView();
00261 
00263     void checkAutoSave();
00264 
00265     void configureDateTimeFinished(KProcess *);
00266 
00267     void setTitle();
00268 
00269     void updateUndoAction( const QString & );
00270 
00271     void updateRedoAction( const QString & );
00272 
00273   protected:
00275     KURL getSaveURL();
00276 
00277     void initCalendar( Calendar *cal );
00278 
00279   private slots:
00280     void dumpText( const QString & );  // only for debugging purposes
00281 
00282   private:
00284     void initActions();
00285     void enableIncidenceActions( bool enable );
00286 
00287     KOrg::Part::List mParts; // List of parts loaded
00288     KURL mURL;      // URL of calendar file
00289     QString mFile;  // Local name of calendar file
00290     QString mLastUrl;  // URL of last loaded calendar.
00291 
00292     KTempFile *mTempFile;
00293     QTimer *mAutoSaveTimer;   // used if calendar is to be autosaved
00294 
00295     // list of all existing KOrganizer instances
00296     static KOWindowList *mWindowList;
00297 
00298     // Actions
00299     KRecentFilesAction *mRecent;
00300     KToggleAction *mFilterViewAction;
00301     KAction *mShowIncidenceAction;
00302     KAction *mEditIncidenceAction;
00303     KAction *mDeleteIncidenceAction;
00304 
00305     KAction *mCutAction;
00306     KAction *mCopyAction;
00307     KAction *mDeleteAction;
00308     KAction *mNextXDays;
00309     KAction *mPublishEvent;
00310 
00311     KAction *mUndoAction;
00312     KAction *mRedoAction;
00313 
00314     KXMLGUIClient *mGUIClient;
00315     KActionCollection *mACollection;
00316     CalendarView *mCalendarView;
00317     KOrg::MainWindow *mMainWindow;
00318     bool mIsPart;
00319 
00320     KONewStuff *mNewStuff;
00321     bool mHtmlExportSync;
00322 
00323     Calendar *mCalendar;
00324     CalendarResources *mCalendarResources;
00325 
00326     bool mIsClosing;
00327 };
00328 
00329 #endif
KDE Logo
This file is part of the documentation for korganizer Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:38:26 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003