[Kde-bindings] [kdelibs] /: kdeui: DateTime widgets improve api and implementation, add tests

John Layt john at layt.net
Fri Jun 10 09:14:37 UTC 2011


Git commit 1150d67e67c78e5fb4e47cd5461baf8237ba4e71 by John Layt.
Committed on 23/05/2011 at 15:35.
Pushed by jlayt into branch 'master'.

kdeui: DateTime widgets improve api and implementation, add tests

Sorry guys, meant to push this before Beta 2 but clean forgot, one
downside to git and feature branches is loosing track of things...

Update new KDateComboBox, KTimeComboBox and KDateTimeEdit widgets with
improved api and add unit tests. These classes are now ready for final
review.  The KDateTimeEdit may need a couple more bug-fixes.

Remove new KDateEdit and KTimeEdit sub-classes as I decided their use
case was very limited and not properly understood.

CCMAIL: kde-bindings at kde.org

M  +0    -2    includes/CMakeLists.txt     
D  +0    -1    includes/KDateEdit     
D  +0    -1    includes/KTimeEdit     
M  +0    -4    kdeui/CMakeLists.txt     
M  +3    -0    kdeui/tests/CMakeLists.txt     
A  +126  -0    kdeui/tests/kdatecomboboxtest.cpp         [License: LGPL (v2+)]
A  +43   -0    kdeui/tests/kdatecomboboxtest.h         [License: LGPL (v2+)]
A  +213  -0    kdeui/tests/kdatetimeedittest.cpp         [License: LGPL (v2+)]
A  +48   -0    kdeui/tests/kdatetimeedittest.h         [License: LGPL (v2+)]
A  +173  -0    kdeui/tests/ktimecomboboxtest.cpp         [License: LGPL (v2+)]
A  +44   -0    kdeui/tests/ktimecomboboxtest.h         [License: LGPL (v2+)]
M  +201  -95   kdeui/widgets/kdatecombobox.cpp     
M  +106  -51   kdeui/widgets/kdatecombobox.h     
D  +0    -30   kdeui/widgets/kdateedit.cpp     
D  +0    -37   kdeui/widgets/kdateedit.h     
M  +7    -7    kdeui/widgets/kdatepicker.h     
M  +239  -154  kdeui/widgets/kdatetimeedit.cpp     
M  +255  -246  kdeui/widgets/kdatetimeedit.h     
M  +1    -1    kdeui/widgets/kdatetimeedit.ui     
M  +243  -86   kdeui/widgets/ktimecombobox.cpp     
M  +92   -26   kdeui/widgets/ktimecombobox.h     
D  +0    -30   kdeui/widgets/ktimeedit.cpp     
D  +0    -37   kdeui/widgets/ktimeedit.h     
M  +5    -15   kdewidgets/kde.widgets     

http://commits.kde.org/kdelibs/1150d67e67c78e5fb4e47cd5461baf8237ba4e71

