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

kalarm/lib

  • sources
  • kde-4.14
  • kdepim
  • kalarm
  • lib
timeperiod.h
Go to the documentation of this file.
1 /*
2  * timeperiod.cpp - time period data entry widget
3  * Program: kalarm
4  * Copyright © 2003-2005,2007,2008,2010 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 TIMEPERIOD_H
22 #define TIMEPERIOD_H
23 
24 #ifdef USE_AKONADI
25 #include <kcalcore/duration.h>
26 #else
27 #include <kcal/duration.h>
28 #endif
29 #include <khbox.h>
30 #include <QString>
31 
32 class QStackedWidget;
33 class ComboBox;
34 class SpinBox;
35 class TimeSpinBox;
36 
37 
55 class TimePeriod : public KHBox
56 {
57  Q_OBJECT
58  public:
65  enum Units { Minutes, HoursMinutes, Days, Weeks };
66 
74  TimePeriod(bool allowMinute, QWidget* parent);
76  bool isReadOnly() const { return mReadOnly; }
81  virtual void setReadOnly(bool readOnly);
83  Units units() const;
87  void setUnits(Units units);
89 #ifdef USE_AKONADI
90  KCalCore::Duration period() const;
91 #else
92  KCal::Duration period() const;
93 #endif
94 
100 #ifdef USE_AKONADI
101  void setPeriod(const KCalCore::Duration& period, bool dateOnly, Units defaultUnits);
102 #else
103  void setPeriod(const KCal::Duration& period, bool dateOnly, Units defaultUnits);
104 #endif
105 
106  bool isDateOnly() const { return mDateOnlyOffset; }
112  void setDateOnly(bool dateOnly) { setDateOnly(period(), dateOnly, true); }
117  void setMaximum(int hourmin, int days);
121  void setSelectOnStep(bool select);
123  void setFocusOnCount();
127  void setWhatsThises(const QString& units, const QString& dayWeek, const QString& hourMin = QString());
128 
129  signals:
133 #ifdef USE_AKONADI
134  void valueChanged(const KCalCore::Duration& period);
135 #else
136  void valueChanged(const KCal::Duration& period);
137 #endif
138 
139  private slots:
140  void slotUnitsSelected(int index);
141  void slotDaysChanged(int);
142  void slotTimeChanged(int minutes);
143 
144  private:
145 #ifdef USE_AKONADI
146  Units setDateOnly(const KCalCore::Duration&, bool dateOnly, bool signal);
147 #else
148  Units setDateOnly(const KCal::Duration&, bool dateOnly, bool signal);
149 #endif
150  void setUnitRange();
151  void showHourMin(bool hourMin);
152  void adjustDayWeekShown();
153 
154  static QString i18n_minutes(); // text of 'minutes' units, lower case
155  static QString i18n_hours_mins(); // text of 'hours/minutes' units
156  static QString i18n_days(); // text of 'days' units
157  static QString i18n_weeks(); // text of 'weeks' units
158 
159  QStackedWidget* mSpinStack; // displays either the days/weeks or hours:minutes spinbox
160  SpinBox* mSpinBox; // the minutes/days/weeks value spinbox
161  TimeSpinBox* mTimeSpinBox; // the hours:minutes value spinbox
162  ComboBox* mUnitsCombo;
163  int mMaxDays; // maximum day count
164  int mDateOnlyOffset; // for mUnitsCombo: 2 if minutes & hours/minutes is disabled, else 0
165  Units mMaxUnitShown; // for mUnitsCombo: maximum units shown
166  bool mNoHourMinute; // hours/minutes cannot be displayed, ever
167  bool mReadOnly; // the widget is read only
168  bool mHourMinuteRaised; // hours:minutes spinbox is currently displayed
169 };
170 
171 #endif // TIMEPERIOD_H
172 
173 // vim: et sw=4:
TimePeriod::setSelectOnStep
void setSelectOnStep(bool select)
Sets whether the editor text is to be selected whenever spin buttons are clicked. ...
Definition: timeperiod.cpp:112
QWidget
TimePeriod::Days
Definition: timeperiod.h:65
TimePeriod::Units
Units
Units for the time period.
Definition: timeperiod.h:65
TimePeriod::period
KCal::Duration period() const
Gets the entered time period.
Definition: timeperiod.cpp:151
TimePeriod::setPeriod
void setPeriod(const KCal::Duration &period, bool dateOnly, Units defaultUnits)
Initialises the time period value.
Definition: timeperiod.cpp:174
TimePeriod::valueChanged
void valueChanged(const KCal::Duration &period)
This signal is emitted whenever the value held in the widget changes.
TimeSpinBox
Hours/minutes time entry widget.
Definition: timespinbox.h:45
TimePeriod::setFocusOnCount
void setFocusOnCount()
Sets the input focus to the count field.
Definition: timeperiod.cpp:121
TimePeriod::HoursMinutes
Definition: timeperiod.h:65
TimePeriod::TimePeriod
TimePeriod(bool allowMinute, QWidget *parent)
Constructor.
Definition: timeperiod.cpp:52
TimePeriod::setUnits
void setUnits(Units units)
Sets the time units.
Definition: timeperiod.cpp:336
TimePeriod
Time period entry widget.
Definition: timeperiod.h:55
TimePeriod::isReadOnly
bool isReadOnly() const
Returns true if the widget is read only.
Definition: timeperiod.h:76
QStackedWidget
QString
TimePeriod::setWhatsThises
void setWhatsThises(const QString &units, const QString &dayWeek, const QString &hourMin=QString())
Sets separate WhatsThis texts for the count spin boxes and the units combo box.
Definition: timeperiod.cpp:419
SpinBox
Spin box with accelerated shift key stepping and read-only option.
Definition: spinbox.h:44
TimePeriod::setReadOnly
virtual void setReadOnly(bool readOnly)
Sets whether the widget is read-only for the user.
Definition: timeperiod.cpp:97
TimePeriod::setDateOnly
void setDateOnly(bool dateOnly)
Enables or disables minutes and hours/minutes units in the combo box.
Definition: timeperiod.h:112
TimePeriod::isDateOnly
bool isDateOnly() const
Returns true if minutes and hours/minutes units are disabled.
Definition: timeperiod.h:106
TimePeriod::Weeks
Definition: timeperiod.h:65
KHBox
ComboBox
A KComboBox with read-only option.
Definition: combobox.h:39
TimePeriod::setMaximum
void setMaximum(int hourmin, int days)
Sets the maximum values for the minutes and hours/minutes, and days/weeks spin boxes.
Definition: timeperiod.cpp:130
TimePeriod::Minutes
Definition: timeperiod.h:65
TimePeriod::units
Units units() const
Gets the currently selected time units.
Definition: timeperiod.cpp:360
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:35:02 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kalarm/lib

Skip menu "kalarm/lib"
  • 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