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

KDEUI

  • sources
  • kde-4.12
  • kdelibs
  • kdeui
  • widgets
kdatetimeedit.cpp
Go to the documentation of this file.
1 /*
2  Copyright 2011 John Layt <john@layt.net>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License as published by the Free Software Foundation; either
7  version 2 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #include "kdatetimeedit.h"
21 
22 #include <QtCore/QStringList>
23 #include <QtGui/QKeyEvent>
24 #include <QtGui/QMenu>
25 #include <QtGui/QLineEdit>
26 #include <QtGui/QWidgetAction>
27 
28 #include "kdebug.h"
29 #include "kdatetime.h"
30 #include "ksystemtimezone.h"
31 #include "kcalendarsystem.h"
32 #include "kcombobox.h"
33 #include "kdatepicker.h"
34 #include "kdatecombobox.h"
35 #include "kmessagebox.h"
36 
37 #include "ui_kdatetimeedit.h"
38 
39 class KDateTimeEditPrivate
40 {
41 public:
42  KDateTimeEditPrivate(KDateTimeEdit *q);
43  virtual ~KDateTimeEditPrivate();
44 
45  const KCalendarSystem *calendar() const;
46 
47  KDateTime defaultMinDateTime();
48  KDateTime defaultMaxDateTime();
49 
50  void initWidgets();
51  void initDateWidget();
52  void initTimeWidget();
53  void initCalendarWidget();
54  void updateCalendarWidget();
55  void initTimeSpecWidget();
56  void updateTimeSpecWidget();
57 
58  void warnDateTime();
59 
60 //private slots:
61  void selectCalendar(int index);
62  void enterCalendar(KLocale::CalendarSystem calendarSystem);
63  void selectTimeZone(int index);
64  void enterTimeZone(const QString &zone);
65 
66  KDateTimeEdit *const q;
67 
68  KDateTimeEdit::Options m_options;
69  KDateTime m_dateTime;
70  KDateTime m_minDateTime;
71  KDateTime m_maxDateTime;
72  QString m_minWarnMsg;
73  QString m_maxWarnMsg;
74 
75  QList<KLocale::CalendarSystem> m_calendarSystems;
76  KTimeZones::ZoneMap m_zones;
77 
78  Ui::KDateTimeEdit ui;
79 };
80 
81 KDateTimeEditPrivate::KDateTimeEditPrivate(KDateTimeEdit *q)
82  :q(q)
83 {
84  m_options = KDateTimeEdit::ShowDate | KDateTimeEdit::EditDate | KDateTimeEdit::SelectDate |
85  KDateTimeEdit::ShowTime | KDateTimeEdit::EditTime | KDateTimeEdit::SelectTime |
86  KDateTimeEdit::DatePicker | KDateTimeEdit::DateKeywords;
87  m_dateTime = KDateTime::currentLocalDateTime();
88  m_dateTime.setTime(QTime(0, 0, 0));
89  m_calendarSystems = KCalendarSystem::calendarSystemsList();
90  m_zones = KSystemTimeZones::zones();
91 }
92 
93 KDateTimeEditPrivate::~KDateTimeEditPrivate()
94 {
95 }
96 
97 const KCalendarSystem *KDateTimeEditPrivate::calendar() const
98 {
99  return ui.m_dateCombo->calendar();
100 }
101 
102 KDateTime KDateTimeEditPrivate::defaultMinDateTime()
103 {
104  return KDateTime(calendar()->earliestValidDate(), QTime(0, 0, 0, 0));
105 }
106 
107 KDateTime KDateTimeEditPrivate::defaultMaxDateTime()
108 {
109  return KDateTime(calendar()->latestValidDate(), QTime(23, 59, 59, 999));
110 }
111 
112 void KDateTimeEditPrivate::initWidgets()
113 {
114  initDateWidget();
115  initTimeWidget();
116  initCalendarWidget();
117  initTimeSpecWidget();
118 }
119 
120 void KDateTimeEditPrivate::initDateWidget()
121 {
122  ui.m_dateCombo->blockSignals(true);
123  ui.m_dateCombo->setVisible((m_options &KDateTimeEdit::ShowDate) == KDateTimeEdit::ShowDate);
124  KDateComboBox::Options options;
125  if ((m_options & KDateTimeEdit::EditDate) == KDateTimeEdit::EditDate) {
126  options = options | KDateComboBox::EditDate;
127  }
128  if ((m_options & KDateTimeEdit::SelectDate) == KDateTimeEdit::SelectDate) {
129  options = options | KDateComboBox::SelectDate;
130  }
131  if ((m_options & KDateTimeEdit::DatePicker) == KDateTimeEdit::DatePicker) {
132  options = options | KDateComboBox::DatePicker;
133  }
134  if ((m_options & KDateTimeEdit::DateKeywords) == KDateTimeEdit::DateKeywords) {
135  options = options | KDateComboBox::DateKeywords;
136  }
137  ui.m_dateCombo->setOptions(options);
138  ui.m_dateCombo->blockSignals(false);
139 }
140 
141 void KDateTimeEditPrivate::initTimeWidget()
142 {
143  ui.m_timeCombo->blockSignals(true);
144  ui.m_timeCombo->setVisible((m_options &KDateTimeEdit::ShowTime) == KDateTimeEdit::ShowTime);
145  KTimeComboBox::Options options;
146  if ((m_options &KDateTimeEdit::EditTime) == KDateTimeEdit::EditTime) {
147  options = options | KTimeComboBox::EditTime;
148  }
149  if ((m_options &KDateTimeEdit::SelectTime) == KDateTimeEdit::SelectTime) {
150  options = options | KTimeComboBox::SelectTime;
151  }
152  if ((m_options &KDateTimeEdit::ForceTime) == KDateTimeEdit::ForceTime) {
153  options = options | KTimeComboBox::ForceTime;
154  }
155  ui.m_timeCombo->setOptions(options);
156  ui.m_timeCombo->blockSignals(false);
157 }
158 
159 void KDateTimeEditPrivate::initCalendarWidget()
160 {
161  ui.m_calendarCombo->blockSignals(true);
162  ui.m_calendarCombo->clear();
163  foreach (KLocale::CalendarSystem calendar, m_calendarSystems) {
164  ui.m_calendarCombo->addItem(KCalendarSystem::calendarLabel(calendar), calendar);
165  }
166  ui.m_calendarCombo->setCurrentIndex(ui.m_calendarCombo->findData(ui.m_dateCombo->calendarSystem()));
167  ui.m_calendarCombo->setVisible((m_options &KDateTimeEdit::ShowCalendar) == KDateTimeEdit::ShowCalendar);
168  ui.m_calendarCombo->setEnabled((m_options &KDateTimeEdit::SelectCalendar) == KDateTimeEdit::SelectCalendar);
169  ui.m_calendarCombo->setEditable(false);
170  ui.m_calendarCombo->blockSignals(false);
171 }
172 
173 void KDateTimeEditPrivate::updateCalendarWidget()
174 {
175  ui.m_calendarCombo->blockSignals(true);
176  ui.m_calendarCombo->setCurrentIndex(ui.m_calendarCombo->findData(ui.m_dateCombo->calendarSystem()));
177  ui.m_calendarCombo->blockSignals(false);
178 }
179 
180 void KDateTimeEditPrivate::selectCalendar(int index)
181 {
182  enterCalendar((KLocale::CalendarSystem) ui.m_calendarCombo->itemData(index).toInt());
183 }
184 
185 void KDateTimeEditPrivate::enterCalendar(KLocale::CalendarSystem calendarSystem)
186 {
187  q->setCalendarSystem(calendarSystem);
188  emit q->calendarEntered(ui.m_dateCombo->calendarSystem());
189 }
190 
191 void KDateTimeEditPrivate::initTimeSpecWidget()
192 {
193  ui.m_timeSpecCombo->blockSignals(true);
194  ui.m_timeSpecCombo->clear();
195  ui.m_timeSpecCombo->addItem(i18nc("UTC time zone", "UTC"), "UTC");
196  ui.m_timeSpecCombo->addItem(i18nc("No specific time zone", "Floating"), "Floating");
197  QStringList keys = m_zones.keys();
198  QMap<QString, QString> names;
199  foreach (const QString &key, keys) {
200  names.insert(i18n(key.toUtf8()).replace('_', ' '), key);
201  }
202  QMapIterator<QString, QString> i(names);
203  while (i.hasNext()) {
204  i.next();
205  ui.m_timeSpecCombo->addItem(i.key(), i.value());
206  }
207  ui.m_timeSpecCombo->setVisible((m_options &KDateTimeEdit::ShowTimeSpec) == KDateTimeEdit::ShowTimeSpec);
208  ui.m_timeSpecCombo->setEnabled((m_options &KDateTimeEdit::SelectTimeSpec) == KDateTimeEdit::SelectTimeSpec);
209  ui.m_timeSpecCombo->setEditable(false);
210  ui.m_timeSpecCombo->blockSignals(false);
211 }
212 
213 void KDateTimeEditPrivate::updateTimeSpecWidget()
214 {
215  ui.m_timeSpecCombo->blockSignals(true);
216  ui.m_timeSpecCombo->blockSignals(false);
217 }
218 
219 void KDateTimeEditPrivate::selectTimeZone(int index)
220 {
221  enterTimeZone(ui.m_timeCombo->itemData(index).toString());
222 }
223 
224 void KDateTimeEditPrivate::enterTimeZone(const QString &zone)
225 {
226  q->setTimeSpec(m_zones.value(zone));
227  emit q->dateTimeEntered(m_dateTime);
228  emit q->timeSpecEntered(m_dateTime.timeSpec());
229 }
230 
231 void KDateTimeEditPrivate::warnDateTime()
232 {
233  if (!q->isValid() &&
234  (m_options &KDateTimeEdit::WarnOnInvalid) == KDateTimeEdit::WarnOnInvalid) {
235  QString warnMsg;
236  if (!m_dateTime.isValid()) {
237  //TODO Add missing string
238  //warnMsg = i18n("The date or time you entered is invalid");
239  } else if (m_dateTime < m_minDateTime) {
240  if (m_minWarnMsg.isEmpty()) {
241  //TODO Add datetime to string
242  //warnMsg = i18nc("@info", "Date and time cannot be earlier than %1", formatDate(m_minDate));
243  warnMsg = i18nc("@info", "The entered date and time is before the minimum allowed date and time.");
244  } else {
245  warnMsg = m_minWarnMsg;
246  //TODO localize properly
247  warnMsg.replace("%1", KGlobal::locale()->formatDateTime(m_minDateTime));
248  }
249  } else if (m_dateTime > m_maxDateTime) {
250  if (m_maxWarnMsg.isEmpty()) {
251  //TODO Add datetime to string
252  //warnMsg = i18nc("@info", "Date cannot be later than %1", formatDate(m_maxDate));
253  warnMsg = i18nc("@info", "The entered date and time is after the maximum allowed date and time.");
254  } else {
255  warnMsg = m_maxWarnMsg;
256  warnMsg.replace("%1", KGlobal::locale()->formatDateTime(m_maxDateTime));
257  }
258  }
259  KMessageBox::sorry(q, warnMsg);
260  }
261 }
262 
263 
264 KDateTimeEdit::KDateTimeEdit(QWidget *parent)
265  :QWidget(parent),
266  d(new KDateTimeEditPrivate(this))
267 {
268  KGlobal::locale()->insertCatalog("timezones4");
269  d->ui.setupUi(this);
270  //Need to do the min/max defaults here and not in private init as need to wait for ui to init
271  //the KDateComboBox which holds the calendar object. Revisit this???
272  d->m_minDateTime = d->defaultMinDateTime();
273  d->m_maxDateTime = d->defaultMaxDateTime();
274  d->ui.m_calendarCombo->installEventFilter(this);
275  d->ui.m_dateCombo->installEventFilter(this);
276  d->ui.m_timeCombo->installEventFilter(this);
277  d->ui.m_timeSpecCombo->installEventFilter(this);
278  d->initWidgets();
279 
280  connect( d->ui.m_calendarCombo, SIGNAL(activated(int)),
281  this, SLOT(selectCalendar(int)));
282  connect( d->ui.m_timeSpecCombo, SIGNAL(activated(int)),
283  this, SLOT(selectTimeZone(int)));
284 }
285 
286 KDateTimeEdit::~KDateTimeEdit()
287 {
288  delete d;
289 }
290 
291 KDateTime KDateTimeEdit::dateTime() const
292 {
293  return d->m_dateTime;
294 }
295 
296 KLocale::CalendarSystem KDateTimeEdit::calendarSystem() const
297 {
298  return d-> ui.m_dateCombo->calendarSystem();
299 }
300 
301 QDate KDateTimeEdit::date() const
302 {
303  return d->m_dateTime.date();
304 }
305 
306 QTime KDateTimeEdit::time() const
307 {
308  return d->m_dateTime.time();
309 }
310 
311 KDateTime::Spec KDateTimeEdit::timeSpec() const
312 {
313  return d->m_dateTime.timeSpec();
314 }
315 
316 bool KDateTimeEdit::isValid() const
317 {
318  return d->m_dateTime.isValid() &&
319  d->m_dateTime >= d->m_minDateTime &&
320  d->m_dateTime <= d->m_maxDateTime;
321 }
322 
323 bool KDateTimeEdit::isNull() const
324 {
325  return isNullDate() && isNullTime();
326 }
327 
328 bool KDateTimeEdit::isValidDate() const
329 {
330  return d->ui.m_dateCombo->isValid();
331 }
332 
333 bool KDateTimeEdit::isNullDate() const
334 {
335  return d->ui.m_dateCombo->isNull();
336 }
337 
338 bool KDateTimeEdit::isValidTime() const
339 {
340  return d->ui.m_timeCombo->isValid();
341 }
342 
343 bool KDateTimeEdit::isNullTime() const
344 {
345  return d->ui.m_timeCombo->isNull();
346 }
347 
348 void KDateTimeEdit::setOptions(Options options)
349 {
350  if (options != d->m_options) {
351  d->m_options = options;
352  d->initWidgets();
353  }
354 }
355 
356 KDateTimeEdit::Options KDateTimeEdit::options() const
357 {
358  return d->m_options;
359 }
360 
361 void KDateTimeEdit::setDateTime(const KDateTime &dateTime)
362 {
363  if (dateTime != d->m_dateTime) {
364  assignDateTime(dateTime);
365  emit dateTimeChanged(d->m_dateTime);
366  emit dateChanged(d->m_dateTime.date());
367  emit timeChanged(d->m_dateTime.time());
368  }
369 }
370 
371 void KDateTimeEdit::assignDateTime(const KDateTime &dateTime)
372 {
373  d->m_dateTime = dateTime;
374  d->ui.m_dateCombo->setDate(dateTime.date());
375  d->ui.m_timeCombo->setTime(dateTime.time());
376 }
377 
378 void KDateTimeEdit::setDate(const QDate &date)
379 {
380  if (date != d->m_dateTime.date()) {
381  assignDate(date);
382  emit dateTimeChanged(d->m_dateTime);
383  emit dateChanged(d->m_dateTime.date());
384  }
385 }
386 
387 void KDateTimeEdit::assignDate(const QDate &date)
388 {
389  d->m_dateTime.setDate(date);
390  d->ui.m_dateCombo->setDate(date);
391 }
392 
393 void KDateTimeEdit::setCalendarSystem(KLocale::CalendarSystem calendarSystem)
394 {
395  if (calendarSystem == d->ui.m_dateCombo->calendarSystem() ||
396  !d->m_calendarSystems.contains(calendarSystem)) {
397  return;
398  }
399 
400  assignCalendarSystem(calendarSystem);
401  emit calendarChanged(d->ui.m_dateCombo->calendarSystem());
402 }
403 
404 void KDateTimeEdit::assignCalendarSystem(KLocale::CalendarSystem calendarSystem)
405 {
406  d->ui.m_dateCombo->setCalendarSystem(calendarSystem);
407  d->updateCalendarWidget();
408 }
409 
410 void KDateTimeEdit::setCalendar(KCalendarSystem *calendar)
411 {
412  d->ui.m_dateCombo->setCalendar(calendar);
413  d->updateCalendarWidget();
414 }
415 
416 void KDateTimeEdit::setTime(const QTime &time)
417 {
418  if (time != d->m_dateTime.time()) {
419  assignTime(time);
420  emit dateTimeChanged(d->m_dateTime);
421  emit timeChanged(d->m_dateTime.time());
422  }
423 }
424 
425 void KDateTimeEdit::assignTime(const QTime &time)
426 {
427  d->m_dateTime.setTime(time);
428  d->ui.m_timeCombo->setTime(time);
429 }
430 
431 void KDateTimeEdit::setTimeSpec(const KDateTime::Spec &spec)
432 {
433  if (spec == d->m_dateTime.timeSpec() || !spec.isValid()) {
434  return;
435  }
436 
437  assignTimeSpec(spec);
438  emit dateTimeChanged(d->m_dateTime);
439  emit timeSpecChanged(d->m_dateTime.timeSpec());
440 }
441 
442 void KDateTimeEdit::assignTimeSpec(const KDateTime::Spec &spec)
443 {
444  d->m_dateTime.setTimeSpec(spec);
445  d->updateTimeSpecWidget();
446 }
447 
448 void KDateTimeEdit::setMinimumDateTime(const KDateTime &minDateTime, const QString &minWarnMsg)
449 {
450  setDateTimeRange(minDateTime, maximumDateTime(), minWarnMsg, d->m_maxWarnMsg);
451 }
452 
453 KDateTime KDateTimeEdit::minimumDateTime() const
454 {
455  return d->m_minDateTime;
456 }
457 
458 void KDateTimeEdit::resetMinimumDateTime()
459 {
460  d->m_minDateTime = d->defaultMinDateTime();
461 }
462 
463 void KDateTimeEdit::setMaximumDateTime(const KDateTime &maxDateTime, const QString &maxWarnMsg)
464 {
465  setDateTimeRange(minimumDateTime(), maxDateTime, d->m_minWarnMsg, maxWarnMsg);
466 }
467 
468 KDateTime KDateTimeEdit::maximumDateTime() const
469 {
470  return d->m_maxDateTime;
471 }
472 
473 void KDateTimeEdit::resetMaximumDateTime()
474 {
475  d->m_maxDateTime = d->defaultMaxDateTime();
476 }
477 
478 void KDateTimeEdit::setDateTimeRange(const KDateTime &minDateTime,
479  const KDateTime &maxDateTime,
480  const QString &minErrorMsg,
481  const QString &maxErrorMsg)
482 {
483  if (minDateTime.isValid() &&
484  maxDateTime.isValid() &&
485  minDateTime <= maxDateTime &&
486  d->calendar()->isValid(minDateTime.date()) &&
487  d->calendar()->isValid(maxDateTime.date())) {
488 
489  d->m_minDateTime = minDateTime;
490  d->m_minWarnMsg = minErrorMsg;
491  d->m_maxDateTime = maxDateTime;
492  d->m_maxWarnMsg = maxErrorMsg;
493 
494  }
495 }
496 
497 void KDateTimeEdit::resetDateTimeRange()
498 {
499  setDateTimeRange(d->defaultMinDateTime(), d->defaultMaxDateTime());
500 }
501 
502 void KDateTimeEdit::setCalendarSystemsList(QList<KLocale::CalendarSystem> calendars)
503 {
504  if (calendars != d->m_calendarSystems) {
505  d->m_calendarSystems = calendars;
506  d->updateCalendarWidget();
507  }
508 }
509 
510 QList<KLocale::CalendarSystem> KDateTimeEdit::calendarSystemsList() const
511 {
512  return d->m_calendarSystems;
513 }
514 
515 void KDateTimeEdit::setDateDisplayFormat(KLocale::DateFormat format)
516 {
517  d->ui.m_dateCombo->setDisplayFormat(format);
518 }
519 
520 KLocale::DateFormat KDateTimeEdit::dateDisplayFormat() const
521 {
522  return d->ui.m_dateCombo->displayFormat();
523 }
524 
525 void KDateTimeEdit::setDateMap(QMap<QDate, QString> dateMap)
526 {
527  d->ui.m_dateCombo->setDateMap(dateMap);
528 }
529 
530 QMap<QDate, QString> KDateTimeEdit::dateMap() const
531 {
532  return d->ui.m_dateCombo->dateMap();
533 }
534 
535 void KDateTimeEdit::setTimeDisplayFormat(KLocale::TimeFormatOptions formatOptions)
536 {
537  d->ui.m_timeCombo->setDisplayFormat(formatOptions);
538 }
539 
540 KLocale::TimeFormatOptions KDateTimeEdit::timeDisplayFormat() const
541 {
542  return d->ui.m_timeCombo->displayFormat();
543 }
544 
545 void KDateTimeEdit::setTimeListInterval(int minutes)
546 {
547  d->ui.m_timeCombo->setTimeListInterval(minutes);
548 }
549 
550 int KDateTimeEdit::timeListInterval() const
551 {
552  return d->ui.m_timeCombo->timeListInterval();
553 }
554 
555 void KDateTimeEdit::setTimeList(QList<QTime> timeList,
556  const QString &minWarnMsg,
557  const QString &maxWarnMsg)
558 {
559  d->ui.m_timeCombo->setTimeList(timeList, minWarnMsg, maxWarnMsg);
560 }
561 
562 QList<QTime> KDateTimeEdit::timeList() const
563 {
564  return d->ui.m_timeCombo->timeList();
565 }
566 
567 void KDateTimeEdit::setTimeZones(const KTimeZones::ZoneMap &zones)
568 {
569  if (zones != d->m_zones) {
570  d->m_zones = zones;
571  d->updateTimeSpecWidget();
572  }
573 }
574 
575 KTimeZones::ZoneMap KDateTimeEdit::timeZones() const
576 {
577  return d->m_zones;
578 }
579 
580 bool KDateTimeEdit::eventFilter(QObject *object, QEvent *event)
581 {
582  return QWidget::eventFilter(object, event);
583 }
584 
585 void KDateTimeEdit::focusInEvent(QFocusEvent *event)
586 {
587  QWidget::focusInEvent(event);
588 }
589 
590 void KDateTimeEdit::focusOutEvent(QFocusEvent *event)
591 {
592  d->warnDateTime();
593  QWidget::focusOutEvent(event);
594 }
595 
596 void KDateTimeEdit::resizeEvent(QResizeEvent *event)
597 {
598  QWidget::resizeEvent(event);
599 }
600 
601 #include "kdatetimeedit.moc"
i18n
QString i18n(const char *text)
KDateTimeEdit::setDateDisplayFormat
void setDateDisplayFormat(KLocale::DateFormat format)
Sets the date format to display.
Definition: kdatetimeedit.cpp:515
KDateTimeEdit::focusInEvent
virtual void focusInEvent(QFocusEvent *event)
Definition: kdatetimeedit.cpp:585
kcombobox.h
KDateTimeEdit::isNullTime
bool isNullTime() const
Return if the current user input time is null.
Definition: kdatetimeedit.cpp:343
KDateTimeEdit::dateTimeChanged
void dateTimeChanged(const KDateTime &dateTime)
Signal if the date or time has been changed either manually by the user or programatically.
KDateTimeEdit::assignDateTime
virtual void assignDateTime(const KDateTime &dateTime)
Assign the date, time and time spec for the widget.
Definition: kdatetimeedit.cpp:371
KDateTimeEdit::dateMap
QMap< QDate, QString > dateMap() const
Return the map of dates listed in the drop-down and their displayed string forms. ...
Definition: kdatetimeedit.cpp:530
KDateTime::isValid
bool isValid() const
kdebug.h
KDateTimeEdit::ShowTime
If the Time is displayed.
Definition: kdatetimeedit.h:53
KDateTimeEdit::setTimeListInterval
void setTimeListInterval(int minutes)
Set the interval between times able to be selected from the drop-down.
Definition: kdatetimeedit.cpp:545
KDateComboBox::SelectDate
Allow the user to select the date from a drop-down menu.
Definition: kdatecombobox.h:53
kdatetime.h
KDateTime::currentLocalDateTime
static KDateTime currentLocalDateTime()
KDateTimeEdit::setTimeZones
void setTimeZones(const KTimeZones::ZoneMap &zones)
Set the time zones able to be selected.
Definition: kdatetimeedit.cpp:567
KDateTimeEdit::assignCalendarSystem
void assignCalendarSystem(KLocale::CalendarSystem calendarSystem)
Assign the calendar system for the widget.
Definition: kdatetimeedit.cpp:404
KDateTimeEdit::resetMaximumDateTime
void resetMaximumDateTime()
Reset the minimum date and time to the default.
Definition: kdatetimeedit.cpp:473
KDateTimeEdit::time
QTime time() const
Return the currently selected time.
KDateTimeEdit::setCalendarSystemsList
void setCalendarSystemsList(QList< KLocale::CalendarSystem > calendars)
Set the list of Calendar Systems to display.
Definition: kdatetimeedit.cpp:502
KDateTimeEdit::setTimeList
void setTimeList(QList< QTime > timeList, const QString &minWarnMsg=QString(), const QString &maxWarnMsg=QString())
Set the list of times able to be selected from the drop-down.
Definition: kdatetimeedit.cpp:555
QWidget
KDateTimeEdit::focusOutEvent
virtual void focusOutEvent(QFocusEvent *event)
Definition: kdatetimeedit.cpp:590
KDateTimeEdit
Definition: kdatetimeedit.h:33
KLocale::DateFormat
DateFormat
KSystemTimeZones::zones
static const KTimeZones::ZoneMap zones()
KDateTimeEdit::WarnOnInvalid
Show a warning on focus out if the date or time is invalid.
Definition: kdatetimeedit.h:66
KDateTimeEdit::timeChanged
void timeChanged(const QTime &time)
Signal if the time has been changed either manually by the user or programatically.
kcalendarsystem.h
KDateTimeEdit::minimumDateTime
KDateTime minimumDateTime() const
Return the current minimum date and time.
Definition: kdatetimeedit.cpp:453
QString
KDateTimeEdit::dateChanged
void dateChanged(const QDate &date)
Signal if the date has been changed either manually by the user or programatically.
KDateTimeEdit::calendarEntered
void calendarEntered(KLocale::CalendarSystem calendarSystem)
Signal if the Calendar System has been manually entered by the user.
KDateTimeEdit::setTime
void setTime(const QTime &time)
Set the currently selected time.
Definition: kdatetimeedit.cpp:416
KDateTimeEdit::calendarChanged
void calendarChanged(KLocale::CalendarSystem calendarSystem)
Signal if the Calendar System has been changed either manually by the user or programatically.
KTimeComboBox::EditTime
Allow the user to manually edit the time in the combo line edit.
Definition: ktimecombobox.h:51
KDateTimeEdit::timeDisplayFormat
KLocale::TimeFormatOptions timeDisplayFormat() const
Return the currently set time format.
Definition: kdatetimeedit.cpp:540
QObject
KDateTimeEdit::setMaximumDateTime
void setMaximumDateTime(const KDateTime &maxDateTime, const QString &maxWarnMsg=QString())
Set the maximum allowed date.
Definition: kdatetimeedit.cpp:463
KDateTimeEdit::dateTimeEntered
void dateTimeEntered(const KDateTime &dateTime)
Signal if the date or time has been manually entered by the user.
kdatepicker.h
KDateTimeEdit::resetMinimumDateTime
void resetMinimumDateTime()
Reset the minimum date and time to the default.
Definition: kdatetimeedit.cpp:458
KDateTimeEdit::setDateTime
void setDateTime(const KDateTime &dateTime)
Set the currently selected date, time and time spec.
Definition: kdatetimeedit.cpp:361
KCalendarSystem
i18nc
QString i18nc(const char *ctxt, const char *text)
ksystemtimezone.h
KDateTimeEdit::isNullDate
bool isNullDate() const
Return if the current user input date is null.
Definition: kdatetimeedit.cpp:333
KDateTimeEdit::setDateTimeRange
void setDateTimeRange(const KDateTime &minDateTime, const KDateTime &maxDateTime, const QString &minWarnMsg=QString(), const QString &maxWarnMsg=QString())
Set the minimum and maximum date and time range.
Definition: kdatetimeedit.cpp:478
KLocale::CalendarSystem
CalendarSystem
KDateComboBox::DateKeywords
Show date keywords in the drop-down.
Definition: kdatecombobox.h:55
KDateTimeEdit::setTimeDisplayFormat
void setTimeDisplayFormat(KLocale::TimeFormatOptions formatOptions)
Sets the time format to display.
Definition: kdatetimeedit.cpp:535
KDateTimeEdit::ShowDate
If the Date is displayed.
Definition: kdatetimeedit.h:52
KDateTimeEdit::ShowTimeSpec
If the Time Spec is displayed.
Definition: kdatetimeedit.h:54
KDateTimeEdit::dateTime
KDateTime dateTime() const
Return the currently selected date, time and time spec.
Definition: kdatetimeedit.cpp:291
KDateTimeEdit::calendarSystemsList
QList< KLocale::CalendarSystem > calendarSystemsList() const
Returns the list of Calendar Systems displayed.
Definition: kdatetimeedit.cpp:510
KDateTimeEdit::eventFilter
virtual bool eventFilter(QObject *object, QEvent *event)
Definition: kdatetimeedit.cpp:580
QStringList
KMessageBox::sorry
static void sorry(QWidget *parent, const QString &text, const QString &caption=QString(), Options options=Notify)
Display an "Sorry" dialog.
Definition: kmessagebox.cpp:904
KDateTime::date
QDate date() const
KDateTimeEdit::assignDate
virtual void assignDate(const QDate &date)
Assign the date for the widget.
Definition: kdatetimeedit.cpp:387
KDateTimeEdit::timeSpecChanged
void timeSpecChanged(const KDateTime::Spec &spec)
Signal if the time spec has been changed either manually by the user or programatically.
KDateTimeEdit::maximumDateTime
KDateTime maximumDateTime() const
Return the current maximum date and time.
Definition: kdatetimeedit.cpp:468
KDateTimeEdit::DateKeywords
Show date keywords.
Definition: kdatetimeedit.h:64
KDateTimeEdit::setDate
void setDate(const QDate &date)
Set the currently selected date.
Definition: kdatetimeedit.cpp:378
KDateTimeEdit::resetDateTimeRange
void resetDateTimeRange()
Reset the minimum and maximum date and time to the default.
Definition: kdatetimeedit.cpp:497
KDateTimeEdit::isValidDate
bool isValidDate() const
Return if the current user input date is valid.
Definition: kdatetimeedit.cpp:328
KCalendarSystem::calendarLabel
QString calendarLabel() const
KLocale::insertCatalog
void insertCatalog(const QString &catalog)
kdatetimeedit.h
KDateTimeEdit::timeListInterval
int timeListInterval() const
Return the time list interval able to be selected.
KDateTimeEdit::SelectTimeSpec
Allow the user to select a time spec.
Definition: kdatetimeedit.h:62
KDateTime
KDateTimeEdit::assignTimeSpec
void assignTimeSpec(const KDateTime::Spec &spec)
Assign the time spec for the widget.
Definition: kdatetimeedit.cpp:442
KDateTimeEdit::DatePicker
Show a date picker.
Definition: kdatetimeedit.h:63
KTimeComboBox::SelectTime
Allow the user to select the time from a drop-down menu.
Definition: ktimecombobox.h:52
KDateTimeEdit::EditTime
Allow the user to manually edit the time.
Definition: kdatetimeedit.h:57
KDateTimeEdit::isNull
bool isNull() const
Return if the current user input is null.
Definition: kdatetimeedit.cpp:323
KGlobal::locale
KLocale * locale()
KStandardAction::replace
KAction * replace(const QObject *recvr, const char *slot, QObject *parent)
Find and replace matches.
Definition: kstandardaction.cpp:344
KDateTimeEdit::timeSpecEntered
void timeSpecEntered(const KDateTime::Spec &spec)
Signal if the time spec has been changed manually by the user.
KDateTimeEdit::SelectCalendar
Allow the user to select a calendar.
Definition: kdatetimeedit.h:59
KDateTimeEdit::setCalendarSystem
void setCalendarSystem(KLocale::CalendarSystem calendarSystem)
Set the Calendar System used for this widget.
Definition: kdatetimeedit.cpp:393
KDateTimeEdit::setMinimumDateTime
void setMinimumDateTime(const KDateTime &minDateTime, const QString &minWarnMsg=QString())
Set the minimum allowed date.
Definition: kdatetimeedit.cpp:448
kdatecombobox.h
KDateTimeEdit::~KDateTimeEdit
virtual ~KDateTimeEdit()
Destroy the widget.
Definition: kdatetimeedit.cpp:286
KDateTimeEdit::timeList
QList< QTime > timeList() const
Return the list of times able to be selected in the drop-down.
Definition: kdatetimeedit.cpp:562
KDateTimeEdit::resizeEvent
virtual void resizeEvent(QResizeEvent *event)
Definition: kdatetimeedit.cpp:596
KDateTimeEdit::isValidTime
bool isValidTime() const
Return if the current user input time is valid.
Definition: kdatetimeedit.cpp:338
KDateTimeEdit::date
QDate date() const
Return the currently selected date.
KDateTimeEdit::EditDate
Allow the user to manually edit the date.
Definition: kdatetimeedit.h:56
KDateComboBox::DatePicker
Show a date picker in the drop-down.
Definition: kdatecombobox.h:54
KDateTimeEdit::setOptions
void setOptions(Options options)
Set the new widget options.
Definition: kdatetimeedit.cpp:348
KDateComboBox::EditDate
Allow the user to manually edit the date in the combo line edit.
Definition: kdatecombobox.h:52
KDateTimeEdit::setDateMap
void setDateMap(QMap< QDate, QString > dateMap)
Set the list of dates able to be selected from the drop-down and the string form to display for those...
Definition: kdatetimeedit.cpp:525
KDateTimeEdit::dateDisplayFormat
KLocale::DateFormat dateDisplayFormat() const
Return the currently set date display format.
Definition: kdatetimeedit.cpp:520
KDateTime::Spec::isValid
bool isValid() const
KDateTimeEdit::setCalendar
void setCalendar(KCalendarSystem *calendar=0)
Changes the calendar system to use.
Definition: kdatetimeedit.cpp:410
KDateTimeEdit::ForceTime
The entered time can only be a selected time.
Definition: kdatetimeedit.h:65
kmessagebox.h
KDateTime::Spec
KTimeComboBox::ForceTime
Any set or entered time will be forced to one of the drop-down times.
Definition: ktimecombobox.h:53
KDateTimeEdit::options
Options options() const
Return the currently set widget options.
KDateTime::time
QTime time() const
KDateTimeEdit::SelectDate
Allow the user to select a date.
Definition: kdatetimeedit.h:60
KDateTimeEdit::SelectTime
Allow the user to select a time.
Definition: kdatetimeedit.h:61
QMap
KDateTimeEdit::isValid
bool isValid() const
Return if the current user input is valid.
Definition: kdatetimeedit.cpp:316
KDateTimeEdit::timeSpec
KDateTime::Spec timeSpec() const
Return the currently selected time spec.
Definition: kdatetimeedit.cpp:311
KDateTimeEdit::setTimeSpec
void setTimeSpec(const KDateTime::Spec &spec)
Set the current time spec.
Definition: kdatetimeedit.cpp:431
KCalendarSystem::calendarSystemsList
static QList< KLocale::CalendarSystem > calendarSystemsList()
KDateTimeEdit::KDateTimeEdit
KDateTimeEdit(QWidget *parent=0)
Create a new KDateTimeEdit widget.
Definition: kdatetimeedit.cpp:264
QList< KLocale::CalendarSystem >
KDateTimeEdit::assignTime
virtual void assignTime(const QTime &time)
Assign the time for the widget.
Definition: kdatetimeedit.cpp:425
KDateTimeEdit::calendarSystem
KLocale::CalendarSystem calendarSystem() const
Returns the Calendar System type used by the widget.
Definition: kdatetimeedit.cpp:296
KDateTimeEdit::timeZones
KTimeZones::ZoneMap timeZones() const
Return the list of time zones able to be selected.
Definition: kdatetimeedit.cpp:575
KDateTimeEdit::ShowCalendar
If the Calendar System edit is displayed.
Definition: kdatetimeedit.h:51
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:49:14 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

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