author | umopapisdn <umopapisdn> | 2003-04-13 23:14:23 (UTC) |
---|---|---|
committer | umopapisdn <umopapisdn> | 2003-04-13 23:14:23 (UTC) |
commit | ef69f1d1ca947a0b972e3f8d635883ae7ef0ae23 (patch) (unidiff) | |
tree | 23de36544964e52be73c31cd467838d473c97293 | |
parent | 377a172d8b497674d14d7e3580a008228f83d081 (diff) | |
download | opie-ef69f1d1ca947a0b972e3f8d635883ae7ef0ae23.zip opie-ef69f1d1ca947a0b972e3f8d635883ae7ef0ae23.tar.gz opie-ef69f1d1ca947a0b972e3f8d635883ae7ef0ae23.tar.bz2 |
Bugfix: (Bug #0000716) The timepicker now works in am/pm mode also, I also changed datebook to use the otimepicker class in libopie.
-rw-r--r-- | core/pim/datebook/datebook.pro | 2 | ||||
-rw-r--r-- | core/pim/datebook/dateentry.ui | 6 | ||||
-rw-r--r-- | core/pim/datebook/dateentryimpl.cpp | 22 | ||||
-rw-r--r-- | core/pim/datebook/timepicker.cpp | 119 | ||||
-rw-r--r-- | core/pim/datebook/timepicker.h | 32 |
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 | |||
@@ -7,26 +7,24 @@ HEADERS = datebookday.h \ | |||
7 | datebookdayheaderimpl.h \ | 7 | datebookdayheaderimpl.h \ |
8 | datebooksettings.h \ | 8 | datebooksettings.h \ |
9 | datebookweek.h \ | 9 | datebookweek.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 \ |
17 | datebookday.cpp \ | 16 | datebookday.cpp \ |
18 | datebook.cpp \ | 17 | datebook.cpp \ |
19 | dateentryimpl.cpp \ | 18 | dateentryimpl.cpp \ |
20 | datebookdayheaderimpl.cpp \ | 19 | datebookdayheaderimpl.cpp \ |
21 | datebooksettings.cpp \ | 20 | datebooksettings.cpp \ |
22 | datebookweek.cpp \ | 21 | datebookweek.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 \ |
30 | datebookdayheader.ui \ | 28 | datebookdayheader.ui \ |
31 | datebookweekheader.ui \ | 29 | datebookweekheader.ui \ |
32 | datebookweeklstheader.ui \ | 30 | datebookweeklstheader.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 | |||
@@ -285,13 +285,13 @@ | |||
285 | <height>20</height> | 285 | <height>20</height> |
286 | </size> | 286 | </size> |
287 | </property> | 287 | </property> |
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> |
295 | </property> | 295 | </property> |
296 | </widget> | 296 | </widget> |
297 | <widget row="3" column="3" colspan="1"> | 297 | <widget row="3" column="3" colspan="1"> |
@@ -537,14 +537,14 @@ | |||
537 | <hordata>7</hordata> | 537 | <hordata>7</hordata> |
538 | <verdata>1</verdata> | 538 | <verdata>1</verdata> |
539 | </sizepolicy> | 539 | </sizepolicy> |
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> |
548 | </sizehint> | 548 | </sizehint> |
549 | <container>0</container> | 549 | <container>0</container> |
550 | <sizepolicy> | 550 | <sizepolicy> |
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 | |||
@@ -37,13 +37,13 @@ | |||
37 | #include <qmultilineedit.h> | 37 | #include <qmultilineedit.h> |
38 | #include <qpopupmenu.h> | 38 | #include <qpopupmenu.h> |
39 | #include <qscrollview.h> | 39 | #include <qscrollview.h> |
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> |
47 | #include <stdio.h> | 47 | #include <stdio.h> |
48 | 48 | ||
49 | /* | 49 | /* |
@@ -79,22 +79,22 @@ bool DateEntry::eventFilter(QObject *obj, QEvent *ev ) | |||
79 | timePickerStart->setHour(endTime.hour()); | 79 | timePickerStart->setHour(endTime.hour()); |
80 | timePickerStart->setMinute(endTime.minute()); | 80 | timePickerStart->setMinute(endTime.minute()); |
81 | TimePickerLabel->setText( tr("End Time") ); | 81 | TimePickerLabel->setText( tr("End Time") ); |
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; |
98 | } | 98 | } |
99 | 99 | ||
100 | static void addOrPick( QComboBox* combo, const QString& t ) | 100 | static void addOrPick( QComboBox* combo, const QString& t ) |
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 | |||
9 | TimePicker::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 | |||
60 | void 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 | |||
77 | void 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 | |||
94 | void 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 | |||
108 | void 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 | |||
9 | class 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 | ||