From 38052b763f7d248023024487a7e645b46637c76b Mon Sep 17 00:00:00 2001 From: zecke Date: Mon, 15 Apr 2002 22:40:49 +0000 Subject: -fix handling of the kewl timepicker click in a lineedit and the focus will change ARDO FEEL FREE TO REVERT IT WANTED TO GET THIS INTO THE FEED --- diff --git a/core/pim/datebook/dateentryimpl.cpp b/core/pim/datebook/dateentryimpl.cpp index 403378e..f2f17c6 100644 --- a/core/pim/datebook/dateentryimpl.cpp +++ b/core/pim/datebook/dateentryimpl.cpp @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -63,6 +64,20 @@ DateEntry::DateEntry( bool startOnMonday, const QDateTime &start, setFocusProxy(comboDescription); } +bool DateEntry::eventFilter(QObject *obj, QEvent *ev ) +{ + if( ev->type() == QEvent::FocusIn ){ + if( obj == comboStart ){ + TextLabel3_2->setText( tr("Start Time" ) ); + m_showStart= true; + }else if( obj == comboEnd ){ + TextLabel3_2->setText( tr("End Time") ); + m_showStart = false; + } + } + return false; +} + static void addOrPick( QComboBox* combo, const QString& t ) { // Pick an item if one excists @@ -186,6 +201,9 @@ void DateEntry::init() connect(timePickerStart, SIGNAL( timeChanged(const QTime &) ), this, SLOT( startTimePicked(const QTime &) )); editNote->setFixedVisibleLines(3); + // install eventFilters + comboEnd->installEventFilter( this ); + comboStart->installEventFilter( this ); } /* @@ -304,8 +322,14 @@ void DateEntry::startTimeChanged( const QTime &t ) endTime=t.addSecs(duration); } void DateEntry::startTimePicked( const QTime &t ) { + if(m_showStart ){ startTimeChanged(t); updateTimeEdit(true,true); + }else{ + endTime = t; + updateTimeEdit(false, true ); + + } } /* diff --git a/core/pim/datebook/dateentryimpl.h b/core/pim/datebook/dateentryimpl.h index bde3119..4eb24b4 100644 --- a/core/pim/datebook/dateentryimpl.h +++ b/core/pim/datebook/dateentryimpl.h @@ -42,7 +42,7 @@ public: Event event(); void setAlarmEnabled( bool alarmPreset, int presetTime, Event::SoundTypeChoice ); - + virtual bool eventFilter( QObject *, QEvent * ); public slots: void endDateChanged( int, int, int ); void endTimeChanged( const QString & ); @@ -67,8 +67,9 @@ private: QDate startDate, endDate; QTime startTime, endTime; Event::RepeatPattern rp; - bool ampm; - bool startWeekOnMonday; + bool ampm:1; + bool startWeekOnMonday:1; + bool m_showStart:1; }; #endif // DATEENTRY_H -- cgit v0.9.0.2