Factor out the shared parts of the agent action manager setup.
[kdepim.git] / kalarm / timeselector.h
blob7878267ac464d5fbfcff7ca040dcf71ca4e34149
1 /*
2 * timeselector.h - widget to optionally set a time period
3 * Program: kalarm
4 * Copyright © 2004,2005,2007,2008,2010,2011 by David Jarvie <djarvie@kde.org>
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.
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.
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.
21 #ifndef TIMESELECTOR_H
22 #define TIMESELECTOR_H
24 #include "timeperiod.h"
25 #include <QFrame>
27 class QLabel;
28 class CheckBox;
29 class ComboBox;
32 class TimeSelector : public QFrame
34 Q_OBJECT
35 public:
36 TimeSelector(const QString& selectText, const QString& selectWhatsThis,
37 const QString& valueWhatsThis, bool allowHourMinute, QWidget* parent);
38 ComboBox* createSignCombo();
39 bool isChecked() const;
40 void setChecked(bool on);
41 #ifdef USE_AKONADI
42 KCalCore::Duration period() const;
43 void setPeriod(const KCalCore::Duration&, bool dateOnly, TimePeriod::Units defaultUnits);
44 #else
45 KCal::Duration period() const;
46 void setPeriod(const KCal::Duration&, bool dateOnly, TimePeriod::Units defaultUnits);
47 #endif
48 TimePeriod::Units units() const { return mPeriod->units(); }
49 void setUnits(TimePeriod::Units units) { mPeriod->setUnits(units); }
50 void setReadOnly(bool);
51 bool isDateOnly() const { return mPeriod->isDateOnly(); }
52 void setDateOnly(bool dateOnly = true);
53 void setMaximum(int hourmin, int days);
54 void setFocusOnCount();
56 signals:
57 void toggled(bool); // selection checkbox has been toggled
58 #ifdef USE_AKONADI
59 void valueChanged(const KCalCore::Duration&); // value has changed
60 #else
61 void valueChanged(const KCal::Duration&); // value has changed
62 #endif
64 protected slots:
65 void selectToggled(bool);
66 #ifdef USE_AKONADI
67 void periodChanged(const KCalCore::Duration&);
68 #else
69 void periodChanged(const KCal::Duration&);
70 #endif
72 private:
73 CheckBox* mSelect;
74 TimePeriod* mPeriod;
75 ComboBox* mSignWidget;
76 bool mReadOnly; // the widget is read only
79 #endif // TIMESELECTOR_H
81 // vim: et sw=4: