korganizer
calendarview.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef CALENDARVIEW_H
00027 #define CALENDARVIEW_H
00028
00029 #include "korganizer_export.h"
00030 #include <korganizer/koeventviewer.h>
00031 #include <korganizer/calendarviewbase.h>
00032
00033 #include <kcal/scheduler.h>
00034
00035 #include <kfile.h>
00036
00037 #include <QWidget>
00038 #include <QMap>
00039 #include <QList>
00040
00041 class CalPrinter;
00042 class KOViewManager;
00043 class KODialogManager;
00044 class KOTodoView;
00045 class KOEventEditor;
00046 class DateNavigatorContainer;
00047 class DateNavigator;
00048 class KOIncidenceEditor;
00049 class NavigatorBar;
00050 class DateChecker;
00051
00052 class KVBox;
00053
00054 class QByteArray;
00055 class QStackedWidget;
00056 class QSplitter;
00057
00058 namespace KOrg {
00059 class History;
00060 class IncidenceChangerBase;
00061 }
00062 namespace KCal {
00063 class HTMLExportSettings;
00064 }
00065
00066 using namespace KOrg;
00067 using namespace KCal;
00068
00069 class CalendarViewExtension : public QWidget
00070 {
00071 public:
00072 explicit CalendarViewExtension( QWidget *parent ) : QWidget( parent ) {}
00073
00074 class Factory
00075 {
00076 public:
00077 virtual ~Factory() {}
00078 virtual CalendarViewExtension *create( QWidget *parent ) = 0;
00079 };
00080 };
00081
00091 class KORGANIZERPRIVATE_EXPORT CalendarView : public KOrg::CalendarViewBase,
00092 public Calendar::CalendarObserver
00093 {
00094 Q_OBJECT
00095 public:
00100 CalendarView( QWidget *parent=0 );
00101 virtual ~CalendarView();
00102
00103 class CalendarViewVisitor : public IncidenceBase::Visitor
00104 {
00105 public:
00106 CalendarViewVisitor() : mView( 0 ) {}
00107 bool act( IncidenceBase *incidence, CalendarView *view )
00108 {
00109 mView = view;
00110 return incidence->accept( *this );
00111 }
00112 protected:
00113 CalendarView *mView;
00114 };
00115
00116 class CanDeleteIncidenceVisitor : public CalendarViewVisitor
00117 {
00118 protected:
00119 bool visit( Event *event ) { return mView->deleteEvent( event ); }
00120 bool visit( Todo *todo ) { return mView->deleteTodo( todo ); }
00121 bool visit( Journal *journal ) { return mView->deleteJournal( journal ); }
00122 bool visit( FreeBusy * ) { return false; }
00123 };
00124
00125 void setCalendar( Calendar * );
00126 Calendar *calendar();
00127
00128 History *history() const { return mHistory; }
00129
00130 KOViewManager *viewManager() const { return mViewManager; }
00131 KODialogManager *dialogManager() const { return mDialogManager; }
00132
00133 QStackedWidget *viewStack() const { return mRightFrame; }
00134 QWidget *leftFrame() const { return mLeftFrame; }
00135 NavigatorBar *navigatorBar() const { return mNavigatorBar; }
00136 DateNavigator *dateNavigator() const { return mNavigator; }
00137
00138 KOIncidenceEditor *editorDialog( Incidence *incidence ) const;
00139 IncidenceChangerBase *incidenceChanger() const { return mChanger; }
00140
00141 QDate startDate();
00142 QDate endDate();
00143
00144 void addView( KOrg::BaseView * );
00145 void showView( KOrg::BaseView * );
00146
00151 void addExtension( CalendarViewExtension::Factory * );
00152
00154 Incidence *currentSelection();
00155
00158 Incidence *selectedIncidence();
00159
00161 QString currentFilterName() const;
00162
00163 signals:
00167 void configChanged();
00168
00171 void categoriesChanged();
00172
00175 void categoryConfigChanged();
00176
00179 void closingDown();
00180
00182 void closed( QWidget * );
00183
00185 void modifiedChanged( bool );
00186
00188 void readOnlyChanged( bool );
00189
00191 void changeNavStringPrev( const QString & );
00192 void changeNavStringNext( const QString & );
00193
00195 void organizerEventsSelected( bool );
00197 void groupEventsSelected( bool );
00202 void incidenceSelected( Incidence * );
00205 void todoSelected( bool );
00206 void subtodoSelected( bool );
00207
00210 void dayPassed( const QDate & );
00216 void cancelAttendees( Incidence * );
00217
00222 void pasteEnabled( bool );
00224 void statusMessage( const QString & );
00225
00226 void calendarViewExpanded( bool );
00227
00229 void autoArchivingSettingsModified();
00230
00231 void newIncidenceChanger( IncidenceChangerBase * );
00232 void exportHTML( HTMLExportSettings * );
00233
00234 void newFilterListSignal( const QStringList & );
00235 void selectFilterSignal( int );
00236 void filterChanged();
00237
00238 public slots:
00241 void updateConfig( const QByteArray & );
00242
00245 void updateCategories();
00246
00256 bool openCalendar( const QString &filename, bool merge=false );
00257
00263 bool saveCalendar( const QString &filename );
00264
00269 void closeCalendar();
00270
00272 void archiveCalendar();
00273
00274 void showIncidence();
00275 void editIncidence();
00276 bool editIncidence( const QString &uid );
00277 bool showIncidence( const QString &uid );
00278
00284 bool showIncidenceContext( const QString &uid );
00285 void deleteIncidence();
00286
00295 bool addIncidence( const QString &ical );
00296
00297 void connectIncidenceEditor( KOIncidenceEditor * );
00298
00301 void newEvent();
00302
00305 void newEvent( const QDate &startDt );
00306 void newEvent( const QDateTime &startDt );
00307 void newEvent( const QDateTime &startDt, const QDateTime &EndDt, bool allDay=false );
00308
00313 void newEvent( const QString &summary, const QString &description=QString(),
00314 const QStringList &attachment=QStringList(),
00315 const QStringList &attendees=QStringList(),
00316 const QStringList &attachmentMimetypes=QStringList(),
00317 bool inlineAttachment=false );
00318 void newFloatingEvent();
00319
00322 void showIncidence( Incidence * );
00323
00329 void showIncidenceContext( Incidence *incidence );
00330
00332 bool editIncidence( Incidence *incidence, bool isCounter = false );
00333
00339 void deleteIncidence( Incidence *, bool force=false );
00340
00344 void cutIncidence( Incidence * );
00345
00349 void copyIncidence( Incidence *);
00350
00354 void pasteIncidence();
00355
00357 void deleteSubTodosIncidence ( Todo *todo );
00358
00364 void deleteTodoIncidence ( Todo *todo, bool force=false );
00365
00367 bool deleteEvent( Event * ) { return true; }
00368
00370 bool deleteTodo( Todo * ) {return true; }
00371
00373 bool deleteJournal( Journal * ) { return true; }
00374
00381 bool deleteIncidence( const QString &uid, bool force=false );
00382
00384 void newTodo();
00385
00387 void newTodo( const QDate &date );
00388
00390 void newSubTodo();
00391
00393 void newSubTodo( Todo * );
00394
00395 void newTodo( const QString &summary, const QString &description=QString(),
00396 const QStringList &attachments=QStringList(),
00397 const QStringList &attendees=QStringList(),
00398 const QStringList &attachmentMimetypes=QStringList(),
00399 bool inlineAttachment=false );
00400
00401 void newJournal();
00402 void newJournal( const QDate &date );
00403 void newJournal( const QString &text, const QDate &date=QDate() );
00404
00405 void toggleAlarm( Incidence * );
00406 void dissociateOccurrence( Incidence *, const QDate & );
00407 void dissociateFutureOccurrence( Incidence *, const QDate & );
00408
00413 void checkClipboard();
00414
00421 void readSettings();
00422
00424 void writeSettings();
00425
00427 void readFilterSettings( KConfig *config );
00428
00430 void writeFilterSettings( KConfig *config );
00431
00434 void changeIncidenceDisplay( Incidence *, int );
00435
00436 void incidenceAdded( Incidence * );
00437 void incidenceChanged( Incidence *oldEvent, Incidence *newEvent );
00438 void incidenceChanged( Incidence *oldEvent, Incidence *newEvent, int what );
00439 void incidenceToBeDeleted( Incidence *incidence );
00440 void incidenceDeleted( Incidence * );
00441 void startMultiModify( const QString &text );
00442 void endMultiModify();
00443
00444 void editCanceled( Incidence * );
00445
00446 void updateView( const QDate &start, const QDate &end );
00447 void updateView();
00448
00449 void updateUnmanagedViews();
00450
00452 void edit_cut();
00453
00455 void edit_copy();
00456
00458 void edit_paste();
00459
00461 void edit_options();
00462
00467 void print();
00468
00470 void exportWeb();
00471
00473 void exportICalendar();
00474
00476 void exportVCalendar();
00477
00479 void appointment_show();
00485 void appointment_edit();
00486
00491 void appointment_delete();
00492
00494 void todo_unsub();
00495
00497 bool todo_unsub( Todo *todo );
00498
00500 bool makeSubTodosIndependents ( );
00501
00503 bool makeSubTodosIndependents ( Todo *todo );
00504
00506 void takeOverEvent();
00507
00509 void takeOverCalendar();
00510
00512 bool isModified();
00513
00517 void setModified( bool modified=true );
00518
00520 bool isReadOnly();
00521
00525 void setReadOnly( bool readOnly=true );
00526
00527 void eventUpdated( Incidence * );
00528
00529
00530 void schedule_publish( Incidence *incidence=0 );
00531 void schedule_request( Incidence *incidence=0 );
00532 void schedule_refresh( Incidence *incidence=0 );
00533 void schedule_cancel( Incidence *incidence=0 );
00534 void schedule_add( Incidence *incidence=0 );
00535 void schedule_reply( Incidence *incidence=0 );
00536 void schedule_counter( Incidence *incidence=0 );
00537 void schedule_declinecounter( Incidence *incidence=0 );
00538 void schedule_forward( Incidence *incidence=0 );
00539 void mailFreeBusy( int daysToPublish=30 );
00540 void uploadFreeBusy();
00541
00542 void openAddressbook();
00543
00544 void editFilters();
00545
00546 void updateFilter();
00547
00548 void showIntro();
00549
00550 void showDateNavigator( bool );
00551 void showTodoView( bool );
00552 void showEventViewer( bool );
00553
00555 void goDate( const QDate &date );
00556
00558 void showDate( const QDate &date );
00559
00561 void goToday();
00562
00564 void goNext();
00565
00567 void goPrevious();
00568
00569 void showLeftFrame( bool show=true );
00570
00571 void dialogClosing( Incidence * );
00572
00573 void processMainViewSelection( Incidence * );
00574 void processTodoListSelection( Incidence * );
00575
00576 void processIncidenceSelection( Incidence * );
00577
00578 void purgeCompleted();
00579
00580 void slotCalendarChanged();
00581
00582 void slotAutoArchivingSettingsModified() { emit autoArchivingSettingsModified(); }
00583
00584 void showErrorMessage( const QString & );
00585 void schedule( iTIPMethod, Incidence *incidence );
00586 void addIncidenceOn( Incidence *, const QDate & );
00587 void moveIncidenceTo( Incidence *, const QDate & );
00588 void filterActivated( int filterNum );
00589
00590 void resourcesChanged();
00591
00592 protected slots:
00594 void showDates( const KCal::DateList & );
00595
00596 public:
00597
00598
00599 int msgCalModified();
00600
00604 void adaptNavigationUnits();
00605
00606
00607
00608 protected:
00609 void setIncidenceChanger( IncidenceChangerBase *changer );
00610
00611
00612 int msgItemDelete( Incidence *incidence );
00613
00614 Todo *selectedTodo();
00615
00616 void warningChangeFailed( Incidence * );
00617 void checkForFilteredChange( Incidence *incidence );
00621 void dateTimesForNewEvent( QDateTime &startDt, QDateTime &endDt, bool &allDay );
00622 KOEventEditor *newEventEditor( const QDateTime &startDtParam=QDateTime(),
00623 const QDateTime &endDtParam=QDateTime(),
00624 bool allDayParam=false );
00625
00626 private:
00627 void init();
00628
00629 void createPrinter();
00630
00631 void calendarModified( bool, Calendar * );
00632
00633
00634
00635 bool purgeCompletedSubTodos( Todo *todo, bool ¬AllPurged );
00636
00637 KOrg::History *mHistory;
00638
00639 CalPrinter *mCalPrinter;
00640
00641 QSplitter *mPanner;
00642 QSplitter *mLeftSplitter;
00643 QWidget *mLeftFrame;
00644 QStackedWidget *mRightFrame;
00645
00646 NavigatorBar *mNavigatorBar;
00647
00648 DateNavigatorContainer *mDateNavigator;
00649
00650 QList<CalendarViewExtension*> mExtensions;
00651
00652 Calendar *mCalendar;
00653
00654 DateNavigator *mNavigator;
00655 DateChecker *mDateChecker;
00656
00657 KVBox *mEventViewerBox;
00658 KOEventViewer *mEventViewer;
00659 KOViewManager *mViewManager;
00660 KODialogManager *mDialogManager;
00661
00662
00663 QList<CalFilter*> mFilters;
00664 CalFilter *mCurrentFilter;
00665
00666
00667 bool mModified;
00668 bool mReadOnly;
00669 QDate mSaveSingleDate;
00670
00671 Incidence *mSelectedIncidence;
00672 KOTodoView *mTodoList;
00673 QMap<Incidence*,KOIncidenceEditor*> mDialogList;
00674
00675 KOrg::IncidenceChangerBase *mChanger;
00676 };
00677
00678 #endif
00679