diff --git a/includes/CMakeLists.txt b/includes/CMakeLists.txt
index 42ba121..859e86f 100644
--- a/includes/CMakeLists.txt
+++ b/includes/CMakeLists.txt
@@ -145,7 +145,6 @@ install( FILES
   KDataToolAction
   KDataToolInfo
   KDateComboBox
-  KDateEdit
   KDatePicker
   KDateTable
   KDateTime
@@ -394,7 +393,6 @@ install( FILES
   KTextBrowser
   KTextEdit
   KTimeComboBox
-  KTimeEdit
   KTimeZone
   KTimeZoneData
   KTimeZoneSource
diff --git a/includes/KDateEdit b/includes/KDateEdit
deleted file mode 100644
index 7c64f1e..0000000
--- a/includes/KDateEdit
+++ /dev/null
@@ -1 +0,0 @@
-#include "../kdateedit.h"
diff --git a/includes/KTimeEdit b/includes/KTimeEdit
deleted file mode 100644
index 10226ac..0000000
--- a/includes/KTimeEdit
+++ /dev/null
@@ -1 +0,0 @@
-#include "../ktimeedit.h"
diff --git a/kdeui/CMakeLists.txt b/kdeui/CMakeLists.txt
index d68a43f..c9f2ed2 100644
--- a/kdeui/CMakeLists.txt
+++ b/kdeui/CMakeLists.txt
@@ -229,7 +229,6 @@ set(kdeui_LIB_SRCS
  widgets/kdatecombobox.cpp
  widgets/kdatepicker.cpp
  widgets/kdatetable.cpp
- widgets/kdateedit.cpp
  widgets/kdatetimeedit.cpp
  widgets/kdatetimewidget.cpp
  widgets/kdatewidget.cpp
@@ -267,7 +266,6 @@ set(kdeui_LIB_SRCS
  widgets/ktextbrowser.cpp
  widgets/ktextedit.cpp
  widgets/ktimecombobox.cpp
- widgets/ktimeedit.cpp
  widgets/ktimezonewidget.cpp
  widgets/ktitlewidget.cpp
  widgets/ktoolbar.cpp
@@ -636,7 +634,6 @@ install( FILES
  widgets/kbuttongroup.h
  widgets/kcharselect.h
  widgets/kdatetable.h
- widgets/kdateedit.h
  widgets/kdatetimeedit.h
  widgets/kdatetimewidget.h
  widgets/kdatewidget.h
@@ -669,7 +666,6 @@ install( FILES
  widgets/ktextbrowser.h
  widgets/ktextedit.h
  widgets/ktimecombobox.h
- widgets/ktimeedit.h
  widgets/ktimezonewidget.h
  widgets/ktitlewidget.h
  widgets/ktabbar.h
diff --git a/kdeui/tests/CMakeLists.txt b/kdeui/tests/CMakeLists.txt
index c7b8026..63788f6 100644
--- a/kdeui/tests/CMakeLists.txt
+++ b/kdeui/tests/CMakeLists.txt
@@ -68,6 +68,9 @@ KDEUI_UNIT_TESTS(
   krichtextedittest
   kselectaction_unittest
   klistwidgetsearchlinetest
+  ktimecomboboxtest
+  kdatecomboboxtest
+  kdatetimeedittest
 )
 
 KDEUI_PROXYMODEL_TESTS(
diff --git a/kdeui/tests/kdatecomboboxtest.cpp b/kdeui/tests/kdatecomboboxtest.cpp
new file mode 100644
index 0000000..639be27
--- /dev/null
+++ b/kdeui/tests/kdatecomboboxtest.cpp
@@ -0,0 +1,126 @@
+/*
+    Copyright 2011 John Layt <john at layt.net>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#include "kdatecomboboxtest.h"
+
+#include <QtCore/QDate>
+
+#include "qtest_kde.h"
+#include "kdebug.h"
+#include "kdatecombobox.h"
+#include "kcalendarsystem.h"
+
+QTEST_KDEMAIN(KDateComboBoxTest, GUI)
+
+#include "kdatecomboboxtest.moc"
+
+void KDateComboBoxTest::testDefaults()
+{
+    m_combo = new KDateComboBox(0);
+    QCOMPARE(m_combo->date(), QDate::currentDate());
+    QCOMPARE(m_combo->minimumDate(), KGlobal::locale()->calendar()->earliestValidDate());
+    QCOMPARE(m_combo->maximumDate(), KGlobal::locale()->calendar()->latestValidDate());
+    QCOMPARE(m_combo->isValid(), true);
+    QCOMPARE(m_combo->options(), KDateComboBox::EditDate | KDateComboBox::SelectDate | KDateComboBox::DatePicker | KDateComboBox::DateKeywords);
+    QCOMPARE(m_combo->displayFormat(), KLocale::ShortDate);
+    delete m_combo;
+}
+
+void KDateComboBoxTest::testDateRange()
+{
+    m_combo = new KDateComboBox(0);
+    m_combo->setDate(QDate(2000, 1, 1));
+    QCOMPARE(m_combo->minimumDate(), KGlobal::locale()->calendar()->earliestValidDate());
+    QCOMPARE(m_combo->maximumDate(), KGlobal::locale()->calendar()->latestValidDate());
+    QCOMPARE(m_combo->isValid(), true);
+
+    m_combo->setDateRange(QDate(2001, 1, 1), QDate(2002, 1, 1));
+    QCOMPARE(m_combo->minimumDate(), QDate(2001, 1, 1));
+    QCOMPARE(m_combo->maximumDate(), QDate(2002, 1, 1));
+    QCOMPARE(m_combo->isValid(), false);
+
+    m_combo->setDate(QDate(2003, 1, 1));
+    QCOMPARE(m_combo->isValid(), false);
+    m_combo->setDate(QDate(2001, 6, 1));
+    QCOMPARE(m_combo->isValid(), true);
+    m_combo->setDate(QDate(2001, 1, 1));
+    QCOMPARE(m_combo->isValid(), true);
+    m_combo->setDate(QDate(2002, 1, 1));
+    QCOMPARE(m_combo->isValid(), true);
+    m_combo->setDate(QDate(2000, 12, 31));
+    QCOMPARE(m_combo->isValid(), false);
+    m_combo->setDate(QDate(2002, 1, 2));
+    QCOMPARE(m_combo->isValid(), false);
+
+    m_combo->setDateRange(QDate(1995, 1, 1), QDate(1990, 1, 1));
+    QCOMPARE(m_combo->minimumDate(), QDate(2001, 1, 1));
+    QCOMPARE(m_combo->maximumDate(), QDate(2002, 1, 1));
+
+    m_combo->setMinimumDate(QDate(2000, 1, 1));
+    QCOMPARE(m_combo->minimumDate(), QDate(2000, 1, 1));
+    QCOMPARE(m_combo->maximumDate(), QDate(2002, 1, 1));
+
+    m_combo->setMaximumDate(QDate(2003, 1, 1));
+    QCOMPARE(m_combo->minimumDate(), QDate(2000, 1, 1));
+    QCOMPARE(m_combo->maximumDate(), QDate(2003, 1, 1));
+
+    delete m_combo;
+}
+
+void KDateComboBoxTest::testDateList()
+{
+    m_combo = new KDateComboBox(0);
+    QMap<QDate, QString> map;
+
+    // Test default map
+    QCOMPARE(m_combo->dateMap(), map);
+
+    // Test basic map
+    map.clear();
+    map.insert(QDate(2000, 1, 1), QLatin1String("New Years Day"));
+    map.insert(QDate(2000, 1, 2), QString());
+    map.insert(QDate(2000, 1, 3), QLatin1String("separator"));
+    map.insert(QDate(), QLatin1String("No Date"));
+    m_combo->setDateMap(map);
+    QCOMPARE(m_combo->dateMap(), map);
+
+    delete m_combo;
+}
+
+void KDateComboBoxTest::testOptions()
+{
+    m_combo = new KDateComboBox(0);
+    KDateComboBox::Options options = KDateComboBox::EditDate | KDateComboBox::SelectDate | KDateComboBox::DatePicker | KDateComboBox::DateKeywords;
+    QCOMPARE(m_combo->options(), options);
+    options = KDateComboBox::EditDate | KDateComboBox::WarnOnInvalid;
+    m_combo->setOptions(options);
+    QCOMPARE(m_combo->options(), options);
+    delete m_combo;
+}
+
+void KDateComboBoxTest::testDisplayFormat()
+{
+    m_combo = new KDateComboBox(0);
+    KLocale::DateFormat format = KLocale::ShortDate;
+    QCOMPARE(m_combo->displayFormat(), format);
+    format = KLocale::IsoDate;
+    m_combo->setDisplayFormat(format);
+    QCOMPARE(m_combo->displayFormat(), format);
+    delete m_combo;
+}
diff --git a/kdeui/tests/kdatecomboboxtest.h b/kdeui/tests/kdatecomboboxtest.h
new file mode 100644
index 0000000..2be5c41
--- /dev/null
+++ b/kdeui/tests/kdatecomboboxtest.h
@@ -0,0 +1,43 @@
+/*
+    Copyright 2011 John Layt <john at layt.net>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KDATECOMBOBOXTEST_H
+#define KDATECOMBOBOXTEST_H
+
+#include <QtGui/QWidget>
+
+class KDateComboBox;
+
+class KDateComboBoxTest : public QWidget
+{
+  Q_OBJECT
+
+private Q_SLOTS:
+  void testDefaults();
+  void testDateRange();
+  void testDateList();
+  void testOptions();
+  void testDisplayFormat();
+
+private:
+
+  KDateComboBox* m_combo;
+};
+
+#endif // KDATECOMBOBOXTEST_H
diff --git a/kdeui/tests/kdatetimeedittest.cpp b/kdeui/tests/kdatetimeedittest.cpp
new file mode 100644
index 0000000..b572f05
--- /dev/null
+++ b/kdeui/tests/kdatetimeedittest.cpp
@@ -0,0 +1,213 @@
+/*
+    Copyright 2011 John Layt <john at layt.net>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#include "kdatetimeedittest.h"
+
+#include <QtCore/QDate>
+
+#include "qtest_kde.h"
+#include "kdebug.h"
+#include "kdatetimeedit.h"
+#include "kcalendarsystem.h"
+#include "ksystemtimezone.h"
+
+QTEST_KDEMAIN(KDateTimeEditTest, GUI)
+
+#include "kdatetimeedittest.moc"
+
+void KDateTimeEditTest::testDefaults()
+{
+    m_edit = new KDateTimeEdit(0);
+    QCOMPARE(m_edit->date(), QDate::currentDate());
+    QCOMPARE(m_edit->time(), QTime(0, 0, 0, 0));
+    QCOMPARE(m_edit->minimumDateTime(), KDateTime(KGlobal::locale()->calendar()->earliestValidDate(), QTime(0, 0, 0)));
+    QCOMPARE(m_edit->maximumDateTime(), KDateTime(KGlobal::locale()->calendar()->latestValidDate(), QTime(23, 59, 59, 999)));
+    QCOMPARE(m_edit->isValid(), true);
+    QCOMPARE(m_edit->options(), KDateTimeEdit::ShowDate | KDateTimeEdit::EditDate | KDateTimeEdit::SelectDate | KDateTimeEdit::DatePicker | KDateTimeEdit::DateKeywords | KDateTimeEdit::ShowTime | KDateTimeEdit::EditTime | KDateTimeEdit::SelectTime);
+    QCOMPARE(m_edit->dateDisplayFormat(), KLocale::ShortDate);
+    QCOMPARE(m_edit->timeListInterval(), 15);
+    QCOMPARE(m_edit->timeDisplayFormat(), KLocale::TimeDefault);
+    delete m_edit;
+}
+
+void KDateTimeEditTest::testDateTimeRange()
+{
+    m_edit = new KDateTimeEdit(0);
+    m_edit->setDateTime(KDateTime(QDate(2000, 1, 1), QTime(12, 0, 0)));
+    QCOMPARE(m_edit->minimumDateTime(), KDateTime(KGlobal::locale()->calendar()->earliestValidDate(), QTime(0, 0, 0)));
+    QCOMPARE(m_edit->maximumDateTime(), KDateTime(KGlobal::locale()->calendar()->latestValidDate(), QTime(23, 59, 59, 999)));
+    QCOMPARE(m_edit->isValid(), true);
+
+    m_edit->setDateTimeRange(KDateTime(QDate(2001, 1, 1), QTime(10, 0, 0)),
+                             KDateTime(QDate(2002, 1, 1), QTime(20, 0, 0)));
+    QCOMPARE(m_edit->minimumDateTime(), KDateTime(QDate(2001, 1, 1), QTime(10, 0, 0)));
+    QCOMPARE(m_edit->maximumDateTime(), KDateTime(QDate(2002, 1, 1), QTime(20, 0, 0)));
+    QCOMPARE(m_edit->isValid(), false);
+
+    m_edit->setDateTime(KDateTime(QDate(2001, 1, 1), QTime(9, 59, 59, 999)));
+    QCOMPARE(m_edit->isValid(), false);
+    m_edit->setDateTime(KDateTime(QDate(2001, 1, 1), QTime(10, 0, 0)));
+    QCOMPARE(m_edit->isValid(), true);
+    m_edit->setDateTime(KDateTime(QDate(2002, 1, 1), QTime(20, 0, 0, 1)));
+    QCOMPARE(m_edit->isValid(), false);
+    m_edit->setDateTime(KDateTime(QDate(2002, 1, 1), QTime(20, 0, 0, 0)));
+    QCOMPARE(m_edit->isValid(), true);
+
+    m_edit->setDateTimeRange(KDateTime(QDate(1995, 1, 1), QTime(10, 0, 0)),
+                             KDateTime(QDate(1990, 1, 1), QTime(20, 0, 0)));
+    QCOMPARE(m_edit->minimumDateTime(), KDateTime(QDate(2001, 1, 1), QTime(10, 0, 0)));
+    QCOMPARE(m_edit->maximumDateTime(), KDateTime(QDate(2002, 1, 1), QTime(20, 0, 0)));
+
+    m_edit->setMinimumDateTime(KDateTime(QDate(2000, 1, 1), QTime(0, 0, 0)));
+    QCOMPARE(m_edit->minimumDateTime(), KDateTime(QDate(2000, 1, 1), QTime(0, 0, 0)));
+    QCOMPARE(m_edit->maximumDateTime(), KDateTime(QDate(2002, 1, 1), QTime(20, 0, 0)));
+
+    m_edit->setMaximumDateTime(KDateTime(QDate(2003, 1, 1), QTime(0, 0, 0)));
+    QCOMPARE(m_edit->minimumDateTime(), KDateTime(QDate(2000, 1, 1), QTime(0, 0, 0)));
+    QCOMPARE(m_edit->maximumDateTime(), KDateTime(QDate(2003, 1, 1), QTime(0, 0, 0)));
+
+    delete m_edit;
+}
+
+void KDateTimeEditTest::testDateList()
+{
+    m_edit = new KDateTimeEdit(0);
+    QMap<QDate, QString> map;
+
+    // KDateTimeEditTest default map
+    QCOMPARE(m_edit->dateMap(), map);
+
+    // KDateTimeEditTest basic map
+    map.clear();
+    map.insert(QDate(2000, 1, 1), QLatin1String("New Years Day"));
+    map.insert(QDate(2000, 1, 2), QString());
+    map.insert(QDate(2000, 1, 3), QLatin1String("separator"));
+    map.insert(QDate(), QLatin1String("No Date"));
+    m_edit->setDateMap(map);
+    QCOMPARE(m_edit->dateMap(), map);
+
+    delete m_edit;
+}
+
+void KDateTimeEditTest::testOptions()
+{
+    m_edit = new KDateTimeEdit(0);
+    KDateTimeEdit::Options options = KDateTimeEdit::ShowDate | KDateTimeEdit::EditDate | KDateTimeEdit::SelectDate | KDateTimeEdit::DatePicker | KDateTimeEdit::DateKeywords | KDateTimeEdit::ShowTime | KDateTimeEdit::EditTime | KDateTimeEdit::SelectTime;
+    QCOMPARE(m_edit->options(), options);
+    options = KDateTimeEdit::EditDate | KDateTimeEdit::WarnOnInvalid;
+    m_edit->setOptions(options);
+    QCOMPARE(m_edit->options(), options);
+    delete m_edit;
+}
+
+void KDateTimeEditTest::testDateDisplayFormat()
+{
+    m_edit = new KDateTimeEdit(0);
+    KLocale::DateFormat format = KLocale::ShortDate;
+    QCOMPARE(m_edit->dateDisplayFormat(), format);
+    format = KLocale::IsoDate;
+    m_edit->setDateDisplayFormat(format);
+    QCOMPARE(m_edit->dateDisplayFormat(), format);
+    delete m_edit;
+}
+
+void KDateTimeEditTest::testTimeListInterval()
+{
+    m_edit = new KDateTimeEdit();
+    QCOMPARE(m_edit->timeListInterval(), 15);
+    m_edit-> setTimeListInterval(60);
+    QCOMPARE(m_edit->timeListInterval(), 60);
+    delete m_edit;
+}
+
+void KDateTimeEditTest::testTimeList()
+{
+    m_edit = new KDateTimeEdit();
+    QList<QTime> list;
+
+    // KDateTimeEditTest default list
+    QTime thisTime = QTime(0, 0, 0);
+    for (int i = 0; i < 1440; i = i + 15) {
+        list << thisTime.addSecs(i * 60);
+    }
+    list << QTime(23, 59, 59, 999);
+    QCOMPARE(m_edit->timeList(), list);
+
+    // KDateTimeEditTest basic list
+    list.clear();
+    list << QTime(3, 0, 0) << QTime(15, 16, 17);
+    m_edit->setTimeList(list);
+    QCOMPARE(m_edit->timeList(), list);
+
+    delete m_edit;
+}
+
+void KDateTimeEditTest::testTimeDisplayFormat()
+{
+    m_edit = new KDateTimeEdit();
+    KLocale::TimeFormatOptions format = KLocale::TimeDefault;
+    QCOMPARE(m_edit->timeDisplayFormat(), format);
+    format = KLocale::TimeWithoutSeconds;
+    m_edit->setTimeDisplayFormat(format);
+    QCOMPARE(m_edit->timeDisplayFormat(), format);
+    delete m_edit;
+}
+
+void KDateTimeEditTest::testCalendarSystem()
+{
+    m_edit = new KDateTimeEdit();
+    QList<KLocale::CalendarSystem> calendars = KCalendarSystem::calendarSystemsList();
+
+    QCOMPARE(m_edit->calendarSystem(), KGlobal::locale()->calendarSystem());
+    QCOMPARE(m_edit->calendarSystemsList(), calendars);
+
+    m_edit->setCalendarSystem(KLocale::JulianCalendar);
+    QCOMPARE(m_edit->calendarSystem(), KLocale::JulianCalendar);
+
+    calendars.clear();
+    calendars.append(KLocale::QDateCalendar);
+    calendars.append(KLocale::GregorianCalendar);
+    calendars.append(KLocale::JulianCalendar);
+    m_edit->setCalendarSystemsList(calendars);
+    QCOMPARE(m_edit->calendarSystemsList(), calendars);
+
+    m_edit->setCalendarSystem(KLocale::IslamicCivilCalendar);
+    QCOMPARE(m_edit->calendarSystem(), KLocale::JulianCalendar);
+
+    delete m_edit;
+}
+
+void KDateTimeEditTest::testTimeSpec()
+{
+    m_edit = new KDateTimeEdit();
+
+    QCOMPARE(m_edit->timeSpec(), KDateTime::currentLocalDateTime().timeSpec());
+    QCOMPARE(m_edit->timeZones(), KSystemTimeZones::zones());
+
+    KDateTime::Spec spec = KDateTime::Spec::OffsetFromUTC(3600);
+    m_edit->setTimeSpec(spec);
+    QCOMPARE(m_edit->timeSpec(), spec);
+
+    KTimeZones::ZoneMap map;
+    map.insert("Africa/Cairo", KSystemTimeZones::zone("Africa/Cairo"));
+    m_edit->setTimeZones(map);
+    QCOMPARE(m_edit->timeZones(), map);
+
+    delete m_edit;
+}
diff --git a/kdeui/tests/kdatetimeedittest.h b/kdeui/tests/kdatetimeedittest.h
new file mode 100644
index 0000000..a80ce2c
--- /dev/null
+++ b/kdeui/tests/kdatetimeedittest.h
@@ -0,0 +1,48 @@
+/*
+    Copyright 2011 John Layt <john at layt.net>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KDATECOMBOBOXTEST_H
+#define KDATECOMBOBOXTEST_H
+
+#include <QtGui/QWidget>
+
+class KDateTimeEdit;
+
+class KDateTimeEditTest : public QWidget
+{
+  Q_OBJECT
+
+private Q_SLOTS:
+  void testDefaults();
+  void testDateTimeRange();
+  void testOptions();
+  void testDateDisplayFormat();
+  void testDateList();
+  void testTimeListInterval();
+  void testTimeList();
+  void testTimeDisplayFormat();
+  void testCalendarSystem();
+  void testTimeSpec();
+
+private:
+
+  KDateTimeEdit* m_edit;
+};
+
+#endif // KDATECOMBOBOXTEST_H
diff --git a/kdeui/tests/ktimecomboboxtest.cpp b/kdeui/tests/ktimecomboboxtest.cpp
new file mode 100644
index 0000000..2e9cbf6
--- /dev/null
+++ b/kdeui/tests/ktimecomboboxtest.cpp
@@ -0,0 +1,173 @@
+/*
+    Copyright 2011 John Layt <john at layt.net>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#include "ktimecomboboxtest.h"
+
+#include <QtCore/QTime>
+
+#include "qtest_kde.h"
+#include "kdebug.h"
+#include <ktimecombobox.h>
+
+QTEST_KDEMAIN(KTimeComboBoxTest, GUI)
+
+#include "ktimecomboboxtest.moc"
+
+void KTimeComboBoxTest::testDefaults()
+{
+    m_combo = new KTimeComboBox();
+    QCOMPARE(m_combo->time(), QTime(0, 0, 0, 0));
+    QCOMPARE(m_combo->minimumTime(), QTime(0, 0, 0, 0));
+    QCOMPARE(m_combo->maximumTime(), QTime(23, 59, 59, 999));
+    QCOMPARE(m_combo->isValid(), true);
+    QCOMPARE(m_combo->options(), KTimeComboBox::EditTime | KTimeComboBox::SelectTime);
+    QCOMPARE(m_combo->timeListInterval(), 15);
+    QCOMPARE(m_combo->displayFormat(), KLocale::TimeDefault);
+    delete m_combo;
+}
+
+void KTimeComboBoxTest::testTimeRange()
+{
+    m_combo = new KTimeComboBox();
+    m_combo->setTime(QTime(2, 0, 0, 0));
+    QCOMPARE(m_combo->minimumTime(), QTime(0, 0, 0, 0));
+    QCOMPARE(m_combo->maximumTime(), QTime(23, 59, 59, 999));
+    QCOMPARE(m_combo->isValid(), true);
+
+    m_combo->setTimeRange(QTime(3, 0, 0, 0), QTime(22, 0, 0, 0));
+    QCOMPARE(m_combo->minimumTime(), QTime(3, 0, 0, 0));
+    QCOMPARE(m_combo->maximumTime(), QTime(22, 0, 0, 0));
+    QCOMPARE(m_combo->isValid(), false);
+
+    m_combo->setTime(QTime(23, 0, 0, 0));
+    QCOMPARE(m_combo->isValid(), false);
+    m_combo->setTime(QTime(12, 0, 0, 0));
+    QCOMPARE(m_combo->isValid(), true);
+    m_combo->setTime(QTime(3, 0, 0, 0));
+    QCOMPARE(m_combo->isValid(), true);
+    m_combo->setTime(QTime(22, 0, 0, 0));
+    QCOMPARE(m_combo->isValid(), true);
+    m_combo->setTime(QTime(2, 59, 59, 999));
+    QCOMPARE(m_combo->isValid(), false);
+    m_combo->setTime(QTime(22, 1, 0, 0));
+    QCOMPARE(m_combo->isValid(), false);
+
+    m_combo->setTimeRange(QTime(15, 0, 0, 0), QTime(5, 0, 0, 0));
+    QCOMPARE(m_combo->minimumTime(), QTime(3, 0, 0, 0));
+    QCOMPARE(m_combo->maximumTime(), QTime(22, 0, 0, 0));
+
+    m_combo->setMinimumTime(QTime(2, 0, 0, 0));
+    QCOMPARE(m_combo->minimumTime(), QTime(2, 0, 0, 0));
+    QCOMPARE(m_combo->maximumTime(), QTime(22, 0, 0, 0));
+
+    m_combo->setMaximumTime(QTime(21, 0, 0, 0));
+    QCOMPARE(m_combo->minimumTime(), QTime(2, 0, 0, 0));
+    QCOMPARE(m_combo->maximumTime(), QTime(21, 0, 0, 0));
+
+    delete m_combo;
+}
+
+void KTimeComboBoxTest::testTimeListInterval()
+{
+    m_combo = new KTimeComboBox();
+    QCOMPARE(m_combo->timeListInterval(), 15);
+    m_combo-> setTimeListInterval(60);
+    QCOMPARE(m_combo->timeListInterval(), 60);
+    m_combo-> setTimeListInterval(7);
+    QCOMPARE(m_combo->timeListInterval(), 60);
+    m_combo-> setTimeListInterval(720);
+    QCOMPARE(m_combo->timeListInterval(), 720);
+    QList<QTime> list;
+    list << QTime(0, 0, 0) << QTime(12, 0, 0) << QTime(23, 59, 59, 999);
+    QCOMPARE(m_combo->timeList(), list);
+    m_combo->setTimeRange(QTime(4, 0, 0, 0), QTime(5, 0, 0, 0));
+    m_combo-> setTimeListInterval(30);
+    list.clear();
+    list << QTime(4, 0, 0) << QTime(4, 30, 0) << QTime(5, 0, 0, 0);
+    QCOMPARE(m_combo->timeList(), list);
+    m_combo->setTimeRange(QTime(4, 0, 0, 0), QTime(4, 59, 0, 0));
+    m_combo-> setTimeListInterval(30);
+    list.clear();
+    list << QTime(4, 0, 0) << QTime(4, 30, 0) << QTime(4, 59, 0, 0);
+    QCOMPARE(m_combo->timeList(), list);
+    delete m_combo;
+}
+
+void KTimeComboBoxTest::testTimeList()
+{
+    m_combo = new KTimeComboBox();
+    QList<QTime> list;
+
+    // Test default list
+    QTime thisTime = QTime(0, 0, 0);
+    for (int i = 0; i < 1440; i = i + 15) {
+        list << thisTime.addSecs(i * 60);
+    }
+    list << QTime(23, 59, 59, 999);
+    QCOMPARE(m_combo->timeList(), list);
+
+    // Test basic list
+    list.clear();
+    list << QTime(3, 0, 0) << QTime(15, 16, 17);
+    m_combo->setTimeList(list);
+    QCOMPARE(m_combo->timeList(), list);
+    QCOMPARE(m_combo->minimumTime(), QTime(3, 0, 0));
+    QCOMPARE(m_combo->maximumTime(), QTime(15, 16, 17));
+
+    // Test sort input times
+    list.clear();
+    list << QTime(17, 16, 15) << QTime(4, 0, 0);
+    m_combo->setTimeList(list);
+    qSort(list);
+    QCOMPARE(m_combo->timeList(), list);
+    QCOMPARE(m_combo->minimumTime(), QTime(4, 0, 0));
+    QCOMPARE(m_combo->maximumTime(), QTime(17, 16, 15));
+
+    // Test ignore null QTime
+    list.clear();
+    list << QTime(3, 0, 0) << QTime(15, 16, 17) << QTime();
+    m_combo->setTimeList(list);
+    list.takeLast();
+    QCOMPARE(m_combo->timeList(), list);
+    QCOMPARE(m_combo->minimumTime(), QTime(3, 0, 0));
+    QCOMPARE(m_combo->maximumTime(), QTime(15, 16, 17));
+    delete m_combo;
+}
+
+void KTimeComboBoxTest::testOptions()
+{
+    m_combo = new KTimeComboBox();
+    KTimeComboBox::Options options = KTimeComboBox::EditTime | KTimeComboBox::SelectTime;
+    QCOMPARE(m_combo->options(), options);
+    options = KTimeComboBox::EditTime | KTimeComboBox::WarnOnInvalid;
+    m_combo->setOptions(options);
+    QCOMPARE(m_combo->options(), options);
+    delete m_combo;
+}
+
+void KTimeComboBoxTest::testDisplayFormat()
+{
+    m_combo = new KTimeComboBox();
+    KLocale::TimeFormatOptions format = KLocale::TimeDefault;
+    QCOMPARE(m_combo->displayFormat(), format);
+    format = KLocale::TimeWithoutSeconds;
+    m_combo->setDisplayFormat(format);
+    QCOMPARE(m_combo->displayFormat(), format);
+    delete m_combo;
+}
diff --git a/kdeui/tests/ktimecomboboxtest.h b/kdeui/tests/ktimecomboboxtest.h
new file mode 100644
index 0000000..bfb7291
--- /dev/null
+++ b/kdeui/tests/ktimecomboboxtest.h
@@ -0,0 +1,44 @@
+/*
+    Copyright 2011 John Layt <john at layt.net>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KTIMECOMBOBOXTEST_H
+#define KTIMECOMBOBOXTEST_H
+
+#include <QtGui/QWidget>
+
+class KTimeComboBox;
+
+class KTimeComboBoxTest : public QWidget
+{
+  Q_OBJECT
+
+private Q_SLOTS:
+  void testDefaults();
+  void testTimeRange();
+  void testTimeListInterval();
+  void testTimeList();
+  void testOptions();
+  void testDisplayFormat();
+
+private:
+
+  KTimeComboBox* m_combo;
+};
+
+#endif
diff --git a/kdeui/widgets/kdatecombobox.cpp b/kdeui/widgets/kdatecombobox.cpp
index 8475f07..42ca362 100644
--- a/kdeui/widgets/kdatecombobox.cpp
+++ b/kdeui/widgets/kdatecombobox.cpp
@@ -31,6 +31,7 @@
 #include "klocalizeddate.h"
 #include "kcombobox.h"
 #include "kdatepicker.h"
+#include "kmessagebox.h"
 
 class KDateComboBoxPrivate
 {
@@ -42,14 +43,19 @@ public:
     QDate defaultMinDate();
     QDate defaultMaxDate();
 
+    QString formatDate(const QDate &date);
+
     void initDateWidget();
+    void addMenuAction(const QString &text, const QDate &date);
     void updateDateWidget();
 
 // Q_PRIVATE_SLOTs
-    void selectDate(int index);
+    void clickDate();
+    void selectDate(QAction *action);
     void editDate(const QString &text);
     void enterDate(const QDate &date);
     void parseDate();
+    void warnDate();
 
     KDateComboBox *const q;
     QMenu *m_dateMenu;
@@ -60,9 +66,11 @@ public:
     KDateComboBox::Options m_options;
     QDate m_minDate;
     QDate m_maxDate;
-    QString m_minErrorMsg;
-    QString m_maxErrorMsg;
+    QString m_minWarnMsg;
+    QString m_maxWarnMsg;
+    bool m_warningShown;
     KLocale::DateFormat m_displayFormat;
+    QMap<QDate, QString> m_dateMap;
 };
 
 KDateComboBoxPrivate::KDateComboBoxPrivate(KDateComboBox *q)
@@ -72,26 +80,13 @@ KDateComboBoxPrivate::KDateComboBoxPrivate(KDateComboBox *q)
                       m_datePickerAction(new QWidgetAction(q)),
                       m_displayFormat(KLocale::ShortDate)
 {
+    m_options = KDateComboBox::EditDate | KDateComboBox::SelectDate | KDateComboBox::DatePicker | KDateComboBox::DateKeywords;
+    m_date.setDate(QDate::currentDate());
     m_minDate = defaultMinDate();
     m_maxDate = defaultMaxDate();
     m_datePicker->setCloseButton(false);
+    m_datePickerAction->setObjectName(QLatin1String("DatePicker"));
     m_datePickerAction->setDefaultWidget(m_datePicker);
-    m_minErrorMsg = i18n("The entered date is before the minimum allowed date.");
-    m_maxErrorMsg = i18n("The entered date is after the maximum allowed date.");
-    QString stringFreeze;
-    stringFreeze = i18nc( "@option tomorrow",   "Tomorrow" );
-    stringFreeze = i18nc( "@option today",      "Today" );
-    stringFreeze = i18nc( "@option yesterday",  "Yesterday" );
-    stringFreeze = i18nc( "@option next week",  "Next week" );
-    stringFreeze = i18nc( "@option last week",  "Last week" );
-    stringFreeze = i18nc( "@option next month", "Next Month" );
-    stringFreeze = i18nc( "@option last month", "Last Month" );
-    stringFreeze = i18nc( "@option next year",  "Next Year" );
-    stringFreeze = i18nc( "@option last year",  "Last Year" );
-    stringFreeze = i18nc( "@info", "Date cannot be earlier than %1", QString() );
-    stringFreeze = i18nc( "@info", "Date cannot be later than %1", QString() );
-    stringFreeze = i18nc( "@info/plain", "today" );
-    stringFreeze = i18n("The date you entered is invalid");
 }
 
 KDateComboBoxPrivate::~KDateComboBoxPrivate()
@@ -108,73 +103,172 @@ QDate KDateComboBoxPrivate::defaultMaxDate()
     return m_date.calendar()->latestValidDate();
 }
 
+QString KDateComboBoxPrivate::formatDate(const QDate &date)
+{
+    return m_date.calendar()->formatDate(date, m_displayFormat);
+}
+
 void KDateComboBoxPrivate::initDateWidget()
 {
-    q->setEditable(true);
-    q->setMaxCount(1);
+    q->blockSignals(true);
+    q->clear();
+
+    // If EditTime then set the line edit
+    q->lineEdit()->setReadOnly((m_options &KDateComboBox::EditDate) != KDateComboBox::EditDate);
+
+    // If SelectTime then make list items visible
+    if ((m_options &KDateComboBox::SelectDate) == KDateComboBox::SelectDate ||
+        (m_options &KDateComboBox::DatePicker) == KDateComboBox::DatePicker ||
+        (m_options &KDateComboBox::DatePicker) == KDateComboBox::DateKeywords) {
+        q->setMaxVisibleItems(1);
+    } else {
+        q->setMaxVisibleItems(0);
+    }
+
     q->addItem(m_date.formatDate(m_displayFormat));
     q->setCurrentIndex(0);
     q->setSizeAdjustPolicy(QComboBox::AdjustToContents);
 
     m_dateMenu->clear();
-    m_dateMenu->addAction(m_datePickerAction);
-    m_dateMenu->addSeparator();
-    m_dateMenu->addAction(i18nc("@option today", "Today"), q, SLOT( slotToday() ) );
-    m_dateMenu->addAction(i18nc("@option tomorrow", "Tomorrow" ), q, SLOT( slotTomorrow() ) );
-    m_dateMenu->addAction(i18nc("@option next week", "Next Week" ), q, SLOT( slotNextWeek() ) );
-    m_dateMenu->addAction(i18nc("@option next month", "Next Month" ), q, SLOT( slotNextMonth() ) );
-    m_dateMenu->addSeparator();
-    m_dateMenu->addAction(i18nc("@option do not specify a date", "No Date" ), q, SLOT( slotNoDate() ) );
+
+    if ((m_options &KDateComboBox::SelectDate) == KDateComboBox::SelectDate) {
+
+        if ((m_options &KDateComboBox::DatePicker) == KDateComboBox::DatePicker) {
+            m_dateMenu->addAction(m_datePickerAction);
+            m_dateMenu->addSeparator();
+        }
+
+        if ((m_options &KDateComboBox::DateKeywords) == KDateComboBox::DateKeywords) {
+            if (m_dateMap.isEmpty()) {
+                addMenuAction(i18nc("@option next year",  "Next Year" ), m_date.addYears(1).date());
+                addMenuAction(i18nc("@option next month", "Next Month"), m_date.addMonths(1).date());
+                addMenuAction(i18nc("@option next week",  "Next week" ), m_date.addDays(m_date.daysInWeek()).date());
+                addMenuAction(i18nc("@option tomorrow",   "Tomorrow"  ), m_date.addDays(1).date());
+                addMenuAction(i18nc("@option today",      "Today"     ), m_date.date());
+                addMenuAction(i18nc("@option yesterday",  "Yesterday" ), m_date.addDays(-1).date());
+                addMenuAction(i18nc("@option last week",  "Last week" ), m_date.addDays(-m_date.daysInWeek()).date());
+                addMenuAction(i18nc("@option last month", "Last Month"), m_date.addMonths(-1).date());
+                addMenuAction(i18nc("@option last year",  "Last Year" ), m_date.addYears(-1).date());
+                m_dateMenu->addSeparator();
+                addMenuAction(i18nc("@option do not specify a date", "No Date"), QDate());
+            } else {
+                QMapIterator<QDate, QString> i(m_dateMap);
+                while (i.hasNext()) {
+                    i.next();
+                    if (i.value().isEmpty()) {
+                        addMenuAction(formatDate(i.key()), i.key());
+                    } else if (i.value().toLower() == QLatin1String("separator")) {
+                        m_dateMenu->addSeparator();
+                    } else {
+                        addMenuAction(i.value(), i.key());
+                    }
+                }
+            }
+        }
+
+    }
+}
+
+void KDateComboBoxPrivate::addMenuAction(const QString &text, const QDate &date)
+{
+    QAction *action = new QAction(m_dateMenu);
+    action->setText(text);
+    action->setData(date);
+    m_dateMenu->addAction(action);
 }
 
 void KDateComboBoxPrivate::updateDateWidget()
 {
     q->blockSignals(true);
-    int pos = 0;
-    if (q->lineEdit()) {
-        pos = q->lineEdit()->cursorPosition();
-        q->lineEdit()->setText(m_date.formatDate(m_displayFormat));
-        m_datePicker->setDate(m_date.date());
-        q->lineEdit()->setCursorPosition(pos);
-    }
+    m_datePicker->blockSignals(true);
+    m_datePicker->setDate(m_date.date());
+    int pos = q->lineEdit()->cursorPosition();
+    q->setItemText(0, m_date.formatDate(m_displayFormat));
+    q->lineEdit()->setText(m_date.formatDate(m_displayFormat));
+    q->lineEdit()->setCursorPosition(pos);
+    m_datePicker->blockSignals(false);
     q->blockSignals(false);
 }
 
-void KDateComboBoxPrivate::selectDate(int index)
+void KDateComboBoxPrivate::selectDate(QAction *action)
 {
-    //enterTime();
+    if (action->objectName() != QLatin1String("DatePicker")) {
+        enterDate(action->data().toDate());
+    }
+}
+
+void KDateComboBoxPrivate::clickDate()
+{
+    enterDate(m_datePicker->date());
 }
 
-//TODO sure we want to update durign edit, should we wait for either exit widget or call to time()?
 void KDateComboBoxPrivate::editDate(const QString &text)
 {
-    //TODO read the text and set it
-    //enterTime(locale()->readTime(text));
+    m_warningShown = false;
+    emit q->dateEdited(m_date.readDate(text).date());
 }
 
 void KDateComboBoxPrivate::parseDate()
 {
-    enterDate(m_date.readDate(q->lineEdit()->text()).date());
+    m_date.setDate(m_date.readDate(q->lineEdit()->text()).date());
 }
 
 void KDateComboBoxPrivate::enterDate(const QDate &date)
 {
     q->setDate(date);
+    m_dateMenu->hide();
+    warnDate();
     emit q->dateEntered(m_date.date());
 }
 
+void KDateComboBoxPrivate::warnDate()
+{
+    if (!m_warningShown && !q->isValid() &&
+        (m_options &KDateComboBox::WarnOnInvalid) == KDateComboBox::WarnOnInvalid) {
+        QString warnMsg;
+        if (!m_date.date().isValid()) {
+            warnMsg = i18n("The date you entered is invalid");
+        } else if (m_date.date() < m_minDate) {
+            if (m_minWarnMsg.isEmpty()) {
+                warnMsg = i18nc("@info", "Date cannot be earlier than %1", formatDate(m_minDate));
+            } else {
+                warnMsg = m_minWarnMsg;
+                warnMsg.replace("%1", formatDate(m_minDate));
+            }
+        } else if (m_date.date() > m_maxDate) {
+            if (m_maxWarnMsg.isEmpty()) {
+                warnMsg = i18nc("@info", "Date cannot be later than %1", formatDate(m_maxDate));
+            } else {
+                warnMsg = m_maxWarnMsg;
+                warnMsg.replace("%1", formatDate(m_maxDate));
+            }
+        }
+        m_warningShown = true;
+        KMessageBox::sorry(q, warnMsg);
+    }
+}
+
 
 KDateComboBox::KDateComboBox(QWidget *parent)
               :KComboBox(parent),
                d(new KDateComboBoxPrivate(this))
 {
+    setEditable(true);
+    setMaxVisibleItems(1);
+    setInsertPolicy(QComboBox::NoInsert);
+    setSizeAdjustPolicy(QComboBox::AdjustToContents);
     d->m_datePicker->installEventFilter(this);
     d->initDateWidget();
     d->updateDateWidget();
-    connect( d->m_datePicker, SIGNAL(dateChanged(const QDate&)),
-             this,            SLOT(enterDate(const QDate&)));
-    connect( d->m_datePicker, SIGNAL(dateSelected(const QDate&)),
-             this,            SLOT(enterDate(const QDate&)));
+
+    connect(d->m_dateMenu,         SIGNAL(triggered(QAction*)),
+            this,                  SLOT(selectDate(QAction*)));
+    connect(this,                  SIGNAL(editTextChanged(const QString&)),
+            this,                  SLOT(editDate(const QString&)));
+    connect(d->m_datePicker,       SIGNAL(dateEntered(const QDate&)),
+            this,                  SLOT(enterDate(const QDate&)));
+    connect(d->m_datePicker,       SIGNAL(tableClicked()),
+            this,                  SLOT(clickDate()));
 }
 
 KDateComboBox::~KDateComboBox()
@@ -231,12 +325,9 @@ void KDateComboBox::setCalendar(KCalendarSystem *calendar)
 
 bool KDateComboBox::isValid() const
 {
-    if (d->m_minDate.isValid() && d->m_maxDate.isValid()) {
-        return d->m_date.isValid() &&
-               d->m_date >= d->m_minDate &&
-               d->m_date <= d->m_maxDate;
-    }
-    return d->m_date.isValid();
+    return d->m_date.isValid() &&
+           d->m_date >= d->m_minDate &&
+           d->m_date <= d->m_maxDate;
 }
 
 KDateComboBox::Options KDateComboBox::options() const
@@ -247,6 +338,8 @@ KDateComboBox::Options KDateComboBox::options() const
 void KDateComboBox::setOptions(Options options)
 {
     d->m_options = options;
+    d->initDateWidget();
+    d->updateDateWidget();
 }
 
 QDate KDateComboBox::minimumDate() const
@@ -254,47 +347,49 @@ QDate KDateComboBox::minimumDate() const
     return d->m_minDate;
 }
 
-QDate KDateComboBox::maximumDate() const
+void KDateComboBox::setMinimumDate(const QDate &minDate, const QString &minWarnMsg)
 {
-    return d->m_maxDate;
+    setDateRange(minDate, d->m_maxDate, minWarnMsg, d->m_maxWarnMsg);
 }
 
-void KDateComboBox::setDateRange(const QDate &minDate,
-                                 const QDate &maxDate,
-                                 const QString &minErrorMsg,
-                                 const QString &maxErrorMsg)
+void KDateComboBox::resetMinimumDate()
 {
-    if (minDate.isValid() != maxDate.isValid()) {
-        return;
-    }
+    setDateRange(d->defaultMinDate(), d->m_maxDate, QString(), d->m_maxWarnMsg);
+}
 
-    if (minDate <= maxDate) {
-        d->m_minDate = minDate;
-        d->m_maxDate = maxDate;
-        d->m_minErrorMsg = minErrorMsg;
-        d->m_maxErrorMsg = maxErrorMsg;
-    }
+QDate KDateComboBox::maximumDate() const
+{
+    return d->m_maxDate;
 }
 
-void KDateComboBox::resetMinimumDate()
+void KDateComboBox::setMaximumDate(const QDate &maxDate, const QString &maxWarnMsg)
 {
-    d->m_minDate = d->defaultMinDate();
+    setDateRange(d->m_minDate, maxDate, d->m_minWarnMsg, maxWarnMsg);
 }
 
 void KDateComboBox::resetMaximumDate()
 {
-    d->m_maxDate = d->defaultMaxDate();
+    setDateRange(d->m_minDate, d->defaultMaxDate(), d->m_minWarnMsg, QString());
 }
 
-void KDateComboBox::resetDateRange()
+void KDateComboBox::setDateRange(const QDate &minDate,
+                                 const QDate &maxDate,
+                                 const QString &minErrorMsg,
+                                 const QString &maxErrorMsg)
 {
-    setDateRange(d->defaultMinDate(), d->defaultMaxDate());
+    if (!minDate.isValid() || !maxDate.isValid() || minDate > maxDate) {
+        return;
+   }
+
+    d->m_minDate = minDate;
+    d->m_maxDate = maxDate;
+    d->m_minWarnMsg = minErrorMsg;
+    d->m_maxWarnMsg = maxErrorMsg;
 }
 
-void KDateComboBox::clearDateRange()
+void KDateComboBox::resetDateRange()
 {
-    resetMinimumDate();
-    resetMaximumDate();
+    setDateRange(d->defaultMinDate(), d->defaultMaxDate(), QString(), QString());
 }
 
 KLocale::DateFormat KDateComboBox::displayFormat()
@@ -305,6 +400,20 @@ KLocale::DateFormat KDateComboBox::displayFormat()
 void KDateComboBox::setDisplayFormat(KLocale::DateFormat format)
 {
     d->m_displayFormat = format;
+    d->initDateWidget();
+    d->updateDateWidget();
+}
+
+QMap<QDate, QString> KDateComboBox::dateMap() const
+{
+    return d->m_dateMap;
+}
+
+void KDateComboBox::setDateMap(QMap<QDate, QString> dateMap)
+{
+    d->m_dateMap.clear();
+    d->m_dateMap = dateMap;
+    d->initDateWidget();
 }
 
 bool KDateComboBox::eventFilter(QObject *object, QEvent *event)
@@ -314,39 +423,47 @@ bool KDateComboBox::eventFilter(QObject *object, QEvent *event)
 
 void KDateComboBox::keyPressEvent(QKeyEvent *keyEvent)
 {
+    QDate temp;
     switch (keyEvent->key()) {
     case Qt::Key_Down:
-        d->enterDate(d->m_date.addDays(-1).date());
+        temp = d->m_date.addDays(-1).date();
         return;
     case Qt::Key_Up:
-        d->enterDate(d->m_date.addDays(1).date());
+        temp = d->m_date.addDays(1).date();
         return;
     case Qt::Key_PageDown:
-        d->enterDate(d->m_date.addMonths(-1).date());
+        temp = d->m_date.addMonths(-1).date();
         return;
     case Qt::Key_PageUp:
-        d->enterDate(d->m_date.addMonths(1).date());
+        temp = d->m_date.addMonths(1).date();
         return;
     default:
         KComboBox::keyPressEvent(keyEvent);
     }
+    if (temp.isValid() && temp >= d->m_minDate && temp <= d->m_maxDate) {
+        d->enterDate(temp);
+    }
 }
 
 void KDateComboBox::focusOutEvent(QFocusEvent *event)
 {
-    if (event->type() == QEvent::FocusOut) {
-        d->parseDate();
-    }
+    d->parseDate();
+    d->warnDate();
     KComboBox::focusOutEvent(event);
 }
 
-//copied form KDateEdit, still to refactor.
 void KDateComboBox::showPopup()
 {
-    if (!isEditable() || !d->m_dateMenu) {
+    if (!isEditable() ||
+        !d->m_dateMenu ||
+        (d->m_options &KDateComboBox::SelectDate) != KDateComboBox::SelectDate) {
         return;
     }
 
+    d->m_datePicker->blockSignals(true);
+    d->m_datePicker->setDate(d->m_date.date());
+    d->m_datePicker->blockSignals(false);
+
     const QRect desk = KGlobalSettings::desktopGeometry(this);
 
     QPoint popupPoint = mapToGlobal(QPoint(0, 0));
@@ -372,16 +489,6 @@ void KDateComboBox::showPopup()
     }
 
     d->m_dateMenu->popup(popupPoint);
-
-    //Update when done
-
-    // Now, simulate an Enter to unpress it
-    QAbstractItemView *lb = view();
-    if (lb) {
-        lb->setCurrentIndex(lb->model()->index(0, 0));
-        QKeyEvent *keyEvent = new QKeyEvent(QEvent::KeyPress, Qt::Key_Enter, Qt::NoModifier);
-        QApplication::postEvent(lb, keyEvent);
-    }
 }
 
 void KDateComboBox::hidePopup()
@@ -409,5 +516,4 @@ void KDateComboBox::resizeEvent(QResizeEvent *event)
     KComboBox::resizeEvent(event);
 }
 
-
 #include "kdatecombobox.moc"
diff --git a/kdeui/widgets/kdatecombobox.h b/kdeui/widgets/kdatecombobox.h
index 7aa0e81..ab2e910 100644
--- a/kdeui/widgets/kdatecombobox.h
+++ b/kdeui/widgets/kdatecombobox.h
@@ -36,30 +36,33 @@ class KDEUI_EXPORT KDateComboBox : public KComboBox
     Q_OBJECT
 
     Q_PROPERTY(QDate date READ date WRITE setDate NOTIFY dateChanged USER true)
-    Q_PROPERTY(QDate minimumDate READ minimumDate RESET resetMinimumDate)
-    Q_PROPERTY(QDate maximumDate READ maximumDate RESET resetMaximumDate)
+    Q_PROPERTY(QDate minimumDate READ minimumDate WRITE setMinimumDate RESET resetMinimumDate)
+    Q_PROPERTY(QDate maximumDate READ maximumDate WRITE setMaximumDate RESET resetMaximumDate)
     Q_PROPERTY(Options options READ options WRITE setOptions)
-    //Q_PROPERTY(KLocale::DateFormat displayFormat READ displayFormat WRITE setDisplayFormat)
+    Q_FLAGS(Options)
 
 public:
 
     /**
      * Options provided by the widget
-     * @see options
-     * @see setOptions
+     * @see options()
+     * @see setOptions()
      */
     enum Option {
         EditDate         = 0x0001,  /**< Allow the user to manually edit the date in the combo line edit */
         SelectDate       = 0x0002,  /**< Allow the user to select the date from a drop-down menu */
         DatePicker       = 0x0004,  /**< Show a date picker in the drop-down */
         DateKeywords     = 0x0008,  /**< Show date keywords in the drop-down */
-        WarnOnInvalid    = 0x0010,  /**< Show a warning on focus out if the date is invalid */
-        ErrorOnInvalid   = 0x0020   /**< Show an error on focus out if the date is invalid */
+        WarnOnInvalid    = 0x0010   /**< Show a warning on focus out if the date is invalid */
     };
     Q_DECLARE_FLAGS(Options, Option)
 
     /**
      * Create a new KDateComboBox widget
+     *
+     * By default the EditDate, SelectDate, DatePicker and DateKeywords options
+     * are enabled, the ShortDate format is used and the date is set to the
+     * current date.
      */
     explicit KDateComboBox(QWidget *parent = 0);
 
@@ -114,7 +117,7 @@ public:
     Options options() const;
 
     /**
-     * Return the currently set date format
+     * Return the currently set date display format
      *
      * By default this is the Short Date
      *
@@ -130,11 +133,6 @@ public:
     QDate minimumDate() const;
 
     /**
-     * Reset the minimum date to the default
-     */
-    void resetMinimumDate();
-
-    /**
      * Return the current maximum date
      *
      * @return the current maximum date
@@ -142,45 +140,13 @@ public:
     QDate maximumDate() const;
 
     /**
-     * Reset the maximum date to the default
-     */
-    void resetMaximumDate();
-
-    /**
-     * Set the minimum and maximum date range.
-     *
-     * To enable date range checking provide two valid dates.
-     * To disable date range checking provide two invalid dates, or call
-     * clearDateRange;
-     *
-     * @param minDate the minimum date
-     * @param maxDate the maximum date
-     * @param minErrorMsg the minimum error message
-     * @param maxErrorMsg the maximum error message
-     */
-    void setDateRange(const QDate &minDate,
-                      const QDate &maxDate,
-                      const QString &minErrorMsg = QString(),
-                      const QString &maxErrorMsg = QString());
-
-    /**
-     * Reset the minimum and maximum date to the default values.
-     */
-    void resetDateRange();
-
-    /**
-     * Clear the minimum and maximum date, i.e. disable date range checking.
-     */
-    void clearDateRange();
-
-    /**
-     * Changes the calendar system to use.  Can use its own local locale if set.
+     * Return the map of dates listed in the drop-down and their displayed
+     * string forms.
      *
-     * You retain ownership of the calendar object, it will not be destroyed with the widget.
-     *
-     * @param calendar the calendar system object to use, defaults to global
+     * @see setDateMap()
+     * @return the select date map
      */
-    void setCalendar(KCalendarSystem *calendar = 0);
+    QMap<QDate, QString> dateMap() const;
 
 Q_SIGNALS:
 
@@ -234,6 +200,15 @@ public Q_SLOTS:
     void setCalendarSystem(KLocale::CalendarSystem calendarSystem);
 
     /**
+     * Changes the calendar system to use.  Can use its own local locale if set.
+     *
+     * You retain ownership of the calendar object, it will not be destroyed with the widget.
+     *
+     * @param calendar the calendar system object to use, defaults to global
+     */
+    void setCalendar(KCalendarSystem *calendar = 0);
+
+    /**
      * Set the new widget options
      *
      * @param options the new widget options
@@ -249,6 +224,85 @@ public Q_SLOTS:
      */
     void setDisplayFormat(KLocale::DateFormat format);
 
+    /**
+     * Set the valid date range to be applied by isValid().
+     *
+     * Both dates must be valid and the minimum date must be less than or equal
+     * to the maximum date, otherwise the date range will not be set.
+     *
+     * @param minDate the minimum date
+     * @param maxDate the maximum date
+     * @param minWarnMsg the minimum warning message
+     * @param maxWarnMsg the maximum warning message
+     */
+    void setDateRange(const QDate &minDate,
+                      const QDate &maxDate,
+                      const QString &minWarnMsg = QString(),
+                      const QString &maxWarnMsg = QString());
+
+    /**
+     * Reset the minimum and maximum date to the default values.
+     * @see setDateRange()
+     */
+    void resetDateRange();
+
+    /**
+     * Set the minimum allowed date.
+     *
+     * If the date is invalid, or greater than current maximum,
+     * then the minimum will not be set.
+     *
+     * @see minimumDate()
+     * @see maximumDate()
+     * @see setMaximumDate()
+     * @see setDateRange()
+     * @param minDate the minimum date
+     * @param minWarnMsg the minimum warning message
+     */
+    void setMinimumDate(const QDate &minTime, const QString &minWarnMsg = QString());
+
+    /**
+     * Reset the minimum date to the default
+     */
+    void resetMinimumDate();
+
+    /**
+     * Set the maximum allowed date.
+     *
+     * If the date is invalid, or less than current minimum,
+     * then the maximum will not be set.
+     *
+     * @see minimumDate()
+     * @see maximumDate()
+     * @see setMaximumDate()
+     * @see setDateRange()
+     * @param maxDate the maximum date
+     * @param maxWarnMsg the maximum warning message
+     */
+    void setMaximumDate(const QDate &maxDate, const QString &maxWarnMsg = QString());
+
+    /**
+     * Reset the maximum date to the default
+     */
+    void resetMaximumDate();
+
+    /**
+     * Set the list of dates able to be selected from the drop-down and the
+     * string form to display for those dates, e.g. "2010-01-01" and "Yesterday".
+     *
+     * Any invalid or duplicate dates will be used, the list will NOT be
+     * sorted, and the minimum and maximum date will not be affected.
+     *
+     * The @p dateMap is keyed by the date to be listed and the value is the
+     * string to be displayed.  If you want the date to be displayed in the
+     * default date format then the string should be null.  If you want a
+     * separator to be displayed then set the string to "seperator".
+     *
+     * @see dateMap()
+     * @param dateMap the map of dates able to be selected
+     */
+    void setDateMap(QMap<QDate, QString> dateMap);
+
 protected:
 
     virtual bool eventFilter(QObject *object, QEvent *event);
@@ -284,7 +338,8 @@ private:
     friend class KDateComboBoxPrivate;
     KDateComboBoxPrivate *const d;
 
-    Q_PRIVATE_SLOT(d, void selectDate(int index))
+    Q_PRIVATE_SLOT(d, void clickDate())
+    Q_PRIVATE_SLOT(d, void selectDate(QAction*))
     Q_PRIVATE_SLOT(d, void editDate(const QString&))
     Q_PRIVATE_SLOT(d, void enterDate(const QDate&))
     Q_PRIVATE_SLOT(d, void parseDate())
diff --git a/kdeui/widgets/kdateedit.cpp b/kdeui/widgets/kdateedit.cpp
deleted file mode 100644
index 64af8dd..0000000
--- a/kdeui/widgets/kdateedit.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
-    Copyright 2011 John Layt <john at layt.net>
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library General Public
-    License as published by the Free Software Foundation; either
-    version 2 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Library General Public License for more details.
-
-    You should have received a copy of the GNU Library General Public License
-    along with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-    Boston, MA 02110-1301, USA.
-*/
-
-#include "kdateedit.h"
-
-KDateEdit::KDateEdit(QWidget *parent)
-          :KDateTimeEdit(parent)
-{
-    setOptions(KDateTimeEdit::ShowDate | KDateTimeEdit::EditDate | KDateTimeEdit::SelectDate);
-}
-
-KDateEdit::~KDateEdit()
-{
-}
diff --git a/kdeui/widgets/kdateedit.h b/kdeui/widgets/kdateedit.h
deleted file mode 100644
index bd68500..0000000
--- a/kdeui/widgets/kdateedit.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-    Copyright 2011 John Layt <john at layt.net>
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library General Public
-    License as published by the Free Software Foundation; either
-    version 2 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Library General Public License for more details.
-
-    You should have received a copy of the GNU Library General Public License
-    along with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-    Boston, MA 02110-1301, USA.
-*/
-
-#ifndef KDATEEDIT_H
-#define KDATEEDIT_H
-
-#include <kdeui_export.h>
-
-#include <QtGui/QWidget>
-
-#include "kdatetimeedit.h"
-
-class KDEUI_EXPORT KDateEdit : public KDateTimeEdit
-{
-    Q_OBJECT
-public:
-    KDateEdit(QWidget *parent = 0);
-    virtual ~KDateEdit();
-};
-
-#endif // KDATEEDIT_H
diff --git a/kdeui/widgets/kdatepicker.h b/kdeui/widgets/kdatepicker.h
index df83193..8dfc8de 100644
--- a/kdeui/widgets/kdatepicker.h
+++ b/kdeui/widgets/kdatepicker.h
@@ -7,12 +7,12 @@
     modify it under the terms of the GNU Library General Public
     License as published by the Free Software Foundation; either
     version 2 of the License, or (at your option) any later version.
- 
+
     This library is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     Library General Public License for more details.
- 
+
     You should have received a copy of the GNU Library General Public License
     along with this library; see the file COPYING.LIB.  If not, write to
     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
@@ -98,25 +98,25 @@ public:
 
     /**
      * Returns the currently selected calendar system.
-     * 
+     *
      * @returns a KCalendarSystem object
      */
     const KCalendarSystem *calendar() const;
 
     /**
      * Changes the calendar system to use.  Can use its own local locale if set.
-     * 
+     *
      * @param calendar the calendar system object to use, defaults to global
-     * 
+     *
      * @return @c true if the calendar system was successfully set, @c false otherwise
      */
     bool setCalendar( KCalendarSystem *calendar = 0 );
 
     /**
      * Changes the calendar system to use.  Will always use global locale.
-     * 
+     *
      * @param calendarType the calendar system type to use
-     * 
+     *
      * @return @c true if the calendar system was successfully set, @c false otherwise
      */
     bool setCalendar( const QString &calendarType );
diff --git a/kdeui/widgets/kdatetimeedit.cpp b/kdeui/widgets/kdatetimeedit.cpp
index 32edfa3..6f0ff75 100644
--- a/kdeui/widgets/kdatetimeedit.cpp
+++ b/kdeui/widgets/kdatetimeedit.cpp
@@ -32,6 +32,7 @@
 #include "kcombobox.h"
 #include "kdatepicker.h"
 #include "kdatecombobox.h"
+#include "kmessagebox.h"
 
 #include "ui_kdatetimeedit.h"
 
@@ -42,17 +43,19 @@ public:
     virtual ~KDateTimeEditPrivate();
 
     const KCalendarSystem *calendar() const;
-    KLocale *locale();
 
-    QDateTime defaultMinDateTime();
-    QDate defaultMinDate();
-    QTime defaultMinTime();
-    QDateTime defaultMaxDateTime();
-    QDate defaultMaxDate();
-    QTime defaultMaxTime();
+    KDateTime defaultMinDateTime();
+    KDateTime defaultMaxDateTime();
 
+    void initWidgets();
+    void initDateWidget();
+    void initTimeWidget();
     void initCalendarWidget();
-    void initTimeZoneWidget();
+    void updateCalendarWidget();
+    void initTimeSpecWidget();
+    void updateTimeSpecWidget();
+
+    void warnDateTime();
 
 //private slots:
     void selectCalendar(int index);
@@ -64,11 +67,12 @@ public:
 
     KDateTimeEdit::Options m_options;
     KDateTime m_dateTime;
-    QDateTime m_minDateTime;
-    QDateTime m_maxDateTime;
-    QString m_minErrorMsg;
-    QString m_maxErrorMsg;
+    KDateTime m_minDateTime;
+    KDateTime m_maxDateTime;
+    QString m_minWarnMsg;
+    QString m_maxWarnMsg;
 
+    QList<KLocale::CalendarSystem> m_calendarSystems;
     KTimeZones::ZoneMap m_zones;
 
     Ui::KDateTimeEdit ui;
@@ -78,10 +82,11 @@ KDateTimeEditPrivate::KDateTimeEditPrivate(KDateTimeEdit *q)
                      :q(q)
 {
     m_options = KDateTimeEdit::ShowDate | KDateTimeEdit::EditDate | KDateTimeEdit::SelectDate |
-                KDateTimeEdit::ShowTime | KDateTimeEdit::EditTime | KDateTimeEdit::SelectTime;
+                KDateTimeEdit::ShowTime | KDateTimeEdit::EditTime | KDateTimeEdit::SelectTime |
+                KDateTimeEdit::DatePicker | KDateTimeEdit::DateKeywords;
     m_dateTime = KDateTime::currentLocalDateTime();
-    m_minErrorMsg = i18n("The entered date and time is before the minimum allowed date and time.");
-    m_maxErrorMsg = i18n("The entered date and time is after the maximum allowed date and time.");
+    m_dateTime.setTime(QTime(0, 0, 0));
+    m_calendarSystems = KCalendarSystem::calendarSystemsList();
     m_zones = KSystemTimeZones::zones();
 }
 
@@ -94,48 +99,82 @@ const KCalendarSystem *KDateTimeEditPrivate::calendar() const
     return ui.m_dateCombo->calendar();
 }
 
-KLocale *KDateTimeEditPrivate::locale()
-{
-    return KGlobal::locale();
-}
-
-QDateTime KDateTimeEditPrivate::defaultMinDateTime()
-{
-    return QDateTime(calendar()->earliestValidDate(), QTime(0, 0, 0, 0));
-}
-
-QDate KDateTimeEditPrivate::defaultMinDate()
+KDateTime KDateTimeEditPrivate::defaultMinDateTime()
 {
-    return calendar()->earliestValidDate();
+    return KDateTime(calendar()->earliestValidDate(), QTime(0, 0, 0, 0));
 }
 
-QTime KDateTimeEditPrivate::defaultMinTime()
+KDateTime KDateTimeEditPrivate::defaultMaxDateTime()
 {
-    return QTime(0, 0, 0, 0);
+    return KDateTime(calendar()->latestValidDate(), QTime(23, 59, 59, 999));
 }
 
-QDateTime KDateTimeEditPrivate::defaultMaxDateTime()
+void KDateTimeEditPrivate::initWidgets()
 {
-    return QDateTime(calendar()->latestValidDate(), QTime(23, 59, 59, 999));
+    initDateWidget();
+    initTimeWidget();
+    initCalendarWidget();
+    initTimeSpecWidget();
 }
 
-QDate KDateTimeEditPrivate::defaultMaxDate()
+void KDateTimeEditPrivate::initDateWidget()
 {
-    return calendar()->latestValidDate();
+    ui.m_dateCombo->blockSignals(true);
+    ui.m_dateCombo->setVisible((m_options &KDateTimeEdit::ShowDate) == KDateTimeEdit::ShowDate);
+    KDateComboBox::Options options;
+    if ((m_options &KDateTimeEdit::EditDate) == KDateTimeEdit::EditDate) {
+        options = options | KDateComboBox::EditDate;
+    }
+    if ((m_options &KDateTimeEdit::SelectDate) == KDateTimeEdit::SelectDate) {
+        options = options | KDateComboBox::SelectDate;
+    }
+    if ((m_options &KDateTimeEdit::DatePicker) == KDateTimeEdit::DatePicker) {
+        options = options | KDateComboBox::DatePicker;
+    }
+    if ((m_options &KDateTimeEdit::DateKeywords) == KDateTimeEdit::DateKeywords) {
+        options = options | KDateComboBox::DateKeywords;
+    }
+    ui.m_dateCombo->setOptions(options);
+    ui.m_dateCombo->blockSignals(false);
 }
 
-QTime KDateTimeEditPrivate::defaultMaxTime()
+void KDateTimeEditPrivate::initTimeWidget()
 {
-    return QTime(23, 59, 59, 999);
+    ui.m_timeCombo->blockSignals(true);
+    ui.m_timeCombo->setVisible((m_options &KDateTimeEdit::ShowDate) == KDateTimeEdit::ShowDate);
+    KTimeComboBox::Options options;
+    if ((m_options &KDateTimeEdit::EditTime) == KDateTimeEdit::EditTime) {
+        options = options | KTimeComboBox::EditTime;
+    }
+    if ((m_options &KDateTimeEdit::SelectTime) == KDateTimeEdit::SelectTime) {
+        options = options | KTimeComboBox::SelectTime;
+    }
+    if ((m_options &KDateTimeEdit::ForceTime) == KDateTimeEdit::ForceTime) {
+        options = options | KTimeComboBox::ForceTime;
+    }
+    ui.m_timeCombo->setOptions(options);
+    ui.m_timeCombo->blockSignals(false);
 }
 
 void KDateTimeEditPrivate::initCalendarWidget()
 {
+    ui.m_calendarCombo->blockSignals(true);
     ui.m_calendarCombo->clear();
-    foreach (KLocale::CalendarSystem calendar, KCalendarSystem::calendarSystemsList()) {
+    foreach (KLocale::CalendarSystem calendar, m_calendarSystems) {
         ui.m_calendarCombo->addItem(KCalendarSystem::calendarLabel(calendar), calendar);
     }
     ui.m_calendarCombo->setCurrentIndex(ui.m_calendarCombo->findData(ui.m_dateCombo->calendarSystem()));
+    ui.m_calendarCombo->setVisible((m_options &KDateTimeEdit::ShowCalendar) == KDateTimeEdit::ShowCalendar);
+    ui.m_calendarCombo->setEnabled((m_options &KDateTimeEdit::SelectCalendar) == KDateTimeEdit::SelectCalendar);
+    ui.m_calendarCombo->setEditable(false);
+    ui.m_calendarCombo->blockSignals(false);
+}
+
+void KDateTimeEditPrivate::updateCalendarWidget()
+{
+    ui.m_calendarCombo->blockSignals(true);
+    ui.m_calendarCombo->setCurrentIndex(ui.m_calendarCombo->findData(ui.m_dateCombo->calendarSystem()));
+    ui.m_calendarCombo->blockSignals(false);
 }
 
 void KDateTimeEditPrivate::selectCalendar(int index)
@@ -149,11 +188,12 @@ void KDateTimeEditPrivate::enterCalendar(KLocale::CalendarSystem calendarSystem)
     emit q->calendarEntered(ui.m_dateCombo->calendarSystem());
 }
 
-void KDateTimeEditPrivate::initTimeZoneWidget()
+void KDateTimeEditPrivate::initTimeSpecWidget()
 {
-    ui.m_timeZoneCombo->clear();
-    ui.m_timeZoneCombo->addItem(i18n("UTC"), "UTC");
-    ui.m_timeZoneCombo->addItem(i18n("Floating"), "Floating");
+    ui.m_timeSpecCombo->blockSignals(true);
+    ui.m_timeSpecCombo->clear();
+    ui.m_timeSpecCombo->addItem(i18n("UTC"), "UTC");
+    ui.m_timeSpecCombo->addItem(i18n("Floating"), "Floating");
     QStringList keys = m_zones.keys();
     QMap<QString, QString> names;
     foreach (const QString &key, keys) {
@@ -162,8 +202,18 @@ void KDateTimeEditPrivate::initTimeZoneWidget()
     QMapIterator<QString, QString> i(names);
     while (i.hasNext()) {
         i.next();
-        ui.m_timeZoneCombo->addItem(i.key(), i.value());
+        ui.m_timeSpecCombo->addItem(i.key(), i.value());
     }
+    ui.m_timeSpecCombo->setVisible((m_options &KDateTimeEdit::ShowTimeSpec) == KDateTimeEdit::ShowTimeSpec);
+    ui.m_timeSpecCombo->setEnabled((m_options &KDateTimeEdit::SelectTimeSpec) == KDateTimeEdit::SelectTimeSpec);
+    ui.m_timeSpecCombo->setEditable(false);
+    ui.m_timeSpecCombo->blockSignals(false);
+}
+
+void KDateTimeEditPrivate::updateTimeSpecWidget()
+{
+    ui.m_timeSpecCombo->blockSignals(true);
+    ui.m_timeSpecCombo->blockSignals(false);
 }
 
 void KDateTimeEditPrivate::selectTimeZone(int index)
@@ -178,6 +228,39 @@ void KDateTimeEditPrivate::enterTimeZone(const QString &zone)
     emit q->timeSpecEntered(m_dateTime.timeSpec());
 }
 
+void KDateTimeEditPrivate::warnDateTime()
+{
+    if (!q->isValid() &&
+        (m_options &KDateTimeEdit::WarnOnInvalid) == KDateTimeEdit::WarnOnInvalid) {
+        QString warnMsg;
+        if (!m_dateTime.isValid()) {
+            //TODO Add missing string
+            //warnMsg = i18n("The date or time you entered is invalid");
+        } else if (m_dateTime < m_minDateTime) {
+            if (m_minWarnMsg.isEmpty()) {
+                //TODO Add datetime to string
+                //warnMsg = i18nc("@info", "Date and time cannot be earlier than %1", formatDate(m_minDate));
+                warnMsg = i18n("The entered date and time is before the minimum allowed date and time.");
+            } else {
+                warnMsg = m_minWarnMsg;
+                //TODO localize properly
+                warnMsg.replace("%1", KGlobal::locale()->formatDateTime(m_minDateTime));
+            }
+        } else if (m_dateTime > m_maxDateTime) {
+            if (m_maxWarnMsg.isEmpty()) {
+                //TODO Add datetime to string
+                //warnMsg = i18nc("@info", "Date cannot be later than %1", formatDate(m_maxDate));
+                warnMsg = i18n("The entered date and time is after the maximum allowed date and time.");
+            } else {
+                warnMsg = m_maxWarnMsg;
+                warnMsg.replace("%1", KGlobal::locale()->formatDateTime(m_maxDateTime));
+            }
+        }
+        KMessageBox::sorry(q, warnMsg);
+    }
+}
+
+
 KDateTimeEdit::KDateTimeEdit(QWidget *parent)
               :QWidget(parent),
                d(new KDateTimeEditPrivate(this))
@@ -191,12 +274,12 @@ KDateTimeEdit::KDateTimeEdit(QWidget *parent)
     d->ui.m_calendarCombo->installEventFilter(this);
     d->ui.m_dateCombo->installEventFilter(this);
     d->ui.m_timeCombo->installEventFilter(this);
-    d->ui.m_timeZoneCombo->installEventFilter(this);
-    d->initCalendarWidget();
-    d->initTimeZoneWidget();
+    d->ui.m_timeSpecCombo->installEventFilter(this);
+    d->initWidgets();
+
     connect( d->ui.m_calendarCombo, SIGNAL(activated(int)),
              this,                      SLOT(selectCalendar(int)));
-    connect( d->ui.m_timeZoneCombo, SIGNAL(activated(int)),
+    connect( d->ui.m_timeSpecCombo, SIGNAL(activated(int)),
              this,                      SLOT(selectTimeZone(int)));
 }
 
@@ -205,14 +288,14 @@ KDateTimeEdit::~KDateTimeEdit()
     delete d;
 }
 
-KDateTime KDateTimeEdit::fullDateTime() const
+KDateTime KDateTimeEdit::dateTime() const
 {
     return d->m_dateTime;
 }
 
-QDateTime KDateTimeEdit::dateTime() const
+KLocale::CalendarSystem KDateTimeEdit::calendarSystem()
 {
-    return d->m_dateTime.dateTime();
+   return d-> ui.m_dateCombo->calendarSystem();
 }
 
 QDate KDateTimeEdit::date() const
@@ -220,11 +303,6 @@ QDate KDateTimeEdit::date() const
     return d->m_dateTime.date();
 }
 
-KLocale::CalendarSystem KDateTimeEdit::calendarSystem()
-{
-   return d-> ui.m_dateCombo->calendarSystem();
-}
-
 QTime KDateTimeEdit::time() const
 {
     return d->m_dateTime.time();
@@ -238,8 +316,24 @@ KDateTime::Spec KDateTimeEdit::timeSpec() const
 bool KDateTimeEdit::isValid() const
 {
     return d->m_dateTime.isValid() &&
-           d->m_dateTime.dateTime() >= d->m_minDateTime &&
-           d->m_dateTime.dateTime() <= d->m_maxDateTime;
+           d->m_dateTime >= d->m_minDateTime &&
+           d->m_dateTime <= d->m_maxDateTime;
+}
+
+bool KDateTimeEdit::isValidDate() const
+{
+    return d->ui.m_dateCombo->isValid();
+}
+
+bool KDateTimeEdit::isValidTime() const
+{
+    return d->ui.m_timeCombo->isValid();
+}
+
+void KDateTimeEdit::setOptions(Options options)
+{
+    d->m_options = options;
+    d->initWidgets();
 }
 
 KDateTimeEdit::Options KDateTimeEdit::options() const
@@ -255,22 +349,15 @@ void KDateTimeEdit::setDateTime(const KDateTime &dateTime)
 
     assignDateTime(dateTime);
     emit dateTimeChanged(d->m_dateTime);
-    emit dateTimeChanged(d->m_dateTime.dateTime());
     emit dateChanged(d->m_dateTime.date());
     emit timeChanged(d->m_dateTime.time());
 }
 
-void KDateTimeEdit::setDateTime(const QDateTime &dateTime)
+void KDateTimeEdit::assignDateTime(const KDateTime &dateTime)
 {
-    if (dateTime == d->m_dateTime.dateTime()) {
-        return;
-    }
-
-    assignDateTime(dateTime);
-    emit dateTimeChanged(d->m_dateTime);
-    emit dateTimeChanged(d->m_dateTime.dateTime());
-    emit dateChanged(d->m_dateTime.date());
-    emit timeChanged(d->m_dateTime.time());
+    d->m_dateTime = dateTime;
+    d->ui.m_dateCombo->setDate(dateTime.date());
+    d->ui.m_timeCombo->setTime(dateTime.time());
 }
 
 void KDateTimeEdit::setDate(const QDate &date)
@@ -281,20 +368,36 @@ void KDateTimeEdit::setDate(const QDate &date)
 
     assignDate(date);
     emit dateTimeChanged(d->m_dateTime);
-    emit dateTimeChanged(d->m_dateTime.dateTime());
     emit dateChanged(d->m_dateTime.date());
 }
 
+void KDateTimeEdit::assignDate(const QDate &date)
+{
+    d->m_dateTime.setDate(date);
+    d->ui.m_dateCombo->setDate(date);
+}
+
 void KDateTimeEdit::setCalendarSystem(KLocale::CalendarSystem calendarSystem)
 {
-    //TODO Do this properly
-    d->ui.m_dateCombo->setCalendarSystem(calendarSystem);
+    if (calendarSystem == d->ui.m_dateCombo->calendarSystem() ||
+        !d->m_calendarSystems.contains(calendarSystem)) {
+        return;
+    }
+
+    assignCalendarSystem(calendarSystem);
     emit calendarChanged(d->ui.m_dateCombo->calendarSystem());
 }
 
+void KDateTimeEdit::assignCalendarSystem(KLocale::CalendarSystem calendarSystem)
+{
+    d->ui.m_dateCombo->setCalendarSystem(calendarSystem);
+    d->updateCalendarWidget();
+}
+
 void KDateTimeEdit::setCalendar(KCalendarSystem *calendar)
 {
     d->ui.m_dateCombo->setCalendar(calendar);
+    d->updateCalendarWidget();
 }
 
 void KDateTimeEdit::setTime(const QTime &time)
@@ -305,51 +408,38 @@ void KDateTimeEdit::setTime(const QTime &time)
 
     assignTime(time);
     emit dateTimeChanged(d->m_dateTime);
-    emit dateTimeChanged(d->m_dateTime.dateTime());
     emit timeChanged(d->m_dateTime.time());
 }
 
-void KDateTimeEdit::setTimeSpec(const KDateTime::Spec &spec)
-{
-    if (spec.isValid()) {
-        d->m_dateTime.setTimeSpec(spec);
-    }
-    emit dateTimeChanged(d->m_dateTime);
-    emit timeSpecChanged(d->m_dateTime.timeSpec());
-}
-
-void KDateTimeEdit::assignDateTime(const KDateTime &dateTime)
+void KDateTimeEdit::assignTime(const QTime &time)
 {
-    d->m_dateTime = dateTime;
-    d->ui.m_dateCombo->setDate(dateTime.date());
-    d->ui.m_timeCombo->setTime(dateTime.time());
+    d->m_dateTime.setTime(time);
+    d->ui.m_timeCombo->setTime(time);
 }
 
-void KDateTimeEdit::assignDateTime(const QDateTime &dateTime)
+void KDateTimeEdit::setTimeSpec(const KDateTime::Spec &spec)
 {
-    d->m_dateTime.setDateTime(dateTime);
-    d->ui.m_dateCombo->setDate(dateTime.date());
-    d->ui.m_timeCombo->setTime(dateTime.time());
-}
+    if (spec == d->m_dateTime.timeSpec() || !spec.isValid()) {
+        return;
+    }
 
-void KDateTimeEdit::assignDate(const QDate &date)
-{
-    d->m_dateTime.setDate(date);
-    d->ui.m_dateCombo->setDate(date);
+    assignTimeSpec(spec);
+    emit dateTimeChanged(d->m_dateTime);
+    emit timeSpecChanged(d->m_dateTime.timeSpec());
 }
 
-void KDateTimeEdit::assignTime(const QTime &time)
+void KDateTimeEdit::assignTimeSpec(const KDateTime::Spec &spec)
 {
-    d->m_dateTime.setTime(time);
-    d->ui.m_timeCombo->setTime(time);
+    d->m_dateTime.setTimeSpec(spec);
+    d->updateTimeSpecWidget();
 }
 
-void KDateTimeEdit::setOptions(Options options)
+void KDateTimeEdit::setMinimumDateTime(const KDateTime &minDateTime, const QString &minWarnMsg)
 {
-    d->m_options = options;
+    setDateTimeRange(minDateTime, maximumDateTime(), minWarnMsg, d->m_maxWarnMsg);
 }
 
-QDateTime KDateTimeEdit::minimumDateTime() const
+KDateTime KDateTimeEdit::minimumDateTime() const
 {
     return d->m_minDateTime;
 }
@@ -359,7 +449,12 @@ void KDateTimeEdit::resetMinimumDateTime()
     d->m_minDateTime = d->defaultMinDateTime();
 }
 
-QDateTime KDateTimeEdit::maximumDateTime() const
+void KDateTimeEdit::setMaximumDateTime(const KDateTime &maxDateTime, const QString &maxWarnMsg)
+{
+    setDateTimeRange(minimumDateTime(), maxDateTime, d->m_minWarnMsg, maxWarnMsg);
+}
+
+KDateTime KDateTimeEdit::maximumDateTime() const
 {
     return d->m_maxDateTime;
 }
@@ -369,8 +464,8 @@ void KDateTimeEdit::resetMaximumDateTime()
     d->m_maxDateTime = d->defaultMaxDateTime();
 }
 
