korganizer Library API Documentation

calendarview.h

00001 /*
00002     This file is part of KOrganizer.
00003 
00004     Copyright (c) 2000,2001,2003,2004 Cornelius Schumacher <schumacher@kde.org>
00005 
00006     This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00019 
00020     As a special exception, permission is given to link this program
00021     with any edition of Qt, and distribute the resulting executable,
00022     without including the source code for Qt in the source distribution.
00023 */
00024 #ifndef CALENDARVIEW_H
00025 #define CALENDARVIEW_H
00026 
00027 #include <qwidget.h>
00028 #include <qptrlist.h>
00029 #include <qmap.h>
00030 
00031 #include <libkcal/scheduler.h>
00032 
00033 #include <korganizer/calendarviewbase.h>
00034 
00035 class QWidgetStack;
00036 class QSplitter;
00037 
00038 class CalPrinter;
00039 class KOFilterView;
00040 class KOViewManager;
00041 class KODialogManager;
00042 class KOTodoView;
00043 class DateNavigatorContainer;
00044 class DateNavigator;
00045 class KOIncidenceEditor;
00046 class ResourceView;
00047 class NavigatorBar;
00048 class DateChecker;
00049 
00050 namespace KOrg { class History; }
00051 
00052 using namespace KCal;
00053 
00054 class CalendarViewExtension : public QWidget
00055 {
00056   public:
00057     CalendarViewExtension( QWidget *parent, const char *name = 0 )
00058       : QWidget( parent, name ) {}
00059 
00060     class Factory
00061     {
00062       public:
00063         virtual CalendarViewExtension *create( QWidget *parent ) = 0;
00064     };
00065 };
00066 
00076 class CalendarView : public KOrg::CalendarViewBase, public Calendar::Observer
00077 {
00078     Q_OBJECT
00079   public:
00086     CalendarView( QWidget *parent = 0, const char *name = 0 );
00087     virtual ~CalendarView();
00088 
00089     void setCalendar( Calendar * );
00090     Calendar *calendar();
00091 
00092     KOrg::History *history() { return mHistory; }
00093 
00094     KOViewManager *viewManager();
00095     KODialogManager *dialogManager();
00096 
00097     QDate startDate();
00098     QDate endDate();
00099 
00100     QWidgetStack *viewStack();
00101     QWidget *leftFrame();
00102     NavigatorBar *navigatorBar();
00103     KOIncidenceEditor *editorDialog( Incidence* );
00104 
00105     DateNavigator *dateNavigator();
00106 
00107     void addView( KOrg::BaseView * );
00108     void showView( KOrg::BaseView * );
00109 
00114     void addExtension( CalendarViewExtension::Factory * );
00115 
00117     Incidence *currentSelection();
00120     Incidence *selectedIncidence();
00121 
00122   signals:
00126     void configChanged();
00129     void categoriesChanged();
00132     void closingDown();
00134     void closed( QWidget * );
00135 
00137     void modifiedChanged( bool );
00138 
00140     void readOnlyChanged( bool );
00141 
00143     void changeNavStringPrev( const QString & );
00144     void changeNavStringNext( const QString & );
00145 
00147     void organizerEventsSelected( bool );
00149     void groupEventsSelected( bool );
00154     void incidenceSelected( Incidence * );
00157     void todoSelected( bool );
00158     void subtodoSelected( bool );
00159 
00162     void dayPassed( QDate );
00163 
00164 
00169     void pasteEnabled( bool );
00170 
00172     void numIncomingChanged( int );
00173 
00175     void numOutgoingChanged( int );
00176 
00178     void statusMessage( const QString & );
00179 
00180     void calendarViewExpanded( bool );
00181 
00183     void autoArchivingSettingsModified();
00184 
00185   public slots:
00188     void updateConfig();
00191     void updateCategories();
00192 
00193 
00199     bool openCalendar( const QString &filename, bool merge = false );
00200 
00205     bool saveCalendar( const QString &filename );
00206 
00211     void closeCalendar();
00212 
00214     void archiveCalendar();
00215 
00216     void showIncidence();
00217     void editIncidence();
00218     bool editIncidence( const QString& uid );
00219     void deleteIncidence();
00220 
00223     void newEvent( QDateTime, QDateTime, bool allDay = false );
00224     void newEvent( QDateTime fh );
00225     void newEvent( QDate dt );
00228     void newEvent();
00232     void newEvent( const QString & );
00233     void newEvent( const QString &summary, const QString &description,
00234                    const QString &attachment );
00235     void newEvent( const QString &summary, const QString &description,
00236                    const QString &attachment, const QStringList &attendees );
00237     void newFloatingEvent();
00238 
00240     void showIncidence( Incidence * );
00242     bool editIncidence( Incidence * );
00244     void deleteIncidence( Incidence * );
00245 
00247     void editJournal( Journal * );
00249     void deleteJournal( Journal * );
00251     void showJournal( Journal * );
00252 
00254     void editEvent( Event * );
00256     void deleteEvent( Event * );
00261     bool deleteEvent( const QString &uid );
00263     void showEvent( Event * );
00264 
00266     void editTodo( Todo * );
00268     void showTodo( Todo * );
00270     void newTodo();
00272     void newTodo( QDate date );
00274     void newSubTodo();
00276     void newSubTodo( Todo * );
00278     void deleteTodo( Todo * );
00280     void recurTodo( Todo * );
00281 
00282     void newTodo( const QString & );
00283     void newTodo( const QString &summary, const QString &description,
00284                   const QString &attachment );
00285     void newTodo( const QString &summary, const QString &description,
00286                   const QString &attachment, const QStringList &attendees );
00287 
00288     void toggleAlarm( Incidence * );
00289 
00295     void deleteAttendee( Incidence *incidence );
00296 
00297 
00302     void checkClipboard();
00303 
00310     void readSettings();
00311 
00313     void writeSettings();
00314 
00316     void readFilterSettings( KConfig *config );
00317 
00319     void writeFilterSettings( KConfig *config );
00320 
00323     void changeIncidenceDisplay( Incidence *, int );
00324 
00325     void incidenceAdded( Incidence * );
00326     void incidenceChanged( Incidence *oldEvent, Incidence *newEvent );
00327     void incidenceChanged( Incidence *oldEvent, Incidence *newEvent, int what );
00328     void incidenceToBeDeleted( Incidence *incidence );
00329     void incidenceDeleted( Incidence * );
00330     void startMultiModify( const QString &text );
00331     void endMultiModify();
00332 
00333     void editCanceled( Incidence * );
00334 
00335     void updateView( const QDate &start, const QDate &end );
00336     void updateView();
00337 
00338     void updateUnmanagedViews();
00339 
00341     void edit_cut();
00342 
00344     void edit_copy();
00345 
00347     void edit_paste();
00348 
00350     void edit_options();
00351 
00356     void print();
00357     void printSetup();
00358     void printPreview();
00359 
00361     void exportICalendar();
00362 
00364     void exportVCalendar();
00365 
00367     void appointment_show();
00373     void appointment_edit();
00378     void appointment_delete();
00379 
00382     void action_mail();
00383 
00384     /* frees a subtodo from it's relation */
00385     void todo_unsub();
00386 
00388     void takeOverEvent();
00389 
00391     void takeOverCalendar();
00392 
00394     bool isModified();
00396     void setModified( bool modified = true );
00397 
00399     bool isReadOnly();
00401     void setReadOnly( bool readOnly = true );
00402 
00403     void eventUpdated( Incidence * );
00404 
00405     /* iTIP scheduling actions */
00406     void schedule_publish( Incidence *incidence = 0 );
00407     void schedule_request( Incidence *incidence = 0 );
00408     void schedule_refresh( Incidence *incidence = 0 );
00409     void schedule_cancel( Incidence *incidence = 0 );
00410     void schedule_add( Incidence *incidence = 0 );
00411     void schedule_reply( Incidence *incidence = 0 );
00412     void schedule_counter( Incidence *incidence = 0 );
00413     void schedule_declinecounter( Incidence *incidence = 0 );
00414     void mailFreeBusy( int daysToPublish = 30 );
00415     void uploadFreeBusy();
00416 
00417     void openAddressbook();
00418 
00419     void editFilters();
00420 
00421     void showFilter( bool visible );
00422     void updateFilter();
00423     void filterEdited();
00424 
00425     void showIntro();
00426 
00428     void goDate( const QDate& date );
00429 
00431     void goToday();
00432 
00434     void goNext();
00435 
00437     void goPrevious();
00438 
00439     void toggleExpand();
00440     void showLeftFrame( bool show = true );
00441 
00442     void dialogClosing( Incidence * );
00443 
00445     void lookForIncomingMessages();
00447     void lookForOutgoingMessages();
00448 
00449     void processMainViewSelection( Incidence * );
00450     void processTodoListSelection( Incidence * );
00451 
00452     void processIncidenceSelection( Incidence * );
00453 
00454     void purgeCompleted();
00455 
00456     void slotCalendarChanged();
00457 
00458     void slotAutoArchivingSettingsModified() { emit autoArchivingSettingsModified(); }
00459 
00460     void importQtopia( const QString &categoriesFile,
00461                        const QString &datebookFile,
00462                        const QString &tasklistFile );
00463 
00464     void showErrorMessage( const QString & );
00465 
00466   protected slots:
00468     void showDates( const KCal::DateList & );
00469 
00470   public:
00471     // show a standard warning
00472     // returns KMsgBox::yesNoCancel()
00473     int msgCalModified();
00474 
00478     void adaptNavigationUnits();
00479 
00480     //Attendee* getYourAttendee( Event *event );
00481 
00482   protected:
00483     void schedule( Scheduler::Method, Incidence *incidence = 0 );
00484 
00485     // returns KMsgBox::OKCandel()
00486     int msgItemDelete();
00487 
00488     Todo *selectedTodo();
00489 
00490     void warningChangeFailed( Incidence * );
00491 
00492   private:
00493     void init();
00494 
00495     void createPrinter();
00496 
00497     void calendarModified( bool, Calendar * );
00498     // Helper function for purgeCompleted that recursively purges a todo and 
00499     // its subitems. If it cannot delete a completed todo (because it has 
00500     // uncompleted subitems), notAllPurged is set to true.
00501     bool purgeCompletedSubTodos( Todo* todo, bool &notAllPurged );
00502 
00503     KOrg::History *mHistory;
00504 
00505     CalPrinter *mCalPrinter;
00506 
00507     QSplitter    *mPanner;
00508     QSplitter    *mLeftSplitter;
00509     QWidget      *mLeftFrame;
00510     QWidgetStack *mRightFrame;
00511 
00512     NavigatorBar *mNavigatorBar;
00513 
00514     DateNavigatorContainer *mDateNavigator;
00515 
00516     KOFilterView *mFilterView;
00517 
00518     QPtrList<CalendarViewExtension> mExtensions;
00519 
00520     Calendar *mCalendar;
00521 
00522     DateNavigator *mNavigator;
00523     DateChecker *mDateChecker;
00524 
00525     KOViewManager *mViewManager;
00526     KODialogManager *mDialogManager;
00527 
00528     // Calendar filters
00529     QPtrList<CalFilter> mFilters;
00530 
00531     // various housekeeping variables.
00532     bool            mModified; // flag indicating if calendar is modified
00533     bool            mReadOnly; // flag indicating if calendar is read-only
00534     QDate mSaveSingleDate;
00535 
00536     Incidence *mSelectedIncidence;
00537 
00538     KOTodoView *mTodoList;
00539     QMap<Incidence*,KOIncidenceEditor*> mDialogList;
00540 };
00541 
00542 
00543 class CalendarViewVisitor : public Incidence::Visitor
00544 {
00545   public:
00546     CalendarViewVisitor() : mView( 0 ) {}
00547 
00548     bool act( Incidence *incidence, CalendarView *view )
00549     {
00550       mView = view;
00551       return incidence->accept( *this );
00552     }
00553 
00554   protected:
00555     CalendarView *mView;
00556 };
00557 
00558 class ShowIncidenceVisitor : public CalendarViewVisitor
00559 {
00560   protected:
00561     bool visit( Event *event ) { mView->showEvent( event ); return true; }
00562     bool visit( Todo *todo ) { mView->showTodo( todo ); return true; }
00563     bool visit( Journal *journal ) { mView->showJournal( journal ); return true; }
00564 };
00565 
00566 class EditIncidenceVisitor : public CalendarViewVisitor
00567 {
00568   protected:
00569     bool visit( Event *event ) { mView->editEvent( event ); return true; }
00570     bool visit( Todo *todo ) { mView->editTodo( todo ); return true; }
00571     bool visit( Journal *journal ) { mView->editJournal( journal ); return true; }
00572 };
00573 
00574 class DeleteIncidenceVisitor : public CalendarViewVisitor
00575 {
00576   protected:
00577     bool visit( Event *event ) { mView->deleteEvent( event ); return true; }
00578     bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; }
00579     bool visit( Journal *journal ) { mView->deleteJournal( journal ); return true; }
00580 };
00581 
00582 
00583 #endif
KDE Logo
This file is part of the documentation for korganizer Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jan 31 15:55:47 2007 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003