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
41 class KOTimeSpentView
;
43 class KOWhatsNextView
;
47 class MultiAgendaView
;
60 This class manages the views of the calendar. It owns the objects and handles
61 creation and selection.
63 class KOViewManager
: public QObject
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
&);
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
117 KOrg::MultiAgendaView
*multiAgendaView() const
119 return mAgendaSideBySideView
;
121 KOTodoView
*todoView() const
125 KOrg::MonthView
*monthView() const
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
151 void configChanged();
152 void datesSelected(const KCalCore::DateList
&);
155 void showWhatsNextView();
157 void showAgendaView();
159 void showTimeLineView();
160 void showTimeSpentView();
161 void showMonthView();
162 void showJournalView();
163 void showEventView();
166 void selectWorkWeek();
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
);
185 void currentAgendaViewTabChanged(int index
);
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
;