korganizer

baseview.h

00001 /*
00002     This file is part of the KOrganizer interfaces.
00003 
00004     Copyright (c) 1999,2001,2003 Cornelius Schumacher <schumacher@kde.org>
00005         Copyright (C) 2004           Reinhold Kainhofer   <reinhold@kainhofer.com>
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Library General Public
00009     License as published by the Free Software Foundation; either
00010     version 2 of the License, or (at your option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     Library General Public License for more details.
00016 
00017     You should have received a copy of the GNU Library General Public License
00018     along with this library; see the file COPYING.LIB.  If not, write to
00019     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020     Boston, MA 02110-1301, USA.
00021 */
00022 #ifndef KORG_BASEVIEW_H
00023 #define KORG_BASEVIEW_H
00024 
00025 #include <qwidget.h>
00026 #include <qptrlist.h>
00027 #include <qvaluelist.h>
00028 
00029 #include <klocale.h>
00030 #include <kdebug.h>
00031 #include <kmessagebox.h>
00032 #include <kdepimmacros.h>
00033 #include "korganizer/incidencechangerbase.h"
00034 
00035 #include "printplugin.h"
00036 
00037 #include <libkcal/event.h>
00038 
00039 using namespace KCal;
00040 
00041 namespace KCal {
00042   class Calendar;
00043   class ResourceCalendar;
00044 }
00045 
00046 namespace KOrg {
00047 
00059 class KDE_EXPORT BaseView : public QWidget
00060 {
00061   Q_OBJECT
00062   public:
00071     BaseView( Calendar *cal, QWidget *parent = 0, const char *name = 0 )
00072       : QWidget( parent, name ),
00073         mReadOnly( false ), mCalendar( cal ), mResource( 0 ), mChanger( 0 ) {}
00074 
00078     virtual ~BaseView() {}
00079 
00081     void setReadOnly( bool readonly ) { mReadOnly = readonly; }
00082     bool readOnly() { return mReadOnly; }
00083 
00084     virtual void setCalendar( Calendar *cal ) { mCalendar = cal; }
00088     virtual Calendar *calendar() { return mCalendar; }
00089 
00090     virtual void setResource( ResourceCalendar *res, const QString &subResource )
00091     {
00092       mResource = res;
00093       mSubResource = subResource;
00094     }
00095 
00099     ResourceCalendar *resourceCalendar() { return mResource; }
00100 
00104     QString subResourceCalendar() const { return mSubResource; }
00105 
00111     virtual Incidence::List selectedIncidences() = 0;
00112 
00118     virtual DateList selectedDates() = 0;
00119 
00124     virtual QDateTime selectionStart() { return QDateTime(); }
00125 
00130     virtual QDateTime selectionEnd() { return QDateTime(); }
00131 
00132     virtual CalPrinterBase::PrintType printType()
00133     {
00134       return CalPrinterBase::Month;
00135     }
00136 
00140     virtual int currentDateCount() = 0;
00141 
00143     virtual bool isEventView() { return false; }
00144 
00145   public slots:
00154     virtual void showDates( const QDate &start, const QDate &end ) = 0;
00155 
00163     virtual void showIncidences( const Incidence::List &incidenceList, const QDate &date ) = 0;
00164 
00169     virtual void updateView() = 0;
00170     virtual void dayPassed( const QDate & ) { updateView(); }
00171 
00175     virtual void setIncidenceChanger( IncidenceChangerBase *changer ) { mChanger = changer; }
00176 
00180     virtual void flushView() {}
00181 
00185     virtual void changeIncidenceDisplay( Incidence *, int ) = 0;
00186 
00191     virtual void updateConfig() {}
00192 
00196     virtual void clearSelection() {}
00197 
00201     virtual bool eventDurationHint(QDateTime &/*startDt*/, QDateTime &/*endDt*/, bool &/*allDay*/) { return false; }
00202 
00203   signals:
00204     void incidenceSelected( Incidence *, const QDate & );
00205 
00209     void showIncidenceSignal(Incidence *);
00210 
00216     void editIncidenceSignal(Incidence *);
00217 
00223     void deleteIncidenceSignal(Incidence *);
00224 
00228     void cutIncidenceSignal(Incidence *);
00229 
00233     void copyIncidenceSignal(Incidence *);
00234 
00238     void pasteIncidenceSignal();
00239 
00243     void toggleAlarmSignal(Incidence *);
00246     void dissociateOccurrenceSignal( Incidence *, const QDate & );
00249     void dissociateFutureOccurrenceSignal( Incidence *, const QDate & );
00250 
00251     void startMultiModify( const QString & );
00252     void endMultiModify();
00253 
00258     void newEventSignal( ResourceCalendar *res, const QString &subResource );
00263     void newEventSignal( ResourceCalendar *res, const QString &subResource,
00264                          const QDate & );
00269     void newEventSignal( ResourceCalendar *res, const QString &subResource,
00270                          const QDateTime & );
00276     void newEventSignal( ResourceCalendar *res, const QString &subResource,
00277                          const QDateTime &, const QDateTime & );
00278 
00279     void newTodoSignal( ResourceCalendar *res,const QString &subResource,
00280                         const QDate & );
00281     void newSubTodoSignal( Todo * );
00282 
00283     void newJournalSignal( ResourceCalendar *res,const QString &subResource,
00284                            const QDate & );
00285 
00286   private:
00287     bool mReadOnly;
00288     Calendar *mCalendar;
00289     ResourceCalendar *mResource;
00290     QString mSubResource;
00291 
00292   protected:
00293     IncidenceChangerBase *mChanger;
00294 };
00295 
00296 }
00297 
00298 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys