-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 @@ -1,62 +1,60 @@ TEMPLATE = app CONFIG += qt warn_on release DESTDIR = $(OPIEDIR)/bin 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 \ datebooksettingsbase.ui \ noteentry.ui INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopie TARGET = datebook TRANSLATIONS = ../../../i18n/de/datebook.ts \ ../../../i18n/xx/datebook.ts \ ../../../i18n/en/datebook.ts \ ../../../i18n/es/datebook.ts \ ../../../i18n/fr/datebook.ts \ ../../../i18n/hu/datebook.ts \ ../../../i18n/ja/datebook.ts \ ../../../i18n/ko/datebook.ts \ ../../../i18n/no/datebook.ts \ ../../../i18n/pl/datebook.ts \ ../../../i18n/pt/datebook.ts \ ../../../i18n/pt_BR/datebook.ts \ ../../../i18n/sl/datebook.ts \ ../../../i18n/zh_CN/datebook.ts \ ../../../i18n/it/datebook.ts \ ../../../i18n/zh_TW/datebook.ts \ ../../../i18n/da/datebook.ts include ( $(OPIEDIR)/include.pro ) 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 @@ -195,193 +195,193 @@ </property> </widget> <widget row="2" column="1" rowspan="1" colspan="3" > <class>CategorySelect</class> <property stdset="1"> <name>name</name> <cstring>comboCategory</cstring> </property> </widget> <widget row="3" column="0" rowspan="2"> <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel3</cstring> </property> <property stdset="1"> <name>text</name> <string>Start - End </string> </property> </widget> <widget row="3" column="1" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>buttonStart</cstring> </property> <property stdset="1"> <name>text</name> <string>Jan 02 00</string> </property> <property stdset="1"> <name>minimumSize</name> <size> <width>70</width> <height>0</height> </size> </property> <property stdset="1"> <name>maximumSize</name> <size> <width>70</width> <height>32767</height> </size> </property> </widget> <widget row="4" column="1" rowspan="1" colspan="1" > <class>QLineEdit</class> <property stdset="1"> <name>name</name> <cstring>comboStart</cstring> </property> <property stdset="1"> <name>minimumSize</name> <size> <width>70</width> <height>0</height> </size> </property> <property stdset="1"> <name>maximumSize</name> <size> <width>70</width> <height>32767</height> </size> </property> <property stdset="1"> <name>alignment</name> <set>AlignHCenter</set> </property> <property> <name>hAlign</name> </property> </widget> <spacer row="3" column="2" rowspan="2" colspan="1" > <property> <name>name</name> <cstring>Spacer1_2</cstring> </property> <property stdset="1"> <name>orientation</name> <enum>Horizontal</enum> </property> <property stdset="1"> <name>sizeType</name> <enum>Expanding</enum> </property> <property> <name>sizeHint</name> <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"> <name>name</name> <cstring>buttonEnd</cstring> </property> <property stdset="1"> <name>text</name> <string>Jan 02 00</string> </property> <property stdset="1"> <name>minimumSize</name> <size> <width>70</width> <height>0</height> </size> </property> <property stdset="1"> <name>maximumSize</name> <size> <width>70</width> <height>32767</height> </size> </property> </widget> <widget row="4" column="3" colspan="1"> <class>QLineEdit</class> <property stdset="1"> <name>name</name> <cstring>comboEnd</cstring> </property> <property stdset="1"> <name>minimumSize</name> <size> <width>70</width> <height>0</height> </size> </property> <property stdset="1"> <name>maximumSize</name> <size> <width>70</width> <height>32767</height> </size> </property> <property stdset="1"> <name>alignment</name> <set>AlignHCenter</set> </property> <property> <name>hAlign</name> </property> </widget> <widget row="5" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TimePickerLabel</cstring> </property> <property stdset="1"> <name>text</name> <string>Start time</string> </property> </widget> <widget row="6" column="0" > <class>QCheckBox</class> <property stdset="1"> <name>name</name> <cstring>checkAllDay</cstring> </property> <property stdset="1"> <name>text</name> <string>All day</string> </property> </widget> <widget row="7" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel3_2_2</cstring> </property> <property stdset="1"> <name>text</name> <string>Time zone</string> </property> </widget> <widget row="7" column="1" rowspan="1" colspan="3" > <class>TimeZoneSelector</class> <property stdset="1"> <name>name</name> <cstring>timezone</cstring> @@ -447,181 +447,181 @@ <property> <name>text</name> <string>Silent</string> </property> </item> <item> <property> <name>text</name> <string>Loud</string> </property> </item> <property stdset="1"> <name>name</name> <cstring>comboSound</cstring> </property> <property stdset="1"> <name>enabled</name> <bool>false</bool> </property> </widget> <widget row="9" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>lblRepeat</cstring> </property> <property stdset="1"> <name>text</name> <string>Repeat</string> </property> </widget> <widget row="9" column="1" rowspan="1" colspan="3" > <class>QToolButton</class> <property stdset="1"> <name>name</name> <cstring>cmdRepeat</cstring> </property> <property stdset="1"> <name>focusPolicy</name> <enum>TabFocus</enum> </property> <property stdset="1"> <name>text</name> <string>No Repeat...</string> </property> <property stdset="1"> <name>sizePolicy</name> <sizepolicy> <hsizetype>7</hsizetype> <vsizetype>0</vsizetype> </sizepolicy> </property> </widget> <widget row="10" column="0" rowspan="1" colspan="4" > <class>QToolButton</class> <property stdset="1"> <name>name</name> <cstring>editNote</cstring> </property> <property stdset="1"> <name>text</name> <string>Note...</string> </property> </widget> </grid> </widget> <customwidgets> <customwidget> <class>TimeZoneSelector</class> <header location="global">qpe/tzselect.h</header> <sizehint> <width>21</width> <height>10</height> </sizehint> <container>0</container> <sizepolicy> <hordata>7</hordata> <verdata>1</verdata> </sizepolicy> <pixmap>image0</pixmap> </customwidget> <customwidget> <class>CategorySelect</class> <header location="global">qpe/categoryselect.h</header> <sizehint> <width>-1</width> <height>-1</height> </sizehint> <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> </sizepolicy> <pixmap>image1</pixmap> </customwidget> </customwidgets> <images> <image> <name>image0</name> <data format="XPM.GZ" length="45">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523250004143a55a6b2e0026630c4f</data> </image> <image> <name>image1</name> <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> </image> </images> <connections> <connection> <sender>checkAlarm</sender> <signal>toggled(bool)</signal> <receiver>spinAlarm</receiver> <slot>setEnabled(bool)</slot> </connection> <connection> <sender>comboEnd</sender> <signal>textChanged(const QString&)</signal> <receiver>DateEntryBase</receiver> <slot>endTimeChanged( const QString & )</slot> </connection> <connection> <sender>cmdRepeat</sender> <signal>clicked()</signal> <receiver>DateEntryBase</receiver> <slot>slotRepeat()</slot> </connection> <connection> <sender>comboStart</sender> <signal>textChanged(const QString &)</signal> <receiver>DateEntryBase</receiver> <slot>startTimeEdited( const QString & )</slot> </connection> <connection> <sender>checkAllDay</sender> <signal>toggled(bool)</signal> <receiver>comboEnd</receiver> <slot>setDisabled(bool)</slot> </connection> <connection> <sender>checkAllDay</sender> <signal>toggled(bool)</signal> <receiver>timePickerStart</receiver> <slot>setDisabled(bool)</slot> </connection> <connection> <sender>checkAlarm</sender> <signal>toggled(bool)</signal> <receiver>comboSound</receiver> <slot>setEnabled(bool)</slot> </connection> <connection> <sender>checkAllDay</sender> <signal>toggled(bool)</signal> <receiver>comboStart</receiver> <slot>setDisabled(bool)</slot> </connection> <slot access="public">endDateChanged( const QString & )</slot> <slot access="public">endDateChanged( int, int, int )</slot> <slot access="public">endTimeChanged( const QString & )</slot> <slot access="public">slotRepeat()</slot> <slot access="public">slotWait( int )</slot> <slot access="public">startDateChanged( const QString & )</slot> <slot access="public">startDateChanged(int, int, int)</slot> <slot access="public">startTimeEdited( const QString & )</slot> <slot access="public">typeChanged( const QString & )</slot> <slot access="public">tzexecute(void)</slot> </connections> </UI> 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 @@ -1,190 +1,190 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "dateentryimpl.h" #include "repeatentry.h" #include <qpe/qpeapplication.h> #include <qpe/categoryselect.h> #include <qpe/datebookmonth.h> #include <qpe/global.h> #include <qpe/timeconversion.h> #include <qpe/timestring.h> #include <qpe/tzselect.h> #include <qevent.h> #include <qcheckbox.h> #include <qcombobox.h> #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' * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ DateEntry::DateEntry( bool startOnMonday, const QDateTime &start, const QDateTime &end, bool whichClock, QWidget* parent, const char* name ) : DateEntryBase( parent, name ), ampm( whichClock ), startWeekOnMonday( startOnMonday ), m_showStart(true) { init(); setDates(start,end); setFocusProxy(comboDescription); } bool DateEntry::eventFilter(QObject *obj, QEvent *ev ) { if( ev->type() == QEvent::FocusIn ){ if( obj == comboStart ){ timePickerStart->setHour(startTime.hour()); timePickerStart->setMinute(startTime.minute()); TimePickerLabel->setText( tr("Start Time" ) ); 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 for (int i=0; i<combo->count(); i++) { if ( combo->text(i) == t ) { combo->setCurrentItem(i); return; } } // Else add one combo->insertItem(t); combo->setCurrentItem(combo->count()-1); } DateEntry::DateEntry( bool startOnMonday, const Event &event, bool whichClock, QWidget* parent, const char* name ) : DateEntryBase( parent, name ), ampm( whichClock ), startWeekOnMonday( startOnMonday ), m_showStart(true) { init(); setDates(event.start(),event.end()); comboCategory->setCategories( event.categories(), "Calendar", tr("Calendar") ); if(!event.description().isEmpty()) addOrPick( comboDescription, event.description() ); if(!event.location().isEmpty()) addOrPick( comboLocation, event.location() ); checkAlarm->setChecked( event.hasAlarm() ); checkAllDay->setChecked( event.type() == Event::AllDay ); if(!event.notes().isEmpty()) noteStr=event.notes(); else noteStr=""; spinAlarm->setValue(event.alarmTime()); if ( event.alarmSound() != Event::Silent ) comboSound->setCurrentItem( 1 ); if ( event.hasRepeat() ) { rp = event.repeatPattern(); cmdRepeat->setText( tr("Repeat...") ); } setRepeatLabel(); } void DateEntry::setDates( const QDateTime& s, const QDateTime& e ) { startDate = s.date(); endDate = e.date(); startTime = s.time(); endTime = e.time(); startDateChanged( s.date().year(), s.date().month(), s.date().day() ); endDateChanged( e.date().year(), e.date().month(), e.date().day() ); updateTimeEdit(true,true); } void DateEntry::updateTimeEdit(bool s, bool e) { // Comboboxes QString strStart, strEnd; int shour, ehour; if ( ampm ) { shour = startTime.hour(); ehour = endTime.hour(); if ( shour >= 12 ) { if ( shour > 12 ) shour -= 12; strStart.sprintf( "%d:%02d PM", shour, startTime.minute() ); } else { if ( shour == 0 ) shour = 12; strStart.sprintf( "%d:%02d AM", shour, startTime.minute() ); } if ( ehour == 24 && endTime.minute() == 0 ) { strEnd = "11:59 PM"; // or "midnight" } else if ( ehour >= 12 ) { if ( ehour > 12 ) ehour -= 12; strEnd.sprintf( "%d:%02d PM", ehour, endTime.minute() ); } else { if ( ehour == 0 ) ehour = 12; strEnd.sprintf( "%d:%02d AM", ehour, endTime.minute() ); } } else { strStart.sprintf( "%02d:%02d", startTime.hour(), startTime.minute() ); strEnd.sprintf( "%02d:%02d", endTime.hour(), endTime.minute() ); } if (s) comboStart->setText(strStart); 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 |