-void KDateTimeEdit::setDateTimeRange(const QDateTime &minDateTime,
-                                     const QDateTime &maxDateTime,
+void KDateTimeEdit::setDateTimeRange(const KDateTime &minDateTime,
+                                     const KDateTime &maxDateTime,
                                      const QString &minErrorMsg,
                                      const QString &maxErrorMsg)
 {
@@ -380,9 +475,9 @@ void KDateTimeEdit::setDateTimeRange(const QDateTime &minDateTime,
         d->calendar()->isValid(minDateTime.date()) &&
         d->calendar()->isValid(maxDateTime.date())) {
         d->m_minDateTime = minDateTime;
-        d->m_minErrorMsg = minErrorMsg;
+        d->m_minWarnMsg = minErrorMsg;
         d->m_maxDateTime = maxDateTime;
-        d->m_maxErrorMsg = maxErrorMsg;
+        d->m_maxWarnMsg = maxErrorMsg;
     }
 }
 
@@ -391,109 +486,99 @@ void KDateTimeEdit::resetDateTimeRange()
     setDateTimeRange(d->defaultMinDateTime(), d->defaultMaxDateTime());
 }
 
-void KDateTimeEdit::clearDateTimeRange()
-{
-    setDateTimeRange(QDateTime(), QDateTime());
-}
-
-QDate KDateTimeEdit::minimumDate() const
+void KDateTimeEdit::setCalendarSystemsList(QList<KLocale::CalendarSystem> calendars)
 {
-    return d->m_minDateTime.date();
+    d->m_calendarSystems = calendars;
+    d->updateCalendarWidget();
 }
 
