korganizer Library API Documentation

calendarview.h

00001 /*
00002     This file is part of KOrganizer.
00003     Copyright (c) 2000, 2001
00004     Cornelius Schumacher <schumacher@kde.org>
00005 
00006     This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019 
00020     As a special exception, permission is given to link this program
00021     with any edition of Qt, and distribute the resulting executable,
00022     without including the source code for Qt in the source distribution.
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 <qframe.h>
00032 #include <qvbox.h>
00033 #include <qmap.h>
00034 
00035 #include <libkcal/calendar.h>
00036 #include <libkcal/scheduler.h>
00037 
00038 #include <korganizer/calendarviewbase.h>
00039 
00040 class QWidgetStack;
00041 class QSplitter;
00042 
00043 class CalPrinter;
00044 class KOFilterView;
00045 class KOViewManager;
00046 class KODialogManager;
00047 class KOTodoView;
00048 class KDateNavigator;
00049 class DateNavigator;
00050 class KOIncidenceEditor;
00051 
00052 namespace KCal { class FileStorage; }
00053 
00054 using namespace KCal;
00055 
00065 class CalendarView : public KOrg::CalendarViewBase, public Calendar::Observer
00066 {
00067     Q_OBJECT
00068   public:
00074     CalendarView( QWidget *parent = 0, const char *name = 0 ); 
00075     virtual ~CalendarView();
00076   
00077     Calendar *calendar() { return mCalendar; }
00078 
00079     KOViewManager *viewManager();
00080     KODialogManager *dialogManager();
00081 
00082     QDate startDate();
00083     QDate endDate();
00084 
00085     QWidgetStack *viewStack();
00086     QWidget *leftFrame();
00087 
00088     DateNavigator *dateNavigator();
00089 
00090     void addView(KOrg::BaseView *);
00091     void showView(KOrg::BaseView *);
00092 
00093     Incidence *currentSelection();
00094 
00095   signals:
00096   
00100     void configChanged();
00103     void closingDown();
00105     void closed(QWidget *);
00106     
00108     void modifiedChanged(bool);
00109   
00111     void readOnlyChanged(bool);
00112   
00114     void changeNavStringPrev(const QString &);
00115     void changeNavStringNext(const QString &);
00116   
00118     void organizerEventsSelected(bool);
00120     void groupEventsSelected(bool);
00125     void incidenceSelected( Incidence * );
00127     void todoSelected( bool );
00128 
00133     void pasteEnabled(bool);
00134     
00136     void numIncomingChanged(int);
00137 
00139     void numOutgoingChanged(int);
00140 
00142     void statusMessage(const QString &);
00143     
00144     void calendarViewExpanded( bool );
00145         
00146   public slots:
00149     void updateConfig();
00150 
00156     bool openCalendar(QString filename, bool merge=false);
00157 
00162     bool saveCalendar(QString filename);
00163   
00168     void closeCalendar();
00169   
00171     void archiveCalendar();
00172 
00173     void showIncidence();
00174     void editIncidence();
00175     void deleteIncidence();
00176   
00179     void newEvent(QDateTime, QDateTime);
00180     void newEvent(QDateTime, QDateTime, bool allDay);
00181     void newEvent(QDateTime fh);
00182     void newEvent(QDate dt);
00185     void newEvent();
00186     void newFloatingEvent();
00187     
00189     void editEvent(Event *);
00191     void deleteEvent(Event *);
00194     bool deleteEvent(const QString &uid);
00196     void showEvent(Event *);
00197 
00199     void editTodo(Todo *);
00201     void showTodo(Todo *);
00203     void newTodo();
00205     void newSubTodo();
00207     void newSubTodo(Todo *);
00209     void deleteTodo(Todo *);
00210 
00212     void todoModified(Todo *, int);
00213             
00216     void checkClipboard();
00217     
00221     void readSettings();
00222     
00224     void writeSettings();
00225 
00227     void readFilterSettings(KConfig *config);
00228     
00230     void writeFilterSettings(KConfig *config);
00231 
00234     void changeEventDisplay(Event *, int);
00235   
00236     void eventAdded(Event *);
00237     void eventChanged(Event *);
00238     void eventToBeDeleted(Event *);
00239     void eventDeleted();
00240   
00241     void updateView(const QDate &start, const QDate &end);
00242     void updateView();
00243   
00245     void updateTodoViews();
00246 
00247     void updateUnmanagedViews();
00248   
00250     void edit_cut();
00251   
00253     void edit_copy();
00254 
00256     void edit_paste();
00257   
00259     void edit_options();
00260   
00265     void print();
00266     void printSetup();
00267     void printPreview();
00268 
00270     void exportICalendar();
00271   
00273     void exportVCalendar();
00274   
00276     void appointment_show();
00282     void appointment_edit();
00287     void appointment_delete();
00288 
00291     void action_mail();
00292 
00293     /* frees a subtodo from it's relation */
00294     void todo_unsub();
00295 
00297     void takeOverEvent();
00298 
00300     void takeOverCalendar();
00301   
00303     bool isModified();
00305     void setModified(bool modified=true);
00306 
00308     bool isReadOnly();
00310     void setReadOnly(bool readOnly=true);
00311 
00312     void eventUpdated(Incidence *);
00313 
00314     /* iTIP scheduling actions */
00315     void schedule_publish(Incidence *incidence = 0);
00316     void schedule_request(Incidence *incidence = 0);
00317     void schedule_refresh(Incidence *incidence = 0);
00318     void schedule_cancel(Incidence *incidence = 0);
00319     void schedule_add(Incidence *incidence = 0);
00320     void schedule_reply(Incidence *incidence = 0);
00321     void schedule_counter(Incidence *incidence = 0);
00322     void schedule_declinecounter(Incidence *incidence = 0);
00323     void schedule_publish_freebusy(int daysToPublish = 30);
00324 
00325     void openAddressbook();
00326 
00327     void editFilters();
00328 
00329     void showFilter(bool visible);
00330     void updateFilter();
00331     void filterEdited();
00332 
00333     void showIntro();
00334 
00336     void goToday();
00337 
00339     void goNext();
00340   
00342     void goPrevious();
00343 
00344     void toggleExpand();
00345     
00346     void dialogClosing(Incidence *);
00347   
00349     void lookForIncomingMessages();
00351     void lookForOutgoingMessages();
00352 
00353     void processMainViewSelection( Incidence * );
00354     void processTodoListSelection( Incidence * );
00355     
00356     void processIncidenceSelection( Incidence * );
00357 
00358     void purgeCompleted();
00359     
00360   protected slots:
00362     void showDates( const KCal::DateList & );
00363   
00364   public:
00365     // show a standard warning
00366     // returns KMsgBox::yesNoCancel()
00367     int msgCalModified();
00368   
00372     void adaptNavigationUnits();
00373     
00374     //Attendee* getYourAttendee(Event *event);
00375   
00376   protected:
00377     void schedule(Scheduler::Method, Incidence *incidence = 0);
00378     
00379     // returns KMsgBox::OKCandel()
00380     int msgItemDelete();
00381   
00383     void signalAlarmDaemon();
00384   
00385     Todo *selectedTodo();
00386 
00387   private:
00388     void createPrinter();
00389 
00390     void calendarModified( bool, Calendar * );
00391 
00392     CalPrinter *mCalPrinter;
00393 
00394     QSplitter    *mPanner;
00395     QSplitter    *mLeftSplitter;
00396     QWidget      *mLeftFrame;
00397     QWidgetStack *mRightFrame;
00398 
00399     KDateNavigator *mDateNavigator;       // widget showing small month view.
00400 
00401     KOFilterView *mFilterView;
00402 
00403     // calendar object for this viewing instance
00404     Calendar      *mCalendar;
00405 
00406     FileStorage *mStorage;
00407 
00408     DateNavigator *mNavigator;
00409 
00410     KOViewManager *mViewManager;
00411     KODialogManager *mDialogManager;
00412 
00413     // Calendar filters
00414     QPtrList<CalFilter> mFilters;
00415 
00416     // various housekeeping variables.
00417     bool            mModified;     // flag indicating if calendar is modified
00418     bool            mReadOnly; // flag indicating if calendar is read-only
00419     QDate mSaveSingleDate;
00420 
00421     Incidence *mSelectedIncidence;
00422 
00423     KOTodoView *mTodoList;
00424     QMap<Incidence*,KOIncidenceEditor*> mDialogList;
00425 };
00426 
00427 
00428 class CalendarViewVisitor : public Incidence::Visitor
00429 {
00430   public:
00431     CalendarViewVisitor() : mView( 0 ) {}
00432 
00433     bool act( Incidence *incidence, CalendarView *view )
00434     {
00435       mView = view;
00436       return incidence->accept( *this );
00437     }
00438     
00439   protected:
00440     CalendarView *mView;
00441 };
00442 
00443 class ShowIncidenceVisitor : public CalendarViewVisitor
00444 {
00445   protected:
00446     bool visit( Event *event ) { mView->showEvent( event ); return true; }  
00447     bool visit( Todo *todo ) { mView->showTodo( todo ); return true; }  
00448     bool visit( Journal * ) { return false; }
00449 };
00450 
00451 class EditIncidenceVisitor : public CalendarViewVisitor
00452 {
00453   protected:
00454     bool visit( Event *event ) { mView->editEvent( event ); return true; }  
00455     bool visit( Todo *todo ) { mView->editTodo( todo ); return true; }  
00456     bool visit( Journal * ) { return false; }
00457 };
00458 
00459 class DeleteIncidenceVisitor : public CalendarViewVisitor
00460 {
00461   protected:
00462     bool visit( Event *event ) { mView->deleteEvent( event ); return true; }  
00463     bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; }  
00464     bool visit( Journal * ) { return false; }
00465 };
00466 
00467 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sat Oct 18 02:47:30 2003 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001