summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/dateentryimpl.cpp24
-rw-r--r--core/pim/datebook/dateentryimpl.h7
2 files changed, 28 insertions, 3 deletions
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
@@ -26,12 +26,13 @@
#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>
@@ -60,12 +61,26 @@ DateEntry::DateEntry( bool startOnMonday, const QDateTime &start,
{
init();
setDates(start,end);
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
for (int i=0; i<combo->count(); i++) {
if ( combo->text(i) == t ) {
combo->setCurrentItem(i);
@@ -183,12 +198,15 @@ void DateEntry::init()
connect( endPicker, SIGNAL( dateClicked( int, int, int ) ),
this, SLOT( endDateChanged( int, int, int ) ) );
connect(timePickerStart, SIGNAL( timeChanged(const QTime &) ),
this, SLOT( startTimePicked(const QTime &) ));
editNote->setFixedVisibleLines(3);
+ // install eventFilters
+ comboEnd->installEventFilter( this );
+ comboStart->installEventFilter( this );
}
/*
* Destroys the object and frees any allocated resources
*/
DateEntry::~DateEntry()
@@ -301,14 +319,20 @@ void DateEntry::startTimeChanged( const QTime &t )
{
int duration=startTime.secsTo(endTime);
startTime = 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 );
+
+ }
}
/*
* public slot
*/
void DateEntry::typeChanged( const QString &s )
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
@@ -39,13 +39,13 @@ public:
DateEntry( bool startOnMonday, const Event &event, bool whichCLock = FALSE,
QWidget* parent = 0, const char* name = 0 );
~DateEntry();
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 & );
void endTimeChanged( const QTime & );
void startDateChanged(int, int, int);
void startTimeEdited( const QString & );
@@ -64,11 +64,12 @@ private:
void updateTimeEdit(bool,bool);
DateBookMonth *startPicker, *endPicker;
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