-void KDateTimeEdit::resetMinimumDate()
+QList<KLocale::CalendarSystem> KDateTimeEdit::calendarSystemsList()
 {
-    d->m_minDateTime.setDate(d->defaultMinDate());
+    return d->m_calendarSystems;
 }
 
-QDate KDateTimeEdit::maximumDate() const
+void KDateTimeEdit::setDateDisplayFormat(KLocale::DateFormat format)
 {
-    return d->m_maxDateTime.date();
+    d->ui.m_dateCombo->setDisplayFormat(format);
 }
 
-void KDateTimeEdit::resetMaximumDate()
+KLocale::DateFormat KDateTimeEdit::dateDisplayFormat()
 {
-    d->m_maxDateTime.setDate(d->defaultMaxDate());
+    return d->ui.m_dateCombo->displayFormat();
 }
 
-void KDateTimeEdit::setDateRange(const QDate &minDate,
-                                 const QDate &maxDate,
-                                 const QString &minErrorMsg,
-                                 const QString &maxErrorMsg)
+void KDateTimeEdit::setDateMap(QMap<QDate, QString> dateMap)
 {
-    setDateTimeRange(QDateTime(minDate, d->m_minDateTime.time()),
-                     QDateTime(maxDate, d->m_maxDateTime.time()),
-                     minErrorMsg, maxErrorMsg);
+    d->ui.m_dateCombo->setDateMap(dateMap);
 }
 
