summaryrefslogtreecommitdiffstats
path: root/kcontrol/crypto/kdatetimedlg.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit4aed2c8219774f5d797760606b8489a92ddc5163 (patch)
tree3f8c130f7d269626bf6a9447407ef6c35954426a /kcontrol/crypto/kdatetimedlg.cpp
downloadtdebase-4aed2c8219774f5d797760606b8489a92ddc5163.tar.gz
tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kcontrol/crypto/kdatetimedlg.cpp')
-rw-r--r--kcontrol/crypto/kdatetimedlg.cpp118
1 files changed, 118 insertions, 0 deletions
diff --git a/kcontrol/crypto/kdatetimedlg.cpp b/kcontrol/crypto/kdatetimedlg.cpp
new file mode 100644
index 000000000..26001afdd
--- /dev/null
+++ b/kcontrol/crypto/kdatetimedlg.cpp
@@ -0,0 +1,118 @@
+/**
+ * kdatetimedlg.cpp
+ *
+ * Copyright (c) 2001 George Staikos <staikos@kde.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "kdatetimedlg.h"
+#include <qlayout.h>
+#include <qlabel.h>
+#include <klocale.h>
+#include <kdebug.h>
+#include <kdatepicker.h>
+#include <kpushbutton.h>
+#include <knuminput.h>
+#include <kstdguiitem.h>
+
+KDateTimeDlg::KDateTimeDlg(QWidget *parent, const char *name)
+ : KDialog(parent, name, true) {
+QGridLayout *grid = new QGridLayout(this, 9, 6, marginHint(), spacingHint());
+
+ setCaption(i18n("Date & Time Selector"));
+
+ _date = new KDatePicker(this);
+ grid->addMultiCellWidget(_date, 0, 5, 0, 5);
+
+ grid->addWidget(new QLabel(i18n("Hour:"), this), 7, 0);
+ _hours = new KIntNumInput(this);
+ _hours->setRange(0, 23, 1, false);
+ grid->addWidget(_hours, 7, 1);
+
+ grid->addWidget(new QLabel(i18n("Minute:"), this), 7, 2);
+ _mins = new KIntNumInput(this);
+ _mins->setRange(0, 59, 1, false);
+ grid->addWidget(_mins, 7, 3);
+
+ grid->addWidget(new QLabel(i18n("Second:"), this), 7, 4);
+ _secs = new KIntNumInput(this);
+ _secs->setRange(0, 59, 1, false);
+ grid->addWidget(_secs, 7, 5);
+
+ _ok = new KPushButton(KStdGuiItem::ok(), this);
+ grid->addWidget(_ok, 8, 4);
+ connect(_ok, SIGNAL(clicked()), SLOT(accept()));
+
+ _cancel = new KPushButton(KStdGuiItem::cancel(), this);
+ grid->addWidget(_cancel, 8, 5);
+ connect(_cancel, SIGNAL(clicked()), SLOT(reject()));
+
+}
+
+
+KDateTimeDlg::~KDateTimeDlg() {
+
+}
+
+
+QDate KDateTimeDlg::getDate() {
+ return _date->date();
+}
+
+
+QTime KDateTimeDlg::getTime() {
+QTime rc(_hours->value(), _mins->value(), _secs->value());
+return rc;
+}
+
+
+QDateTime KDateTimeDlg::getDateTime() {
+QDateTime qdt;
+QTime qtime(_hours->value(), _mins->value(), _secs->value());
+
+ qdt.setDate(_date->date());
+ qdt.setTime(qtime);
+
+return qdt;
+}
+
+
+void KDateTimeDlg::setDate(const QDate& qdate) {
+ _date->setDate(qdate);
+}
+
+
+void KDateTimeDlg::setTime(const QTime& qtime) {
+ _hours->setValue(qtime.hour());
+ _mins->setValue(qtime.minute());
+ _secs->setValue(qtime.second());
+}
+
+
+void KDateTimeDlg::setDateTime(const QDateTime& qdatetime) {
+ _date->setDate(qdatetime.date());
+ _hours->setValue(qdatetime.time().hour());
+ _mins->setValue(qdatetime.time().minute());
+ _secs->setValue(qdatetime.time().second());
+}
+
+
+#include "kdatetimedlg.moc"
+