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 <qframe.h>
00028
#include <qlayout.h>
00029
#include <qwidget.h>
00030
#include <qptrlist.h>
00031
#include <qvbox.h>
00032
#include <qmap.h>
00033
00034
#include <libkcal/calendar.h>
00035
#include <libkcal/scheduler.h>
00036
00037
#include <korganizer/calendarviewbase.h>
00038
00039
class QWidgetStack;
00040
class QSplitter;
00041
00042
class CalPrinter;
00043
class KOFilterView;
00044
class KOViewManager;
00045
class KODialogManager;
00046
class KOTodoView;
00047
class KDateNavigator;
00048
class DateNavigator;
00049
class KOIncidenceEditor;
00050
class ResourceView;
00051
class NavigatorBar;
00052
00053
namespace KOrg {
class History; }
00054
00055
using namespace KCal;
00056
00057
class CalendarViewExtension :
public QWidget
00058 {
00059
public:
00060 CalendarViewExtension( QWidget *parent,
const char *name = 0 )
00061 : QWidget( parent, name ) {}
00062
00063
class Factory
00064 {
00065
public:
00066
virtual CalendarViewExtension *create( QWidget *parent ) = 0;
00067 };
00068 };
00069
00079 class CalendarView :
public KOrg::
CalendarViewBase,
public Calendar::Observer
00080 {
00081 Q_OBJECT
00082
public:
00089
CalendarView( QWidget *parent = 0,
const char *name = 0 );
00090
virtual ~
CalendarView();
00091
00092
void setCalendar( Calendar * );
00093 Calendar *calendar();
00094
00095 KOrg::History *history() {
return mHistory; }
00096
00097
KOViewManager *viewManager();
00098
KODialogManager *dialogManager();
00099
00100 QDate startDate();
00101 QDate endDate();
00102
00103 QWidgetStack *viewStack();
00104 QWidget *leftFrame();
00105 NavigatorBar *navigatorBar();
00106
00107
DateNavigator *dateNavigator();
00108
00109
void addView(
KOrg::BaseView * );
00110
void showView(
KOrg::BaseView * );
00111
00116
void addExtension( CalendarViewExtension::Factory * );
00117
00119 Incidence *
currentSelection();
00122 Incidence *
selectedIncidence();
00123
00124 signals:
00128
void configChanged();
00131
void closingDown();
00133
void closed( QWidget * );
00134
00136
void modifiedChanged(
bool );
00137
00139
void readOnlyChanged(
bool );
00140
00142
void changeNavStringPrev(
const QString & );
00143
void changeNavStringNext(
const QString & );
00144
00146
void organizerEventsSelected(
bool );
00148
void groupEventsSelected(
bool );
00153
void incidenceSelected( Incidence * );
00155
void todoSelected(
bool );
00156
00161
void pasteEnabled(
bool );
00162
00164
void numIncomingChanged(
int );
00165
00167
void numOutgoingChanged(
int );
00168
00170
void statusMessage(
const QString & );
00171
00172
void calendarViewExpanded(
bool );
00173
00174
public slots:
00177
void updateConfig();
00178
00184
bool openCalendar(
const QString &filename,
bool merge =
false );
00185
00190
bool saveCalendar(
const QString &filename );
00191
00196
void closeCalendar();
00197
00199
void archiveCalendar();
00200
00201
void showIncidence();
00202
void editIncidence();
00203
void deleteIncidence();
00204
00207
void newEvent( QDateTime, QDateTime,
bool allDay =
false );
00208
void newEvent( QDateTime fh );
00209
void newEvent( QDate dt );
00212
void newEvent();
00216
void newEvent(
const QString & );
00217
void newEvent(
const QString &summary,
const QString &description,
00218
const QString &attachment );
00219
void newFloatingEvent();
00220
00222
void showIncidence( Incidence * );
00224
void editIncidence( Incidence * );
00226
void deleteIncidence( Incidence * );
00227
00229
void editEvent( Event * );
00231
void deleteEvent( Event * );
00236
bool deleteEvent(
const QString &uid );
00238
void showEvent( Event * );
00239
00241
void editTodo( Todo * );
00243
void showTodo( Todo * );
00245
void newTodo();
00247
void newSubTodo();
00249
void newSubTodo( Todo * );
00251
void deleteTodo( Todo * );
00252
00253
void newTodo(
const QString & );
00254
void newTodo(
const QString &summary,
const QString &description,
00255
const QString &attachment );
00256
00258
void todoModified( Todo *, Todo *,
int );
00259
00264
void checkClipboard();
00265
00272
void readSettings();
00273
00275
void writeSettings();
00276
00278
void readFilterSettings( KConfig *config );
00279
00281
void writeFilterSettings( KConfig *config );
00282
00285
void changeEventDisplay( Event *,
int );
00286
00287
void incidenceAdded( Incidence * );
00288
void incidenceChanged( Incidence *oldEvent, Incidence *newEvent );
00289
void incidenceDeleted( Incidence * );
00290
00291
void eventAdded( Event * );
00292
void eventChanged( Event *oldEvent, Event *newEvent );
00293
void eventToBeDeleted( Event * );
00294
void eventDeleted( Event * );
00295
00296
void todoAdded( Todo * );
00297
void todoChanged( Todo *oldTodo, Todo *newTodo );
00298
void todoDeleted( Todo * );
00299
00300
void editCanceled( Incidence * );
00301
00302
void updateView(
const QDate &start,
const QDate &end );
00303
void updateView();
00304
00306
void updateTodoViews();
00307
00308
void updateUnmanagedViews();
00309
00311
void edit_cut();
00312
00314
void edit_copy();
00315
00317
void edit_paste();
00318
00320
void edit_options();
00321
00326
void print();
00327
void printSetup();
00328
void printPreview();
00329
00331
void exportICalendar();
00332
00334
void exportVCalendar();
00335
00337
void appointment_show();
00343
void appointment_edit();
00348
void appointment_delete();
00349
00352
void action_mail();
00353
00354
00355
void todo_unsub();
00356
00358
void takeOverEvent();
00359
00361
void takeOverCalendar();
00362
00364
bool isModified();
00366
void setModified(
bool modified =
true );
00367
00369
bool isReadOnly();
00371
void setReadOnly(
bool readOnly =
true );
00372
00373
void eventUpdated( Incidence * );
00374
00375
00376
void schedule_publish( Incidence *incidence = 0 );
00377
void schedule_request( Incidence *incidence = 0 );
00378
void schedule_refresh( Incidence *incidence = 0 );
00379
void schedule_cancel( Incidence *incidence = 0 );
00380
void schedule_add( Incidence *incidence = 0 );
00381
void schedule_reply( Incidence *incidence = 0 );
00382
void schedule_counter( Incidence *incidence = 0 );
00383
void schedule_declinecounter( Incidence *incidence = 0 );
00384
void schedule_publish_freebusy(
int daysToPublish = 30 );
00385
00386
void openAddressbook();
00387
00388
void editFilters();
00389
00390
void showFilter(
bool visible );
00391
void updateFilter();
00392
void filterEdited();
00393
00394
void showIntro();
00395
00397
void goToday();
00398
00400
void goNext();
00401
00403
void goPrevious();
00404
00405
void toggleExpand();
00406
void showLeftFrame(
bool show =
true );
00407
00408
void dialogClosing( Incidence * );
00409
00411
void lookForIncomingMessages();
00413
void lookForOutgoingMessages();
00414
00415
void processMainViewSelection( Incidence * );
00416
void processTodoListSelection( Incidence * );
00417
00418
void processIncidenceSelection( Incidence * );
00419
00420
void purgeCompleted();
00421
00422
void slotCalendarChanged();
00423
00424
void importQtopia(
const QString &categoriesFile,
00425
const QString &datebookFile,
00426
const QString &tasklistFile );
00427
00428
protected slots:
00430
void showDates(
const KCal::DateList & );
00431
00432
public:
00433
00434
00435
int msgCalModified();
00436
00440
void adaptNavigationUnits();
00441
00442
00443
00444
protected:
00445
void schedule( Scheduler::Method, Incidence *incidence = 0 );
00446
00447
00448
int msgItemDelete();
00449
00450 Todo *selectedTodo();
00451
00452
void warningChangeFailed( Incidence * );
00453
00454
private:
00455
void init();
00456
00457
void createPrinter();
00458
00459
void calendarModified(
bool, Calendar * );
00460
00461 KOrg::History *mHistory;
00462
00463
CalPrinter *mCalPrinter;
00464
00465 QSplitter *mPanner;
00466 QSplitter *mLeftSplitter;
00467 QWidget *mLeftFrame;
00468 QWidgetStack *mRightFrame;
00469
00470 NavigatorBar *mNavigatorBar;
00471
00472 KDateNavigator *mDateNavigator;
00473
00474 KOFilterView *mFilterView;
00475
00476 QPtrList<CalendarViewExtension> mExtensions;
00477
00478 Calendar *mCalendar;
00479
00480
DateNavigator *mNavigator;
00481
00482
KOViewManager *mViewManager;
00483
KODialogManager *mDialogManager;
00484
00485
00486 QPtrList<CalFilter> mFilters;
00487
00488
00489
bool mModified;
00490
bool mReadOnly;
00491 QDate mSaveSingleDate;
00492
00493 Incidence *mSelectedIncidence;
00494
00495
KOTodoView *mTodoList;
00496 QMap<Incidence*,KOIncidenceEditor*> mDialogList;
00497 };
00498
00499
00500
class CalendarViewVisitor :
public Incidence::Visitor
00501 {
00502
public:
00503 CalendarViewVisitor() : mView( 0 ) {}
00504
00505
bool act( Incidence *incidence,
CalendarView *view )
00506 {
00507 mView = view;
00508
return incidence->accept( *
this );
00509 }
00510
00511
protected:
00512
CalendarView *mView;
00513 };
00514
00515
class ShowIncidenceVisitor :
public CalendarViewVisitor
00516 {
00517
protected:
00518
bool visit( Event *event ) { mView->showEvent( event );
return true; }
00519
bool visit( Todo *todo ) { mView->showTodo( todo );
return true; }
00520
bool visit( Journal * ) {
return false; }
00521 };
00522
00523
class EditIncidenceVisitor :
public CalendarViewVisitor
00524 {
00525
protected:
00526
bool visit( Event *event ) { mView->editEvent( event );
return true; }
00527
bool visit( Todo *todo ) { mView->editTodo( todo );
return true; }
00528
bool visit( Journal * ) {
return false; }
00529 };
00530
00531
class DeleteIncidenceVisitor :
public CalendarViewVisitor
00532 {
00533
protected:
00534
bool visit( Event *event ) { mView->deleteEvent( event );
return true; }
00535
bool visit( Todo *todo ) { mView->deleteTodo( todo );
return true; }
00536
bool visit( Journal * ) {
return false; }
00537 };
00538
00539
#endif