-void KDateTimeEdit::resetDateRange()
+QMap<QDate, QString> KDateTimeEdit::dateMap() const
 {
-    setDateRange(d->defaultMinDate(), d->defaultMaxDate());
+    return d->ui.m_dateCombo->dateMap();
 }
 
-void KDateTimeEdit::clearDateRange()
+void KDateTimeEdit::setTimeDisplayFormat(KLocale::TimeFormatOptions formatOptions)
 {
-    setDateRange(QDate(), QDate());
+    d->ui.m_timeCombo->setDisplayFormat(formatOptions);
 }
 
-QTime KDateTimeEdit::minimumTime() const
+KLocale::TimeFormatOptions KDateTimeEdit::timeDisplayFormat()
 {
-    return d->m_minDateTime.time();
+    return d->ui.m_timeCombo->displayFormat();
 }
 
-void KDateTimeEdit::resetMinimumTime()
+void KDateTimeEdit::setTimeListInterval(int minutes)
 {
-    d->m_minDateTime.setTime(d->defaultMinTime());
+    d->ui.m_timeCombo->setTimeListInterval(minutes);
 }
 
-QTime KDateTimeEdit::maximumTime() const
+int KDateTimeEdit::timeListInterval() const
 {
-    return d->m_maxDateTime.time();
+    return d->ui.m_timeCombo->timeListInterval();
 }
 
-void KDateTimeEdit::resetMaximumTime()
+void KDateTimeEdit::setTimeList(QList<QTime> timeList,
+                 const QString &minWarnMsg,
+                 const QString &maxWarnMsg)
 {
-    d->m_maxDateTime.setTime(d->defaultMaxTime());
+    d->ui.m_timeCombo->setTimeList(timeList, minWarnMsg, maxWarnMsg);
 }
 
-void KDateTimeEdit::setTimeRange(const QTime &minTime,
-                                 const QTime &maxTime,
-                                 const QString &minErrorMsg,
-                                 const QString &maxErrorMsg)
+QList<QTime> KDateTimeEdit::timeList() const
 {
-    setDateTimeRange(QDateTime(d->m_minDateTime.date(), minTime),
-                     QDateTime(d->m_maxDateTime.date(), maxTime),
-                     minErrorMsg, maxErrorMsg);
+    return d->ui.m_timeCombo->timeList();
 }
 
-void KDateTimeEdit::resetTimeRange()
+void KDateTimeEdit::setTimeZones(const KTimeZones::ZoneMap &zones)
 {
-    setTimeRange(d->defaultMinTime(), d->defaultMaxTime());
+    d->m_zones = zones;
+    d->updateTimeSpecWidget();
 }
 
-void KDateTimeEdit::clearTimeRange()
+KTimeZones::ZoneMap KDateTimeEdit::timeZones()
 {
-    setTimeRange(QTime(), QTime());
+    return d->m_zones;
 }
 
-void KDateTimeEdit::setTimeInterval(int minutes)
+bool KDateTimeEdit::eventFilter(QObject *object, QEvent *event)
 {
-    d->ui.m_timeCombo->setTimeInterval(minutes);
+    return QWidget::eventFilter(object, event);
 }
 
