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 #ifndef CALENDARVIEW_H
00026 #define CALENDARVIEW_H
00027
00028 #include <qwidget.h>
00029 #include <qptrlist.h>
00030 #include <qmap.h>
00031 #include <kfile.h>
00032 #include <korganizer/koeventviewer.h>
00033 #include <libkcal/scheduler.h>
00034 #include <kdepimmacros.h>
00035
00036 #include <korganizer/calendarviewbase.h>
00037
00038 class QWidgetStack;
00039 class QSplitter;
00040
00041 class KOViewManager;
00042 class KODialogManager;
00043 class KOTodoView;
00044 class KOEventEditor;
00045 class DateNavigatorContainer;
00046 class DateNavigator;
00047 class KOIncidenceEditor;
00048 class ResourceView;
00049 class NavigatorBar;
00050 class DateChecker;
00051
00052 namespace KOrg { class History; class IncidenceChangerBase; }
00053 class HTMLExportSettings;
00054
00055 using namespace KOrg;
00056 using namespace KCal;
00057
00058 class CalendarViewExtension : public QWidget
00059 {
00060 public:
00061 CalendarViewExtension( QWidget *parent, const char *name = 0 )
00062 : QWidget( parent, name ) {}
00063
00064 class Factory
00065 {
00066 public:
00067 virtual CalendarViewExtension *create( QWidget *parent ) = 0;
00068 };
00069 };
00070
00080 class KDE_EXPORT CalendarView : public KOrg::CalendarViewBase, public Calendar::Observer
00081 {
00082 Q_OBJECT
00083 public:
00090 CalendarView( QWidget *parent = 0, const char *name = 0 );
00091 virtual ~CalendarView();
00092
00093
00094 class CalendarViewVisitor : public IncidenceBase::Visitor
00095 {
00096 public:
00097 CalendarViewVisitor() : mView( 0 ) {}
00098 bool act( IncidenceBase *incidence, CalendarView *view )
00099 {
00100 mView = view;
00101 return incidence->accept( *this );
00102 }
00103 protected:
00104 CalendarView *mView;
00105 };
00106
00107 class CanDeleteIncidenceVisitor : public CalendarViewVisitor
00108 {
00109 protected:
00110 bool visit( Event *event ) { return mView->deleteEvent( event ); }
00111 bool visit( Todo *todo ) { return mView->deleteTodo( todo ); }
00112 bool visit( Journal *journal ) { return mView->deleteJournal( journal ); }
00113 };
00114
00115
00116 void setCalendar( Calendar * );
00117 Calendar *calendar();
00118
00119 KOrg::History *history() const { return mHistory; }
00120
00121 KOViewManager *viewManager() const { return mViewManager; }
00122 KODialogManager *dialogManager() const { return mDialogManager; }
00123
00124 QWidgetStack *viewStack() const { return mRightFrame; }
00125 QWidget *leftFrame() const { return mLeftFrame; }
00126 NavigatorBar *navigatorBar() const { return mNavigatorBar; }
00127 DateNavigator *dateNavigator() const { return mNavigator; }
00128
00129 KOIncidenceEditor *editorDialog( Incidence* ) const;
00130 IncidenceChangerBase *incidenceChanger() const { return mChanger; }
00131
00132 QDate startDate();
00133 QDate endDate();
00134
00135
00136 void addView( KOrg::BaseView * );
00137 void showView( KOrg::BaseView * );
00138
00143 void addExtension( CalendarViewExtension::Factory * );
00144
00146 Incidence *currentSelection();
00149 Incidence *selectedIncidence();
00151 QString currentFilterName() const;
00152
00153 signals:
00157 void configChanged();
00160 void categoriesChanged();
00163 void closingDown();
00165 void closed( QWidget * );
00166
00168 void modifiedChanged( bool );
00169
00171 void readOnlyChanged( bool );
00172
00174 void changeNavStringPrev( const QString & );
00175 void changeNavStringNext( const QString & );
00176
00178 void organizerEventsSelected( bool );
00180 void groupEventsSelected( bool );
00185 void incidenceSelected( Incidence * );
00188 void todoSelected( bool );
00189 void subtodoSelected( bool );
00190
00193 void dayPassed( const QDate & );
00199 void cancelAttendees( Incidence * );
00200
00201
00206 void pasteEnabled( bool );
00208 void statusMessage( const QString & );
00209
00210 void calendarViewExpanded( bool );
00211
00213 void autoArchivingSettingsModified();
00214
00215 void newIncidenceChanger( IncidenceChangerBase* );
00216 void exportHTML( HTMLExportSettings* );
00217
00218 void newFilterListSignal( const QStringList & );
00219 void selectFilterSignal( int );
00220 void filterChanged();
00221
00222 public slots:
00225 void updateConfig( const QCString& );
00228 void updateCategories();
00229
00230
00236 bool openCalendar( const QString &filename, bool merge = false );
00237
00242 bool saveCalendar( const QString &filename );
00243
00248 void closeCalendar();
00249
00251 void archiveCalendar();
00252
00253 void showIncidence();
00254 void editIncidence();
00255 bool editIncidence( const QString& uid );
00256 void deleteIncidence();
00257
00266 bool addIncidence( const QString &ical );
00267
00268 void connectIncidenceEditor( KOIncidenceEditor * );
00269
00272 void newEvent();
00275 void newEvent( const QDate &startDt );
00276 void newEvent( const QDateTime &startDt );
00277 void newEvent( const QDateTime &startDt, const QDateTime &EndDt, bool allDay = false );
00282 void newEvent( const QString &summary, const QString &description = QString::null,
00283 const QStringList &attachment = QStringList(), const QStringList &attendees = QStringList(),
00284 const QStringList &attachmentMimetypes = QStringList(), bool inlineAttachment = false );
00285 void newFloatingEvent();
00286
00288 void showIncidence( Incidence * );
00290 bool editIncidence( Incidence *incidence, bool isCounter = false );
00296 void deleteIncidence( Incidence *, bool force = false );
00300 void cutIncidence( Incidence * );
00304 void copyIncidence( Incidence *);
00308 void pasteIncidence();
00309
00311 void deleteSubTodosIncidence ( Todo *todo );
00317 void deleteTodoIncidence ( Todo *todo, bool force = false );
00319 bool deleteEvent( Event * ) { return true; }
00321 bool deleteTodo( Todo * ) {return true; }
00323 bool deleteJournal( Journal * ) { return true; }
00330 bool deleteIncidence( const QString &uid, bool force = false );
00331
00333 void newTodo();
00335 void newTodo( const QDate &date );
00337 void newSubTodo();
00339 void newSubTodo( Todo * );
00340
00341 void newTodo( const QString &summary, const QString &description = QString::null,
00342 const QStringList &attachments = QStringList(), const QStringList &attendees = QStringList(),
00343 const QStringList &attachmentMimetypes = QStringList(), bool inlineAttachment = false );
00344
00345 void newJournal();
00346 void newJournal( const QDate &date );
00347 void newJournal( const QString &text, const QDate &date = QDate() );
00348
00349 void toggleAlarm( Incidence * );
00350 void dissociateOccurrence( Incidence *, const QDate & );
00351 void dissociateFutureOccurrence( Incidence *, const QDate & );
00352
00353
00358 void checkClipboard();
00359
00366 void readSettings();
00367
00369 void writeSettings();
00370
00372 void readFilterSettings( KConfig *config );
00373
00375 void writeFilterSettings( KConfig *config );
00376
00379 void changeIncidenceDisplay( Incidence *, int );
00380
00381 void incidenceAdded( Incidence * );
00382 void incidenceChanged( Incidence *oldEvent, Incidence *newEvent );
00383 void incidenceChanged( Incidence *oldEvent, Incidence *newEvent, int what );
00384 void incidenceToBeDeleted( Incidence *incidence );
00385 void incidenceDeleted( Incidence * );
00386 void startMultiModify( const QString &text );
00387 void endMultiModify();
00388
00389 void editCanceled( Incidence * );
00390
00391 void updateView( const QDate &start, const QDate &end );
00392 void updateView();
00393
00394 void updateUnmanagedViews();
00395
00397 void edit_cut();
00398
00400 void edit_copy();
00401
00403 void edit_paste();
00404
00406 void edit_options();
00407
00412 void print();
00413
00415 void exportWeb();
00416
00418 void exportICalendar();
00419
00421 void exportVCalendar();
00422
00424 void appointment_show();
00430 void appointment_edit();
00435 void appointment_delete();
00436
00437
00438 void todo_unsub();
00439
00440 bool todo_unsub( Todo *todo );
00442 bool makeSubTodosIndependents ( );
00444 bool makeSubTodosIndependents ( Todo *todo );
00445
00447 void takeOverEvent();
00448
00450 void takeOverCalendar();
00451
00453 bool isModified();
00455 void setModified( bool modified = true );
00456
00458 bool isReadOnly();
00460 void setReadOnly( bool readOnly = true );
00461
00462 void eventUpdated( Incidence * );
00463
00464
00465 void schedule_publish( Incidence *incidence = 0 );
00466 void schedule_request( Incidence *incidence = 0 );
00467 void schedule_refresh( Incidence *incidence = 0 );
00468 void schedule_cancel( Incidence *incidence = 0 );
00469 void schedule_add( Incidence *incidence = 0 );
00470 void schedule_reply( Incidence *incidence = 0 );
00471 void schedule_counter( Incidence *incidence = 0 );
00472 void schedule_declinecounter( Incidence *incidence = 0 );
00473 void schedule_forward( Incidence *incidence = 0 );
00474 void mailFreeBusy( int daysToPublish = 30 );
00475 void uploadFreeBusy();
00476
00477 void openAddressbook();
00478
00479 void editFilters();
00480
00481 void updateFilter();
00482
00483 void showIntro();
00484
00485 void showDateNavigator( bool );
00486 void showTodoView( bool );
00487 void showEventViewer( bool );
00488
00490 void goDate( const QDate& date );
00491
00493 void showDate( const QDate &date );
00494
00496 void goToday();
00497
00499 void goNext();
00500
00502 void goPrevious();
00503
00504 void toggleExpand();
00505 void showLeftFrame( bool show = true );
00506
00507 void dialogClosing( Incidence * );
00508
00509 void processMainViewSelection( Incidence * );
00510 void processTodoListSelection( Incidence * );
00511
00512 void processIncidenceSelection( Incidence * );
00513
00514 void purgeCompleted();
00515
00516 void slotCalendarChanged();
00517
00518 void slotAutoArchivingSettingsModified() { emit autoArchivingSettingsModified(); }
00519
00520 void showErrorMessage( const QString & );
00521 void schedule( Scheduler::Method, Incidence *incidence );
00522 void addIncidenceOn( Incidence *, const QDate & );
00523 void moveIncidenceTo( Incidence *, const QDate & );
00524 void filterActivated( int filterNum );
00525 protected slots:
00527 void showDates( const KCal::DateList & );
00528
00529 public:
00530
00531
00532 int msgCalModified();
00533
00537 void adaptNavigationUnits();
00538
00539
00540
00541 protected:
00542 void setIncidenceChanger( IncidenceChangerBase *changer );
00543
00544
00545 int msgItemDelete( Incidence *incidence );
00546
00547 Todo *selectedTodo();
00548
00549 void warningChangeFailed( Incidence * );
00550 void checkForFilteredChange( Incidence *incidence );
00554 void dateTimesForNewEvent( QDateTime &startDt, QDateTime &endDt, bool &allDay );
00555 KOEventEditor *newEventEditor( const QDateTime &startDtParam = QDateTime(),
00556 const QDateTime &endDtParam = QDateTime() , bool allDayParam = false );
00557
00558 private:
00559 void init();
00560
00561 void calendarModified( bool, Calendar * );
00562
00563
00564
00565 bool purgeCompletedSubTodos( Todo* todo, bool ¬AllPurged );
00566
00567 KOrg::History *mHistory;
00568
00569 QSplitter *mPanner;
00570 QSplitter *mLeftSplitter;
00571 QWidget *mLeftFrame;
00572 QWidgetStack *mRightFrame;
00573
00574 NavigatorBar *mNavigatorBar;
00575
00576 DateNavigatorContainer *mDateNavigator;
00577
00578
00579 QPtrList<CalendarViewExtension> mExtensions;
00580
00581 Calendar *mCalendar;
00582
00583 DateNavigator *mNavigator;
00584 DateChecker *mDateChecker;
00585
00586 KOEventViewer *mEventViewer;
00587 KOViewManager *mViewManager;
00588 KODialogManager *mDialogManager;
00589
00590
00591 QPtrList<CalFilter> mFilters;
00592 CalFilter *mCurrentFilter;
00593
00594
00595 bool mModified;
00596 bool mReadOnly;
00597 QDate mSaveSingleDate;
00598
00599 Incidence *mSelectedIncidence;
00600
00601 KOTodoView *mTodoList;
00602 QMap<Incidence*,KOIncidenceEditor*> mDialogList;
00603
00604 KOrg::IncidenceChangerBase *mChanger;
00605 };
00606
00607
00608
00609
00610 #endif