00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
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
00294
void checkClipboard();
00295
00302
void readSettings();
00303
00305
void writeSettings();
00306
00308
void readFilterSettings( KConfig *config );
00309
00311
void writeFilterSettings( KConfig *config );
00312
00315
void changeIncidenceDisplay( Incidence *,
int );
00316
00317
void incidenceAdded( Incidence * );
00318
void incidenceChanged( Incidence *oldEvent, Incidence *newEvent );
00319
void incidenceChanged( Incidence *oldEvent, Incidence *newEvent,
int what );
00320
void incidenceToBeDeleted( Incidence *incidence );
00321
void incidenceDeleted( Incidence * );
00322
void startMultiModify(
const QString &text );
00323
void endMultiModify();
00324
00325
void editCanceled( Incidence * );
00326
00327
void updateView(
const QDate &start,
const QDate &end );
00328
void updateView();
00329
00330
void updateUnmanagedViews();
00331
00333
void edit_cut();
00334
00336
void edit_copy();
00337
00339
void edit_paste();
00340
00342
void edit_options();
00343
00348
void print();
00349
void printSetup();
00350
void printPreview();
00351
00353
void exportICalendar();
00354
00356
void exportVCalendar();
00357
00359
void appointment_show();
00365
void appointment_edit();
00370
void appointment_delete();
00371
00374
void action_mail();
00375
00376
00377
void todo_unsub();
00378
00380
void takeOverEvent();
00381
00383
void takeOverCalendar();
00384
00386
bool isModified();
00388
void setModified(
bool modified =
true );
00389
00391
bool isReadOnly();
00393
void setReadOnly(
bool readOnly =
true );
00394
00395
void eventUpdated( Incidence * );
00396
00397
00398
void schedule_publish( Incidence *incidence = 0 );
00399
void schedule_request( Incidence *incidence = 0 );
00400
void schedule_refresh( Incidence *incidence = 0 );
00401
void schedule_cancel( Incidence *incidence = 0 );
00402
void schedule_add( Incidence *incidence = 0 );
00403
void schedule_reply( Incidence *incidence = 0 );
00404
void schedule_counter( Incidence *incidence = 0 );
00405
void schedule_declinecounter( Incidence *incidence = 0 );
00406
void mailFreeBusy(
int daysToPublish = 30 );
00407
void uploadFreeBusy();
00408
00409
void openAddressbook();
00410
00411
void editFilters();
00412
00413
void showFilter(
bool visible );
00414
void updateFilter();
00415
void filterEdited();
00416
00417
void showIntro();
00418
00420
void goDate(
const QDate& date );
00421
00423
void goToday();
00424
00426
void goNext();
00427
00429
void goPrevious();
00430
00431
void toggleExpand();
00432
void showLeftFrame(
bool show =
true );
00433
00434
void dialogClosing( Incidence * );
00435
00437
void lookForIncomingMessages();
00439
void lookForOutgoingMessages();
00440
00441
void processMainViewSelection( Incidence * );
00442
void processTodoListSelection( Incidence * );
00443
00444
void processIncidenceSelection( Incidence * );
00445
00446
void purgeCompleted();
00447
00448
void slotCalendarChanged();
00449
00450
void slotAutoArchivingSettingsModified() { emit
autoArchivingSettingsModified(); }
00451
00452
void importQtopia(
const QString &categoriesFile,
00453
const QString &datebookFile,
00454
const QString &tasklistFile );
00455
00456
void showErrorMessage(
const QString & );
00457
00458
protected slots:
00460
void showDates(
const KCal::DateList & );
00461
00462
public:
00463
00464
00465
int msgCalModified();
00466
00470
void adaptNavigationUnits();
00471
00472
00473
00474
protected:
00475
void schedule( Scheduler::Method, Incidence *incidence = 0 );
00476
00477
00478
int msgItemDelete();
00479
00480 Todo *selectedTodo();
00481
00482
void warningChangeFailed( Incidence * );
00483
00484
private:
00485
void init();
00486
00487
void createPrinter();
00488
00489
void calendarModified(
bool, Calendar * );
00490
00491 KOrg::History *mHistory;
00492
00493
CalPrinter *mCalPrinter;
00494
00495
QSplitter *mPanner;
00496
QSplitter *mLeftSplitter;
00497
QWidget *mLeftFrame;
00498
QWidgetStack *mRightFrame;
00499
00500 NavigatorBar *mNavigatorBar;
00501
00502 DateNavigatorContainer *mDateNavigator;
00503
00504 KOFilterView *mFilterView;
00505
00506
QPtrList<CalendarViewExtension> mExtensions;
00507
00508 Calendar *mCalendar;
00509
00510
DateNavigator *mNavigator;
00511 DateChecker *mDateChecker;
00512
00513
KOViewManager *mViewManager;
00514
KODialogManager *mDialogManager;
00515
00516
00517
QPtrList<CalFilter> mFilters;
00518
00519
00520
bool mModified;
00521
bool mReadOnly;
00522
QDate mSaveSingleDate;
00523
00524 Incidence *mSelectedIncidence;
00525
00526
KOTodoView *mTodoList;
00527
QMap<Incidence*,KOIncidenceEditor*> mDialogList;
00528 };
00529
00530
00531
class CalendarViewVisitor :
public Incidence::Visitor
00532 {
00533
public:
00534 CalendarViewVisitor() : mView( 0 ) {}
00535
00536
bool act( Incidence *incidence,
CalendarView *view )
00537 {
00538 mView = view;
00539
return incidence->accept( *
this );
00540 }
00541
00542
protected:
00543
CalendarView *mView;
00544 };
00545
00546
class ShowIncidenceVisitor :
public CalendarViewVisitor
00547 {
00548
protected:
00549
bool visit( Event *event ) { mView->showEvent( event );
return true; }
00550
bool visit( Todo *todo ) { mView->showTodo( todo );
return true; }
00551
bool visit( Journal *journal ) { mView->showJournal( journal );
return true; }
00552 };
00553
00554
class EditIncidenceVisitor :
public CalendarViewVisitor
00555 {
00556
protected:
00557
bool visit( Event *event ) { mView->editEvent( event );
return true; }
00558
bool visit( Todo *todo ) { mView->editTodo( todo );
return true; }
00559
bool visit( Journal *journal ) { mView->editJournal( journal );
return true; }
00560 };
00561
00562
class DeleteIncidenceVisitor :
public CalendarViewVisitor
00563 {
00564
protected:
00565
bool visit( Event *event ) { mView->deleteEvent( event );
return true; }
00566
bool visit( Todo *todo ) { mView->deleteTodo( todo );
return true; }
00567
bool visit( Journal *journal ) { mView->deleteJournal( journal );
return true; }
00568 };
00569
00570
00571
#endif