-int KDateTimeEdit::timeInterval() const
+void KDateTimeEdit::focusInEvent(QFocusEvent *event)
 {
-    return d->ui.m_timeCombo->timeInterval();
+    QWidget::focusInEvent(event);
 }
 
-void KDateTimeEdit::setTimeZones(const KTimeZones::ZoneMap &zones)
+void KDateTimeEdit::focusOutEvent(QFocusEvent *event)
 {
-    d->m_zones = zones;
+    d->warnDateTime();
+    QWidget::focusOutEvent(event);
 }
 
-bool KDateTimeEdit::eventFilter(QObject *object, QEvent *event)
+void KDateTimeEdit::resizeEvent(QResizeEvent *event)
 {
-    return false;
+    QWidget::resizeEvent(event);
 }
 
 #include "kdatetimeedit.moc"
diff --git a/kdeui/widgets/kdatetimeedit.h b/kdeui/widgets/kdatetimeedit.h
index ac14c19..de9344c 100644
--- a/kdeui/widgets/kdatetimeedit.h
+++ b/kdeui/widgets/kdatetimeedit.h
@@ -34,18 +34,11 @@ class KDEUI_EXPORT KDateTimeEdit : public QWidget
 {
     Q_OBJECT
 
-    //Q_PROPERTY(KDateTime dateTime READ dateTime WRITE setDateTime NOTIFY dateTimeChanged USER true)
-    Q_PROPERTY(QDateTime dateTime READ dateTime WRITE setDateTime NOTIFY dateTimeChanged USER true)
     Q_PROPERTY(QDate date READ date WRITE setDate NOTIFY dateChanged USER true)
     Q_PROPERTY(QTime time READ time WRITE setTime NOTIFY timeChanged USER true)
-    Q_PROPERTY(KDateTime::Spec timeSpec READ timeSpec WRITE setTimeSpec)
+    Q_PROPERTY(int timeListInterval READ timeListInterval WRITE setTimeListInterval)
     Q_PROPERTY(Options options READ options WRITE setOptions)
-    Q_PROPERTY(QDateTime minimumDateTime READ minimumDateTime RESET resetMinimumDateTime)
-    Q_PROPERTY(QDateTime maximumDateTime READ maximumDateTime RESET resetMaximumDateTime)
-    Q_PROPERTY(QDate minimumDate READ minimumDate RESET resetMinimumDate)
-    Q_PROPERTY(QDate maximumDate READ maximumDate RESET resetMaximumDate)
-    Q_PROPERTY(QTime minimumTime READ minimumTime RESET resetMinimumTime)
-    Q_PROPERTY(QTime maximumTime READ maximumTime RESET resetMaximumTime)
+    Q_FLAGS(Options)
 
 public:
 
@@ -58,20 +51,19 @@ public:
         ShowCalendar     = 0x00001,  /**< If the Calendar System edit is displayed */
         ShowDate         = 0x00002,  /**< If the Date is displayed */
         ShowTime         = 0x00004,  /**< If the Time is displayed */
-        ShowTimeSpec     = 0x00008,  /**< If the Time Zone is displayed */
-        EditCalendar     = 0x00010,  /**< Allow the user to manually edit the calendar */
+        ShowTimeSpec     = 0x00008,  /**< If the Time Spec is displayed */
+        //EditCalendar     = 0x00010,  /**< Allow the user to manually edit the calendar */
         EditDate         = 0x00020,  /**< Allow the user to manually edit the date */
         EditTime         = 0x00040,  /**< Allow the user to manually edit the time */
-        EditTimeSpec     = 0x00080,  /**< Allow the user to manually edit the time spec */
+        //EditTimeSpec     = 0x00080,  /**< Allow the user to manually edit the time spec */
         SelectCalendar   = 0x00100,  /**< Allow the user to select a calendar */
         SelectDate       = 0x00200,  /**< Allow the user to select a date */
         SelectTime       = 0x00400,  /**< Allow the user to select a time */
-        SelectTimeSpec   = 0x00800,  /**< Allow the user to select a time */
+        SelectTimeSpec   = 0x00800,  /**< Allow the user to select a time spec */
         DatePicker       = 0x01000,  /**< Show a date picker */
         DateKeywords     = 0x02000,  /**< Show date keywords */
-        ForceInterval    = 0x04000,  /**< The entered time can only be a selected interval */
-        WarnOnInvalid    = 0x08000,  /**< Show a warning on focus out if the date or time is invalid */
-        ErrorOnInvalid   = 0x01000   /**< Show an error on focus out if the date or time is invalid */
+        ForceTime        = 0x04000,  /**< The entered time can only be a selected time */
+        WarnOnInvalid    = 0x08000   /**< Show a warning on focus out if the date or time is invalid */
     };
     Q_DECLARE_FLAGS(Options, Option)
 
@@ -86,25 +78,18 @@ public:
     virtual ~KDateTimeEdit();
 
     /**
-     * Return the currently selected date, time and time zone
-     *
-     * @return the currently selected date, time and time zone
-     */
-    KDateTime fullDateTime() const;
-
-    /**
-     * Return the currently selected date and time
+     * Return the currently set widget options
      *
-     * @return the currently selected date and time
+     * @return the currently set widget options
      */
-    QDateTime dateTime() const;
+    Options options() const;
 
     /**
-     * Return the currently selected date
+     * Return the currently selected date, time and time spec
      *
-     * @return the currently selected date
+     * @return the currently selected date, time and time spec
      */
-    QDate date() const;
+    KDateTime dateTime() const;
 
     /**
      * Returns the Calendar System type used by the widget
@@ -131,240 +116,127 @@ public:
     const KCalendarSystem *calendar() const;
 
     /**
-     * Return the currently selected time
+     * Return the currently selected date
      *
-     * @return the currently selected time
+     * @return the currently selected date
      */
-    QTime time() const;
+    QDate date() const;
 
     /**
-     * Return the currently selected time zone
+     * Return the currently selected time
      *
-     * @return the currently selected time zone
+     * @return the currently selected time
      */
-    KDateTime::Spec timeSpec() const;
+    QTime time() const;
 
     /**
-     * Return if the current user input is valid
+     * Return the currently selected time spec
      *
-     * @return if the current user input is valid
+     * @return the currently selected time spec
      */
-    bool isValid()const;
+    KDateTime::Spec timeSpec() const;
 
     /**
-     * Return the currently set widget options
+     * Returns the list of Calendar Systems displayed.
      *
-     * @return the currently set widget options
+     * @param calendars the list of calendar systems to display
      */
-    Options options() const;
-
-    KLocale::DateFormat dateDisplayFormat();
-    void setDateDisplayFormat(KLocale::DateFormat options);
-    KLocale::TimeFormatOptions timeDisplayFormat();
-    void setTimeDisplaayFormat(KLocale::TimeFormatOptions options);
+    QList<KLocale::CalendarSystem> calendarSystemsList();
 
     /**
      * Return the current minimum date and time
      *
      * @return the current minimum date and time
      */
-    QDateTime minimumDateTime() const;
-
-    /**
-     * Reset the minimum date and time to the default
-     */
-    void resetMinimumDateTime();
+    KDateTime minimumDateTime() const;
 
     /**
      * Return the current maximum date and time
      *
      * @return the current maximum date and time
      */
-    QDateTime maximumDateTime() const;
-
-    /**
-     * Reset the minimum date and time to the default
-     */
-    void resetMaximumDateTime();
+    KDateTime maximumDateTime() const;
 
     /**
-     * Set the minimum and maximum date and time range
+     * Return the currently set date display format
      *
-     * To enable range checking provide two valid dates.
-     * To disable range checking provide two invalid dates, or call
-     * clearDateRange;
+     * By default this is the Short Date
      *
-     * @param minDateTime the minimum date and time
-     * @param maxDateTime the maximum date and time
-     * @param minErrorMsg the minimum error message
-     * @param maxErrorMsg the maximum error message
+     * @return the currently set date format
      */
-    void setDateTimeRange(const QDateTime &minDateTime,
-                          const QDateTime &maxDateTime,
-                          const QString &minErrorMsg = QString(),
-                          const QString &maxErrorMsg = QString());
-
-    /**
-     * Reset the minimum and maximum date and time to the default
-     */
-    void resetDateTimeRange();
-
-    /**
-     * Clear the minimum and maximum date and time, i.e. disable range checking
-     */
-    void clearDateTimeRange();
+    KLocale::DateFormat dateDisplayFormat();
 
     /**
-     * Return the current minimum date
+     * Return the map of dates listed in the drop-down and their displayed
+     * string forms.
      *
-     * @return the current minimum date
+     * @see setDateMap()
+     * @return the select date map
      */
-    QDate minimumDate() const;
+    QMap<QDate, QString> dateMap() const;
 
     /**
-     * Reset the minimum date to the default
-     */
-    void resetMinimumDate();
-
-    /**
-     * Return the current maximum date
+     * Return the currently set time format
      *
-     * @return the current maximum date
-     */
-    QDate maximumDate() const;
-
-    /**
-     * Reset the maximum date to the default
-     */
-    void resetMaximumDate();
-
-    /**
-     * Set the minimum and maximum date range
-     *
-     * To enable date range checking provide two valid dates.
-     * To disable date range checking provide two invalid dates, or call
-     * clearDateRange;
-     *
-     * @param minDate the minimum date
-     * @param maxDate the maximum date
-     * @param minErrorMsg the minimum error message
-     * @param maxErrorMsg the maximum error message
-     */
-    void setDateRange(const QDate &minDate,
-                      const QDate &maxDate,
-                      const QString &minErrorMsg = QString(),
-                      const QString &maxErrorMsg = QString());
-
-    /**
-     * Reset the minimum and maximum date to the default
-     */
-    void resetDateRange();
-
-    /**
-     * Clear the minimum and maximum date, i.e. disable the date range checking
-     */
-    void clearDateRange();
-
-    /**
-     * Return the current minimum time
+     * By default this is the Short Time
      *
-     * @return the current minimum time
+     * @return the currently set time format
      */
-    QTime minimumTime() const;
-
-    /**
-     * Reset the minimum time to the default
-     */
-    void resetMinimumTime();
+    KLocale::TimeFormatOptions timeDisplayFormat();
 
     /**
-     * Return the current maximum time
+     * Return the time list interval able to be selected
      *
-     * @return the current maximum time
-     */
-    QTime maximumTime() const;
-
-    /**
-     * Reset the maximum time to the default
+     * @return the select time intervals in minutes
      */
-    void resetMaximumTime();
+    int timeListInterval() const;
 
     /**
-     * Set the minimum and maximum time range
+     * Return the list of times able to be selected in the drop-down.
      *
-     * @param minTime the minimum time
-     * @param maxTime the maximum time
-     * @param minErrorMsg the minimum error message
-     * @param maxErrorMsg the maximum error message
+     * @see setTimeList()
+     * @see timeListInterval()
+     * @see setTimeListInterval()
+     * @return the select time list
      */
-    void setTimeRange(const QTime &minTime,
-                      const QTime &maxTime,
-                      const QString &minErrorMsg = QString(),
-                      const QString &maxErrorMsg = QString());
+    QList<QTime> timeList() const;
 
     /**
-     * Reset the minimum and maximum time to the default
-     */
-    void resetTimeRange();
-
-    /**
-     * Clear the minimum and maximum time, i.e. turn off time range checking
-     */
-    void clearTimeRange();
-
-    /**
-     * Set the time interval able to be selected in the time widget
+     * Return the list of time zones able to be selected
      *
-     * @param minutes the interval to display
+     * @param zones the time zones to display
      */
-    void setTimeInterval(int minutes);
+    KTimeZones::ZoneMap timeZones();
 
     /**
-     * Return the time interval able to be selected
+     * Return if the current user input is valid
      *
-     * @return the select time intervals in minutes
+     * @return if the current user input is valid
      */
-    int timeInterval() const;
+    bool isValid()const;
 
     /**
-     * Changes the calendar system to use.  Can use its own local locale if set.
-     *
-     * You retain ownership of the calendar object, it will not be destroyed with the widget.
+     * Return if the current user input date is valid
      *
-     * @param calendar the calendar system object to use, defaults to global
+     * @return if the current user input is valid
      */
-    void setCalendar(KCalendarSystem *calendar = 0);
+    bool isValidDate()const;
 
     /**
-     * Set the time zones able to be selected
+     * Return if the current user input time is valid
      *
-     * @param zones the time zones to display
+     * @return if the current user input is valid
      */
-    void setTimeZones(const KTimeZones::ZoneMap &zones);
+    bool isValidTime()const;
 
 Q_SIGNALS:
 
     /**
-     * Signal if the Calendar System has been manually entered by the user.
-     *
-     * @param calendarSystem the new calendar system
-     */
-    void calendarEntered(KLocale::CalendarSystem calendarSystem);
-
-    /**
-     * Signal if the Calendar System has been changed either manually by the user
-     * or programatically.
-     *
-     * @param calendarSystem the new calendar system
-     */
-    void calendarChanged(KLocale::CalendarSystem calendarSystem);
-
-    /**
      * Signal if the date or time has been manually entered by the user.
      *
      * The returned date and time may be invalid.
      *
-     * @param dateTime the new date, time and time zone
+     * @param dateTime the new date, time and time spec
      */
     void dateTimeEntered(const KDateTime &dateTime);
 
@@ -374,7 +246,7 @@ Q_SIGNALS:
      *
      * The returned date and time may be invalid.
      *
-     * @param dateTime the new date, time and time zone
+     * @param dateTime the new date, time and time spec
      */
     void dateTimeChanged(const KDateTime &dateTime);
 
@@ -383,37 +255,24 @@ Q_SIGNALS:
      *
      * The returned date and time may be invalid.
      *
-     * @param dateTime the new date, time and time zone
+     * @param dateTime the new date, time and time spec
      */
     void dateTimeEdited(const KDateTime &dateTime);
 
     /**
-     * Signal if the date or time has been manually entered by the user.
-     *
-     * The returned date and time may be invalid.
+     * Signal if the Calendar System has been manually entered by the user.
      *
-     * @param dateTime the new date and time
+     * @param calendarSystem the new calendar system
      */
-    void dateTimeEntered(const QDateTime &dateTime);
+    void calendarEntered(KLocale::CalendarSystem calendarSystem);
 
     /**
-     * Signal if the date or time has been changed either manually by the user
+     * Signal if the Calendar System has been changed either manually by the user
      * or programatically.
      *
-     * The returned date and time may be invalid.
-     *
-     * @param dateTime the new date and time
-     */
-    void dateTimeChanged(const QDateTime &dateTime);
-
-    /**
-     * Signal if the date or time is being manually edited by the user.
-     *
-     * The returned date and time may be invalid.
-     *
-     * @param dateTime the new date and time
+     * @param calendarSystem the new calendar system
      */
-    void dateTimeEdited(const QDateTime &dateTime);
+    void calendarChanged(KLocale::CalendarSystem calendarSystem);
 
     /**
      * Signal if the date has been manually entered by the user.
@@ -472,7 +331,7 @@ Q_SIGNALS:
     void timeEdited(const QTime &time);
 
     /**
-     * Signal if the time spec has been manually entered by the user.
+     * Signal if the time spec has been changed manually by the user.
      *
      * @param timeSpec the new time spec
      */
@@ -489,25 +348,18 @@ Q_SIGNALS:
 public Q_SLOTS:
 
     /**
-     * Set the currently selected date, time and time zone
-     *
-     * @param dateTime the new date, time and time zone
-     */
-    void setDateTime(const KDateTime &dateTime);
-
-    /**
-     * Set the currently selected date and time
+     * Set the new widget options
      *
-     * @param dateTime the new date and time
+     * @param options the new widget options
      */
-    void setDateTime(const QDateTime &dateTime);
+    void setOptions(Options options);
 
     /**
-     * Set the currently selected date
+     * Set the currently selected date, time and time spec
      *
-     * @param date the new date
+     * @param dateTime the new date, time and time spec
      */
-    void setDate(const QDate &date);
+    void setDateTime(const KDateTime &dateTime);
 
     /**
      * Set the Calendar System used for this widget.  Uses the global locale.
@@ -519,6 +371,22 @@ public Q_SLOTS:
     void setCalendarSystem(KLocale::CalendarSystem calendarSystem);
 
     /**
+     * Changes the calendar system to use.  Can use its own local locale if set.
+     *
+     * You retain ownership of the calendar object, it will not be destroyed with the widget.
+     *
+     * @param calendar the calendar system object to use, defaults to global
+     */
+    void setCalendar(KCalendarSystem *calendar = 0);
+
+    /**
+     * Set the currently selected date
+     *
+     * @param date the new date
+     */
+    void setDate(const QDate &date);
+
+    /**
      * Set the currently selected time
      *
      * @param time the new time
@@ -526,45 +394,183 @@ public Q_SLOTS:
     void setTime(const QTime &time);
 
     /**
-     * Set the currently selected time zone spec
+     * Set the current time spec
      *
      * @param spec the new spec
      */
     void setTimeSpec(const KDateTime::Spec &spec);
 
     /**
-     * Set the new widget options
+     * Set the minimum and maximum date and time range
      *
-     * @param options the new widget options
+     * To enable range checking provide two valid dates.
+     * To disable range checking provide two invalid dates, or call
+     * clearDateRange;
+     *
+     * @param minDateTime the minimum date and time
+     * @param maxDateTime the maximum date and time
+     * @param minWarnMsg the minimum warning message
+     * @param maxWarnMsg the maximum warning message
      */
-    void setOptions(Options options);
+    void setDateTimeRange(const KDateTime &minDateTime,
+                          const KDateTime &maxDateTime,
+                          const QString &minWarnMsg = QString(),
+                          const QString &maxWarnMsg = QString());
 
-protected:
+    /**
+     * Reset the minimum and maximum date and time to the default
+     */
+    void resetDateTimeRange();
 
