Diffstat (limited to 'core/pim/datebook/dateentryimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/datebook/dateentryimpl.cpp | 24 |
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 @@ | |||
20 | 20 | ||
21 | #include "dateentryimpl.h" | 21 | #include "dateentryimpl.h" |
22 | #include "repeatentry.h" | 22 | #include "repeatentry.h" |
23 | 23 | ||
24 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
25 | #include <qpe/categoryselect.h> | 25 | #include <qpe/categoryselect.h> |
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> |
38 | #include <qscrollview.h> | 39 | #include <qscrollview.h> |
39 | #include <qspinbox.h> | 40 | #include <qspinbox.h> |
40 | #include <qtoolbutton.h> | 41 | #include <qtoolbutton.h> |
41 | 42 | ||
42 | #include "timepicker.h" | 43 | #include "timepicker.h" |
43 | 44 | ||
@@ -54,24 +55,38 @@ | |||
54 | DateEntry::DateEntry( bool startOnMonday, const QDateTime &start, | 55 | DateEntry::DateEntry( bool startOnMonday, const QDateTime &start, |
55 | const QDateTime &end, bool whichClock, QWidget* parent, | 56 | const QDateTime &end, bool whichClock, QWidget* parent, |
56 | const char* name ) | 57 | const char* name ) |
57 | : DateEntryBase( parent, name ), | 58 | : DateEntryBase( parent, name ), |
58 | ampm( whichClock ), | 59 | ampm( whichClock ), |
59 | startWeekOnMonday( startOnMonday ) | 60 | startWeekOnMonday( startOnMonday ) |
60 | { | 61 | { |
61 | init(); | 62 | init(); |
62 | setDates(start,end); | 63 | setDates(start,end); |
63 | setFocusProxy(comboDescription); | 64 | setFocusProxy(comboDescription); |
64 | } | 65 | } |
65 | 66 | ||
67 | bool 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 | |||
66 | static void addOrPick( QComboBox* combo, const QString& t ) | 81 | static 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); |
72 | return; | 87 | return; |
73 | } | 88 | } |
74 | } | 89 | } |
75 | 90 | ||
76 | // Else add one | 91 | // Else add one |
77 | combo->insertItem(t); | 92 | combo->insertItem(t); |
@@ -177,24 +192,27 @@ void DateEntry::init() | |||
177 | this, SLOT(slotChangeStartOfWeek(bool)) ); | 192 | this, SLOT(slotChangeStartOfWeek(bool)) ); |
178 | 193 | ||
179 | QPopupMenu *m2 = new QPopupMenu( this ); | 194 | QPopupMenu *m2 = new QPopupMenu( this ); |
180 | endPicker = new DateBookMonth( m2, 0, TRUE ); | 195 | endPicker = new DateBookMonth( m2, 0, TRUE ); |
181 | m2->insertItem( endPicker ); | 196 | m2->insertItem( endPicker ); |
182 | buttonEnd->setPopup( m2 ); | 197 | buttonEnd->setPopup( m2 ); |
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 | */ |
194 | DateEntry::~DateEntry() | 212 | DateEntry::~DateEntry() |
195 | { | 213 | { |
196 | // no need to delete child widgets, Qt does it all for us | 214 | // no need to delete child widgets, Qt does it all for us |
197 | //cout << "Del: " << comboStart->currentText() << endl; | 215 | //cout << "Del: " << comboStart->currentText() << endl; |
198 | } | 216 | } |
199 | 217 | ||
200 | /* | 218 | /* |
@@ -295,26 +313,32 @@ void DateEntry::startTimeEdited( const QString &s ) | |||
295 | updateTimeEdit(false,true); | 313 | updateTimeEdit(false,true); |
296 | timePickerStart->setHour(startTime.hour()); | 314 | timePickerStart->setHour(startTime.hour()); |
297 | timePickerStart->setMinute(startTime.minute()); | 315 | timePickerStart->setMinute(startTime.minute()); |
298 | } | 316 | } |
299 | 317 | ||
300 | void DateEntry::startTimeChanged( const QTime &t ) | 318 | 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 | } |
306 | void DateEntry::startTimePicked( const QTime &t ) { | 324 | void 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 | */ |
314 | void DateEntry::typeChanged( const QString &s ) | 338 | void DateEntry::typeChanged( const QString &s ) |
315 | { | 339 | { |
316 | bool b = s != "All Day"; | 340 | bool b = s != "All Day"; |
317 | buttonStart->setEnabled( b ); | 341 | buttonStart->setEnabled( b ); |
318 | comboStart->setEnabled( b ); | 342 | comboStart->setEnabled( b ); |
319 | comboEnd->setEnabled( b ); | 343 | comboEnd->setEnabled( b ); |
320 | } | 344 | } |