summaryrefslogtreecommitdiff
authorhakan <hakan>2002-05-06 21:09:38 (UTC)
committer hakan <hakan>2002-05-06 21:09:38 (UTC)
commitf046179d3b49c44896298aa86380046a21394bbc (patch) (unidiff)
treeb0df64a4170cd9d2631244213b33c7ef0e55b4f8
parent8622bcb85245937853f3e657498957deb7eb2073 (diff)
downloadopie-f046179d3b49c44896298aa86380046a21394bbc.zip
opie-f046179d3b49c44896298aa86380046a21394bbc.tar.gz
opie-f046179d3b49c44896298aa86380046a21394bbc.tar.bz2
In the date entry dialog:
- Show end time (not only chnage label) when end textbox is selected. - Update timepicker when endtime is edited. - Update time textboxes when they looses focus. - Got rid of vertical empty borders. - "All day" dissables timepicker aswell. - Picking bad end time will set and show end time to starttime
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/dateentry.ui40
-rw-r--r--core/pim/datebook/dateentryimpl.cpp38
2 files changed, 61 insertions, 17 deletions
diff --git a/core/pim/datebook/dateentry.ui b/core/pim/datebook/dateentry.ui
index dc5195f..1a712ec 100644
--- a/core/pim/datebook/dateentry.ui
+++ b/core/pim/datebook/dateentry.ui
@@ -30,33 +30,33 @@
30 <property stdset="1"> 30 <property stdset="1">
31 <name>geometry</name> 31 <name>geometry</name>
32 <rect> 32 <rect>
33 <x>0</x> 33 <x>0</x>
34 <y>0</y> 34 <y>0</y>
35 <width>242</width> 35 <width>242</width>
36 <height>339</height> 36 <height>339</height>
37 </rect> 37 </rect>
38 </property> 38 </property>
39 <property stdset="1"> 39 <property stdset="1">
40 <name>caption</name> 40 <name>caption</name>
41 <string>New Event</string> 41 <string>New Event</string>
42 </property> 42 </property>
43 <grid> 43 <grid>
44 <property stdset="1"> 44 <property stdset="1">
45 <name>margin</name> 45 <name>margin</name>
46 <number>0</number> 46 <number>2</number>
47 </property> 47 </property>
48 <property stdset="1"> 48 <property stdset="1">
49 <name>spacing</name> 49 <name>spacing</name>
50 <number>0</number> 50 <number>0</number>
51 </property> 51 </property>
52 <widget row="1" column="0" > 52 <widget row="1" column="0" >
53 <class>QLabel</class> 53 <class>QLabel</class>
54 <property stdset="1"> 54 <property stdset="1">
55 <name>name</name> 55 <name>name</name>
56 <cstring>TextLabel2</cstring> 56 <cstring>TextLabel2</cstring>
57 </property> 57 </property>
58 <property stdset="1"> 58 <property stdset="1">
59 <name>frameShape</name> 59 <name>frameShape</name>
60 <enum>MShape</enum> 60 <enum>MShape</enum>
61 </property> 61 </property>
62 <property stdset="1"> 62 <property stdset="1">
@@ -134,33 +134,33 @@
134 <name>currentItem</name> 134 <name>currentItem</name>
135 <number>0</number> 135 <number>0</number>
136 </property> 136 </property>
137 <property stdset="1"> 137 <property stdset="1">
138 <name>duplicatesEnabled</name> 138 <name>duplicatesEnabled</name>
139 <bool>false</bool> 139 <bool>false</bool>
140 </property> 140 </property>
141 </widget> 141 </widget>
142 <widget row="0" column="0" > 142 <widget row="0" column="0" >
143 <class>QLabel</class> 143 <class>QLabel</class>
144 <property stdset="1"> 144 <property stdset="1">
145 <name>name</name> 145 <name>name</name>
146 <cstring>TextLabel1</cstring> 146 <cstring>TextLabel1</cstring>
147 </property> 147 </property>
148 <property stdset="1"> 148 <property stdset="1">
149 <name>text</name> 149 <name>text</name>
150 <string>Description</string> 150 <string>Description </string>
151 </property> 151 </property>
152 </widget> 152 </widget>
153 <widget row="1" column="1" rowspan="1" colspan="3" > 153 <widget row="1" column="1" rowspan="1" colspan="3" >
154 <class>QComboBox</class> 154 <class>QComboBox</class>
155 <item> 155 <item>
156 <property> 156 <property>
157 <name>text</name> 157 <name>text</name>
158 <string></string> 158 <string></string>
159 </property> 159 </property>
160 </item> 160 </item>
161 <item> 161 <item>
162 <property> 162 <property>
163 <name>text</name> 163 <name>text</name>
164 <string>Office</string> 164 <string>Office</string>
165 </property> 165 </property>
166 </item> 166 </item>
@@ -196,33 +196,33 @@
196 </widget> 196 </widget>
197 <widget row="2" column="1" rowspan="1" colspan="3" > 197 <widget row="2" column="1" rowspan="1" colspan="3" >
198 <class>CategorySelect</class> 198 <class>CategorySelect</class>
199 <property stdset="1"> 199 <property stdset="1">
200 <name>name</name> 200 <name>name</name>
201 <cstring>comboCategory</cstring> 201 <cstring>comboCategory</cstring>
202 </property> 202 </property>
203 </widget> 203 </widget>
204 <widget row="3" column="0" rowspan="2"> 204 <widget row="3" column="0" rowspan="2">
205 <class>QLabel</class> 205 <class>QLabel</class>
206 <property stdset="1"> 206 <property stdset="1">
207 <name>name</name> 207 <name>name</name>
208 <cstring>TextLabel3</cstring> 208 <cstring>TextLabel3</cstring>
209 </property> 209 </property>
210 <property stdset="1"> 210 <property stdset="1">
211 <name>text</name> 211 <name>text</name>
212 <string>Start - End</string> 212 <string>Start - End </string>
213 </property> 213 </property>
214 </widget> 214 </widget>
215 <widget row="3" column="1" > 215 <widget row="3" column="1" >
216 <class>QPushButton</class> 216 <class>QPushButton</class>
217 <property stdset="1"> 217 <property stdset="1">
218 <name>name</name> 218 <name>name</name>
219 <cstring>buttonStart</cstring> 219 <cstring>buttonStart</cstring>
220 </property> 220 </property>
221 <property stdset="1"> 221 <property stdset="1">
222 <name>text</name> 222 <name>text</name>
223 <string>Jan 02 00</string> 223 <string>Jan 02 00</string>
224 </property> 224 </property>
225 <property stdset="1"> 225 <property stdset="1">
226 <name>minimumSize</name> 226 <name>minimumSize</name>
227 <size> 227 <size>
228 <width>70</width> 228 <width>70</width>
@@ -252,97 +252,119 @@
252 </property> 252 </property>
253 <property stdset="1"> 253 <property stdset="1">
254 <name>maximumSize</name> 254 <name>maximumSize</name>
255 <size> 255 <size>
256 <width>70</width> 256 <width>70</width>
257 <height>32767</height> 257 <height>32767</height>
258 </size> 258 </size>
259 </property> 259 </property>
260 <property stdset="1"> 260 <property stdset="1">
261 <name>alignment</name> 261 <name>alignment</name>
262 <set>AlignHCenter</set> 262 <set>AlignHCenter</set>
263 </property> 263 </property>
264 <property> 264 <property>
265 <name>hAlign</name> 265 <name>hAlign</name>
266 </property> 266 </property>
267 </widget> 267 </widget>
268 <spacer row="3" column="2" rowspan="2" colspan="1" >
269 <property>
270 <name>name</name>
271 <cstring>Spacer1_2</cstring>
272 </property>
273 <property stdset="1">
274 <name>orientation</name>
275 <enum>Horizontal</enum>
276 </property>
277 <property stdset="1">
278 <name>sizeType</name>
279 <enum>Expanding</enum>
280 </property>
281 <property>
282 <name>sizeHint</name>
283 <size>
284 <width>20</width>
285 <height>20</height>
286 </size>
287 </property>
288 </spacer>
289
268 <widget row="5" column="1" colspan="3"> 290 <widget row="5" column="1" colspan="3">
269 <class>TimePicker</class> 291 <class>TimePicker</class>
270 <property stdset="1"> 292 <property stdset="1">
271 <name>name</name> 293 <name>name</name>
272 <cstring>timePickerStart</cstring> 294 <cstring>timePickerStart</cstring>
273 </property> 295 </property>
274 </widget> 296 </widget>
275 <widget row="3" column="2" colspan="2"> 297 <widget row="3" column="3" colspan="1">
276 <class>QPushButton</class> 298 <class>QPushButton</class>
277 <property stdset="1"> 299 <property stdset="1">
278 <name>name</name> 300 <name>name</name>
279 <cstring>buttonEnd</cstring> 301 <cstring>buttonEnd</cstring>
280 </property> 302 </property>
281 <property stdset="1"> 303 <property stdset="1">
282 <name>text</name> 304 <name>text</name>
283 <string>Jan 02 00</string> 305 <string>Jan 02 00</string>
284 </property> 306 </property>
285 <property stdset="1"> 307 <property stdset="1">
286 <name>minimumSize</name> 308 <name>minimumSize</name>
287 <size> 309 <size>
288 <width>70</width> 310 <width>70</width>
289 <height>0</height> 311 <height>0</height>
290 </size> 312 </size>
291 </property> 313 </property>
292 <property stdset="1"> 314 <property stdset="1">
293 <name>maximumSize</name> 315 <name>maximumSize</name>
294 <size> 316 <size>
295 <width>70</width> 317 <width>70</width>
296 <height>32767</height> 318 <height>32767</height>
297 </size> 319 </size>
298 </property> 320 </property>
299 </widget> 321 </widget>
300 <widget row="4" column="2" colspan="2"> 322 <widget row="4" column="3" colspan="1">
301 <class>QLineEdit</class> 323 <class>QLineEdit</class>
302 <property stdset="1"> 324 <property stdset="1">
303 <name>name</name> 325 <name>name</name>
304 <cstring>comboEnd</cstring> 326 <cstring>comboEnd</cstring>
305 </property> 327 </property>
306 <property stdset="1"> 328 <property stdset="1">
307 <name>minimumSize</name> 329 <name>minimumSize</name>
308 <size> 330 <size>
309 <width>70</width> 331 <width>70</width>
310 <height>0</height> 332 <height>0</height>
311 </size> 333 </size>
312 </property> 334 </property>
313 <property stdset="1"> 335 <property stdset="1">
314 <name>maximumSize</name> 336 <name>maximumSize</name>
315 <size> 337 <size>
316 <width>70</width> 338 <width>70</width>
317 <height>32767</height> 339 <height>32767</height>
318 </size> 340 </size>
319 </property> 341 </property>
320 <property stdset="1"> 342 <property stdset="1">
321 <name>alignment</name> 343 <name>alignment</name>
322 <set>AlignHCenter</set> 344 <set>AlignHCenter</set>
323 </property> 345 </property>
324 <property> 346 <property>
325 <name>hAlign</name> 347 <name>hAlign</name>
326 </property> 348 </property>
327 </widget> 349 </widget>
328 <widget row="5" column="0" > 350 <widget row="5" column="0" >
329 <class>QLabel</class> 351 <class>QLabel</class>
330 <property stdset="1"> 352 <property stdset="1">
331 <name>name</name> 353 <name>name</name>
332 <cstring>TextLabel3_2</cstring> 354 <cstring>TimePickerLabel</cstring>
333 </property> 355 </property>
334 <property stdset="1"> 356 <property stdset="1">
335 <name>text</name> 357 <name>text</name>
336 <string>Start time</string> 358 <string>Start time</string>
337 </property> 359 </property>
338 </widget> 360 </widget>
339 <widget row="6" column="0" > 361 <widget row="6" column="0" >
340 <class>QCheckBox</class> 362 <class>QCheckBox</class>
341 <property stdset="1"> 363 <property stdset="1">
342 <name>name</name> 364 <name>name</name>
343 <cstring>checkAllDay</cstring> 365 <cstring>checkAllDay</cstring>
344 </property> 366 </property>
345 <property stdset="1"> 367 <property stdset="1">
346 <name>text</name> 368 <name>text</name>
347 <string>All day</string> 369 <string>All day</string>
348 </property> 370 </property>
@@ -550,32 +572,38 @@
550 <receiver>DateEntryBase</receiver> 572 <receiver>DateEntryBase</receiver>
551 <slot>slotRepeat()</slot> 573 <slot>slotRepeat()</slot>
552 </connection> 574 </connection>
553 <connection> 575 <connection>
554 <sender>comboStart</sender> 576 <sender>comboStart</sender>
555 <signal>textChanged(const QString &amp;)</signal> 577 <signal>textChanged(const QString &amp;)</signal>
556 <receiver>DateEntryBase</receiver> 578 <receiver>DateEntryBase</receiver>
557 <slot>startTimeEdited( const QString &amp; )</slot> 579 <slot>startTimeEdited( const QString &amp; )</slot>
558 </connection> 580 </connection>
559 <connection> 581 <connection>
560 <sender>checkAllDay</sender> 582 <sender>checkAllDay</sender>
561 <signal>toggled(bool)</signal> 583 <signal>toggled(bool)</signal>
562 <receiver>comboEnd</receiver> 584 <receiver>comboEnd</receiver>
563 <slot>setDisabled(bool)</slot> 585 <slot>setDisabled(bool)</slot>
564 </connection> 586 </connection>
565 <connection> 587 <connection>
588 <sender>checkAllDay</sender>
589 <signal>toggled(bool)</signal>
590 <receiver>timePickerStart</receiver>
591 <slot>setDisabled(bool)</slot>
592 </connection>
593 <connection>
566 <sender>checkAlarm</sender> 594 <sender>checkAlarm</sender>
567 <signal>toggled(bool)</signal> 595 <signal>toggled(bool)</signal>
568 <receiver>comboSound</receiver> 596 <receiver>comboSound</receiver>
569 <slot>setEnabled(bool)</slot> 597 <slot>setEnabled(bool)</slot>
570 </connection> 598 </connection>
571 <connection> 599 <connection>
572 <sender>checkAllDay</sender> 600 <sender>checkAllDay</sender>
573 <signal>toggled(bool)</signal> 601 <signal>toggled(bool)</signal>
574 <receiver>comboStart</receiver> 602 <receiver>comboStart</receiver>
575 <slot>setDisabled(bool)</slot> 603 <slot>setDisabled(bool)</slot>
576 </connection> 604 </connection>
577 <slot access="public">endDateChanged( const QString &amp; )</slot> 605 <slot access="public">endDateChanged( const QString &amp; )</slot>
578 <slot access="public">endDateChanged( int, int, int )</slot> 606 <slot access="public">endDateChanged( int, int, int )</slot>
579 <slot access="public">endTimeChanged( const QString &amp; )</slot> 607 <slot access="public">endTimeChanged( const QString &amp; )</slot>
580 <slot access="public">slotRepeat()</slot> 608 <slot access="public">slotRepeat()</slot>
581 <slot access="public">slotWait( int )</slot> 609 <slot access="public">slotWait( int )</slot>
diff --git a/core/pim/datebook/dateentryimpl.cpp b/core/pim/datebook/dateentryimpl.cpp
index f2f17c6..e14e2f5 100644
--- a/core/pim/datebook/dateentryimpl.cpp
+++ b/core/pim/datebook/dateentryimpl.cpp
@@ -55,39 +55,55 @@
55DateEntry::DateEntry( bool startOnMonday, const QDateTime &start, 55DateEntry::DateEntry( bool startOnMonday, const QDateTime &start,
56 const QDateTime &end, bool whichClock, QWidget* parent, 56 const QDateTime &end, bool whichClock, QWidget* parent,
57 const char* name ) 57 const char* name )
58 : DateEntryBase( parent, name ), 58 : DateEntryBase( parent, name ),
59 ampm( whichClock ), 59 ampm( whichClock ),
60 startWeekOnMonday( startOnMonday ) 60 startWeekOnMonday( startOnMonday )
61{ 61{
62 init(); 62 init();
63 setDates(start,end); 63 setDates(start,end);
64 setFocusProxy(comboDescription); 64 setFocusProxy(comboDescription);
65} 65}
66 66
67bool DateEntry::eventFilter(QObject *obj, QEvent *ev ) 67bool DateEntry::eventFilter(QObject *obj, QEvent *ev )
68{ 68{
69 if( ev->type() == QEvent::FocusIn ){ 69 if( ev->type() == QEvent::FocusIn ){
70 if( obj == comboStart ){ 70 if( obj == comboStart ){
71 TextLabel3_2->setText( tr("Start Time" ) ); 71 timePickerStart->setHour(startTime.hour());
72 timePickerStart->setMinute(startTime.minute());
73 TimePickerLabel->setText( tr("Start Time" ) );
72 m_showStart= true; 74 m_showStart= true;
73 }else if( obj == comboEnd ){ 75 }else if( obj == comboEnd ){
74 TextLabel3_2->setText( tr("End Time") ); 76 timePickerStart->setHour(endTime.hour());
77 timePickerStart->setMinute(endTime.minute());
78 TimePickerLabel->setText( tr("End Time") );
75 m_showStart = false; 79 m_showStart = false;
76 } 80 }
81 } else if( ev->type() == QEvent::FocusOut ){
82 if( obj == comboEnd ){
83 QString s;
84 s.sprintf("%.2d:%.2d",endTime.hour(), endTime.minute());
85 comboEnd->setText(s);
86 }
87 else if( obj == comboStart ){
88 QString s;
89 s.sprintf("%.2d:%.2d",startTime.hour(), startTime.minute());
90 comboStart->setText(s);
91 }
77 } 92 }
93
78 return false; 94 return false;
79} 95}
80 96
81static void addOrPick( QComboBox* combo, const QString& t ) 97static void addOrPick( QComboBox* combo, const QString& t )
82{ 98{
83 // Pick an item if one excists 99 // Pick an item if one excists
84 for (int i=0; i<combo->count(); i++) { 100 for (int i=0; i<combo->count(); i++) {
85 if ( combo->text(i) == t ) { 101 if ( combo->text(i) == t ) {
86 combo->setCurrentItem(i); 102 combo->setCurrentItem(i);
87 return; 103 return;
88 } 104 }
89 } 105 }
90 106
91 // Else add one 107 // Else add one
92 combo->insertItem(t); 108 combo->insertItem(t);
93 combo->setCurrentItem(combo->count()-1); 109 combo->setCurrentItem(combo->count()-1);
@@ -255,43 +271,44 @@ static QTime parseTime( const QString& s, bool ampm )
255 else if ( minute < 0 ) 271 else if ( minute < 0 )
256 minute = 0; 272 minute = 0;
257 if ( hour > 23 ) { 273 if ( hour > 23 ) {
258 hour = 23; 274 hour = 23;
259 minute = 59; 275 minute = 59;
260 } else if ( hour < 0 ) 276 } else if ( hour < 0 )
261 hour = 0; 277 hour = 0;
262 tmpTime.setHMS( hour, minute, 0 ); 278 tmpTime.setHMS( hour, minute, 0 );
263 return tmpTime; 279 return tmpTime;
264} 280}
265 281
266/* 282/*
267 * public slot 283 * public slot
268 */ 284 */
269void DateEntry::endTimeChanged( const QString &s ) 285void DateEntry::endTimeChanged( const QString &s )
270{ 286{
271 QTime tmpTime = parseTime(s,ampm); 287 endTimeChanged( parseTime(s,ampm) );
272 if ( endDate > startDate || tmpTime >= startTime ) { 288}
273 endTime = tmpTime; 289
290void DateEntry::endTimeChanged( const QTime &t ) {
291 if ( endDate > startDate || t >= startTime ) {
292 endTime = t;
274 } else { 293 } else {
275 endTime = startTime; 294 endTime = startTime;
276 //comboEnd->setCurrentItem( comboStart->currentItem() ); 295 //comboEnd->setCurrentItem( comboStart->currentItem() );
277 } 296 }
278 297 timePickerStart->setHour(endTime.hour());
279} 298 timePickerStart->setMinute(endTime.minute());
280
281void DateEntry::endTimeChanged( const QTime &t ) {
282} 299}
283 300
284/* 301/*
285 * public slot 302 * public slot
286 */ 303 */
287void DateEntry::startDateChanged( int y, int m, int d ) 304void DateEntry::startDateChanged( int y, int m, int d )
288{ 305{
289 QDate prev = startDate; 306 QDate prev = startDate;
290 startDate.setYMD( y, m, d ); 307 startDate.setYMD( y, m, d );
291 if ( rp.type == Event::Weekly && 308 if ( rp.type == Event::Weekly &&
292 startDate.dayOfWeek() != prev.dayOfWeek() ) { 309 startDate.dayOfWeek() != prev.dayOfWeek() ) {
293 // if we change the start of a weekly repeating event 310 // if we change the start of a weekly repeating event
294 // set the repeating day appropriately 311 // set the repeating day appropriately
295 char mask = 1 << (prev.dayOfWeek()-1); 312 char mask = 1 << (prev.dayOfWeek()-1);
296 rp.days &= (~mask); 313 rp.days &= (~mask);
297 rp.days |= 1 << (startDate.dayOfWeek()-1); 314 rp.days |= 1 << (startDate.dayOfWeek()-1);
@@ -313,35 +330,34 @@ void DateEntry::startTimeEdited( const QString &s )
313 updateTimeEdit(false,true); 330 updateTimeEdit(false,true);
314 timePickerStart->setHour(startTime.hour()); 331 timePickerStart->setHour(startTime.hour());
315 timePickerStart->setMinute(startTime.minute()); 332 timePickerStart->setMinute(startTime.minute());
316} 333}
317 334
318void DateEntry::startTimeChanged( const QTime &t ) 335void DateEntry::startTimeChanged( const QTime &t )
319{ 336{
320 int duration=startTime.secsTo(endTime); 337 int duration=startTime.secsTo(endTime);
321 startTime = t; 338 startTime = t;
322 endTime=t.addSecs(duration); 339 endTime=t.addSecs(duration);
323} 340}
324void DateEntry::startTimePicked( const QTime &t ) { 341void DateEntry::startTimePicked( const QTime &t ) {
325 if(m_showStart ){ 342 if(m_showStart ){
326 startTimeChanged(t); 343 startTimeChanged(t);
327 updateTimeEdit(true,true); 344 updateTimeEdit(true,true);
328 }else{ 345 }else{
329 endTime = t; 346 endTimeChanged(t);
330 updateTimeEdit(false, true ); 347 updateTimeEdit(false, true );
331
332 } 348 }
333} 349}
334 350
335/* 351/*
336 * public slot 352 * public slot
337 */ 353 */
338void DateEntry::typeChanged( const QString &s ) 354void DateEntry::typeChanged( const QString &s )
339{ 355{
340 bool b = s != "All Day"; 356 bool b = s != "All Day";
341 buttonStart->setEnabled( b ); 357 buttonStart->setEnabled( b );
342 comboStart->setEnabled( b ); 358 comboStart->setEnabled( b );
343 comboEnd->setEnabled( b ); 359 comboEnd->setEnabled( b );
344} 360}
345 361
346void DateEntry::slotRepeat() 362void DateEntry::slotRepeat()
347{ 363{