Fix url
[kdepim.git] / korganizer / src / datenavigator.h
blobcf987f4df0daf96c5fac3d1315f1e3fb2f37dbad
1 /*
2 This file is part of KOrganizer.
4 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
5 Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
7 Copyright (C) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
8 Author: Sergio Martins <sergio@kdab.com>
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License along
21 with this program; if not, write to the Free Software Foundation, Inc.,
22 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 As a special exception, permission is given to link this program
25 with any edition of Qt, and distribute the resulting executable,
26 without including the source code for Qt in the source distribution.
29 #ifndef KORG_DATENAVIGATOR_H
30 #define KORG_DATENAVIGATOR_H
32 #include <KCalCore/IncidenceBase> // for KCalCore::DateList typedef
34 #include <QObject>
35 #include <QDate>
36 /**
37 This class controls date navigation. All requests to move the views to another
38 date are sent to the DateNavigator. The DateNavigator processes the new
39 selection of dates and emits the required signals for the views.
41 class DateNavigator : public QObject
43 Q_OBJECT
44 public:
45 explicit DateNavigator(QObject *parent = Q_NULLPTR);
46 ~DateNavigator();
48 KCalCore::DateList selectedDates();
50 int datesCount() const;
52 public Q_SLOTS:
53 void selectDates(const KCalCore::DateList &, const QDate &preferredMonth = QDate());
54 void selectDate(const QDate &);
56 void selectDates(int count);
57 void selectDates(const QDate &, int count, const QDate &preferredMonth = QDate());
59 void selectWeek();
60 void selectWeek(const QDate &, const QDate &preferredMonth = QDate());
62 void selectWorkWeek();
63 void selectWorkWeek(const QDate &);
65 void selectWeekByDay(int weekDay, const QDate &, const QDate &preferredMonth = QDate());
67 void selectToday();
69 void selectPreviousYear();
70 void selectPreviousMonth(const QDate &currentMonth = QDate(),
71 const QDate &selectionLowerLimit = QDate(),
72 const QDate &selectionUpperLimit = QDate());
73 void selectPreviousWeek();
74 void selectNextWeek();
75 void selectNextMonth(const QDate &currentMonth = QDate(),
76 const QDate &selectionLowerLimit = QDate(),
77 const QDate &selectionUpperLimit = QDate());
78 void selectNextYear();
80 void selectPrevious();
81 void selectNext();
83 void selectMonth(int month);
84 void selectYear(int year);
86 Q_SIGNALS:
87 /* preferredMonth is useful when the datelist crosses months,
88 if valid, any month-like component should honour it
90 void datesSelected(const KCalCore::DateList &, const QDate &preferredMonth);
92 protected:
93 void emitSelected(const QDate &preferredMonth = QDate());
95 private:
98 Selects next month if offset equals 1, or previous month
99 if offset equals -1.
100 Bigger offsets are accepted.
102 void shiftMonth(const QDate &date,
103 const QDate &selectionLowerLimit,
104 const QDate &selectionUpperLimit,
105 int offset);
107 KCalCore::DateList mSelectedDates;
109 enum {
110 MAX_SELECTABLE_DAYS = 50
114 #endif