summaryrefslogtreecommitdiff
authorzecke <zecke>2002-04-15 22:40:49 (UTC)
committer zecke <zecke>2002-04-15 22:40:49 (UTC)
commit38052b763f7d248023024487a7e645b46637c76b (patch) (unidiff)
treedc6131bc2f56ea2aaab7c75364a979d117a52915
parenta91544d04ed391bbdc0c6f95ff8a80d35190788c (diff)
downloadopie-38052b763f7d248023024487a7e645b46637c76b.zip
opie-38052b763f7d248023024487a7e645b46637c76b.tar.gz
opie-38052b763f7d248023024487a7e645b46637c76b.tar.bz2
-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
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 @@
26#include <qpe/datebookmonth.h> 26#include <qpe/datebookmonth.h>
27#include <qpe/global.h> 27#include <qpe/global.h>
28#include <qpe/timeconversion.h> 28#include <qpe/timeconversion.h>
29#include <qpe/timestring.h> 29#include <qpe/timestring.h>
30#include <qpe/tzselect.h> 30#include <qpe/tzselect.h>
31 31
32#include <qevent.h>
32#include <qcheckbox.h> 33#include <qcheckbox.h>
33#include <qcombobox.h> 34#include <qcombobox.h>
34#include <qlayout.h> 35#include <qlayout.h>
35#include <qlineedit.h> 36#include <qlineedit.h>
36#include <qmultilineedit.h> 37#include <qmultilineedit.h>
37#include <qpopupmenu.h> 38#include <qpopupmenu.h>
@@ -60,12 +61,26 @@ DateEntry::DateEntry( bool startOnMonday, const QDateTime &start,
60{ 61{
61 init(); 62 init();
62 setDates(start,end); 63 setDates(start,end);
63 setFocusProxy(comboDescription); 64 setFocusProxy(comboDescription);
64} 65}
65 66
67bool DateEntry::eventFilter(QObject *obj, QEvent *ev )
68{
69 if( ev->type() == QEvent::FocusIn ){
70 if( obj == comboStart ){
71 TextLabel3_2->setText( tr("Start Time" ) );
72 m_showStart= true;
73 }else if( obj == comboEnd ){
74 TextLabel3_2->setText( tr("End Time") );
75 m_showStart = false;
76 }
77 }
78 return false;
79}
80
66static void addOrPick( QComboBox* combo, const QString& t ) 81static void addOrPick( QComboBox* combo, const QString& t )
67{ 82{
68 // Pick an item if one excists 83 // Pick an item if one excists
69 for (int i=0; i<combo->count(); i++) { 84 for (int i=0; i<combo->count(); i++) {
70 if ( combo->text(i) == t ) { 85 if ( combo->text(i) == t ) {
71 combo->setCurrentItem(i); 86 combo->setCurrentItem(i);
@@ -183,12 +198,15 @@ void DateEntry::init()
183 connect( endPicker, SIGNAL( dateClicked( int, int, int ) ), 198 connect( endPicker, SIGNAL( dateClicked( int, int, int ) ),
184 this, SLOT( endDateChanged( int, int, int ) ) ); 199 this, SLOT( endDateChanged( int, int, int ) ) );
185 200
186 connect(timePickerStart, SIGNAL( timeChanged(const QTime &) ), 201 connect(timePickerStart, SIGNAL( timeChanged(const QTime &) ),
187 this, SLOT( startTimePicked(const QTime &) )); 202 this, SLOT( startTimePicked(const QTime &) ));
188 editNote->setFixedVisibleLines(3); 203 editNote->setFixedVisibleLines(3);
204 // install eventFilters
205 comboEnd->installEventFilter( this );
206 comboStart->installEventFilter( this );
189} 207}
190 208
191/* 209/*
192 * Destroys the object and frees any allocated resources 210 * Destroys the object and frees any allocated resources
193 */ 211 */
194DateEntry::~DateEntry() 212DateEntry::~DateEntry()
@@ -301,14 +319,20 @@ void DateEntry::startTimeChanged( const QTime &t )
301{ 319{
302 int duration=startTime.secsTo(endTime); 320 int duration=startTime.secsTo(endTime);
303 startTime = t; 321 startTime = t;
304 endTime=t.addSecs(duration); 322 endTime=t.addSecs(duration);
305} 323}
306void DateEntry::startTimePicked( const QTime &t ) { 324void DateEntry::startTimePicked( const QTime &t ) {
325 if(m_showStart ){
307 startTimeChanged(t); 326 startTimeChanged(t);
308 updateTimeEdit(true,true); 327 updateTimeEdit(true,true);
328 }else{
329 endTime = t;
330 updateTimeEdit(false, true );
331
332 }
309} 333}
310 334
311/* 335/*
312 * public slot 336 * public slot
313 */ 337 */
314void DateEntry::typeChanged( const QString &s ) 338void 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:
39 DateEntry( bool startOnMonday, const Event &event, bool whichCLock = FALSE, 39 DateEntry( bool startOnMonday, const Event &event, bool whichCLock = FALSE,
40 QWidget* parent = 0, const char* name = 0 ); 40 QWidget* parent = 0, const char* name = 0 );
41 ~DateEntry(); 41 ~DateEntry();
42 42
43 Event event(); 43 Event event();
44 void setAlarmEnabled( bool alarmPreset, int presetTime, Event::SoundTypeChoice ); 44 void setAlarmEnabled( bool alarmPreset, int presetTime, Event::SoundTypeChoice );
45 45 virtual bool eventFilter( QObject *, QEvent * );
46public slots: 46public slots:
47 void endDateChanged( int, int, int ); 47 void endDateChanged( int, int, int );
48 void endTimeChanged( const QString & ); 48 void endTimeChanged( const QString & );
49 void endTimeChanged( const QTime & ); 49 void endTimeChanged( const QTime & );
50 void startDateChanged(int, int, int); 50 void startDateChanged(int, int, int);
51 void startTimeEdited( const QString & ); 51 void startTimeEdited( const QString & );
@@ -64,11 +64,12 @@ private:
64 void updateTimeEdit(bool,bool); 64 void updateTimeEdit(bool,bool);
65 65
66 DateBookMonth *startPicker, *endPicker; 66 DateBookMonth *startPicker, *endPicker;
67 QDate startDate, endDate; 67 QDate startDate, endDate;
68 QTime startTime, endTime; 68 QTime startTime, endTime;
69 Event::RepeatPattern rp; 69 Event::RepeatPattern rp;
70 bool ampm; 70 bool ampm:1;
71 bool startWeekOnMonday; 71 bool startWeekOnMonday:1;
72 bool m_showStart:1;
72}; 73};
73 74
74#endif // DATEENTRY_H 75#endif // DATEENTRY_H