author | hakan <hakan> | 2002-05-06 21:09:38 (UTC) |
---|---|---|
committer | hakan <hakan> | 2002-05-06 21:09:38 (UTC) |
commit | f046179d3b49c44896298aa86380046a21394bbc (patch) (side-by-side diff) | |
tree | b0df64a4170cd9d2631244213b33c7ef0e55b4f8 /core/pim | |
parent | 8622bcb85245937853f3e657498957deb7eb2073 (diff) | |
download | opie-f046179d3b49c44896298aa86380046a21394bbc.zip opie-f046179d3b49c44896298aa86380046a21394bbc.tar.gz opie-f046179d3b49c44896298aa86380046a21394bbc.tar.bz2 |
In the date entry dialog:
- Show end time (not only chnage label) when end textbox is selected.
- Update timepicker when endtime is edited.
- Update time textboxes when they looses focus.
- Got rid of vertical empty borders.
- "All day" dissables timepicker aswell.
- Picking bad end time will set and show end time to starttime
-rw-r--r-- | core/pim/datebook/dateentry.ui | 40 | ||||
-rw-r--r-- | core/pim/datebook/dateentryimpl.cpp | 38 |
2 files changed, 61 insertions, 17 deletions
diff --git a/core/pim/datebook/dateentry.ui b/core/pim/datebook/dateentry.ui index dc5195f..1a712ec 100644 --- a/core/pim/datebook/dateentry.ui +++ b/core/pim/datebook/dateentry.ui @@ -40,13 +40,13 @@ <name>caption</name> <string>New Event</string> </property> <grid> <property stdset="1"> <name>margin</name> - <number>0</number> + <number>2</number> </property> <property stdset="1"> <name>spacing</name> <number>0</number> </property> <widget row="1" column="0" > @@ -144,13 +144,13 @@ <property stdset="1"> <name>name</name> <cstring>TextLabel1</cstring> </property> <property stdset="1"> <name>text</name> - <string>Description</string> + <string>Description </string> </property> </widget> <widget row="1" column="1" rowspan="1" colspan="3" > <class>QComboBox</class> <item> <property> @@ -206,13 +206,13 @@ <property stdset="1"> <name>name</name> <cstring>TextLabel3</cstring> </property> <property stdset="1"> <name>text</name> - <string>Start - End</string> + <string>Start - End </string> </property> </widget> <widget row="3" column="1" > <class>QPushButton</class> <property stdset="1"> <name>name</name> @@ -262,20 +262,42 @@ <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> <property stdset="1"> <name>name</name> <cstring>timePickerStart</cstring> </property> </widget> - <widget row="3" column="2" colspan="2"> + <widget row="3" column="3" colspan="1"> <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>buttonEnd</cstring> </property> <property stdset="1"> @@ -294,13 +316,13 @@ <size> <width>70</width> <height>32767</height> </size> </property> </widget> - <widget row="4" column="2" colspan="2"> + <widget row="4" column="3" colspan="1"> <class>QLineEdit</class> <property stdset="1"> <name>name</name> <cstring>comboEnd</cstring> </property> <property stdset="1"> @@ -326,13 +348,13 @@ </property> </widget> <widget row="5" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> - <cstring>TextLabel3_2</cstring> + <cstring>TimePickerLabel</cstring> </property> <property stdset="1"> <name>text</name> <string>Start time</string> </property> </widget> @@ -560,12 +582,18 @@ <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> diff --git a/core/pim/datebook/dateentryimpl.cpp b/core/pim/datebook/dateentryimpl.cpp index f2f17c6..e14e2f5 100644 --- a/core/pim/datebook/dateentryimpl.cpp +++ b/core/pim/datebook/dateentryimpl.cpp @@ -65,19 +65,35 @@ DateEntry::DateEntry( bool startOnMonday, const QDateTime &start, } bool DateEntry::eventFilter(QObject *obj, QEvent *ev ) { if( ev->type() == QEvent::FocusIn ){ if( obj == comboStart ){ - TextLabel3_2->setText( tr("Start Time" ) ); + timePickerStart->setHour(startTime.hour()); + timePickerStart->setMinute(startTime.minute()); + TimePickerLabel->setText( tr("Start Time" ) ); m_showStart= true; }else if( obj == comboEnd ){ - TextLabel3_2->setText( tr("End Time") ); + 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); + } } + return false; } static void addOrPick( QComboBox* combo, const QString& t ) { // Pick an item if one excists @@ -265,23 +281,24 @@ static QTime parseTime( const QString& s, bool ampm ) /* * public slot */ void DateEntry::endTimeChanged( const QString &s ) { - QTime tmpTime = parseTime(s,ampm); - if ( endDate > startDate || tmpTime >= startTime ) { - endTime = tmpTime; + endTimeChanged( parseTime(s,ampm) ); +} + +void DateEntry::endTimeChanged( const QTime &t ) { + if ( endDate > startDate || t >= startTime ) { + endTime = t; } else { endTime = startTime; //comboEnd->setCurrentItem( comboStart->currentItem() ); } - -} - -void DateEntry::endTimeChanged( const QTime &t ) { + timePickerStart->setHour(endTime.hour()); + timePickerStart->setMinute(endTime.minute()); } /* * public slot */ void DateEntry::startDateChanged( int y, int m, int d ) @@ -323,15 +340,14 @@ void DateEntry::startTimeChanged( const QTime &t ) } void DateEntry::startTimePicked( const QTime &t ) { if(m_showStart ){ startTimeChanged(t); updateTimeEdit(true,true); }else{ - endTime = t; + endTimeChanged(t); updateTimeEdit(false, true ); - } } /* * public slot */ |