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 <tqwidget.h>
00026 #include <tqptrlist.h>
00027 #include <tqvaluelist.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 TQWidget
00060 {
00061   Q_OBJECT
00062   TQ_OBJECT
00063   public:
00072     BaseView( Calendar *cal, TQWidget *parent = 0, const char *name = 0 )
00073       : TQWidget( parent, name ),
00074         mReadOnly( false ), mCalendar( cal ), mResource( 0 ), mChanger( 0 ) {}
00075 
00079     virtual ~BaseView() {}
00080 
00082     void setReadOnly( bool readonly ) { mReadOnly = readonly; }
00083     bool readOnly() { return mReadOnly; }
00084 
00085     virtual void setCalendar( Calendar *cal ) { mCalendar = cal; }
00089     virtual Calendar *calendar() { return mCalendar; }
00090 
00091     virtual void setResource( ResourceCalendar *res, const TQString &subResource )
00092     {
00093       mResource = res;
00094       mSubResource = subResource;
00095     }
00096 
00100     ResourceCalendar *resourceCalendar() { return mResource; }
00101 
00105     TQString subResourceCalendar() const { return mSubResource; }
00106 
00112     virtual Incidence::List selectedIncidences() = 0;
00113 
00119     virtual DateList selectedIncidenceDates() = 0;
00120 
00125     virtual TQDateTime selectionStart() { return TQDateTime(); }
00126 
00131     virtual TQDateTime selectionEnd() { return TQDateTime(); }
00132 
00133     virtual CalPrinterBase::PrintType printType()
00134     {
00135       return CalPrinterBase::Month;
00136     }
00137 
00141     virtual int currentDateCount() = 0;
00142 
00144     virtual bool isEventView() { return false; }
00145 
00149     virtual bool supportsDateNavigation() const { return false; }
00150 
00151   public slots:
00160     virtual void showDates( const TQDate &start, const TQDate &end ) = 0;
00161 
00169     virtual void showIncidences( const Incidence::List &incidenceList, const TQDate &date ) = 0;
00170 
00175     virtual void updateView() = 0;
00176     virtual void dayPassed( const TQDate & ) { updateView(); }
00177 
00181     virtual void setIncidenceChanger( IncidenceChangerBase *changer ) { mChanger = changer; }
00182 
00186     virtual void flushView() {}
00187 
00191     virtual void changeIncidenceDisplay( Incidence *, int ) = 0;
00192 
00197     virtual void updateConfig() {}
00198 
00202     virtual void clearSelection() {}
00203 
00207     virtual bool eventDurationHint(TQDateTime &/*startDt*/, TQDateTime &/*endDt*/, bool &/*allDay*/) { return false; }
00208 
00209   signals:
00210     void incidenceSelected( Incidence *, const TQDate & );
00211 
00215     void showIncidenceSignal( Incidence *, const TQDate & );
00216 
00222     void editIncidenceSignal( Incidence *, const TQDate & );
00223 
00229     void deleteIncidenceSignal(Incidence *);
00230 
00234     void cutIncidenceSignal(Incidence *);
00235 
00239     void copyIncidenceSignal(Incidence *);
00240 
00244     void pasteIncidenceSignal();
00245 
00249     void toggleAlarmSignal(Incidence *);
00252     void dissociateOccurrenceSignal( Incidence *, const TQDate & );
00255     void dissociateFutureOccurrenceSignal( Incidence *, const TQDate & );
00256 
00257     void startMultiModify( const TQString & );
00258     void endMultiModify();
00259 
00264     void newEventSignal( ResourceCalendar *res, const TQString &subResource );
00269     void newEventSignal( ResourceCalendar *res, const TQString &subResource,
00270                          const TQDate & );
00275     void newEventSignal( ResourceCalendar *res, const TQString &subResource,
00276                          const TQDateTime & );
00282     void newEventSignal( ResourceCalendar *res, const TQString &subResource,
00283                          const TQDateTime &, const TQDateTime & );
00284 
00285     void newTodoSignal( ResourceCalendar *res,const TQString &subResource,
00286                         const TQDate & );
00287     void newSubTodoSignal( Todo * );
00288 
00289     void newJournalSignal( ResourceCalendar *res,const TQString &subResource,
00290                            const TQDate & );
00291 
00292   private:
00293     bool mReadOnly;
00294     Calendar *mCalendar;
00295     ResourceCalendar *mResource;
00296     TQString mSubResource;
00297 
00298   protected:
00299     IncidenceChangerBase *mChanger;
00300 };
00301 
00302 }
00303 
00304 #endif