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

KDEUI

  • 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
39class KDateTimeEditPrivate
40{
41public:
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
81KDateTimeEditPrivate::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
93KDateTimeEditPrivate::~KDateTimeEditPrivate()
94{
95}
96
97const KCalendarSystem *KDateTimeEditPrivate::calendar() const
98{
99 return ui.m_dateCombo->calendar();
100}
101
102KDateTime KDateTimeEditPrivate::defaultMinDateTime()
103{
104 return KDateTime(calendar()->earliestValidDate(), QTime(0, 0, 0, 0));
105}
106
107KDateTime KDateTimeEditPrivate::defaultMaxDateTime()
108{
109 return KDateTime(calendar()->latestValidDate(), QTime(23, 59, 59, 999));
110}
111
112void KDateTimeEditPrivate::initWidgets()
113{
114 initDateWidget();
115 initTimeWidget();
116 initCalendarWidget();
117 initTimeSpecWidget();
118}
119
120void 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
141void 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
159void 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
173void 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
180void KDateTimeEditPrivate::selectCalendar(int index)
181{
182 enterCalendar((KLocale::CalendarSystem) ui.m_calendarCombo->itemData(index).toInt());
183}
184
185void KDateTimeEditPrivate::enterCalendar(KLocale::CalendarSystem calendarSystem)
186{
187 q->setCalendarSystem(calendarSystem);
188 emit q->calendarEntered(ui.m_dateCombo->calendarSystem());
189}
190
191void 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
213void KDateTimeEditPrivate::updateTimeSpecWidget()
214{
215 ui.m_timeSpecCombo->blockSignals(true);
216 ui.m_timeSpecCombo->blockSignals(false);
217}
218
219void KDateTimeEditPrivate::selectTimeZone(int index)
220{
221 enterTimeZone(ui.m_timeCombo->itemData(index).toString());
222}
223
224void 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
231void 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
264KDateTimeEdit::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_dateCombo, SIGNAL(dateChanged(QDate)),
281 this, SLOT(setDate(QDate)));
282 connect(d->ui.m_timeCombo, SIGNAL(timeChanged(QTime)),
283 this, SLOT(setTime(QTime)));
284 connect( d->ui.m_calendarCombo, SIGNAL(activated(int)),
285 this, SLOT(selectCalendar(int)));
286 connect( d->ui.m_timeSpecCombo, SIGNAL(activated(int)),
287 this, SLOT(selectTimeZone(int)));
288}
289
290KDateTimeEdit::~KDateTimeEdit()
291{
292 delete d;
293}
294
295KDateTime KDateTimeEdit::dateTime() const
296{
297 return d->m_dateTime;
298}
299
300KLocale::CalendarSystem KDateTimeEdit::calendarSystem() const
301{
302 return d-> ui.m_dateCombo->calendarSystem();
303}
304
305QDate KDateTimeEdit::date() const
306{
307 return d->m_dateTime.date();
308}
309
310QTime KDateTimeEdit::time() const
311{
312 return d->m_dateTime.time();
313}
314
315KDateTime::Spec KDateTimeEdit::timeSpec() const
316{
317 return d->m_dateTime.timeSpec();
318}
319
320bool KDateTimeEdit::isValid() const
321{
322 return d->m_dateTime.isValid() &&
323 d->m_dateTime >= d->m_minDateTime &&
324 d->m_dateTime <= d->m_maxDateTime;
325}
326
327bool KDateTimeEdit::isNull() const
328{
329 return isNullDate() && isNullTime();
330}
331
332bool KDateTimeEdit::isValidDate() const
333{
334 return d->ui.m_dateCombo->isValid();
335}
336
337bool KDateTimeEdit::isNullDate() const
338{
339 return d->ui.m_dateCombo->isNull();
340}
341
342bool KDateTimeEdit::isValidTime() const
343{
344 return d->ui.m_timeCombo->isValid();
345}
346
347bool KDateTimeEdit::isNullTime() const
348{
349 return d->ui.m_timeCombo->isNull();
350}
351
352void KDateTimeEdit::setOptions(Options options)
353{
354 if (options != d->m_options) {
355 d->m_options = options;
356 d->initWidgets();
357 }
358}
359
360KDateTimeEdit::Options KDateTimeEdit::options() const
361{
362 return d->m_options;
363}
364
365void KDateTimeEdit::setDateTime(const KDateTime &dateTime)
366{
367 if (dateTime != d->m_dateTime) {
368 assignDateTime(dateTime);
369 emit dateTimeChanged(d->m_dateTime);
370 emit dateChanged(d->m_dateTime.date());
371 emit timeChanged(d->m_dateTime.time());
372 }
373}
374
375void KDateTimeEdit::assignDateTime(const KDateTime &dateTime)
376{
377 d->m_dateTime = dateTime;
378 d->ui.m_dateCombo->setDate(dateTime.date());
379 d->ui.m_timeCombo->setTime(dateTime.time());
380}
381
382void KDateTimeEdit::setDate(const QDate &date)
383{
384 if (date != d->m_dateTime.date()) {
385 assignDate(date);
386 emit dateTimeChanged(d->m_dateTime);
387 emit dateChanged(d->m_dateTime.date());
388 }
389}
390
391void KDateTimeEdit::assignDate(const QDate &date)
392{
393 d->m_dateTime.setDate(date);
394 d->ui.m_dateCombo->setDate(date);
395}
396
397void KDateTimeEdit::setCalendarSystem(KLocale::CalendarSystem calendarSystem)
398{
399 if (calendarSystem == d->ui.m_dateCombo->calendarSystem() ||
400 !d->m_calendarSystems.contains(calendarSystem)) {
401 return;
402 }
403
404 assignCalendarSystem(calendarSystem);
405 emit calendarChanged(d->ui.m_dateCombo->calendarSystem());
406}
407
408void KDateTimeEdit::assignCalendarSystem(KLocale::CalendarSystem calendarSystem)
409{
410 d->ui.m_dateCombo->setCalendarSystem(calendarSystem);
411 d->updateCalendarWidget();
412}
413
414void KDateTimeEdit::setCalendar(KCalendarSystem *calendar)
415{
416 d->ui.m_dateCombo->setCalendar(calendar);
417 d->updateCalendarWidget();
418}
419
420void KDateTimeEdit::setTime(const QTime &time)
421{
422 if (time != d->m_dateTime.time()) {
423 assignTime(time);
424 emit dateTimeChanged(d->m_dateTime);
425 emit timeChanged(d->m_dateTime.time());
426 }
427}
428
429void KDateTimeEdit::assignTime(const QTime &time)
430{
431 d->m_dateTime.setTime(time);
432 d->ui.m_timeCombo->setTime(time);
433}
434
435void KDateTimeEdit::setTimeSpec(const KDateTime::Spec &spec)
436{
437 if (spec == d->m_dateTime.timeSpec() || !spec.isValid()) {
438 return;
439 }
440
441 assignTimeSpec(spec);
442 emit dateTimeChanged(d->m_dateTime);
443 emit timeSpecChanged(d->m_dateTime.timeSpec());
444}
445
446void KDateTimeEdit::assignTimeSpec(const KDateTime::Spec &spec)
447{
448 d->m_dateTime.setTimeSpec(spec);
449 d->updateTimeSpecWidget();
450}
451
452void KDateTimeEdit::setMinimumDateTime(const KDateTime &minDateTime, const QString &minWarnMsg)
453{
454 setDateTimeRange(minDateTime, maximumDateTime(), minWarnMsg, d->m_maxWarnMsg);
455}
456
457KDateTime KDateTimeEdit::minimumDateTime() const
458{
459 return d->m_minDateTime;
460}
461
462void KDateTimeEdit::resetMinimumDateTime()
463{
464 d->m_minDateTime = d->defaultMinDateTime();
465}
466
467void KDateTimeEdit::setMaximumDateTime(const KDateTime &maxDateTime, const QString &maxWarnMsg)
468{
469 setDateTimeRange(minimumDateTime(), maxDateTime, d->m_minWarnMsg, maxWarnMsg);
470}
471
472KDateTime KDateTimeEdit::maximumDateTime() const
473{
474 return d->m_maxDateTime;
475}
476
477void KDateTimeEdit::resetMaximumDateTime()
478{
479 d->m_maxDateTime = d->defaultMaxDateTime();
480}
481
482void KDateTimeEdit::setDateTimeRange(const KDateTime &minDateTime,
483 const KDateTime &maxDateTime,
484 const QString &minErrorMsg,
485 const QString &maxErrorMsg)
486{
487 if (minDateTime.isValid() &&
488 maxDateTime.isValid() &&
489 minDateTime <= maxDateTime &&
490 d->calendar()->isValid(minDateTime.date()) &&
491 d->calendar()->isValid(maxDateTime.date())) {
492
493 d->m_minDateTime = minDateTime;
494 d->m_minWarnMsg = minErrorMsg;
495 d->m_maxDateTime = maxDateTime;
496 d->m_maxWarnMsg = maxErrorMsg;
497
498 }
499}
500
501void KDateTimeEdit::resetDateTimeRange()
502{
503 setDateTimeRange(d->defaultMinDateTime(), d->defaultMaxDateTime());
504}
505
506void KDateTimeEdit::setCalendarSystemsList(QList<KLocale::CalendarSystem> calendars)
507{
508 if (calendars != d->m_calendarSystems) {
509 d->m_calendarSystems = calendars;
510 d->updateCalendarWidget();
511 }
512}
513
514QList<KLocale::CalendarSystem> KDateTimeEdit::calendarSystemsList() const
515{
516 return d->m_calendarSystems;
517}
518
519void KDateTimeEdit::setDateDisplayFormat(KLocale::DateFormat format)
520{
521 d->ui.m_dateCombo->setDisplayFormat(format);
522}
523
524KLocale::DateFormat KDateTimeEdit::dateDisplayFormat() const
525{
526 return d->ui.m_dateCombo->displayFormat();
527}
528
529void KDateTimeEdit::setDateMap(QMap<QDate, QString> dateMap)
530{
531 d->ui.m_dateCombo->setDateMap(dateMap);
532}
533
534QMap<QDate, QString> KDateTimeEdit::dateMap() const
535{
536 return d->ui.m_dateCombo->dateMap();
537}
538
539void KDateTimeEdit::setTimeDisplayFormat(KLocale::TimeFormatOptions formatOptions)
540{
541 d->ui.m_timeCombo->setDisplayFormat(formatOptions);
542}
543
544KLocale::TimeFormatOptions KDateTimeEdit::timeDisplayFormat() const
545{
546 return d->ui.m_timeCombo->displayFormat();
547}
548
549void KDateTimeEdit::setTimeListInterval(int minutes)
550{
551 d->ui.m_timeCombo->setTimeListInterval(minutes);
552}
553
554int KDateTimeEdit::timeListInterval() const
555{
556 return d->ui.m_timeCombo->timeListInterval();
557}
558
559void KDateTimeEdit::setTimeList(QList<QTime> timeList,
560 const QString &minWarnMsg,
561 const QString &maxWarnMsg)
562{
563 d->ui.m_timeCombo->setTimeList(timeList, minWarnMsg, maxWarnMsg);
564}
565
566QList<QTime> KDateTimeEdit::timeList() const
567{
568 return d->ui.m_timeCombo->timeList();
569}
570
571void KDateTimeEdit::setTimeZones(const KTimeZones::ZoneMap &zones)
572{
573 if (zones != d->m_zones) {
574 d->m_zones = zones;
575 d->updateTimeSpecWidget();
576 }
577}
578
579KTimeZones::ZoneMap KDateTimeEdit::timeZones() const
580{
581 return d->m_zones;
582}
583
584bool KDateTimeEdit::eventFilter(QObject *object, QEvent *event)
585{
586 return QWidget::eventFilter(object, event);
587}
588
589void KDateTimeEdit::focusInEvent(QFocusEvent *event)
590{
591 QWidget::focusInEvent(event);
592}
593
594void KDateTimeEdit::focusOutEvent(QFocusEvent *event)
595{
596 d->warnDateTime();
597 QWidget::focusOutEvent(event);
598}
599
600void KDateTimeEdit::resizeEvent(QResizeEvent *event)
601{
602 QWidget::resizeEvent(event);
603}
604
605#include "kdatetimeedit.moc"
KCalendarSystem
KCalendarSystem::calendarLabel
QString calendarLabel() const
KCalendarSystem::calendarSystemsList
static QList< KLocale::CalendarSystem > calendarSystemsList()
KDateComboBox::SelectDate
@ SelectDate
Allow the user to select the date from a drop-down menu.
Definition: kdatecombobox.h:53
KDateComboBox::DateKeywords
@ DateKeywords
Show date keywords in the drop-down.
Definition: kdatecombobox.h:55
KDateComboBox::EditDate
@ EditDate
Allow the user to manually edit the date in the combo line edit.
Definition: kdatecombobox.h:52
KDateComboBox::DatePicker
@ DatePicker
Show a date picker in the drop-down.
Definition: kdatecombobox.h:54
KDateTimeEdit
Definition: kdatetimeedit.h:34
KDateTimeEdit::minimumDateTime
KDateTime minimumDateTime() const
Return the current minimum date and time.
Definition: kdatetimeedit.cpp:457
KDateTimeEdit::KDateTimeEdit
KDateTimeEdit(QWidget *parent=0)
Create a new KDateTimeEdit widget.
Definition: kdatetimeedit.cpp:264
KDateTimeEdit::eventFilter
virtual bool eventFilter(QObject *object, QEvent *event)
Definition: kdatetimeedit.cpp:584
KDateTimeEdit::resetMinimumDateTime
void resetMinimumDateTime()
Reset the minimum date and time to the default.
Definition: kdatetimeedit.cpp:462
KDateTimeEdit::setTimeSpec
void setTimeSpec(const KDateTime::Spec &spec)
Set the current time spec.
Definition: kdatetimeedit.cpp:435
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:529
KDateTimeEdit::setCalendar
void setCalendar(KCalendarSystem *calendar=0)
Changes the calendar system to use.
Definition: kdatetimeedit.cpp:414
KDateTimeEdit::~KDateTimeEdit
virtual ~KDateTimeEdit()
Destroy the widget.
Definition: kdatetimeedit.cpp:290
KDateTimeEdit::setDate
void setDate(const QDate &date)
Set the currently selected date.
Definition: kdatetimeedit.cpp:382
KDateTimeEdit::calendarSystem
KLocale::CalendarSystem calendarSystem() const
Returns the Calendar System type used by the widget.
Definition: kdatetimeedit.cpp:300
KDateTimeEdit::assignCalendarSystem
void assignCalendarSystem(KLocale::CalendarSystem calendarSystem)
Assign the calendar system for the widget.
Definition: kdatetimeedit.cpp:408
KDateTimeEdit::resizeEvent
virtual void resizeEvent(QResizeEvent *event)
Definition: kdatetimeedit.cpp:600
KDateTimeEdit::dateTimeChanged
void dateTimeChanged(const KDateTime &dateTime)
Signal if the date or time has been changed either manually by the user or programatically.
KDateTimeEdit::setTimeZones
void setTimeZones(const KTimeZones::ZoneMap &zones)
Set the time zones able to be selected.
Definition: kdatetimeedit.cpp:571
KDateTimeEdit::isNullTime
bool isNullTime() const
Return if the current user input time is null.
Definition: kdatetimeedit.cpp:347
KDateTimeEdit::assignDateTime
virtual void assignDateTime(const KDateTime &dateTime)
Assign the date, time and time spec for the widget.
Definition: kdatetimeedit.cpp:375
KDateTimeEdit::resetDateTimeRange
void resetDateTimeRange()
Reset the minimum and maximum date and time to the default.
Definition: kdatetimeedit.cpp:501
KDateTimeEdit::setMinimumDateTime
void setMinimumDateTime(const KDateTime &minDateTime, const QString &minWarnMsg=QString())
Set the minimum allowed date.
Definition: kdatetimeedit.cpp:452
KDateTimeEdit::ForceTime
@ ForceTime
The entered time can only be a selected time.
Definition: kdatetimeedit.h:65
KDateTimeEdit::WarnOnInvalid
@ WarnOnInvalid
Show a warning on focus out if the date or time is invalid.
Definition: kdatetimeedit.h:66
KDateTimeEdit::ShowCalendar
@ ShowCalendar
If the Calendar System edit is displayed.
Definition: kdatetimeedit.h:51
KDateTimeEdit::EditTime
@ EditTime
Allow the user to manually edit the time.
Definition: kdatetimeedit.h:57
KDateTimeEdit::DatePicker
@ DatePicker
Show a date picker.
Definition: kdatetimeedit.h:63
KDateTimeEdit::ShowTime
@ ShowTime
If the Time is displayed.
Definition: kdatetimeedit.h:53
KDateTimeEdit::ShowDate
@ ShowDate
If the Date is displayed.
Definition: kdatetimeedit.h:52
KDateTimeEdit::SelectTimeSpec
@ SelectTimeSpec
Allow the user to select a time spec.
Definition: kdatetimeedit.h:62
KDateTimeEdit::DateKeywords
@ DateKeywords
Show date keywords.
Definition: kdatetimeedit.h:64
KDateTimeEdit::EditDate
@ EditDate
Allow the user to manually edit the date.
Definition: kdatetimeedit.h:56
KDateTimeEdit::SelectDate
@ SelectDate
Allow the user to select a date.
Definition: kdatetimeedit.h:60
KDateTimeEdit::ShowTimeSpec
@ ShowTimeSpec
If the Time Spec is displayed.
Definition: kdatetimeedit.h:54
KDateTimeEdit::SelectTime
@ SelectTime
Allow the user to select a time.
Definition: kdatetimeedit.h:61
KDateTimeEdit::SelectCalendar
@ SelectCalendar
Allow the user to select a calendar.
Definition: kdatetimeedit.h:59
KDateTimeEdit::isValid
bool isValid() const
Return if the current user input is valid.
Definition: kdatetimeedit.cpp:320
KDateTimeEdit::dateChanged
void dateChanged(const QDate &date)
Signal if the date 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:472
KDateTimeEdit::calendarChanged
void calendarChanged(KLocale::CalendarSystem calendarSystem)
Signal if the Calendar System has been changed either manually by the user or programatically.
KDateTimeEdit::timeSpecEntered
void timeSpecEntered(const KDateTime::Spec &spec)
Signal if the time spec has been changed manually by the user.
KDateTimeEdit::setMaximumDateTime
void setMaximumDateTime(const KDateTime &maxDateTime, const QString &maxWarnMsg=QString())
Set the maximum allowed date.
Definition: kdatetimeedit.cpp:467
KDateTimeEdit::setTime
void setTime(const QTime &time)
Set the currently selected time.
Definition: kdatetimeedit.cpp:420
KDateTimeEdit::assignTime
virtual void assignTime(const QTime &time)
Assign the time for the widget.
Definition: kdatetimeedit.cpp:429
KDateTimeEdit::timeList
QList< QTime > timeList() const
Return the list of times able to be selected in the drop-down.
Definition: kdatetimeedit.cpp:566
KDateTimeEdit::isNull
bool isNull() const
Return if the current user input is null.
Definition: kdatetimeedit.cpp:327
KDateTimeEdit::timeSpecChanged
void timeSpecChanged(const KDateTime::Spec &spec)
Signal if the time spec has been changed either manually by the user or programatically.
KDateTimeEdit::timeSpec
KDateTime::Spec timeSpec() const
Return the currently selected time spec.
Definition: kdatetimeedit.cpp:315
KDateTimeEdit::time
QTime time
Definition: kdatetimeedit.h:38
KDateTimeEdit::setDateDisplayFormat
void setDateDisplayFormat(KLocale::DateFormat format)
Sets the date format to display.
Definition: kdatetimeedit.cpp:519
KDateTimeEdit::resetMaximumDateTime
void resetMaximumDateTime()
Reset the minimum date and time to the default.
Definition: kdatetimeedit.cpp:477
KDateTimeEdit::calendarEntered
void calendarEntered(KLocale::CalendarSystem calendarSystem)
Signal if the Calendar System has been manually entered by the user.
KDateTimeEdit::timeDisplayFormat
KLocale::TimeFormatOptions timeDisplayFormat() const
Return the currently set time format.
Definition: kdatetimeedit.cpp:544
KDateTimeEdit::setCalendarSystem
void setCalendarSystem(KLocale::CalendarSystem calendarSystem)
Set the Calendar System used for this widget.
Definition: kdatetimeedit.cpp:397
KDateTimeEdit::setCalendarSystemsList
void setCalendarSystemsList(QList< KLocale::CalendarSystem > calendars)
Set the list of Calendar Systems to display.
Definition: kdatetimeedit.cpp:506
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:559
KDateTimeEdit::timeChanged
void timeChanged(const QTime &time)
Signal if the time has been changed either manually by the user or programatically.
KDateTimeEdit::setDateTime
void setDateTime(const KDateTime &dateTime)
Set the currently selected date, time and time spec.
Definition: kdatetimeedit.cpp:365
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:482
KDateTimeEdit::date
QDate date
Definition: kdatetimeedit.h:37
KDateTimeEdit::dateTimeEntered
void dateTimeEntered(const KDateTime &dateTime)
Signal if the date or time has been manually entered by the user.
KDateTimeEdit::focusOutEvent
virtual void focusOutEvent(QFocusEvent *event)
Definition: kdatetimeedit.cpp:594
KDateTimeEdit::assignDate
virtual void assignDate(const QDate &date)
Assign the date for the widget.
Definition: kdatetimeedit.cpp:391
KDateTimeEdit::options
Options options
Definition: kdatetimeedit.h:40
KDateTimeEdit::setTimeDisplayFormat
void setTimeDisplayFormat(KLocale::TimeFormatOptions formatOptions)
Sets the time format to display.
Definition: kdatetimeedit.cpp:539
KDateTimeEdit::timeListInterval
int timeListInterval
Definition: kdatetimeedit.h:39
KDateTimeEdit::dateDisplayFormat
KLocale::DateFormat dateDisplayFormat() const
Return the currently set date display format.
Definition: kdatetimeedit.cpp:524
KDateTimeEdit::setOptions
void setOptions(Options options)
Set the new widget options.
Definition: kdatetimeedit.cpp:352
KDateTimeEdit::timeZones
KTimeZones::ZoneMap timeZones() const
Return the list of time zones able to be selected.
Definition: kdatetimeedit.cpp:579
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:534
KDateTimeEdit::focusInEvent
virtual void focusInEvent(QFocusEvent *event)
Definition: kdatetimeedit.cpp:589
KDateTimeEdit::setTimeListInterval
void setTimeListInterval(int minutes)
Set the interval between times able to be selected from the drop-down.
Definition: kdatetimeedit.cpp:549
KDateTimeEdit::calendarSystemsList
QList< KLocale::CalendarSystem > calendarSystemsList() const
Returns the list of Calendar Systems displayed.
Definition: kdatetimeedit.cpp:514
KDateTimeEdit::dateTime
KDateTime dateTime() const
Return the currently selected date, time and time spec.
Definition: kdatetimeedit.cpp:295
KDateTimeEdit::isValidDate
bool isValidDate() const
Return if the current user input date is valid.
Definition: kdatetimeedit.cpp:332
KDateTimeEdit::assignTimeSpec
void assignTimeSpec(const KDateTime::Spec &spec)
Assign the time spec for the widget.
Definition: kdatetimeedit.cpp:446
KDateTimeEdit::isNullDate
bool isNullDate() const
Return if the current user input date is null.
Definition: kdatetimeedit.cpp:337
KDateTimeEdit::isValidTime
bool isValidTime() const
Return if the current user input time is valid.
Definition: kdatetimeedit.cpp:342
KDateTime::Spec
KDateTime::Spec::isValid
bool isValid() const
KDateTime
KDateTime::time
QTime time() const
KDateTime::date
QDate date() const
KDateTime::currentLocalDateTime
static KDateTime currentLocalDateTime()
KDateTime::isValid
bool isValid() const
KLocale::insertCatalog
void insertCatalog(const QString &catalog)
KLocale::DateFormat
DateFormat
KLocale::CalendarSystem
CalendarSystem
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
KSystemTimeZones::zones
static const KTimeZones::ZoneMap zones()
KTimeComboBox::ForceTime
@ ForceTime
Any set or entered time will be forced to one of the drop-down times.
Definition: ktimecombobox.h:53
KTimeComboBox::SelectTime
@ SelectTime
Allow the user to select the time from a drop-down menu.
Definition: ktimecombobox.h:52
KTimeComboBox::EditTime
@ EditTime
Allow the user to manually edit the time in the combo line edit.
Definition: ktimecombobox.h:51
QList
QMap
QObject
QWidget
kcalendarsystem.h
kcombobox.h
kdatecombobox.h
kdatepicker.h
kdatetime.h
kdatetimeedit.h
kdebug.h
i18n
QString i18n(const char *text)
i18nc
QString i18nc(const char *ctxt, const char *text)
kmessagebox.h
ksystemtimezone.h
KGlobal::locale
KLocale * locale()
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 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-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 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
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
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