summaryrefslogtreecommitdiffabout
path: root/korganizer/interfaces
Unidiff
Diffstat (limited to 'korganizer/interfaces') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/interfaces/korganizer/baseview.h192
-rw-r--r--korganizer/interfaces/korganizer/calendarviewbase.h65
2 files changed, 257 insertions, 0 deletions
diff --git a/korganizer/interfaces/korganizer/baseview.h b/korganizer/interfaces/korganizer/baseview.h
new file mode 100644
index 0000000..09f8ba3
--- a/dev/null
+++ b/korganizer/interfaces/korganizer/baseview.h
@@ -0,0 +1,192 @@
1/*
2 This file is part of the KOrganizer interfaces.
3 Copyright (c) 1999 Cornelius Schumacher <schumacher@kde.org>
4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.
20*/
21#ifndef KORG_BASEVIEW_H
22#define KORG_BASEVIEW_H
23// $Id$
24// KOBaseView is the abstract base class of all calendar views.
25
26#include <qwidget.h>
27#include <qptrlist.h>
28#include <qvaluelist.h>
29
30#include <klocale.h>
31#include <kdebug.h>
32#include <kmessagebox.h>
33
34#include <libkcal/event.h>
35#include <libkcal/calendar.h>
36
37using namespace KCal;
38
39class CalPrinter;
40
41namespace KOrg {
42
43class CalPrinterBase
44{
45 public:
46 enum PrintType { Day, Week, Month, Todolist };
47};
48
49
50/**
51 This class provides an interface for all views being displayed within the main
52 calendar view. It has functions to update the view, to specify date range and
53 other display parameter and to return selected objects. An important class,
54 which inherits KOBaseView is KOEventView, which provides the interface for all
55 views of event data like the agenda or the month view.
56
57 @short Base class for calendar views
58 @author Preston Brown, Cornelius Schumacher
59 @see KOTodoView, KOEventView, KOListView, KOAgendaView, KOMonthView
60*/
61class BaseView : public QWidget
62{
63 Q_OBJECT
64 public:
65 /**
66 Constructs a view.
67
68 @param cal Pointer to the calendar object from which events
69 will be retrieved for display.
70 @param parent parent widget.
71 @param name name of this widget.
72 */
73 BaseView(Calendar *cal, QWidget *parent = 0, const char *name = 0) :
74 QWidget(parent, name), mCalendar(cal) {}
75
76 /**
77 Destructor. Views will do view-specific cleanups here.
78 */
79 virtual ~BaseView() {}
80
81 /**
82 Return calendar object of this view.
83 */
84 Calendar *calendar() { return mCalendar; }
85
86 /**
87 @return a list of selected events. Most views can probably only
88 select a single event at a time, but some may be able to select
89 more than one.
90 */
91 virtual QPtrList<Incidence> selectedIncidences() = 0;
92
93 /**
94 @return a list of the dates of selected events. Most views can probably only
95 select a single event at a time, but some may be able to select
96 more than one.
97 */
98 virtual DateList selectedDates() = 0;
99
100 /**
101 Generate a print preview of this event view.
102
103 @param calPrinter Calendar printer object used for printing
104 @param fd from date
105 @param td to date
106 */
107/*
108 The date parameters should be determined by the view itself and not given as
109 parameters. At the moment I just move the code from the topwidget to the
110 individual views.
111*/
112 virtual void printPreview(CalPrinter *,
113 const QDate &, const QDate &)
114 {
115 KMessageBox::sorry(this, i18n("Unfortunately, we don't handle printing for\n"
116 "that view yet.\n"));
117 }
118
119 /**
120 Print this view.
121
122 @param calPrinter Calendar printer object used for printing
123 */
124 virtual void print(CalPrinter *)
125 {
126 KMessageBox::sorry(this, i18n("Unfortunately, we don't handle printing for\n"
127 "that view yet.\n"));
128 }
129
130 /**
131 Return number of currently shown dates. A return value of 0 means no idea.
132 */
133 virtual int currentDateCount() = 0;
134
135 /** Return if this view is a view for displaying events. */
136 virtual bool isEventView() { return false; }
137
138 public slots:
139 /**
140 Show incidences for the given date range. The date range actually shown may be
141 different from the requested range, depending on the particular requirements
142 of the view.
143
144 @param start Start of date range.
145 @param end End of date range.
146 */
147 virtual void showDates( const QDate &start, const QDate &end ) = 0;
148
149 /**
150 Show given events. Depending on the actual view it might not be possible to
151 show all given events.
152
153 @param eventList a list of events to show.
154 */
155 virtual void showEvents(QPtrList<Event> eventList) = 0;
156
157 /**
158 Updates the current display to reflect changes that may have happened
159 in the calendar since the last display refresh.
160 */
161 virtual void updateView() = 0;
162
163 /**
164 Write all unsaved data back to calendar store.
165 */
166 virtual void flushView() {}
167
168 /**
169 Updates the current display to reflect the changes to one particular event.
170 */
171 virtual void changeEventDisplay(Event *, int) = 0;
172
173 /**
174 Re-reads the KOrganizer configuration and picks up relevant
175 changes which are applicable to the view.
176 */
177 virtual void updateConfig() {}
178
179 /**
180 Clear selection. The incidenceSelected signal is not emitted.
181 */
182 virtual void clearSelection() {}
183
184 signals:
185 void incidenceSelected( Incidence * );
186
187 protected:
188 Calendar *mCalendar;
189};
190
191}
192#endif
diff --git a/korganizer/interfaces/korganizer/calendarviewbase.h b/korganizer/interfaces/korganizer/calendarviewbase.h
new file mode 100644
index 0000000..3c715b1
--- a/dev/null
+++ b/korganizer/interfaces/korganizer/calendarviewbase.h
@@ -0,0 +1,65 @@
1/*
2 This file is part of the KOrganizer interfaces.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20#ifndef KORG_CALENDARVIEWBASE_H
21#define KORG_CALENDARVIEWBASE_H
22// $Id$
23
24#include <qwidget.h>
25#include <qlayout.h>
26
27
28#include <libkcal/calendar.h>
29
30#include <korganizer/baseview.h>
31
32namespace KOrg {
33
34/**
35 @short interface for main calendar view widget
36 @author Cornelius Schumacher
37*/
38class CalendarViewBase : public QWidget
39{
40 Q_OBJECT
41 public:
42 CalendarViewBase(QWidget *parent, const char *name) :
43 QWidget(parent,name) {new QVBoxLayout(this);}
44 virtual ~CalendarViewBase() {};
45
46 virtual KCal::Calendar *calendar() = 0;
47
48 virtual QDate startDate() = 0;
49 virtual QDate endDate() = 0;
50
51 virtual Incidence *currentSelection() = 0;
52
53 virtual void addView(KOrg::BaseView *) = 0;
54
55 /** changes the view to be the currently selected view */
56 virtual void showView(KOrg::BaseView *) = 0;
57
58 public slots:
59 virtual void updateView() = 0;
60
61};
62
63}
64
65#endif