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 
229  void deleteIncidenceSignal(Incidence *);
230 
234  void cutIncidenceSignal(Incidence *);
235 
239  void copyIncidenceSignal(Incidence *);
240 
244  void pasteIncidenceSignal();
245 
249  void toggleAlarmSignal(Incidence *);
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
virtual ~BaseView()
Destructor.
Definition: baseview.h:79
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
void setReadOnly(bool readonly)
Flag indicating if the view is read-only.
Definition: baseview.h:82
This class provides an interface for all views being displayed within the main calendar view.
Definition: baseview.h:59
TQString subResourceCalendar() const
Return subResourceCalendar of this view.
Definition: baseview.h:105
virtual void clearSelection()
Clear selection.
Definition: baseview.h:202
virtual bool isEventView()
Return if this view is a view for displaying events.
Definition: baseview.h:144
virtual void flushView()
Write all unsaved data back to calendar store.
Definition: baseview.h:186
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 setIncidenceChanger(IncidenceChangerBase *changer)
Assign a new incidence change helper object.
Definition: baseview.h:181
virtual bool supportsDateNavigation() const
Returns true if the view supports navigation through the date navigator ( selecting a date range,...
Definition: baseview.h:149
ResourceCalendar * resourceCalendar()
Return resourceCalendar of this view.
Definition: baseview.h:100
virtual void updateConfig()
Re-reads the KOrganizer configuration and picks up relevant changes which are applicable to the view.
Definition: baseview.h:197
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
virtual bool eventDurationHint(TQDateTime &, TQDateTime &, bool &)
Set the default start/end date/time for new events.
Definition: baseview.h:207