-    virtual bool eventFilter(QObject *object, QEvent *event);
+    /**
+     * Set the minimum allowed date.
+     *
+     * If the date is invalid, or more than current maximum,
+     * then the minimum will not be set.
+     *
+     * @see setMaximumDateTime()
+     * @see setDateRange()
+     * @param maxDate the minimum date
+     * @param maxWarnMsg the minimum warning message
+     */
+    void setMinimumDateTime(const KDateTime &minDateTime, const QString &minWarnMsg = QString());
 
     /**
-     * Assign the date, time and time zone for the widget.
+     * Reset the minimum date and time to the default
+     */
+    void resetMinimumDateTime();
+
+    /**
+     * Set the maximum allowed date.
      *
-     * Virtual to allow sub-classes to apply extra validation rules.
+     * If the date is invalid, or less than current minimum,
+     * then the maximum will not be set.
      *
-     * @param datetime the new date and time
+     * @see setMinimumDateTime()
+     * @see setDateRange()
+     * @param maxDate the maximum date
+     * @param maxWarnMsg the maximum warning message
      */
-    virtual void assignDateTime(const KDateTime &dateTime);
+    void setMaximumDateTime(const KDateTime &maxDateTime, const QString &maxWarnMsg = QString());
+
+    /**
+     * Reset the minimum date and time to the default
+     */
+    void resetMaximumDateTime();
+
+    /**
+     * Sets the date format to display.
+     *
+     * By default is the Short Date format.
+     *
+     * @param format the date format to use
+     */
+    void setDateDisplayFormat(KLocale::DateFormat format);
+
+    /**
+     * Set the list of Calendar Systems to display.
+     *
+     * @param calendars the list of calendar systems to display
+     */
+    void setCalendarSystemsList(QList<KLocale::CalendarSystem> calendars);
+
+    /**
+     * Set the list of dates able to be selected from the drop-down and the
+     * string form to display for those dates, e.g. "2010-01-01" and "Yesterday".
+     *
+     * Any invalid or duplicate dates will be used, the list will NOT be
+     * sorted, and the minimum and maximum date will not be affected.
+     *
+     * The @p dateMap is keyed by the date to be listed and the value is the
+     * string to be displayed.  If you want the date to be displayed in the
+     * default date format then the string should be null.  If you want a
+     * separator to be displayed then set the string to "seperator".
+     *
+     * @see dateMap()
+     * @param dateMap the map of dates able to be selected
+     */
+    void setDateMap(QMap<QDate, QString> dateMap);
+
+    /**
+     * Sets the time format to display.
+     *
+     * By default is the Short Time format.
+     *
+     * @param format the time format to use
+     */
+    void setTimeDisplayFormat(KLocale::TimeFormatOptions formatOptions);
+
+    /**
+     * Set the interval between times able to be selected from the drop-down.
+     *
+     * The combo drop-down will be populated with times every @param minutes
+     * apart, starting from the minimumTime() and ending at maximumTime().
+     *
+     * If the ForceInterval option is set then any time manually typed into the
+     * combo line edit will be forced to the nearest interval.
+     *
+     * This interval must be an exact divisor of the valid time range hours.
+     * For example with the default 24 hour range @p interval must divide 1440
+     * minutes exactly, meaning 1, 6 and 90 are valid but 7, 31 and 91 are not.
+     *
+     * Setting the time list interval will override any time list previously set
+     * via setTimeList().
+     *
+     * @see timeListInterval()
+     * @param minutes the time list interval to display
+     */
+    void setTimeListInterval(int minutes);
 
     /**
-     * Assign the date and time for the widget.
+     * Set the list of times able to be selected from the drop-down.
+     *
+     * Setting the time list will override any time interval previously set via
+     * setTimeListInterval().
+     *
+     * Any invalid or duplicate times will be ignored, and the list will be
+     * sorted.
      *
-     * Virtual to allow sub-classes to apply extra validation rules.
+     * The minimum and maximum time will automatically be set to the earliest
+     * and latest value in the list.
+     *
+     * @see timeList()
+     * @param timeList the list of times able to be selected
+     * @param minWarnMsg the minimum warning message
+     * @param maxWarnMsg the maximum warning message
+     */
+    void setTimeList(QList<QTime> timeList,
+                     const QString &minWarnMsg = QString(),
+                     const QString &maxWarnMsg = QString());
+
+    /**
+     * Set the time zones able to be selected
+     *
+     * @param zones the time zones to display
+     */
+    void setTimeZones(const KTimeZones::ZoneMap &zones);
+
+protected:
+
+    virtual bool eventFilter(QObject *object, QEvent *event);
+    virtual void focusInEvent(QFocusEvent *event);
+    virtual void focusOutEvent(QFocusEvent *event);
+    virtual void resizeEvent(QResizeEvent *event);
+
+    /**
+     * Assign the date, time and time spec for the widget.
+     *
+     * Virtual to allow sub-classes to apply extra validation rules,
+     * but reimplementations must call the parent method at the end.
      *
      * @param datetime the new date and time
      */
-    virtual void assignDateTime(const QDateTime &dateTime);
+    virtual void assignDateTime(const KDateTime &dateTime);
 
     /**
      * Assign the date for the widget.
      *
-     * Virtual to allow sub-classes to apply extra validation rules.
+     * Virtual to allow sub-classes to apply extra validation rules,
+     * but reimplementations must call the parent method at the end.
      *
      * @param date the new date
      */
@@ -573,27 +579,30 @@ protected:
     /**
      * Assign the calendar system for the widget.
      *
-     * Virtual to allow sub-classes to apply extra validation rules.
+     * Virtual to allow sub-classes to apply extra validation rules,
+     * but reimplementations must call the parent method at the end.
      *
-     * @param time the new time
+     * @param calendarSystem the new calendar system
      */
     void assignCalendarSystem(KLocale::CalendarSystem calendarSystem);
 
     /**
      * Assign the time for the widget.
      *
-     * Virtual to allow sub-classes to apply extra validation rules.
+     * Virtual to allow sub-classes to apply extra validation rules,
+     * but reimplementations must call the parent method at the end.
      *
      * @param time the new time
      */
     virtual void assignTime(const QTime &time);
 
     /**
-     * Assign the time zone for the widget.
+     * Assign the time spec for the widget.
      *
-     * Virtual to allow sub-classes to apply extra validation rules.
+     * Virtual to allow sub-classes to apply extra validation rules,
+     * but reimplementations must call the parent method at the end.
      *
-     * @param time the new time zone
+     * @param spec the new time spec
      */
     void assignTimeSpec(const KDateTime::Spec &spec);
 
diff --git a/kdeui/widgets/kdatetimeedit.ui b/kdeui/widgets/kdatetimeedit.ui
index ba731b9..6ac2290 100644
--- a/kdeui/widgets/kdatetimeedit.ui
+++ b/kdeui/widgets/kdatetimeedit.ui
@@ -42,7 +42,7 @@
     </widget>
    </item>
    <item>
-    <widget class="KComboBox" name="m_timeZoneCombo">
+    <widget class="KComboBox" name="m_timeSpecCombo">
      <property name="sizePolicy">
       <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
        <horstretch>0</horstretch>
diff --git a/kdeui/widgets/ktimecombobox.cpp b/kdeui/widgets/ktimecombobox.cpp
index 8d78845..7154aec 100644
--- a/kdeui/widgets/ktimecombobox.cpp
+++ b/kdeui/widgets/ktimecombobox.cpp
@@ -27,6 +27,7 @@
 #include "kdebug.h"
 #include "klocale.h"
 #include "kcombobox.h"
+#include "kmessagebox.h"
 
 class KTimeComboBoxPrivate
 {
@@ -38,6 +39,11 @@ public:
     QTime defaultMinTime();
     QTime defaultMaxTime();
 
+    QString timeFormatToInputMask(const QString &format);
+    QTime nearestIntervalTime(const QTime &time);
+    QString formatTime(const QTime &time);
+    QString convertDigits(const QString &digits);
+
     void initTimeWidget();
     void updateTimeWidget();
 
@@ -46,6 +52,7 @@ public:
     void editTime(const QString &text);
     void enterTime(const QTime &time);
     void parseTime();
+    void warnTime();
 
     KTimeComboBox *const q;
 
@@ -53,25 +60,24 @@ public:
     KTimeComboBox::Options m_options;
     QTime m_minTime;
     QTime m_maxTime;
-    QString m_minErrorMsg;
-    QString m_maxErrorMsg;
+    QString m_minWarnMsg;
+    QString m_maxWarnMsg;
+    bool m_warningShown;
     KLocale::TimeFormatOptions m_displayFormat;
-    int m_timeInterval;
+    int m_timeListInterval;
+    QList<QTime> m_timeList;
 };
 
 KTimeComboBoxPrivate::KTimeComboBoxPrivate(KTimeComboBox *q)
                      :q(q),
+                      m_time(QTime(0, 0, 0)),
+                      m_warningShown(false),
                       m_displayFormat(KLocale::TimeDefault),
-                      m_timeInterval(15)
+                      m_timeListInterval(15)
 {
+    m_options = KTimeComboBox::EditTime | KTimeComboBox::SelectTime;
     m_minTime = defaultMinTime();
     m_maxTime = defaultMaxTime();
-    m_minErrorMsg = i18n("The entered time is before the minimum allowed time.");
-    m_maxErrorMsg = i18n("The entered time is after the maximum allowed time.");
-    QString stringFreeze;
-    stringFreeze = i18nc( "@info", "Time cannot be earlier than %1", QString() );
-    stringFreeze = i18nc( "@info", "Time cannot be later than %1", QString() );
-    stringFreeze = i18n("The time you entered is invalid");
 }
 
 KTimeComboBoxPrivate::~KTimeComboBoxPrivate()
@@ -88,50 +94,123 @@ QTime KTimeComboBoxPrivate::defaultMaxTime()
     return QTime(23, 59, 59, 999);
 }
 
