summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebook.pro2
-rw-r--r--core/pim/datebook/dateentry.ui6
-rw-r--r--core/pim/datebook/dateentryimpl.cpp22
-rw-r--r--core/pim/datebook/timepicker.cpp119
-rw-r--r--core/pim/datebook/timepicker.h32
5 files changed, 14 insertions, 167 deletions
diff --git a/core/pim/datebook/datebook.pro b/core/pim/datebook/datebook.pro
index b4206a9..a6ee799 100644
--- a/core/pim/datebook/datebook.pro
+++ b/core/pim/datebook/datebook.pro
@@ -10,7 +10,6 @@ HEADERS = datebookday.h \
10 datebookweeklst.h \ 10 datebookweeklst.h \
11 datebookweekheaderimpl.h \ 11 datebookweekheaderimpl.h \
12 repeatentry.h \ 12 repeatentry.h \
13 timepicker.h \
14 noteentryimpl.h \ 13 noteentryimpl.h \
15 onoteedit.h 14 onoteedit.h
16 SOURCES= main.cpp \ 15 SOURCES= main.cpp \
@@ -23,7 +22,6 @@ SOURCES = main.cpp \
23 datebookweeklst.cpp \ 22 datebookweeklst.cpp \
24 datebookweekheaderimpl.cpp \ 23 datebookweekheaderimpl.cpp \
25 repeatentry.cpp \ 24 repeatentry.cpp \
26 timepicker.cpp \
27 noteentryimpl.cpp \ 25 noteentryimpl.cpp \
28 onoteedit.cpp 26 onoteedit.cpp
29 INTERFACES= dateentry.ui \ 27 INTERFACES= dateentry.ui \
diff --git a/core/pim/datebook/dateentry.ui b/core/pim/datebook/dateentry.ui
index fadbc35..197eb30 100644
--- a/core/pim/datebook/dateentry.ui
+++ b/core/pim/datebook/dateentry.ui
@@ -288,7 +288,7 @@
288 </spacer> 288 </spacer>
289 289
290 <widget row="5" column="1" colspan="3"> 290 <widget row="5" column="1" colspan="3">
291 <class>TimePicker</class> 291 <class>OTimePicker</class>
292 <property stdset="1"> 292 <property stdset="1">
293 <name>name</name> 293 <name>name</name>
294 <cstring>timePickerStart</cstring> 294 <cstring>timePickerStart</cstring>
@@ -540,8 +540,8 @@
540 <pixmap>image1</pixmap> 540 <pixmap>image1</pixmap>
541 </customwidget> 541 </customwidget>
542 <customwidget> 542 <customwidget>
543 <class>TimePicker</class> 543 <class>OTimePicker</class>
544 <header location="local">timepicker.h</header> 544 <header location="local">opie/otimepicker.h</header>
545 <sizehint> 545 <sizehint>
546 <width>-1</width> 546 <width>-1</width>
547 <height>-1</height> 547 <height>-1</height>
diff --git a/core/pim/datebook/dateentryimpl.cpp b/core/pim/datebook/dateentryimpl.cpp
index 33b9d9b..13d2ce2 100644
--- a/core/pim/datebook/dateentryimpl.cpp
+++ b/core/pim/datebook/dateentryimpl.cpp
@@ -40,7 +40,7 @@
40#include <qspinbox.h> 40#include <qspinbox.h>
41#include <qtoolbutton.h> 41#include <qtoolbutton.h>
42 42
43#include "timepicker.h" 43#include <opie/otimepicker.h>
44#include "onoteedit.h" 44#include "onoteedit.h"
45 45
46#include <stdlib.h> 46#include <stdlib.h>
@@ -82,16 +82,16 @@ bool DateEntry::eventFilter(QObject *obj, QEvent *ev )
82 m_showStart = false; 82 m_showStart = false;
83 } 83 }
84 } else if( ev->type() == QEvent::FocusOut ){ 84 } else if( ev->type() == QEvent::FocusOut ){
85 if( obj == comboEnd ){ 85// if( obj == comboEnd ){
86 QString s; 86// QString s;
87 s.sprintf("%.2d:%.2d",endTime.hour(), endTime.minute()); 87// s.sprintf("%.2d:%.2d",endTime.hour(), endTime.minute());
88 comboEnd->setText(s); 88// comboEnd->setText(s);
89 } 89// }
90 else if( obj == comboStart ){ 90// else if( obj == comboStart ){
91 QString s; 91// QString s;
92 s.sprintf("%.2d:%.2d",startTime.hour(), startTime.minute()); 92// s.sprintf("%.2d:%.2d",startTime.hour(), startTime.minute());
93 comboStart->setText(s); 93// comboStart->setText(s);
94 } 94// }
95 } 95 }
96 96
97 return false; 97 return false;
diff --git a/core/pim/datebook/timepicker.cpp b/core/pim/datebook/timepicker.cpp
deleted file mode 100644
index f2cb71d..0000000
--- a/core/pim/datebook/timepicker.cpp
+++ b/dev/null
@@ -1,119 +0,0 @@
1#include "timepicker.h"
2
3#include <qbuttongroup.h>
4#include <qtoolbutton.h>
5#include <qlayout.h>
6#include <qstring.h>
7#include <stdio.h>
8
9TimePicker::TimePicker(QWidget* parent, const char* name,
10 WFlags fl) :
11 QWidget(parent,name,fl)
12{
13 QVBoxLayout *vbox=new QVBoxLayout(this);
14
15 OClickableLabel *r;
16 QString s;
17
18 // Hour Row
19 QWidget *row=new QWidget(this);
20 QHBoxLayout *l=new QHBoxLayout(row);
21 vbox->addWidget(row);
22
23
24 for (int i=0; i<24; i++) {
25 r=new OClickableLabel(row);
26 hourLst.append(r);
27 s.sprintf("%.2d",i);
28 r->setText(s);
29 r->setToggleButton(true);
30 r->setAlignment(AlignHCenter | AlignVCenter);
31 l->addWidget(r);
32 connect(r, SIGNAL(toggled(bool)),
33 this, SLOT(slotHour(bool)));
34
35 if (i==11) { // Second row
36 row=new QWidget(this);
37 l=new QHBoxLayout(row);
38 vbox->addWidget(row);
39 }
40 }
41
42 // Minute Row
43 row=new QWidget(this);
44 l=new QHBoxLayout(row);
45 vbox->addWidget(row);
46
47 for (int i=0; i<60; i+=5) {
48 r=new OClickableLabel(row);
49 minuteLst.append(r);
50 s.sprintf("%.2d",i);
51 r->setText(s);
52 r->setToggleButton(true);
53 r->setAlignment(AlignHCenter | AlignVCenter);
54 l->addWidget(r);
55 connect(r, SIGNAL(toggled(bool)),
56 this, SLOT(slotMinute(bool)));
57 }
58}
59
60void TimePicker::slotHour(bool b) {
61
62 OClickableLabel *r = (OClickableLabel *) sender();
63
64 if (b) {
65 QValueListIterator<OClickableLabel *> it;
66 for (it=hourLst.begin(); it!=hourLst.end(); it++) {
67 if (*it != r) (*it)->setOn(false);
68 else tm.setHMS((*it)->text().toInt(), tm.minute(), 0);
69 }
70 emit timeChanged(tm);
71 } else {
72 r->setOn(true);
73 }
74
75}
76
77void TimePicker::slotMinute(bool b) {
78
79 OClickableLabel *r = (OClickableLabel *) sender();
80
81 if (b) {
82 QValueListIterator<OClickableLabel *> it;
83 for (it=minuteLst.begin(); it!=minuteLst.end(); it++) {
84 if (*it != r) (*it)->setOn(false);
85 else tm.setHMS(tm.hour(),(*it)->text().toInt(), 0);
86 }
87 emit timeChanged(tm);
88 } else {
89 r->setOn(true);
90 }
91
92}
93
94void TimePicker::setMinute(int m) {
95
96 QString minute;
97 minute.sprintf("%.2d",m);
98
99 QValueListIterator<OClickableLabel *> it;
100 for (it=minuteLst.begin(); it!=minuteLst.end(); it++) {
101 if ((*it)->text() == minute) (*it)->setOn(true);
102 else (*it)->setOn(false);
103 }
104
105 tm.setHMS(tm.hour(),m,0);
106}
107
108void TimePicker::setHour(int h) {
109
110 QString hour;
111 hour.sprintf("%.2d",h);
112
113 QValueListIterator<OClickableLabel *> it;
114 for (it=hourLst.begin(); it!=hourLst.end(); it++) {
115 if ((*it)->text() == hour) (*it)->setOn(true);
116 else (*it)->setOn(false);
117 }
118 tm.setHMS(h,tm.minute(),0);
119}
diff --git a/core/pim/datebook/timepicker.h b/core/pim/datebook/timepicker.h
deleted file mode 100644
index 1c35600..0000000
--- a/core/pim/datebook/timepicker.h
+++ b/dev/null
@@ -1,32 +0,0 @@
1#ifndef TIMEPICKER_H
2#define TIMEPICKER_H
3
4#include <qwidget.h>
5#include <qvaluelist.h>
6#include <opie/oclickablelabel.h>
7#include <qdatetime.h>
8
9class TimePicker: public QWidget {
10 Q_OBJECT
11
12 public:
13 TimePicker(QWidget* parent = 0, const char* name = 0,
14 WFlags fl = 0);
15 void setHour(int h);
16 void setMinute(int m);
17
18 private:
19 QValueList<OClickableLabel *> hourLst;
20 QValueList<OClickableLabel *> minuteLst;
21 QTime tm;
22
23 private slots:
24 void slotHour(bool b);
25 void slotMinute(bool b);
26
27 signals:
28 void timeChanged(const QTime &);
29};
30
31
32#endif