summaryrefslogtreecommitdiff
path: root/core/pim/datebook/dateentryimpl.cpp
Side-by-side diff
Diffstat (limited to 'core/pim/datebook/dateentryimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/dateentryimpl.cpp24
1 files changed, 24 insertions, 0 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
@@ -20,24 +20,25 @@
#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"
@@ -54,24 +55,38 @@
DateEntry::DateEntry( bool startOnMonday, const QDateTime &start,
const QDateTime &end, bool whichClock, QWidget* parent,
const char* name )
: DateEntryBase( parent, name ),
ampm( whichClock ),
startWeekOnMonday( startOnMonday )
{
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);
return;
}
}
// Else add one
combo->insertItem(t);
@@ -177,24 +192,27 @@ void DateEntry::init()
this, SLOT(slotChangeStartOfWeek(bool)) );
QPopupMenu *m2 = new QPopupMenu( this );
endPicker = new DateBookMonth( m2, 0, TRUE );
m2->insertItem( endPicker );
buttonEnd->setPopup( m2 );
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()
{
// no need to delete child widgets, Qt does it all for us
//cout << "Del: " << comboStart->currentText() << endl;
}
/*
@@ -295,26 +313,32 @@ void DateEntry::startTimeEdited( const QString &s )
updateTimeEdit(false,true);
timePickerStart->setHour(startTime.hour());
timePickerStart->setMinute(startTime.minute());
}
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 )
{
bool b = s != "All Day";
buttonStart->setEnabled( b );
comboStart->setEnabled( b );
comboEnd->setEnabled( b );
}