+QString KTimeComboBoxPrivate::timeFormatToInputMask(const QString &format)
+{
+    //TODO not sure this will always work, does it support DigitSets, am/pm is dodgy?
+    QString mask = formatTime(QTime(12,34,56,789));
+    mask.replace(convertDigits(QLatin1String("12")), QLatin1String("09"));
+    mask.replace(convertDigits(QLatin1String("34")), QLatin1String("99"));
+    mask.replace(convertDigits(QLatin1String("56")), QLatin1String("99"));
+    mask.replace(convertDigits(QLatin1String("789")), QLatin1String("900"));
+    if (format.contains(QLatin1String("%p")) ||
+        format.contains(QLatin1String("%P"))) {
+        QString am = KGlobal::locale()->dayPeriodText(QTime(0, 0, 0));
+        QString pm = KGlobal::locale()->dayPeriodText(QTime(12, 0, 0));
+        int ampmLen = qMax(am.length(), pm.length());
+        QString ampmMask;
+        for (int i = 0; i < ampmLen; ++i) {
+            ampmMask.append(QLatin1Char('a'));
+        }
+        mask.replace(pm, ampmMask);
+    }
+    return mask;
+}
+
+QTime KTimeComboBoxPrivate::nearestIntervalTime(const QTime &time)
+{
+    int i = 0;
+    while (q->itemData(i).toTime() < time) {
+        ++i;
+    }
+    QTime before = q->itemData(i).toTime();
+    QTime after = q->itemData(i + 1).toTime();
+    if (before.secsTo(time) <= time.secsTo(after)) {
+        return before;
+    } else {
+        return after;
+    }
+}
+
+QString KTimeComboBoxPrivate::formatTime(const QTime &time)
+{
+    return KGlobal::locale()->formatTime(time, m_displayFormat);
+}
+
+QString KTimeComboBoxPrivate::convertDigits(const QString &digits)
+{
+    return KGlobal::locale()->convertDigits(digits, KGlobal::locale()->dateTimeDigitSet());
+}
+
 void KTimeComboBoxPrivate::initTimeWidget()
 {
+    q->blockSignals(true);
     q->clear();
-    q->setEditable(true);
-    q->setInsertPolicy(QComboBox::NoInsert);
-    q->setSizeAdjustPolicy(QComboBox::AdjustToContents);
-    //TODO localise the mask based on KLocale
-    q->lineEdit()->setInputMask("09:99");
-
-    QTime startTime = m_time;
-    QTime thisTime(startTime.hour(), 0, 0, 0);
-    while (thisTime.isValid() && thisTime <= startTime) {
-        thisTime = thisTime.addSecs(m_timeInterval * 60);
+
+    // Set the input mask from the current format
+    q->lineEdit()->setInputMask(timeFormatToInputMask(KGlobal::locale()->timeFormat()));
+
+    // If EditTime then set the line edit
+    q->lineEdit()->setReadOnly((m_options &KTimeComboBox::EditTime) != KTimeComboBox::EditTime);
+
+    // If SelectTime then make list items visible
+    if ((m_options &KTimeComboBox::SelectTime) == KTimeComboBox::SelectTime) {
+        q->setMaxVisibleItems(10);
+    } else {
+        q->setMaxVisibleItems(0);
     }
-    QTime endTime = m_maxTime;
-    q->addItem(KGlobal::locale()->formatTime(startTime), startTime);
-    while (thisTime.isValid() && thisTime < endTime) {
-        q->addItem(KGlobal::locale()->formatTime(thisTime), thisTime);
-        QTime newTime = thisTime.addSecs(m_timeInterval * 60);
-        if (newTime.isValid() && newTime > thisTime) {
-            thisTime = newTime;
-        } else {
-            thisTime = QTime();
+
+    // Populate the drop-down time list
+    // If no time list set the use the time interval
+    if (m_timeList.isEmpty()) {
+        QTime startTime = m_minTime;
+        QTime thisTime(startTime.hour(), 0, 0, 0);
+        while (thisTime.isValid() && thisTime <= startTime) {
+            thisTime = thisTime.addSecs(m_timeListInterval * 60);
+        }
+        QTime endTime = m_maxTime;
+        q->addItem(formatTime(startTime), startTime);
+        while (thisTime.isValid() && thisTime < endTime) {
+            q->addItem(formatTime(thisTime), thisTime);
+            QTime newTime = thisTime.addSecs(m_timeListInterval * 60);
+            if (newTime.isValid() && newTime > thisTime) {
+                thisTime = newTime;
+            } else {
+                thisTime = QTime();
+            }
+        }
+        q->addItem(formatTime(endTime), endTime);
+    } else {
+        foreach (const QTime &thisTime, m_timeList) {
+            if (thisTime.isValid() && thisTime >= m_minTime && thisTime <= m_maxTime) {
+                q->addItem(formatTime(thisTime), thisTime);
+            }
         }
     }
-    q->addItem(KGlobal::locale()->formatTime(endTime), endTime);
+    q->blockSignals(false);
 }
 
 void KTimeComboBoxPrivate::updateTimeWidget()
 {
     q->blockSignals(true);
-    int pos = 0;
-    if (q->lineEdit()) {
-        pos = q->lineEdit()->cursorPosition();
-        q->lineEdit()->setText(KGlobal::locale()->formatTime(m_time));
-    }
+    int pos = q->lineEdit()->cursorPosition();
+    //Set index before setting text otherwise it overwrites
     int i = 0;
-    while (q->itemData(i).toTime() < m_time) {
-        ++i;
+    if (!m_time.isValid() || m_time < m_minTime) {
+        i = 0;
+    } else if (m_time > m_maxTime) {
+        i = q->count() - 1;
+    } else {
+        while (q->itemData(i).toTime() < m_time && i < q->count() - 1) {
+            ++i;
+        }
     }
     q->setCurrentIndex(i);
-    if (q->lineEdit()) {
-        q->lineEdit()->setCursorPosition(pos);
+    if (m_time.isValid()) {
+        q->lineEdit()->setText(formatTime(m_time));
+    } else {
+        q->lineEdit()->setText(QString());
     }
+    q->lineEdit()->setCursorPosition(pos);
     q->blockSignals(false);
 }
 
@@ -140,28 +219,58 @@ void KTimeComboBoxPrivate::selectTime(int index)
     enterTime(q->itemData(index).toTime());
 }
 
-//TODO sure we want to uptime during edit, should we wait for either exit widget or call to time()?
 void KTimeComboBoxPrivate::editTime(const QString &text)
 {
-    //TODO read the text and set it
-    //enterTime(KGlobal::locale()->readTime(q->lineEdit()->text()));
+    m_warningShown = false;
+    emit q->timeEdited(KGlobal::locale()->readTime(text));
 }
 
 void KTimeComboBoxPrivate::parseTime()
 {
-    enterTime(KGlobal::locale()->readTime(q->lineEdit()->text()));
+    m_time = KGlobal::locale()->readTime(q->lineEdit()->text());
 }
 
 void KTimeComboBoxPrivate::enterTime(const QTime &time)
 {
     q->setTime(time);
+    warnTime();
     emit q->timeEntered(m_time);
 }
 
+void KTimeComboBoxPrivate::warnTime()
+{
+    if (!m_warningShown && !q->isValid() &&
+        (m_options &KTimeComboBox::WarnOnInvalid) == KTimeComboBox::WarnOnInvalid) {
+        QString warnMsg;
+        if (!m_time.isValid()) {
+            warnMsg = i18n("The time you entered is invalid");
+        } else if (m_time < m_minTime) {
+            if (m_minWarnMsg.isEmpty()) {
+                warnMsg = i18nc("@info", "Time cannot be earlier than %1", formatTime(m_minTime));
+            } else {
+                warnMsg = m_minWarnMsg;
+                warnMsg.replace("%1", formatTime(m_minTime));
+            }
+        } else if (m_time > m_maxTime) {
+            if (m_maxWarnMsg.isEmpty()) {
+                warnMsg = i18nc("@info", "Time cannot be later than %1", formatTime(m_maxTime));
+            } else {
+                warnMsg = m_maxWarnMsg;
+                warnMsg.replace("%1", formatTime(m_maxTime));
+            }
+        }
+        m_warningShown = true;
+        KMessageBox::sorry(q, warnMsg);
+    }
+}
+
 KTimeComboBox::KTimeComboBox(QWidget *parent)
               :KComboBox(parent),
                d(new KTimeComboBoxPrivate(this))
 {
+    setEditable(true);
+    setInsertPolicy(QComboBox::NoInsert);
+    setSizeAdjustPolicy(QComboBox::AdjustToContents);
     d->initTimeWidget();
     d->updateTimeWidget();
 
@@ -188,7 +297,12 @@ void KTimeComboBox::setTime(const QTime &time)
         return;
     }
 
-    assignTime(time);
+    if ((d->m_options &KTimeComboBox::ForceTime) == KTimeComboBox::ForceTime) {
+        assignTime(d->nearestIntervalTime(time));
+    } else {
+        assignTime(time);
+    }
+
     d->updateTimeWidget();
     emit timeChanged(d->m_time);
 }
@@ -200,12 +314,10 @@ void KTimeComboBox::assignTime(const QTime &time)
 
 bool KTimeComboBox::isValid() const
 {
-    if (d->m_minTime.isValid() && d->m_maxTime.isValid()) {
-        return d->m_time.isValid() &&
-               d->m_time >= d->m_minTime &&
-               d->m_time <= d->m_maxTime;
-    }
-    return d->m_time.isValid();
+    d->parseTime();
+    return d->m_time.isValid() &&
+           d->m_time >= d->m_minTime &&
+           d->m_time <= d->m_maxTime;
 }
 
 KTimeComboBox::Options KTimeComboBox::options() const
@@ -216,6 +328,8 @@ KTimeComboBox::Options KTimeComboBox::options() const
 void KTimeComboBox::setOptions(Options options)
 {
     d->m_options = options;
+    d->initTimeWidget();
+    d->updateTimeWidget();
 }
 
 QTime KTimeComboBox::minimumTime() const
@@ -223,47 +337,49 @@ QTime KTimeComboBox::minimumTime() const
     return d->m_minTime;
 }
 
-QTime KTimeComboBox::maximumTime() const
+void KTimeComboBox::setMinimumTime(const QTime &minTime, const QString &minWarnMsg)
 {
-    return d->m_maxTime;
+    setTimeRange(minTime, d->m_maxTime, minWarnMsg, d->m_maxWarnMsg);
 }
 
-void KTimeComboBox::setTimeRange(const QTime &minTime,
-                                 const QTime &maxTime,
-                                 const QString &minErrorMsg,
-                                 const QString &maxErrorMsg)
+void KTimeComboBox::resetMinimumTime()
 {
-    if (minTime.isValid() != maxTime.isValid()) {
-        return;
-    }
+    setTimeRange(d->defaultMinTime(), d->m_maxTime, QString(), d->m_maxWarnMsg);
+}
 
-    if (minTime <= maxTime) {
-        d->m_minTime = minTime;
-        d->m_maxTime = maxTime;
-        d->m_minErrorMsg = minErrorMsg;
-        d->m_maxErrorMsg = maxErrorMsg;
-    }
+QTime KTimeComboBox::maximumTime() const
+{
+    return d->m_maxTime;
 }
 
-void KTimeComboBox::resetMinimumTime()
+void KTimeComboBox::setMaximumTime(const QTime &maxTime, const QString &maxWarnMsg)
 {
-    d->m_minTime = d->defaultMinTime();
+    setTimeRange(d->m_minTime, maxTime, d->m_minWarnMsg, maxWarnMsg);
 }
 
 void KTimeComboBox::resetMaximumTime()
 {
-    d->m_maxTime = d->defaultMaxTime();
+    setTimeRange(d->m_minTime, d->defaultMaxTime(), d->m_minWarnMsg, QString());
 }
 
-void KTimeComboBox::resetTimeRange()
+void KTimeComboBox::setTimeRange(const QTime &minTime, const QTime &maxTime,
+                                 const QString &minWarnMsg, const QString &maxWarnMsg)
 {
-    setTimeRange(d->defaultMinTime(), d->defaultMaxTime());
+    if (!minTime.isValid() || !maxTime.isValid() || minTime > maxTime) {
+        return;
+    }
+
+    d->m_minTime = minTime;
+    d->m_maxTime = maxTime;
+    d->m_minWarnMsg = minWarnMsg;
+    d->m_maxWarnMsg = maxWarnMsg;
+    d->initTimeWidget();
+    d->updateTimeWidget();
 }
 
-void KTimeComboBox::clearTimeRange()
+void KTimeComboBox::resetTimeRange()
 {
-    resetMinimumTime();
-    resetMaximumTime();
+    setTimeRange(d->defaultMinTime(), d->defaultMaxTime(), QString(), QString());
 }
 
 KLocale::TimeFormatOptions KTimeComboBox::displayFormat()
@@ -274,19 +390,56 @@ KLocale::TimeFormatOptions KTimeComboBox::displayFormat()
 void KTimeComboBox::setDisplayFormat(KLocale::TimeFormatOptions format)
 {
     d->m_displayFormat = format;
+    d->initTimeWidget();
+    d->updateTimeWidget();
+}
+
+int KTimeComboBox::timeListInterval() const
+{
+    return d->m_timeListInterval;
+}
+
+void KTimeComboBox::setTimeListInterval(int minutes)
+{
+    //Must be able to exactly divide the valid time period
+    int lowMins = (d->m_minTime.hour() * 60) + d->m_minTime.minute();
+    int hiMins = (d->m_maxTime.hour() * 60) + d->m_maxTime.minute();
+    if (d->m_minTime.minute() == 0 && d->m_maxTime.minute() == 59) {
+        ++hiMins;
+    }
+    if ((hiMins - lowMins) % minutes == 0) {
+        d->m_timeListInterval = minutes;
+        d->m_timeList.clear();
+    } else {
+        return;
+    }
+    d->initTimeWidget();
 }
 
-int KTimeComboBox::timeInterval() const
+QList<QTime> KTimeComboBox::timeList() const
 {
-    return d->m_timeInterval;
+    //Return the drop down list as it is what can be selected currently
+    QList<QTime> list;
+    int c = count();
+    for (int i = 0; i < c; ++i) {
+        list.append(itemData(i).toTime());
+    }
+    return list;
 }
 
-void KTimeComboBox::setTimeInterval(int minutes)
+void KTimeComboBox::setTimeList(QList<QTime> timeList,
+                                const QString &minWarnMsg, const QString &maxWarnMsg)
 {
-    //Must be able to exactly divide the day
-    if (1440 % minutes == 0) {
-        d->m_timeInterval = minutes;
+    d->m_timeList.clear();
+    foreach (const QTime &time, timeList) {
+        if (time.isValid() && !d->m_timeList.contains(time)) {
+            d->m_timeList.append(time);
+        }
     }
+    qSort(d->m_timeList);
+    // Does the updateTimeWidget call for us
+    setTimeRange(d->m_timeList.first(), d->m_timeList.last(),
+                 minWarnMsg, maxWarnMsg);
 }
 
 bool KTimeComboBox::eventFilter(QObject *object, QEvent *event)
@@ -296,29 +449,33 @@ bool KTimeComboBox::eventFilter(QObject *object, QEvent *event)
 
 void KTimeComboBox::keyPressEvent(QKeyEvent *keyEvent)
 {
+    QTime temp;
     switch (keyEvent->key()) {
     case Qt::Key_Down:
-        d->enterTime(d->m_time.addSecs(-60));
+        temp = d->m_time.addSecs(-60);
         break;
     case Qt::Key_Up:
-        d->enterTime(d->m_time.addSecs(60));
+        temp = d->m_time.addSecs(60);
         break;
     case Qt::Key_PageDown:
-        d->enterTime(d->m_time.addSecs(-3600));
+        temp = d->m_time.addSecs(-3600);
         break;
     case Qt::Key_PageUp:
-        d->enterTime(d->m_time.addSecs(3600));
+        temp = d->m_time.addSecs(3600);
         break;
     default:
         KComboBox::keyPressEvent(keyEvent);
+        return;
+    }
+    if (temp.isValid() && temp >= d->m_minTime && temp <= d->m_maxTime) {
+        d->enterTime(temp);
     }
 }
 
 void KTimeComboBox::focusOutEvent(QFocusEvent *event)
 {
-    if (event->type() == QEvent::FocusOut) {
-        d->parseTime();
-    }
+    d->parseTime();
+    d->warnTime();
     KComboBox::focusOutEvent(event);
 }
 
diff --git a/kdeui/widgets/ktimecombobox.h b/kdeui/widgets/ktimecombobox.h
index 3dafb04..b38c6d6 100644
--- a/kdeui/widgets/ktimecombobox.h
+++ b/kdeui/widgets/ktimecombobox.h
@@ -34,10 +34,11 @@ class KDEUI_EXPORT KTimeComboBox : public KComboBox
     Q_OBJECT
 
     Q_PROPERTY(QTime time READ time WRITE setTime NOTIFY timeChanged USER true)
-    Q_PROPERTY(QTime minimumTime READ minimumTime RESET resetMinimumTime)
-    Q_PROPERTY(QTime maximumTime READ maximumTime RESET resetMaximumTime)
+    Q_PROPERTY(QTime minimumTime READ minimumTime WRITE setMinimumTime RESET resetMinimumTime)
+    Q_PROPERTY(QTime maximumTime READ maximumTime WRITE setMaximumTime RESET resetMaximumTime)
+    Q_PROPERTY(int timeListInterval READ timeListInterval WRITE setTimeListInterval)
     Q_PROPERTY(Options options READ options WRITE setOptions)
-    //Q_PROPERTY(KLocale::TimeFormatOptions displayFormat READ displayFormat WRITE setDisplayFormat)
+    Q_FLAGS(Options)
 
 public:
 
@@ -49,9 +50,8 @@ public:
     enum Option {
         EditTime         = 0x0001,  /**< Allow the user to manually edit the time in the combo line edit */
         SelectTime       = 0x0002,  /**< Allow the user to select the time from a drop-down menu */
-        ForceInterval    = 0x0004,  /**< The entered time can only be a selected interval */
-        WarnOnInvalid    = 0x0010,  /**< Show a warning on focus out if the time is invalid */
-        ErrorOnInvalid   = 0x0020   /**< Show an error on focus out if the time is invalid */
+        ForceTime        = 0x0004,  /**< Any set or entered time will be forced to one of the drop-down times */
+        WarnOnInvalid    = 0x0008,  /**< Show a warning box on focus out if the user enters an invalid time */
     };
     Q_DECLARE_FLAGS(Options, Option)
 
@@ -103,7 +103,7 @@ public:
     QTime minimumTime() const;
 
     /**
-     * Reset the minimum time to the default
+     * Reset the minimum time to the default of 00:00:00.000
      */
     void resetMinimumTime();
 
@@ -115,26 +115,24 @@ public:
     QTime maximumTime() const;
 
     /**
-     * Reset the maximum time to the default
+     * Reset the maximum time to the default of 23:59:59.999
      */
     void resetMaximumTime();
 
     /**
      * Set the minimum and maximum time range.
      *
-     * To enable time range checking provide two valid times.
-     * To disable time range checking provide two invalid times, or call
-     * clearTimeRange;
+     * If either time is invalid, or min > max then the range will not be set.
      *
      * @param minTime the minimum time
      * @param maxTime the maximum time
-     * @param minErrorMsg the minimum error message
-     * @param maxErrorMsg the maximum error message
+     * @param minWarnMsg the minimum warning message
+     * @param maxWarnMsg the maximum warning message
      */
     void setTimeRange(const QTime &minTime,
                       const QTime &maxTime,
-                      const QString &minErrorMsg = QString(),
-                      const QString &maxErrorMsg = QString());
+                      const QString &minWarnMsg = QString(),
+                      const QString &maxWarnMsg = QString());
 
     /**
      * Reset the minimum and maximum time to the default values.
@@ -142,16 +140,24 @@ public:
     void resetTimeRange();
 
     /**
-     * Clear the minimum and maximum time, i.e. disable time range checking.
+     * Return the interval between select time list entries if set by setTimeListInterval().
+     *
+     * Returns -1 if not set.
+     *
+     * @see setTimeListInterval()
+     * @return the select time list interval in minutes
      */
-    void clearTimeRange();
+    int timeListInterval() const;
 
     /**
-     * Return the time interval able to be selected
+     * Return the list of times able to be selected in the drop-down.
      *
-     * @return the select time intervals in minutes
+     * @see setTimeList()
+     * @see timeListInterval()
+     * @see setTimeListInterval()
+     * @return the select time list
      */
-    int timeInterval() const;
+    QList<QTime> timeList() const;
 
 Q_SIGNALS:
 
@@ -212,16 +218,76 @@ public Q_SLOTS:
     void setDisplayFormat(KLocale::TimeFormatOptions formatOptions);
 
     /**
-     * Set the time interval able to be selected in the time widget
+     * Set the minimum allowed time.
+     *
+     * If the time is invalid, or greater than current maximum,
+     * then the minimum will not be set.
+     *
+     * @see minimumTime()
+     * @see maximumTime()
+     * @see setMaximumTime()
+     * @see setTimeRange()
+     * @param minTime the minimum time
+     * @param minWarnMsg the minimum warning message
+     */
+    void setMinimumTime(const QTime &minTime, const QString &minWarnMsg = QString());
+
+    /**
+     * Set the maximum allowed time.
+     *
+     * If the time is invalid, or less than current minimum,
+     * then the maximum will not be set.
+     *
+     * @see minimumTime()
+     * @see maximumTime()
+     * @see setMaximumTime()
+     * @see setTimeRange()
+     * @param maxTime the maximum time
+     * @param maxWarnMsg the maximum warning message
+     */
+    void setMaximumTime(const QTime &maxTime, const QString &maxWarnMsg = QString());
+
+    /**
+     * Set the interval between times able to be selected from the drop-down.
+     *
+     * The combo drop-down will be populated with times every @param minutes
+     * apart, starting from the minimumTime() and ending at maximumTime().
+     *
+     * If the ForceInterval option is set then any time manually typed into the
+     * combo line edit will be forced to the nearest interval.
+     *
+     * This interval must be an exact divisor of the valid time range hours.
+     * For example with the default 24 hour range @p interval must divide 1440
+     * minutes exactly, meaning 1, 6 and 90 are valid but 7, 31 and 91 are not.
+     *
+     * Setting the time list interval will override any time list previously set
+     * via setTimeList().
+     *
+     * @see timeListInterval()
+     * @param minutes the time list interval to display
+     */
+    void setTimeListInterval(int minutes);
+
+    /**
+     * Set the list of times able to be selected from the drop-down.
+     *
+     * Setting the time list will override any time interval previously set via
+     * setTimeListInterval().
      *
-     * If the ForceInterval option is set then any entered date will be
-     * forced to the nearest interval.
+     * Any invalid or duplicate times will be ignored, and the list will be
+     * sorted.
      *
-     * This interval must be an exact divisor of 60 minutes.
+     * The minimum and maximum time will automatically be set to the earliest
+     * and latest value in the list.
      *
-     * @param minutes the interval to display
+     * @see timeList()
+     * @param timeList the list of times able to be selected
+     * @param minWarnMsg the minimum warning message
+     * @param maxWarnMsg the maximum warning message
      */
-    void setTimeInterval(int minutes);
+    void setTimeList(QList<QTime> timeList,
+                     const QString &minWarnMsg = QString(),
+                     const QString &maxWarnMsg = QString());
 
 protected:
 
diff --git a/kdeui/widgets/ktimeedit.cpp b/kdeui/widgets/ktimeedit.cpp
deleted file mode 100644
index 9aba165..0000000
--- a/kdeui/widgets/ktimeedit.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
-    Copyright 2011 John Layt <john at layt.net>
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library General Public
-    License as published by the Free Software Foundation; either
-    version 2 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Library General Public License for more details.
-
-    You should have received a copy of the GNU Library General Public License
-    along with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-    Boston, MA 02110-1301, USA.
-*/
-
-#include "ktimeedit.h"
-
-KTimeEdit::KTimeEdit(QWidget *parent)
-          :KDateTimeEdit(parent)
-{
-    setOptions(KDateTimeEdit::ShowTime | KDateTimeEdit::EditTime | KDateTimeEdit::SelectTime);
-}
-
-KTimeEdit::~KTimeEdit()
-{
-}
diff --git a/kdeui/widgets/ktimeedit.h b/kdeui/widgets/ktimeedit.h
deleted file mode 100644
index 4da307d..0000000
--- a/kdeui/widgets/ktimeedit.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-    Copyright 2011 John Layt <john at layt.net>
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library General Public
-    License as published by the Free Software Foundation; either
-    version 2 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Library General Public License for more details.
-
-    You should have received a copy of the GNU Library General Public License
-    along with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-    Boston, MA 02110-1301, USA.
-*/
-
-#ifndef KTIMEEDIT_H
-#define KTIMEEDIT_H
-
-#include <kdeui_export.h>
-
-#include <QtGui/QWidget>
-
-#include "kdatetimeedit.h"
-
-class KDEUI_EXPORT KTimeEdit : public KDateTimeEdit
-{
-    Q_OBJECT
-public:
-    KTimeEdit(QWidget *parent = 0);
-    virtual ~KTimeEdit();
-};
-
-#endif // KTIMEEDIT_H
diff --git a/kdewidgets/kde.widgets b/kdewidgets/kde.widgets
index 52ff84b..85d9a33 100644
--- a/kdewidgets/kde.widgets
+++ b/kdewidgets/kde.widgets
@@ -76,21 +76,6 @@ Group=Date/Time (KDE)
 IncludeFile=kdatetable.h
 Group=Date/Time (KDE)
 
-[KDateTimeEdit]
-ToolTip=This widget can be used to display or edit the date and time. (KDE)
-IncludeFile=kdatetimeedit.h
-Group=Date/Time (KDE)
-
-[KDateEdit]
-ToolTip=This widget can be used to display or edit the date. (KDE)
-IncludeFile=kdateedit.h
-Group=Date/Time (KDE)
-
-[KTimeEdit]
-ToolTip=This widget can be used to display or edit the time. (KDE)
-IncludeFile=ktimeedit.h
-Group=Date/Time (KDE)
-
 [KDateComboBox]
 ToolTip=This widget can be used to display or edit the date. (KDE)
 IncludeFile=kdatecombobox.h
@@ -101,6 +86,11 @@ ToolTip=This widget can be used to display or edit the time. (KDE)
 IncludeFile=ktimecombobox.h
 Group=Date/Time (KDE)
 
+[KDateTimeEdit]
+ToolTip=This widget can be used to display or edit the date and time. (KDE)
+IncludeFile=kdatetimeedit.h
+Group=Date/Time (KDE)
+
 [KDateTimeWidget]
 ToolTip=This widget can be used to display or allow user selection of date and time. (KDE)
 IncludeFile=kdatetimewidget.h



More information about the Kde-bindings mailing list