Fix dnd email
[kdepim.git] / kalarm / timeselector.h
blobf1b8a61f61b36f7894a9247d9f83f0b830307e3b
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 CheckBox;
28 class ComboBox;
31 class TimeSelector : public QFrame
33 Q_OBJECT
34 public:
35 TimeSelector(const QString& selectText, const QString& selectWhatsThis,
36 const QString& valueWhatsThis, bool allowHourMinute, QWidget* parent);
37 ComboBox* createSignCombo();
38 bool isChecked() const;
39 void setChecked(bool on);
40 KCalCore::Duration period() const;
41 void setPeriod(const KCalCore::Duration&, bool dateOnly, TimePeriod::Units defaultUnits);
42 TimePeriod::Units units() const { return mPeriod->units(); }
43 void setUnits(TimePeriod::Units units) { mPeriod->setUnits(units); }
44 void setReadOnly(bool);
45 bool isDateOnly() const { return mPeriod->isDateOnly(); }
46 void setDateOnly(bool dateOnly = true);
47 void setMaximum(int hourmin, int days);
48 void setFocusOnCount();
50 Q_SIGNALS:
51 void toggled(bool); // selection checkbox has been toggled
52 void valueChanged(const KCalCore::Duration&); // value has changed
54 protected Q_SLOTS:
55 void selectToggled(bool);
56 void periodChanged(const KCalCore::Duration&);
58 private:
59 CheckBox* mSelect;
60 TimePeriod* mPeriod;
61 ComboBox* mSignWidget;
62 bool mReadOnly; // the widget is read only
65 #endif // TIMESELECTOR_H
67 // vim: et sw=4: