From f046179d3b49c44896298aa86380046a21394bbc Mon Sep 17 00:00:00 2001 From: hakan Date: Mon, 06 May 2002 21:09:38 +0000 Subject: 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 --- 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 @@ -43,7 +43,7 @@ margin - 0 + 2 spacing @@ -147,7 +147,7 @@ text - Description + Description @@ -209,7 +209,7 @@ text - Start - End + Start - End @@ -265,6 +265,28 @@ hAlign + + + name + Spacer1_2 + + + orientation + Horizontal + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + TimePicker @@ -272,7 +294,7 @@ timePickerStart - + QPushButton name @@ -297,7 +319,7 @@ - + QLineEdit name @@ -329,7 +351,7 @@ QLabel name - TextLabel3_2 + TimePickerLabel text @@ -563,6 +585,12 @@ setDisabled(bool) + checkAllDay + toggled(bool) + timePickerStart + setDisabled(bool) + + checkAlarm toggled(bool) comboSound 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 @@ -68,13 +68,29 @@ 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; } @@ -268,17 +284,18 @@ static QTime parseTime( const QString& s, bool ampm ) */ 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()); } /* @@ -326,9 +343,8 @@ void DateEntry::startTimePicked( const QTime &t ) { startTimeChanged(t); updateTimeEdit(true,true); }else{ - endTime = t; + endTimeChanged(t); updateTimeEdit(false, true ); - } } -- cgit v0.9.0.2