1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2015 The Qt Company Ltd. |
4 | ** Contact: http://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the QtOrganizer module of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL21$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see http://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at http://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 2.1 or version 3 as published by the Free |
20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and |
21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the |
22 | ** following information to ensure the GNU Lesser General Public License |
23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and |
24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
25 | ** |
26 | ** As a special exception, The Qt Company gives you certain additional |
27 | ** rights. These rights are described in The Qt Company LGPL Exception |
28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
29 | ** |
30 | ** $QT_END_LICENSE$ |
31 | ** |
32 | ****************************************************************************/ |
33 | |
34 | #ifndef QDECLARATIVEORGANIZERITEMRECURRENCERULE_H |
35 | #define QDECLARATIVEORGANIZERITEMRECURRENCERULE_H |
36 | |
37 | #include <QtQml/qqml.h> |
38 | |
39 | #include <QtOrganizer/qorganizerrecurrencerule.h> |
40 | |
41 | QTORGANIZER_USE_NAMESPACE |
42 | |
43 | QT_BEGIN_NAMESPACE |
44 | |
45 | class QDeclarativeOrganizerRecurrenceRule : public QObject |
46 | { |
47 | Q_OBJECT |
48 | Q_ENUMS(Frequency) |
49 | Q_ENUMS(Month) |
50 | Q_PROPERTY(Frequency frequency READ frequency WRITE setFrequency NOTIFY recurrenceRuleChanged) |
51 | Q_PROPERTY(QVariant limit READ limit WRITE setLimit NOTIFY recurrenceRuleChanged) |
52 | Q_PROPERTY(int interval READ interval WRITE setInterval NOTIFY recurrenceRuleChanged) |
53 | Q_PROPERTY(QVariantList daysOfWeek READ daysOfWeek WRITE setDaysOfWeek NOTIFY recurrenceRuleChanged) |
54 | Q_PROPERTY(QVariantList daysOfMonth READ daysOfMonth WRITE setDaysOfMonth NOTIFY recurrenceRuleChanged) |
55 | Q_PROPERTY(QVariantList daysOfYear READ daysOfYear WRITE setDaysOfYear NOTIFY recurrenceRuleChanged) |
56 | Q_PROPERTY(QVariantList monthsOfYear READ monthsOfYear WRITE setMonthsOfYear NOTIFY recurrenceRuleChanged) |
57 | Q_PROPERTY(QVariantList positions READ positions WRITE setPositions NOTIFY recurrenceRuleChanged) |
58 | Q_PROPERTY(Qt::DayOfWeek firstDayOfWeek READ firstDayOfWeek WRITE setFirstDayOfWeek NOTIFY recurrenceRuleChanged) |
59 | |
60 | public: |
61 | enum Frequency { |
62 | Invalid = QOrganizerRecurrenceRule::Invalid, |
63 | Daily = QOrganizerRecurrenceRule::Daily, |
64 | Weekly = QOrganizerRecurrenceRule::Weekly, |
65 | Monthly = QOrganizerRecurrenceRule::Monthly, |
66 | Yearly = QOrganizerRecurrenceRule::Yearly |
67 | }; |
68 | |
69 | enum Month { |
70 | January = QOrganizerRecurrenceRule::January, |
71 | February = QOrganizerRecurrenceRule::February, |
72 | March = QOrganizerRecurrenceRule::March, |
73 | April = QOrganizerRecurrenceRule::April, |
74 | May = QOrganizerRecurrenceRule::May, |
75 | June = QOrganizerRecurrenceRule::June, |
76 | July = QOrganizerRecurrenceRule::July, |
77 | August = QOrganizerRecurrenceRule::August, |
78 | September = QOrganizerRecurrenceRule::September, |
79 | October = QOrganizerRecurrenceRule::October, |
80 | November = QOrganizerRecurrenceRule::November, |
81 | December = QOrganizerRecurrenceRule::December |
82 | }; |
83 | |
84 | QDeclarativeOrganizerRecurrenceRule(QObject *parent = Q_NULLPTR); |
85 | |
86 | void setFrequency(Frequency freq); |
87 | Frequency frequency() const; |
88 | |
89 | void setLimit(const QVariant &value); |
90 | QVariant limit() const; |
91 | |
92 | void setInterval(int interval); |
93 | int interval() const; |
94 | |
95 | void setDaysOfWeek(const QVariantList &days); |
96 | QVariantList daysOfWeek() const; |
97 | |
98 | void setDaysOfMonth(const QVariantList &days); |
99 | QVariantList daysOfMonth() const; |
100 | |
101 | void setDaysOfYear(const QVariantList &days); |
102 | QVariantList daysOfYear() const; |
103 | |
104 | void setMonthsOfYear(const QVariantList &months); |
105 | QVariantList monthsOfYear() const; |
106 | |
107 | void setWeeksOfYear(const QVariantList &weeks); |
108 | QVariantList weeksOfYear() const; |
109 | |
110 | void setPositions(const QVariantList &pos); |
111 | QVariantList positions() const; |
112 | |
113 | void setFirstDayOfWeek(Qt::DayOfWeek day); |
114 | Qt::DayOfWeek firstDayOfWeek() const; |
115 | |
116 | // used by recurrence detail |
117 | QOrganizerRecurrenceRule rule() const; |
118 | void setRule(const QOrganizerRecurrenceRule &rule); |
119 | |
120 | Q_SIGNALS: |
121 | void recurrenceRuleChanged(); |
122 | |
123 | private: |
124 | QOrganizerRecurrenceRule m_rule; |
125 | }; |
126 | |
127 | QT_END_NAMESPACE |
128 | |
129 | QML_DECLARE_TYPE(QDeclarativeOrganizerRecurrenceRule) |
130 | |
131 | #endif // QDECLARATIVEORGANIZERITEMRECURRENCERULE_H |
132 | |