author | umopapisdn <umopapisdn> | 2003-04-13 23:14:23 (UTC) |
---|---|---|
committer | umopapisdn <umopapisdn> | 2003-04-13 23:14:23 (UTC) |
commit | ef69f1d1ca947a0b972e3f8d635883ae7ef0ae23 (patch) (side-by-side diff) | |
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 @@ -5,30 +5,28 @@ HEADERS = datebookday.h \ datebook.h \ dateentryimpl.h \ datebookdayheaderimpl.h \ datebooksettings.h \ datebookweek.h \ datebookweeklst.h \ datebookweekheaderimpl.h \ repeatentry.h \ - timepicker.h \ noteentryimpl.h \ onoteedit.h SOURCES = main.cpp \ datebookday.cpp \ datebook.cpp \ dateentryimpl.cpp \ datebookdayheaderimpl.cpp \ datebooksettings.cpp \ datebookweek.cpp \ datebookweeklst.cpp \ datebookweekheaderimpl.cpp \ repeatentry.cpp \ - timepicker.cpp \ noteentryimpl.cpp \ onoteedit.cpp INTERFACES = dateentry.ui \ datebookdayheader.ui \ datebookweekheader.ui \ datebookweeklstheader.ui \ datebookweeklstdayhdr.ui \ repeatentrybase.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 @@ -283,17 +283,17 @@ <size> <width>20</width> <height>20</height> </size> </property> </spacer> <widget row="5" column="1" colspan="3"> - <class>TimePicker</class> + <class>OTimePicker</class> <property stdset="1"> <name>name</name> <cstring>timePickerStart</cstring> </property> </widget> <widget row="3" column="3" colspan="1"> <class>QPushButton</class> <property stdset="1"> @@ -535,18 +535,18 @@ <container>0</container> <sizepolicy> <hordata>7</hordata> <verdata>1</verdata> </sizepolicy> <pixmap>image1</pixmap> </customwidget> <customwidget> - <class>TimePicker</class> - <header location="local">timepicker.h</header> + <class>OTimePicker</class> + <header location="local">opie/otimepicker.h</header> <sizehint> <width>-1</width> <height>-1</height> </sizehint> <container>0</container> <sizepolicy> <hordata>7</hordata> <verdata>1</verdata> 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 @@ -35,17 +35,17 @@ #include <qlayout.h> #include <qlineedit.h> #include <qmultilineedit.h> #include <qpopupmenu.h> #include <qscrollview.h> #include <qspinbox.h> #include <qtoolbutton.h> -#include "timepicker.h" +#include <opie/otimepicker.h> #include "onoteedit.h" #include <stdlib.h> #include <stdio.h> /* * Constructs a DateEntry which is a child of 'parent', with the * name 'name' and widget flags set to 'f' @@ -77,26 +77,26 @@ bool DateEntry::eventFilter(QObject *obj, QEvent *ev ) m_showStart= true; }else if( obj == comboEnd ){ timePickerStart->setHour(endTime.hour()); timePickerStart->setMinute(endTime.minute()); TimePickerLabel->setText( tr("End Time") ); m_showStart = false; } } else if( ev->type() == QEvent::FocusOut ){ - if( obj == comboEnd ){ - QString s; - s.sprintf("%.2d:%.2d",endTime.hour(), endTime.minute()); - comboEnd->setText(s); - } - else if( obj == comboStart ){ - QString s; - s.sprintf("%.2d:%.2d",startTime.hour(), startTime.minute()); - comboStart->setText(s); - } +// if( obj == comboEnd ){ +// QString s; +// s.sprintf("%.2d:%.2d",endTime.hour(), endTime.minute()); +// comboEnd->setText(s); +// } +// else if( obj == comboStart ){ +// QString s; +// s.sprintf("%.2d:%.2d",startTime.hour(), startTime.minute()); +// comboStart->setText(s); +// } } return false; } static void addOrPick( QComboBox* combo, const QString& t ) { // Pick an item if one excists 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 @@ -#include "timepicker.h" - -#include <qbuttongroup.h> -#include <qtoolbutton.h> -#include <qlayout.h> -#include <qstring.h> -#include <stdio.h> - -TimePicker::TimePicker(QWidget* parent, const char* name, - WFlags fl) : - QWidget(parent,name,fl) -{ - QVBoxLayout *vbox=new QVBoxLayout(this); - - OClickableLabel *r; - QString s; - - // Hour Row - QWidget *row=new QWidget(this); - QHBoxLayout *l=new QHBoxLayout(row); - vbox->addWidget(row); - - - for (int i=0; i<24; i++) { - r=new OClickableLabel(row); - hourLst.append(r); - s.sprintf("%.2d",i); - r->setText(s); - r->setToggleButton(true); - r->setAlignment(AlignHCenter | AlignVCenter); - l->addWidget(r); - connect(r, SIGNAL(toggled(bool)), - this, SLOT(slotHour(bool))); - - if (i==11) { // Second row - row=new QWidget(this); - l=new QHBoxLayout(row); - vbox->addWidget(row); - } - } - - // Minute Row - row=new QWidget(this); - l=new QHBoxLayout(row); - vbox->addWidget(row); - - for (int i=0; i<60; i+=5) { - r=new OClickableLabel(row); - minuteLst.append(r); - s.sprintf("%.2d",i); - r->setText(s); - r->setToggleButton(true); - r->setAlignment(AlignHCenter | AlignVCenter); - l->addWidget(r); - connect(r, SIGNAL(toggled(bool)), - this, SLOT(slotMinute(bool))); - } -} - -void TimePicker::slotHour(bool b) { - - OClickableLabel *r = (OClickableLabel *) sender(); - - if (b) { - QValueListIterator<OClickableLabel *> it; - for (it=hourLst.begin(); it!=hourLst.end(); it++) { - if (*it != r) (*it)->setOn(false); - else tm.setHMS((*it)->text().toInt(), tm.minute(), 0); - } - emit timeChanged(tm); - } else { - r->setOn(true); - } - -} - -void TimePicker::slotMinute(bool b) { - - OClickableLabel *r = (OClickableLabel *) sender(); - - if (b) { - QValueListIterator<OClickableLabel *> it; - for (it=minuteLst.begin(); it!=minuteLst.end(); it++) { - if (*it != r) (*it)->setOn(false); - else tm.setHMS(tm.hour(),(*it)->text().toInt(), 0); - } - emit timeChanged(tm); - } else { - r->setOn(true); - } - -} - -void TimePicker::setMinute(int m) { - - QString minute; - minute.sprintf("%.2d",m); - - QValueListIterator<OClickableLabel *> it; - for (it=minuteLst.begin(); it!=minuteLst.end(); it++) { - if ((*it)->text() == minute) (*it)->setOn(true); - else (*it)->setOn(false); - } - - tm.setHMS(tm.hour(),m,0); -} - -void TimePicker::setHour(int h) { - - QString hour; - hour.sprintf("%.2d",h); - - QValueListIterator<OClickableLabel *> it; - for (it=hourLst.begin(); it!=hourLst.end(); it++) { - if ((*it)->text() == hour) (*it)->setOn(true); - else (*it)->setOn(false); - } - tm.setHMS(h,tm.minute(),0); -} 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 @@ -#ifndef TIMEPICKER_H -#define TIMEPICKER_H - -#include <qwidget.h> -#include <qvaluelist.h> -#include <opie/oclickablelabel.h> -#include <qdatetime.h> - -class TimePicker: public QWidget { - Q_OBJECT - - public: - TimePicker(QWidget* parent = 0, const char* name = 0, - WFlags fl = 0); - void setHour(int h); - void setMinute(int m); - - private: - QValueList<OClickableLabel *> hourLst; - QValueList<OClickableLabel *> minuteLst; - QTime tm; - - private slots: - void slotHour(bool b); - void slotMinute(bool b); - - signals: - void timeChanged(const QTime &); -}; - - -#endif |