• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

kalarm

  • sources
  • kde-4.14
  • kdepim
  • kalarm
recurrenceedit_p.h
Go to the documentation of this file.
1 /*
2  * recurrenceedit_p.h - private classes for recurrenceedit.cpp
3  * Program: kalarm
4  * Copyright © 2003,2005,2007,2009-2011 by David Jarvie <djarvie@kde.org>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program 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
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef RECURRENCEEDIT_P_H
22 #define RECURRENCEEDIT_P_H
23 
24 #include "radiobutton.h"
25 
26 #include <kalarmcal/karecurrence.h>
27 
28 #include <QList>
29 #include <QVector>
30 #include <QFrame>
31 #include <QBitArray>
32 #include <QAbstractButton>
33 
34 class QLabel;
35 class QWidget;
36 class QVBoxLayout;
37 class ButtonGroup;
38 class ComboBox;
39 class CheckBox;
40 class SpinBox;
41 class TimeSpinBox;
42 class QString;
43 
44 using namespace KAlarmCal;
45 
46 
47 class NoRule : public QFrame
48 {
49  Q_OBJECT
50  public:
51  explicit NoRule(QWidget* parent) : QFrame(parent) { }
52  virtual int frequency() const { return 0; }
53 };
54 
55 class Rule : public NoRule
56 {
57  Q_OBJECT
58  public:
59  Rule(const QString& freqText, const QString& freqWhatsThis, bool time, bool readOnly,
60  QWidget* parent);
61  int frequency() const;
62  void setFrequency(int);
63  virtual void setFrequencyFocus() { mSpinBox->setFocus(); }
64  QVBoxLayout* layout() const { return mLayout; }
65  virtual QWidget* validate(QString&) { return 0; }
66  virtual void saveState();
67  virtual bool stateChanged() const;
68 
69  signals:
70  void frequencyChanged();
71  void changed(); // emitted whenever any control changes
72 
73  private:
74  QWidget* mSpinBox;
75  SpinBox* mIntSpinBox;
76  TimeSpinBox* mTimeSpinBox;
77  QVBoxLayout* mLayout;
78  // Saved state of all controls
79  int mSavedFrequency; // frequency for the selected rule
80 };
81 
82 // Subdaily rule choices
83 class SubDailyRule : public Rule
84 {
85  Q_OBJECT
86  public:
87  SubDailyRule(bool readOnly, QWidget* parent);
88 };
89 
90 // Daily/weekly rule choices base class
91 class DayWeekRule : public Rule
92 {
93  Q_OBJECT
94  public:
95  DayWeekRule(const QString& freqText, const QString& freqWhatsThis, const QString& daysWhatsThis,
96  bool readOnly, QWidget* parent);
97  QBitArray days() const;
98  void setDays(bool);
99  void setDays(const QBitArray& days);
100  void setDay(int dayOfWeek);
101  virtual QWidget* validate(QString& errorMessage);
102  virtual void saveState();
103  virtual bool stateChanged() const;
104 
105  private:
106  CheckBox* mDayBox[7];
107  // Saved state of all controls
108  QBitArray mSavedDays; // ticked days for weekly rule
109 };
110 
111 // Daily rule choices
112 class DailyRule : public DayWeekRule
113 {
114  Q_OBJECT
115  public:
116  DailyRule(bool readOnly, QWidget* parent);
117 };
118 
119 // Weekly rule choices
120 class WeeklyRule : public DayWeekRule
121 {
122  Q_OBJECT
123  public:
124  WeeklyRule(bool readOnly, QWidget* parent);
125 };
126 
127 // Monthly/yearly rule choices base class
128 class MonthYearRule : public Rule
129 {
130  Q_OBJECT
131  public:
132  enum DayPosType { DATE, POS };
133 
134  MonthYearRule(const QString& freqText, const QString& freqWhatsThis, bool allowEveryWeek,
135  bool readOnly, QWidget* parent);
136  DayPosType type() const;
137  int date() const; // if date in month is selected
138  int week() const; // if position is selected
139  int dayOfWeek() const; // if position is selected
140  void setType(DayPosType);
141  void setDate(int dayOfMonth);
142  void setPosition(int week, int dayOfWeek);
143  void setDefaultValues(int dayOfMonth, int dayOfWeek);
144  virtual void saveState();
145  virtual bool stateChanged() const;
146 
147  signals:
148  void typeChanged(DayPosType);
149 
150  protected:
151  DayPosType buttonType(QAbstractButton* b) const { return b == mDayButton ? DATE : POS; }
152  virtual void daySelected(int /*day*/) { }
153 
154  protected slots:
155  virtual void clicked(QAbstractButton*);
156 
157  private slots:
158  virtual void slotDaySelected(int index);
159 
160  private:
161  void enableSelection(DayPosType);
162 
163  ButtonGroup* mButtonGroup;
164  RadioButton* mDayButton;
165  RadioButton* mPosButton;
166  ComboBox* mDayCombo;
167  ComboBox* mWeekCombo;
168  ComboBox* mDayOfWeekCombo;
169  bool mEveryWeek; // "Every" week is allowed
170  // Saved state of all controls
171  int mSavedType; // whether day-of-month or month position radio button was selected
172  int mSavedDay; // chosen day of month selected item
173  int mSavedWeek; // chosen month position: selected week item
174  int mSavedWeekDay; // chosen month position: selected day of week
175 };
176 
177 // Monthly rule choices
178 class MonthlyRule : public MonthYearRule
179 {
180  Q_OBJECT
181  public:
182  MonthlyRule(bool readOnly, QWidget* parent);
183 };
184 
185 // Yearly rule choices
186 class YearlyRule : public MonthYearRule
187 {
188  Q_OBJECT
189  public:
190  YearlyRule(bool readOnly, QWidget* parent);
191  QVector<int> months() const;
192  void setMonths(const QList<int>& months);
193  void setDefaultValues(int dayOfMonth, int dayOfWeek, int month);
194  KARecurrence::Feb29Type feb29Type() const;
195  void setFeb29Type(KARecurrence::Feb29Type);
196  virtual QWidget* validate(QString& errorMessage);
197  virtual void saveState();
198  virtual bool stateChanged() const;
199 
200  protected:
201  virtual void daySelected(int day);
202 
203  protected slots:
204  virtual void clicked(QAbstractButton*);
205 
206  private slots:
207  void enableFeb29();
208 
209  private:
210  CheckBox* mMonthBox[12];
211  QLabel* mFeb29Label;
212  ComboBox* mFeb29Combo;
213  // Saved state of all controls
214  QVector<int> mSavedMonths; // ticked months for yearly rule
215  int mSavedFeb29Type; // February 29th recurrence type
216 };
217 
218 #endif // RECURRENCEEDIT_P_H
219 
220 // vim: et sw=4:
saveState
KDEPIM_EXPORT void saveState(QWidget *widget, KConfigGroup &config)
QWidget
TimeSpinBox
RadioButton
date
time_t date() const
SubDailyRule
Definition: recurrenceedit_p.h:83
MonthYearRule::daySelected
virtual void daySelected(int)
Definition: recurrenceedit_p.h:152
YearlyRule
Definition: recurrenceedit_p.h:186
CheckBox
NoRule::NoRule
NoRule(QWidget *parent)
Definition: recurrenceedit_p.h:51
DailyRule
Definition: recurrenceedit_p.h:112
NoRule
Definition: recurrenceedit_p.h:47
QVBoxLayout
QString
QList
Rule::setFrequencyFocus
virtual void setFrequencyFocus()
Definition: recurrenceedit_p.h:63
QBitArray
MonthYearRule
Definition: recurrenceedit_p.h:128
Rule
Definition: recurrenceedit_p.h:55
SpinBox
MonthYearRule::DayPosType
DayPosType
Definition: recurrenceedit_p.h:132
QFrame
Rule::validate
virtual QWidget * validate(QString &)
Definition: recurrenceedit_p.h:65
QAbstractButton
WeeklyRule
Definition: recurrenceedit_p.h:120
QVector< int >
MonthYearRule::buttonType
DayPosType buttonType(QAbstractButton *b) const
Definition: recurrenceedit_p.h:151
Rule::layout
QVBoxLayout * layout() const
Definition: recurrenceedit_p.h:64
MonthlyRule
Definition: recurrenceedit_p.h:178
ComboBox
QLabel
DayWeekRule
Definition: recurrenceedit_p.h:91
radiobutton.h
NoRule::frequency
virtual int frequency() const
Definition: recurrenceedit_p.h:52
ButtonGroup
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:34:51 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kalarm

Skip menu "kalarm"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal