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 "koglobals.h"
00037 #include "interfaces/korganizer/calendarviewbase.h"
00038
00039 class QWidgetStack;
00040 class QSplitter;
00041
00042 class KOViewManager;
00043 class KODialogManager;
00044 class KOTodoView;
00045 class KOEventEditor;
00046 class DateNavigatorContainer;
00047 class DateNavigator;
00048 class KOIncidenceEditor;
00049 class ResourceView;
00050 class NavigatorBar;
00051 class DateChecker;
00052
00053 namespace KOrg { class History; class IncidenceChangerBase; }
00054 class HTMLExportSettings;
00055
00056 using namespace KOrg;
00057 using namespace KCal;
00058
00059 class CalendarViewExtension : public QWidget
00060 {
00061 public:
00062 CalendarViewExtension( QWidget *parent, const char *name = 0 )
00063 : QWidget( parent, name ) {}
00064
00065 class Factory
00066 {
00067 public:
00068 virtual CalendarViewExtension *create( QWidget *parent ) = 0;
00069 };
00070 };
00071
00081 class KDE_EXPORT CalendarView : public KOrg::CalendarViewBase, public Calendar::Observer
00082 {
00083 Q_OBJECT
00084 public:
00091 CalendarView( QWidget *parent = 0, const char *name = 0 );
00092 virtual ~CalendarView();
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 void setCalendar( Calendar * );
00116 Calendar *calendar();
00117
00118 QPair<ResourceCalendar *, QString> viewSubResourceCalendar();
00119
00120 KOrg::History *history() const { return mHistory; }
00121
00122 KOViewManager *viewManager() const { return mViewManager; }
00123 KODialogManager *dialogManager() const { return mDialogManager; }
00124
00125 QWidgetStack *viewStack() const { return mRightFrame; }
00126 QWidget *leftFrame() const { return mLeftFrame; }
00127 NavigatorBar *navigatorBar() const { return mNavigatorBar; }
00128 DateNavigator *dateNavigator() const { return mNavigator; }
00129
00130 KOIncidenceEditor *editorDialog( Incidence* ) const;
00131 IncidenceChangerBase *incidenceChanger() const { return mChanger; }
00132
00133 QDate startDate();
00134 QDate endDate();
00135
00136
00137 void addView( KOrg::BaseView * );
00138 void showView( KOrg::BaseView * );
00139
00144 void addExtension( CalendarViewExtension::Factory * );
00145
00147 Incidence *currentSelection();
00150 Incidence *selectedIncidence();
00152 QString currentFilterName() const;
00153
00154 signals:
00158 void configChanged();
00161 void categoriesChanged();
00164 void closingDown();
00166 void closed( QWidget * );
00167
00169 void modifiedChanged( bool );
00170
00172 void readOnlyChanged( bool );
00173
00175 void changeNavStringPrev( const QString & );
00176 void changeNavStringNext( const QString & );
00177
00179 void organizerEventsSelected( bool );
00181 void groupEventsSelected( bool );
00186 void incidenceSelected( Incidence *incidence, const QDate &date );
00189 void todoSelected( bool );
00190 void subtodoSelected( bool );
00191
00194 void dayPassed( const QDate & );
00200 void cancelAttendees( Incidence * );
00201
00202
00207 void pasteEnabled( bool );
00209 void statusMessage( const QString & );
00210
00211 void calendarViewExpanded( bool );
00212
00214 void autoArchivingSettingsModified();
00215
00216 void newIncidenceChanger( IncidenceChangerBase* );
00217 void exportHTML( HTMLExportSettings* );
00218
00219 void newFilterListSignal( const QStringList & );
00220 void selectFilterSignal( int );
00221 void filterChanged();
00222
00223 public slots:
00226 void updateConfig( const QCString& );
00229 void updateCategories();
00230
00231
00237 bool openCalendar( const QString &filename, bool merge = false );
00238
00243 bool saveCalendar( const QString &filename );
00244
00249 void closeCalendar();
00250
00252 void archiveCalendar();
00253
00254 void showIncidence();
00255 void editIncidence();
00256 bool editIncidence( const QString &uid );
00257 bool editIncidence( const QString &uid, const QDate &date );
00258 void deleteIncidence();
00259
00268 bool addIncidence( const QString &ical );
00269
00270 void connectIncidenceEditor( KOIncidenceEditor *editor );
00271
00274 void newEvent();
00275 void newEvent( ResourceCalendar *res, const QString &subRes );
00278 void newEvent( ResourceCalendar *res, const QString &subRes,
00279 const QDate &startDt );
00280 void newEvent( ResourceCalendar *res, const QString &subRes,
00281 const QDateTime &startDt );
00282 void newEvent( ResourceCalendar *res, const QString &subRes,
00283 const QDateTime &startDt, const QDateTime &EndDt,
00284 bool allDay = false );
00289 void newEvent( ResourceCalendar *res, const QString &subRes,
00290 const QString &summary,
00291 const QString &description = QString::null,
00292 const QStringList &attachment = QStringList(),
00293 const QStringList &attendees = QStringList(),
00294 const QStringList &attachmentMimetypes = QStringList(),
00295 bool inlineAttachment = false );
00296
00298 void showIncidence( Incidence * );
00300 bool editIncidence( Incidence *incidence );
00301 bool editIncidence( Incidence *incidence, const QDate &date, bool isCounter = false );
00307 void deleteIncidence( Incidence *, bool force = false );
00311 void cutIncidence( Incidence * );
00315 void copyIncidence( Incidence *);
00319 void pasteIncidence();
00320
00322 void deleteSubTodosIncidence ( Todo *todo );
00328 void deleteTodoIncidence ( Todo *todo, bool force = false );
00330 bool deleteEvent( Event * ) { return true; }
00332 bool deleteTodo( Todo * ) {return true; }
00334 bool deleteJournal( Journal * ) { return true; }
00341 bool deleteIncidence( const QString &uid, bool force = false );
00342
00344 void newTodo();
00345 void newTodo( ResourceCalendar *res, const QString &subRes );
00347 void newTodo( ResourceCalendar *res, const QString &subRes,
00348 const QDate &date );
00350 void newSubTodo();
00352 void newSubTodo( Todo * );
00353
00354 void newTodo( ResourceCalendar *res, const QString &subRes,
00355 const QString &summary,
00356 const QString &description = QString::null,
00357 const QStringList &attachments = QStringList(),
00358 const QStringList &attendees = QStringList(),
00359 const QStringList &attachmentMimetypes = QStringList(),
00360 bool inlineAttachment = false, bool createTask = false );
00361
00362 void newJournal();
00363 void newJournal( ResourceCalendar *res, const QString &subRes );
00364 void newJournal( ResourceCalendar *res, const QString &subRes,
00365 const QDate &date );
00366 void newJournal( ResourceCalendar *res, const QString &subRes,
00367 const QString &text, const QDate &date = QDate() );
00368
00369 void toggleAlarm( Incidence * );
00370 void dissociateOccurrence( Incidence *, const QDate & );
00371 void dissociateFutureOccurrence( Incidence *, const QDate & );
00372
00373
00378 void checkClipboard();
00379
00386 void readSettings();
00387
00389 void writeSettings();
00390
00392 void readFilterSettings( KConfig *config );
00393
00395 void writeFilterSettings( KConfig *config );
00396
00399 void changeIncidenceDisplay( Incidence *, int );
00400
00401 void incidenceAdded( Incidence * );
00402 void incidenceChanged( Incidence *oldEvent, Incidence *newEvent,
00403 KOGlobals::WhatChanged modification );
00404 void incidenceToBeDeleted( Incidence *incidence );
00405 void incidenceDeleted( Incidence * );
00406 void startMultiModify( const QString &text );
00407 void endMultiModify();
00408
00409 void editCanceled( Incidence * );
00410
00411 void updateView( const QDate &start, const QDate &end );
00412 void updateView();
00413
00414 void updateUnmanagedViews();
00415
00417 void edit_cut();
00418
00420 void edit_copy();
00421
00423 void edit_paste();
00424
00426 void edit_options();
00427
00432 void print();
00433
00435 void exportWeb();
00436
00438 void exportICalendar();
00439
00441 void exportVCalendar();
00442
00444 void appointment_show();
00450 void appointment_edit();
00455 void appointment_delete();
00456
00457
00458 void todo_unsub();
00459
00460 bool todo_unsub( Todo *todo );
00462 bool makeSubTodosIndependents ( );
00464 bool makeSubTodosIndependents ( Todo *todo );
00465
00467 void takeOverEvent();
00468
00470 void takeOverCalendar();
00471
00473 bool isModified();
00475 void setModified( bool modified = true );
00476
00478 bool isReadOnly();
00480 void setReadOnly( bool readOnly = true );
00481
00482 void eventUpdated( Incidence * );
00483
00484
00485 void schedule_publish( Incidence *incidence = 0 );
00486 void schedule_request( Incidence *incidence = 0 );
00487 void schedule_refresh( Incidence *incidence = 0 );
00488 void schedule_cancel( Incidence *incidence = 0 );
00489 void schedule_add( Incidence *incidence = 0 );
00490 void schedule_reply( Incidence *incidence = 0 );
00491 void schedule_counter( Incidence *incidence = 0 );
00492 void schedule_declinecounter( Incidence *incidence = 0 );
00493 void schedule_forward( Incidence *incidence = 0 );
00494 void mailFreeBusy( int daysToPublish = 30 );
00495 void uploadFreeBusy();
00496
00497 void openAddressbook();
00498
00499 void editFilters();
00500
00501 void updateFilter();
00502
00503 void showIntro();
00504
00505 void showDateNavigator( bool );
00506 void showTodoView( bool );
00507 void showEventViewer( bool );
00508
00510 void goDate( const QDate& date );
00511
00513 void showDate( const QDate &date );
00514
00516 void goToday();
00517
00519 void goNext();
00520
00522 void goPrevious();
00523
00524 void toggleExpand();
00525 void showLeftFrame( bool show = true );
00526
00527 void dialogClosing( Incidence * );
00528
00529 void processMainViewSelection( Incidence *incidence, const QDate &date );
00530 void processTodoListSelection( Incidence *incidence, const QDate &date );
00531
00532 void processIncidenceSelection( Incidence *incidence, const QDate &date );
00533
00534 void purgeCompleted();
00535
00536 void slotAutoArchivingSettingsModified() { emit autoArchivingSettingsModified(); }
00537
00538 void showErrorMessage( const QString & );
00539 void schedule( Scheduler::Method, Incidence *incidence );
00540 void addIncidenceOn( Incidence *, const QDate & );
00541 void moveIncidenceTo( Incidence *, const QDate & );
00542 void filterActivated( int filterNum );
00543
00544 void resourcesChanged();
00545
00552 void selectWeek( const QDate & );
00553
00554 protected slots:
00556 void showDates( const KCal::DateList & );
00557
00558 public:
00559
00560
00561 int msgCalModified();
00562
00566 void adaptNavigationUnits();
00567
00574 QDate activeIncidenceDate();
00575
00586 QDate activeDate( bool fallbackToToday = false );
00587
00609 Incidence* singleOccurrenceOrAll( Incidence *inc,
00610 KOGlobals::OccurrenceAction userAction,
00611 KOGlobals::WhichOccurrences &chosenOption,
00612 const QDate &itemDate = QDate(),
00613 const bool commitToCalendar = false );
00614
00615 protected:
00616 void setIncidenceChanger( IncidenceChangerBase *changer );
00617
00618
00619 int msgItemDelete( Incidence *incidence );
00620
00621 Todo *selectedTodo();
00622
00623 void warningChangeFailed( Incidence * );
00624 void checkForFilteredChange( Incidence *incidence );
00628 void dateTimesForNewEvent( QDateTime &startDt, QDateTime &endDt, bool &allDay );
00629 KOEventEditor *newEventEditor( ResourceCalendar *res, const QString &subRes,
00630 const QDateTime &startDtParam = QDateTime(),
00631 const QDateTime &endDtParam = QDateTime() ,
00632 bool allDayParam = false );
00633
00634 private:
00635 void init();
00636
00643 Incidence *incToSendToClipboard( bool cut );
00644
00645 void calendarModified( bool, Calendar * );
00646
00647
00648
00649 bool purgeCompletedSubTodos( Todo* todo, bool ¬AllPurged );
00650
00651 KOrg::History *mHistory;
00652
00653 QSplitter *mPanner;
00654 QSplitter *mLeftSplitter;
00655 QWidget *mLeftFrame;
00656 QWidgetStack *mRightFrame;
00657
00658 NavigatorBar *mNavigatorBar;
00659
00660 DateNavigatorContainer *mDateNavigator;
00661
00662
00663 QPtrList<CalendarViewExtension> mExtensions;
00664
00665 Calendar *mCalendar;
00666
00667 DateNavigator *mNavigator;
00668 DateChecker *mDateChecker;
00669
00670 KOEventViewer *mEventViewer;
00671 KOViewManager *mViewManager;
00672 KODialogManager *mDialogManager;
00673
00674
00675 QPtrList<CalFilter> mFilters;
00676 CalFilter *mCurrentFilter;
00677
00678
00679 bool mModified;
00680 bool mReadOnly;
00681
00682 Incidence *mSelectedIncidence;
00683 QDate mSaveDate;
00684
00685 KOTodoView *mTodoList;
00686 QMap<Incidence*,KOIncidenceEditor*> mDialogList;
00687
00688 KOrg::IncidenceChangerBase *mChanger;
00689 };
00690
00691
00692
00693
00694 #endif