baseview.h
1 /*
2  This file is part of the KOrganizer interfaces.
3 
4  Copyright (c) 1999,2001,2003 Cornelius Schumacher <schumacher@kde.org>
5  Copyright (C) 2004 Reinhold Kainhofer <reinhold@kainhofer.com>
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License as published by the Free Software Foundation; either
10  version 2 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to
19  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA.
21 */
22 #ifndef KORG_BASEVIEW_H
23 #define KORG_BASEVIEW_H
24 
25 #include <tqwidget.h>
26 #include <tqptrlist.h>
27 #include <tqvaluelist.h>
28 
29 #include <tdelocale.h>
30 #include <kdebug.h>
31 #include <tdemessagebox.h>
32 #include <tdemacros.h>
33 #include "korganizer/incidencechangerbase.h"
34 
35 #include "printplugin.h"
36 
37 #include <libkcal/event.h>
38 
39 using namespace KCal;
40 
41 namespace KCal {
42  class Calendar;
43  class ResourceCalendar;
44 }
45 
46 namespace KOrg {
47 
59 class TDE_EXPORT BaseView : public TQWidget
60 {
61  TQ_OBJECT
62 
63  public:
72  BaseView( Calendar *cal, TQWidget *parent = 0, const char *name = 0 )
73  : TQWidget( parent, name ),
74  mReadOnly( false ), mCalendar( cal ), mResource( 0 ), mChanger( 0 ) {}
75 
79  virtual ~BaseView() {}
80 
82  void setReadOnly( bool readonly ) { mReadOnly = readonly; }
83  bool readOnly() { return mReadOnly; }
84 
85  virtual void setCalendar( Calendar *cal ) { mCalendar = cal; }
89  virtual Calendar *calendar() { return mCalendar; }
90 
91  virtual void setResource( ResourceCalendar *res, const TQString &subResource )
92  {
93  mResource = res;
94  mSubResource = subResource;
95  }
96 
100  ResourceCalendar *resourceCalendar() { return mResource; }
101 
105  TQString subResourceCalendar() const { return mSubResource; }
106 
112  virtual Incidence::List selectedIncidences() = 0;
113 
119  virtual DateList selectedIncidenceDates() = 0;
120 
125  virtual TQDateTime selectionStart() { return TQDateTime(); }
126 
131  virtual TQDateTime selectionEnd() { return TQDateTime(); }
132 
133  virtual CalPrinterBase::PrintType printType()
134  {
135  return CalPrinterBase::Month;
136  }
137 
141  virtual int currentDateCount() = 0;
142 
144  virtual bool isEventView() { return false; }
145 
149  virtual bool supportsDateNavigation() const { return false; }
150 
151  public slots:
160  virtual void showDates( const TQDate &start, const TQDate &end ) = 0;
161 
169  virtual void showIncidences( const Incidence::List &incidenceList, const TQDate &date ) = 0;
170 
175  virtual void updateView() = 0;
176  virtual void dayPassed( const TQDate & ) { updateView(); }
177 
181  virtual void setIncidenceChanger( IncidenceChangerBase *changer ) { mChanger = changer; }
182 
186  virtual void flushView() {}
187 
191  virtual void changeIncidenceDisplay( Incidence *, int ) = 0;
192 
197  virtual void updateConfig() {}
198 
202  virtual void clearSelection() {}
203 
207  virtual bool eventDurationHint(TQDateTime &/*startDt*/, TQDateTime &/*endDt*/, bool &/*allDay*/) { return false; }
208 
209  signals:
210  void incidenceSelected( Incidence *, const TQDate & );
211 
215  void showIncidenceSignal( Incidence *, const TQDate & );
216 
222  void editIncidenceSignal( Incidence *, const TQDate & );
223 
230 
235 
240 
245 
252  void dissociateOccurrenceSignal( Incidence *, const TQDate & );
255  void dissociateFutureOccurrenceSignal( Incidence *, const TQDate & );
256 
257  void startMultiModify( const TQString & );
258  void endMultiModify();
259 
264  void newEventSignal( ResourceCalendar *res, const TQString &subResource );
269  void newEventSignal( ResourceCalendar *res, const TQString &subResource,
270  const TQDate & );
275  void newEventSignal( ResourceCalendar *res, const TQString &subResource,
276  const TQDateTime & );
282  void newEventSignal( ResourceCalendar *res, const TQString &subResource,
283  const TQDateTime &, const TQDateTime & );
284 
285  void newTodoSignal( ResourceCalendar *res,const TQString &subResource,
286  const TQDate & );
287  void newSubTodoSignal( Todo * );
288 
289  void newJournalSignal( ResourceCalendar *res,const TQString &subResource,
290  const TQDate & );
291 
292  private:
293  bool mReadOnly;
294  Calendar *mCalendar;
295  ResourceCalendar *mResource;
296  TQString mSubResource;
297 
298  protected:
299  IncidenceChangerBase *mChanger;
300 };
301 
302 }
303 
304 #endif
This class provides an interface for all views being displayed within the main calendar view.
Definition: baseview.h:60
void copyIncidenceSignal(Incidence *)
instructs the receiver to copy the incidence
virtual void flushView()
Write all unsaved data back to calendar store.
Definition: baseview.h:186
void dissociateOccurrenceSignal(Incidence *, const TQDate &)
Dissociate from a recurring incidence the occurrence on the given date to a new incidence.
void newEventSignal(ResourceCalendar *res, const TQString &subResource, const TQDate &)
instructs the receiver to create a new event with the specified beginning time.
virtual bool eventDurationHint(TQDateTime &, TQDateTime &, bool &)
Set the default start/end date/time for new events.
Definition: baseview.h:207
void newEventSignal(ResourceCalendar *res, const TQString &subResource, const TQDateTime &, const TQDateTime &)
instructs the receiver to create a new event, with the specified beginning end ending times.
virtual void showIncidences(const Incidence::List &incidenceList, const TQDate &date)=0
Show given incidences.
void toggleAlarmSignal(Incidence *)
instructs the receiver to toggle the alarms of the Incidence.
virtual TQDateTime selectionStart()
Returns the start of the selection, or an invalid TQDateTime if there is no selection or the view doe...
Definition: baseview.h:125
virtual void changeIncidenceDisplay(Incidence *, int)=0
Updates the current display to reflect the changes to one particular incidence.
void editIncidenceSignal(Incidence *, const TQDate &)
instructs the receiver to begin editing the incidence specified in some manner.
void dissociateFutureOccurrenceSignal(Incidence *, const TQDate &)
Dissociate from a recurring incidence all occurrences after the given date to a new incidence.
virtual TQDateTime selectionEnd()
Returns the end of the selection, or an invalid TQDateTime if there is no selection or the view doesn...
Definition: baseview.h:131
ResourceCalendar * resourceCalendar()
Return resourceCalendar of this view.
Definition: baseview.h:100
virtual void showDates(const TQDate &start, const TQDate &end)=0
Show incidences for the given date range.
virtual ~BaseView()
Destructor.
Definition: baseview.h:79
virtual void updateView()=0
Updates the current display to reflect changes that may have happened in the calendar since the last ...
void cutIncidenceSignal(Incidence *)
instructs the receiver to cut the Incidence
virtual void setIncidenceChanger(IncidenceChangerBase *changer)
Assign a new incidence change helper object.
Definition: baseview.h:181
virtual void clearSelection()
Clear selection.
Definition: baseview.h:202
void deleteIncidenceSignal(Incidence *)
instructs the receiver to delete the Incidence in some manner; some possibilities include automatical...
void newEventSignal(ResourceCalendar *res, const TQString &subResource)
instructs the receiver to create a new event.
virtual int currentDateCount()=0
Return number of currently shown dates.
void setReadOnly(bool readonly)
Flag indicating if the view is read-only.
Definition: baseview.h:82
void pasteIncidenceSignal()
instructs the receiver to paste the incidence
virtual void updateConfig()
Re-reads the KOrganizer configuration and picks up relevant changes which are applicable to the view.
Definition: baseview.h:197
TQString subResourceCalendar() const
Return subResourceCalendar of this view.
Definition: baseview.h:105
virtual DateList selectedIncidenceDates()=0
virtual bool isEventView()
Return if this view is a view for displaying events.
Definition: baseview.h:144
void showIncidenceSignal(Incidence *, const TQDate &)
instructs the receiver to show the incidence in read-only mode.
void newEventSignal(ResourceCalendar *res, const TQString &subResource, const TQDateTime &)
instructs the receiver to create a new event with the specified beginning time.
virtual Incidence::List selectedIncidences()=0
virtual bool supportsDateNavigation() const
Returns true if the view supports navigation through the date navigator ( selecting a date range,...
Definition: baseview.h:149
virtual Calendar * calendar()
Return calendar object of this view.
Definition: baseview.h:89
BaseView(Calendar *cal, TQWidget *parent=0, const char *name=0)
Constructs a view.
Definition: baseview.h:72