Fix url
[kdepim.git] / korganizer / src / koviewmanager.h
blobcd077ed14c6af4a0e8e464e9c4d9a3be2f0b4c49
1 /*
2 This file is part of KOrganizer.
4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
5 Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program 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
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License along
18 with this program; if not, write to the Free Software Foundation, Inc.,
19 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 As a special exception, permission is given to link this program
22 with any edition of Qt, and distribute the resulting executable,
23 without including the source code for Qt in the source distribution.
26 #ifndef KORG_KOVIEWMANAGER_H
27 #define KORG_KOVIEWMANAGER_H
29 #include <EventViews/EventView>
31 #include <KCalCore/IncidenceBase> //for KCalCore::DateList typedef
33 #include <QDate>
34 #include <QObject>
36 class CalendarView;
37 class KOAgendaView;
38 class KOJournalView;
39 class KOListView;
40 class KOTimelineView;
41 class KOTimeSpentView;
42 class KOTodoView;
43 class KOWhatsNextView;
44 namespace KOrg
46 class BaseView;
47 class MultiAgendaView;
48 class MonthView;
51 namespace Akonadi
53 class Item;
56 class KConfig;
57 class QTabWidget;
59 /**
60 This class manages the views of the calendar. It owns the objects and handles
61 creation and selection.
63 class KOViewManager : public QObject
66 Q_OBJECT
67 public:
69 enum RangeMode {
70 NO_RANGE,
71 DAY_RANGE,
72 WORK_WEEK_RANGE,
73 WEEK_RANGE,
74 NEXTX_RANGE,
75 OTHER_RANGE // for example, showing 8 days
78 explicit KOViewManager(CalendarView *);
79 virtual ~KOViewManager();
81 /** changes the view to be the currently selected view */
82 void showView(KOrg::BaseView *);
84 void readSettings(KConfig *config);
85 void writeSettings(KConfig *config);
87 /** Read which view was shown last from config file */
88 void readCurrentView(KConfig *config);
89 /** Write which view is currently shown to config file */
90 void writeCurrentView(KConfig *config);
92 KOrg::BaseView *currentView();
94 void setDocumentId(const QString &);
96 void updateView();
97 void updateView(const QDate &start, const QDate &end, const QDate &preferredMonth);
99 void goMenu(bool enable);
100 void raiseCurrentView();
102 void connectView(KOrg::BaseView *);
103 void addView(KOrg::BaseView *, bool isTab = false);
105 Akonadi::Item currentSelection();
108 * If there's a selected incidence, it's date is returned, otherwise
109 * an invalid QDate is returned.
111 QDate currentSelectionDate();
113 KOAgendaView *agendaView() const
115 return mAgendaView;
117 KOrg::MultiAgendaView *multiAgendaView() const
119 return mAgendaSideBySideView;
121 KOTodoView *todoView() const
123 return mTodoView;
125 KOrg::MonthView *monthView() const
127 return mMonthView;
130 void updateMultiCalendarDisplay();
133 * Returns true if agenda is the current view.
135 * Never use the pointer returned by agendaView()
136 * to know if agenda is selected, because agenda has other modes
137 * (tabbed, side by side). Use this function instead.
139 bool agendaIsSelected() const;
142 Return the current range mode:
143 week, work week, day or nextX days, etc.
145 RangeMode rangeMode() const
147 return mRangeMode;
150 Q_SIGNALS:
151 void configChanged();
152 void datesSelected(const KCalCore::DateList &);
154 public Q_SLOTS:
155 void showWhatsNextView();
156 void showListView();
157 void showAgendaView();
158 void showTodoView();
159 void showTimeLineView();
160 void showTimeSpentView();
161 void showMonthView();
162 void showJournalView();
163 void showEventView();
165 void selectDay();
166 void selectWorkWeek();
167 void selectWeek();
168 void selectNextX();
170 void connectTodoView(KOTodoView *todoView);
172 void zoomInHorizontally();
173 void zoomOutHorizontally();
174 void zoomInVertically();
175 void zoomOutVertically();
178 Notifies all views that an update is needed. This means that the
179 next time CalendarView::updateView() is called, views won't try to be smart
180 and ignore the update for performance reasons.
182 void addChange(EventViews::EventView::Change change);
184 private Q_SLOTS:
185 void currentAgendaViewTabChanged(int index);
187 private:
188 QWidget *widgetForView(KOrg::BaseView *) const;
189 QList<KOrg::BaseView *> mViews;
190 CalendarView *mMainView;
192 KOAgendaView *mAgendaView;
193 KOrg::MultiAgendaView *mAgendaSideBySideView;
194 KOListView *mListView;
195 KOTodoView *mTodoView;
196 KOWhatsNextView *mWhatsNextView;
197 KOJournalView *mJournalView;
198 KOTimelineView *mTimelineView;
199 KOTimeSpentView *mTimeSpentView;
200 KOrg::MonthView *mMonthView;
201 KOrg::BaseView *mCurrentView;
203 KOrg::BaseView *mLastEventView;
204 QTabWidget *mAgendaViewTabs;
205 int mAgendaViewTabIndex;
207 RangeMode mRangeMode;
210 #endif