author | zautrix <zautrix> | 2005-02-09 13:22:06 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-09 13:22:06 (UTC) |
commit | c3dd5bfd446b893a8b39ddec425a6cf8deff2261 (patch) (unidiff) | |
tree | d0dd74c17fd6101da1d6c403c85924c58bc1ac9b /libkdepim | |
parent | 940cdd0fd1349e7f8e53adff0595c1d946322ef1 (diff) | |
download | kdepimpi-c3dd5bfd446b893a8b39ddec425a6cf8deff2261.zip kdepimpi-c3dd5bfd446b893a8b39ddec425a6cf8deff2261.tar.gz kdepimpi-c3dd5bfd446b893a8b39ddec425a6cf8deff2261.tar.bz2 |
fixes
-rw-r--r-- | libkdepim/kdateedit.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libkdepim/kdateedit.cpp b/libkdepim/kdateedit.cpp index c4c0081..2c78ea3 100644 --- a/libkdepim/kdateedit.cpp +++ b/libkdepim/kdateedit.cpp | |||
@@ -173,325 +173,326 @@ void KDateEdit::setDate( QDate date,int *cpos,const int key ,const bool dateForm | |||
173 | case 'm':// 01 (month) | 173 | case 'm':// 01 (month) |
174 | strLength = 2; //Ok | 174 | strLength = 2; //Ok |
175 | break; | 175 | break; |
176 | case 'a':// Mon (Weekday) | 176 | case 'a':// Mon (Weekday) |
177 | strLength = KGlobal::locale()->weekDayName(date.dayOfWeek(), true).length(); | 177 | strLength = KGlobal::locale()->weekDayName(date.dayOfWeek(), true).length(); |
178 | break; | 178 | break; |
179 | case 'A':// Monday (Weekday) | 179 | case 'A':// Monday (Weekday) |
180 | strLength = KGlobal::locale()->weekDayName(date.dayOfWeek(), false).length(); | 180 | strLength = KGlobal::locale()->weekDayName(date.dayOfWeek(), false).length(); |
181 | break; | 181 | break; |
182 | case 'b':// Jan (monthName) | 182 | case 'b':// Jan (monthName) |
183 | strLength = KGlobal::locale()->monthName(date.month(), true).length(); | 183 | strLength = KGlobal::locale()->monthName(date.month(), true).length(); |
184 | break; | 184 | break; |
185 | case 'B':// January (monthName) | 185 | case 'B':// January (monthName) |
186 | strLength = KGlobal::locale()->monthName(date.month(), false).length(); | 186 | strLength = KGlobal::locale()->monthName(date.month(), false).length(); |
187 | break; | 187 | break; |
188 | case 'y':// 04 (year short) | 188 | case 'y':// 04 (year short) |
189 | strLength = 2; //Ok | 189 | strLength = 2; //Ok |
190 | break; | 190 | break; |
191 | case 'Y':// 2004 (year) | 191 | case 'Y':// 2004 (year) |
192 | strLength = 4; //Ok | 192 | strLength = 4; //Ok |
193 | break; | 193 | break; |
194 | default: | 194 | default: |
195 | break; | 195 | break; |
196 | } | 196 | } |
197 | space = begin - (repeat++ * 2); | 197 | space = begin - (repeat++ * 2); |
198 | // all select? then dayswitch | 198 | // all select? then dayswitch |
199 | if( (mDateEdit->text().length() == mDateEdit->markedText().length() ) && | 199 | if( (mDateEdit->text().length() == mDateEdit->markedText().length() ) && |
200 | ( (dateForm.at(begin + 1).latin1() == 'd') || | 200 | ( (dateForm.at(begin + 1).latin1() == 'd') || |
201 | (dateForm.at(begin + 1).latin1() == 'a') || | 201 | (dateForm.at(begin + 1).latin1() == 'a') || |
202 | (dateForm.at(begin + 1).latin1() == 'A') ) ) { | 202 | (dateForm.at(begin + 1).latin1() == 'A') ) ) { |
203 | break; | 203 | break; |
204 | } | 204 | } |
205 | // mDateEdit-StringPos == CursorPosition(cpos) then break and set date | 205 | // mDateEdit-StringPos == CursorPosition(cpos) then break and set date |
206 | if( ( (space + allStrLength) <= *cpos && *cpos <= (space + allStrLength + strLength) ) || *cpos < begin ) { | 206 | if( ( (space + allStrLength) <= *cpos && *cpos <= (space + allStrLength + strLength) ) || *cpos < begin ) { |
207 | break; | 207 | break; |
208 | } | 208 | } |
209 | allStrLength += strLength; | 209 | allStrLength += strLength; |
210 | begin = dateForm.find("%", begin +1); | 210 | begin = dateForm.find("%", begin +1); |
211 | } | 211 | } |
212 | 212 | ||
213 | // set date | 213 | // set date |
214 | switch ( dateForm.at(begin + 1).latin1() ) { | 214 | switch ( dateForm.at(begin + 1).latin1() ) { |
215 | case 'd': | 215 | case 'd': |
216 | case 'a': | 216 | case 'a': |
217 | case 'A': | 217 | case 'A': |
218 | if(key == Key_Up) { | 218 | if(key == Key_Up) { |
219 | setDate( date.addDays( 1 ) ); | 219 | setDate( date.addDays( 1 ) ); |
220 | } | 220 | } |
221 | else if(key == Key_Down) { | 221 | else if(key == Key_Down) { |
222 | setDate( date.addDays( -1 ) ); | 222 | setDate( date.addDays( -1 ) ); |
223 | } | 223 | } |
224 | maxDay = readDate().day(); | 224 | maxDay = readDate().day(); |
225 | break; | 225 | break; |
226 | case 'm': | 226 | case 'm': |
227 | case 'b': | 227 | case 'b': |
228 | case 'B': | 228 | case 'B': |
229 | if(key == Key_Up) { | 229 | if(key == Key_Up) { |
230 | int year = ((date.month()+1)>12)?date.year()+1:date.year(); | 230 | int year = ((date.month()+1)>12)?date.year()+1:date.year(); |
231 | int month = ((date.month()+1)>12)?1:date.month()+1; | 231 | int month = ((date.month()+1)>12)?1:date.month()+1; |
232 | int day = (QDate(year,month,1).daysInMonth()<maxDay)?QDate(year,month,1).daysInMonth():maxDay; | 232 | int day = (QDate(year,month,1).daysInMonth()<maxDay)?QDate(year,month,1).daysInMonth():maxDay; |
233 | setDate( QDate( year, month, day ) ); | 233 | setDate( QDate( year, month, day ) ); |
234 | } else if(key == Key_Down) { | 234 | } else if(key == Key_Down) { |
235 | int year = ((date.month()-1)<1)?date.year()-1:date.year(); | 235 | int year = ((date.month()-1)<1)?date.year()-1:date.year(); |
236 | int month = ((date.month()-1)<1)?12:date.month()-1; | 236 | int month = ((date.month()-1)<1)?12:date.month()-1; |
237 | int day = (QDate(year,month,1).daysInMonth()<maxDay)?QDate(year,month,1).daysInMonth():maxDay; | 237 | int day = (QDate(year,month,1).daysInMonth()<maxDay)?QDate(year,month,1).daysInMonth():maxDay; |
238 | setDate( QDate( year, month, day ) ); | 238 | setDate( QDate( year, month, day ) ); |
239 | } | 239 | } |
240 | break; | 240 | break; |
241 | case 'y': | 241 | case 'y': |
242 | case 'Y': | 242 | case 'Y': |
243 | if(key == Key_Up) { | 243 | if(key == Key_Up) { |
244 | setDate( QDate( date.year() + 1, date.month() , date.day()) ); | 244 | setDate( QDate( date.year() + 1, date.month() , date.day()) ); |
245 | } | 245 | } |
246 | else if(key == Key_Down) { | 246 | else if(key == Key_Down) { |
247 | setDate( QDate( date.year() - 1, date.month() , date.day()) ); | 247 | setDate( QDate( date.year() - 1, date.month() , date.day()) ); |
248 | } | 248 | } |
249 | break; | 249 | break; |
250 | /* default: | 250 | /* default: |
251 | if(key == Key_Up) { | 251 | if(key == Key_Up) { |
252 | setDate( date.addDays( 1 ) ); | 252 | setDate( date.addDays( 1 ) ); |
253 | } else if(key == Key_Down) { | 253 | } else if(key == Key_Down) { |
254 | setDate( date.addDays( -1 ) ); | 254 | setDate( date.addDays( -1 ) ); |
255 | } | 255 | } |
256 | break;*/ | 256 | break;*/ |
257 | } | 257 | } |
258 | 258 | ||
259 | date = readDate(); | 259 | date = readDate(); |
260 | begin = dateForm.find("%"); | 260 | begin = dateForm.find("%"); |
261 | int allSelectStrLength = 0; | 261 | int allSelectStrLength = 0; |
262 | int selectStrLength = 0; | 262 | int selectStrLength = 0; |
263 | 263 | ||
264 | // set selection do new date an set cursor at end of selection | 264 | // set selection do new date an set cursor at end of selection |
265 | for(int i = 0; i < repeat; i++){ | 265 | for(int i = 0; i < repeat; i++){ |
266 | switch ( dateForm.at(begin + 1).latin1() ) | 266 | switch ( dateForm.at(begin + 1).latin1() ) |
267 | { | 267 | { |
268 | case 'd':// 16 (month day) | 268 | case 'd':// 16 (month day) |
269 | selectStrLength = 2; //Ok | 269 | selectStrLength = 2; //Ok |
270 | break; | 270 | break; |
271 | case 'm':// 01 (month) | 271 | case 'm':// 01 (month) |
272 | selectStrLength = 2; //Ok | 272 | selectStrLength = 2; //Ok |
273 | break; | 273 | break; |
274 | case 'a':// Mon (Weekday short) | 274 | case 'a':// Mon (Weekday short) |
275 | selectStrLength = KGlobal::locale()->weekDayName(date.dayOfWeek(), true).length(); | 275 | selectStrLength = KGlobal::locale()->weekDayName(date.dayOfWeek(), true).length(); |
276 | break; | 276 | break; |
277 | case 'A':// Monday (Weekday) | 277 | case 'A':// Monday (Weekday) |
278 | selectStrLength = KGlobal::locale()->weekDayName(date.dayOfWeek(), false).length(); | 278 | selectStrLength = KGlobal::locale()->weekDayName(date.dayOfWeek(), false).length(); |
279 | break; | 279 | break; |
280 | case 'b':// Jan (monthName short) | 280 | case 'b':// Jan (monthName short) |
281 | selectStrLength = KGlobal::locale()->monthName(date.month(), true).length(); | 281 | selectStrLength = KGlobal::locale()->monthName(date.month(), true).length(); |
282 | break; | 282 | break; |
283 | case 'B':// January (monthName) | 283 | case 'B':// January (monthName) |
284 | selectStrLength = KGlobal::locale()->monthName(date.month(), false).length(); | 284 | selectStrLength = KGlobal::locale()->monthName(date.month(), false).length(); |
285 | break; | 285 | break; |
286 | case 'y':// 04 (year short) | 286 | case 'y':// 04 (year short) |
287 | selectStrLength = 2; //Ok | 287 | selectStrLength = 2; //Ok |
288 | break; | 288 | break; |
289 | case 'Y':// 2004 (year) | 289 | case 'Y':// 2004 (year) |
290 | selectStrLength = 4; //Ok | 290 | selectStrLength = 4; //Ok |
291 | break; | 291 | break; |
292 | default: | 292 | default: |
293 | break; | 293 | break; |
294 | } | 294 | } |
295 | space = begin - (i * 2); | 295 | space = begin - (i * 2); |
296 | allSelectStrLength += selectStrLength; | 296 | allSelectStrLength += selectStrLength; |
297 | begin = dateForm.find("%", begin +1); | 297 | begin = dateForm.find("%", begin +1); |
298 | } | 298 | } |
299 | // set selection from begin of date | 299 | // set selection from begin of date |
300 | setSelect( space + allSelectStrLength - selectStrLength , selectStrLength); | 300 | setSelect( space + allSelectStrLength - selectStrLength , selectStrLength); |
301 | *cpos = space + allSelectStrLength; | 301 | *cpos = space + allSelectStrLength; |
302 | emit(dateChanged(date)); | 302 | emit(dateChanged(date)); |
303 | 303 | ||
304 | return; | 304 | return; |
305 | } | 305 | } |
306 | 306 | ||
307 | void KDateEdit::setHandleInvalid(bool handleInvalid) | 307 | void KDateEdit::setHandleInvalid(bool handleInvalid) |
308 | { | 308 | { |
309 | mHandleInvalid = handleInvalid; | 309 | mHandleInvalid = handleInvalid; |
310 | } | 310 | } |
311 | 311 | ||
312 | void KDateEdit::setEnabled(bool on) | 312 | void KDateEdit::setEnabled(bool on) |
313 | { | 313 | { |
314 | mDateEdit->setEnabled(on); | 314 | mDateEdit->setEnabled(on); |
315 | mDateButton->setEnabled(on); | 315 | mDateButton->setEnabled(on); |
316 | } | 316 | } |
317 | 317 | ||
318 | QDate KDateEdit::date() const | 318 | QDate KDateEdit::date() const |
319 | { | 319 | { |
320 | QDate date = readDate(); | 320 | QDate date = readDate(); |
321 | 321 | ||
322 | if (date.isValid() || mHandleInvalid) { | 322 | if (date.isValid() || mHandleInvalid) { |
323 | return date; | 323 | return date; |
324 | } else { | 324 | } else { |
325 | KNotifyClient::beep(); | 325 | KNotifyClient::beep(); |
326 | return QDate::currentDate(); | 326 | return QDate::currentDate(); |
327 | } | 327 | } |
328 | } | 328 | } |
329 | 329 | ||
330 | void KDateEdit::keyPressEvent(QKeyEvent *e) | 330 | void KDateEdit::keyPressEvent(QKeyEvent *e) |
331 | { | 331 | { |
332 | QDate date = readDate(); | 332 | QDate date = readDate(); |
333 | int cpos = mDateEdit->cursorPosition(); | 333 | int cpos = mDateEdit->cursorPosition(); |
334 | 334 | ||
335 | switch(e->key()) | 335 | switch(e->key()) |
336 | { | 336 | { |
337 | case Key_Escape: | 337 | case Key_Escape: |
338 | mDateEdit->deselect(); | 338 | mDateEdit->deselect(); |
339 | case Key_Tab: | 339 | case Key_Tab: |
340 | QHBox::keyPressEvent(e); | 340 | QHBox::keyPressEvent(e); |
341 | break; | 341 | break; |
342 | case Key_Up: | 342 | case Key_Up: |
343 | // when date invalid then set to currend and return | 343 | // when date invalid then set to currend and return |
344 | if(!date.isValid()) { | 344 | if(!date.isValid()) { |
345 | date = QDate::currentDate(); | 345 | date = QDate::currentDate(); |
346 | setDate(date); | 346 | setDate(date); |
347 | mDateEdit->setCursorPosition(cpos); | 347 | mDateEdit->setCursorPosition(cpos); |
348 | emit(dateChanged(date)); | 348 | emit(dateChanged(date)); |
349 | QString text = i18n( "You entered an invalid date!\n Date changed to current date." ); | 349 | QString text = i18n( "You entered an invalid date!\n Date changed to current date." ); |
350 | KMessageBox::information( 0, text ); | 350 | KMessageBox::information( 0, text ); |
351 | return; | 351 | return; |
352 | } | 352 | } |
353 | setDate(date, &cpos, Key_Up, dateFormShort); | 353 | setDate(date, &cpos, Key_Up, dateFormShort); |
354 | break; | 354 | break; |
355 | case Key_Down: | 355 | case Key_Down: |
356 | // when date invalid then set to current and return | 356 | // when date invalid then set to current and return |
357 | if(!date.isValid()) { | 357 | if(!date.isValid()) { |
358 | date = QDate::currentDate(); | 358 | date = QDate::currentDate(); |
359 | setDate(date); | 359 | setDate(date); |
360 | mDateEdit->setCursorPosition(cpos); | 360 | mDateEdit->setCursorPosition(cpos); |
361 | emit(dateChanged(date)); | 361 | emit(dateChanged(date)); |
362 | QString text = i18n( "You entered an invalid date!\n Date changed to current date." ); | 362 | QString text = i18n( "You entered an invalid date!\n Date changed to current date." ); |
363 | KMessageBox::information( 0, text ); | 363 | KMessageBox::information( 0, text ); |
364 | return; | 364 | return; |
365 | } | 365 | } |
366 | setDate(date, &cpos, Key_Down, dateFormShort); | 366 | setDate(date, &cpos, Key_Down, dateFormShort); |
367 | break; | 367 | break; |
368 | default: | 368 | default: |
369 | QHBox::keyPressEvent(e); | 369 | QHBox::keyPressEvent(e); |
370 | break; | 370 | break; |
371 | } // switch | 371 | } // switch |
372 | mDateEdit->setCursorPosition(cpos); | 372 | mDateEdit->setCursorPosition(cpos); |
373 | } | 373 | } |
374 | 374 | ||
375 | void KDateEdit::setSelect( int from, int to ) | 375 | void KDateEdit::setSelect( int from, int to ) |
376 | { | 376 | { |
377 | // return; | 377 | // return; |
378 | mDateEdit->setSelection( from , to ); | 378 | mDateEdit->setSelection( from , to ); |
379 | } | 379 | } |
380 | 380 | ||
381 | void KDateEdit::toggleDatePicker() | 381 | void KDateEdit::toggleDatePicker() |
382 | { | 382 | { |
383 | if( mDateFrame->isVisible() ) { | 383 | if( mDateFrame->isVisible() ) { |
384 | mDateFrame->hide(); | 384 | mDateFrame->hide(); |
385 | } else { | 385 | } else { |
386 | QPoint tmpPoint = mapToGlobal(mDateButton->geometry().bottomRight()); | 386 | QPoint tmpPoint = mapToGlobal(mDateButton->geometry().bottomRight()); |
387 | QSize datepickersize = mDatePicker->sizeHint(); | 387 | QSize datepickersize = mDatePicker->sizeHint(); |
388 | 388 | ||
389 | if ( tmpPoint.x() < 7+datepickersize.width() ) tmpPoint.setX( 7+datepickersize.width() ); | 389 | if ( tmpPoint.x() < 7+datepickersize.width() ) tmpPoint.setX( 7+datepickersize.width() ); |
390 | 390 | ||
391 | int h = QApplication::desktop()->height(); | 391 | int h = QApplication::desktop()->height(); |
392 | 392 | ||
393 | if ( tmpPoint.y() + datepickersize.height() > h ) tmpPoint.setY( h - datepickersize.height() ); | 393 | if ( tmpPoint.y() + datepickersize.height() > h ) tmpPoint.setY( h - datepickersize.height() ); |
394 | 394 | ||
395 | mDateFrame->setGeometry(tmpPoint.x()-datepickersize.width()-7, tmpPoint.y(), | 395 | mDateFrame->setGeometry(tmpPoint.x()-datepickersize.width()-7, tmpPoint.y(), |
396 | datepickersize.width()+2*mDateFrame->lineWidth(), datepickersize.height()+2*mDateFrame->lineWidth()); | 396 | datepickersize.width()+2*mDateFrame->lineWidth(), datepickersize.height()+2*mDateFrame->lineWidth()); |
397 | 397 | ||
398 | QDate date = readDate(); | 398 | QDate date = readDate(); |
399 | if(date.isValid()) { | 399 | if(date.isValid()) { |
400 | mDatePicker->setDate(date); | 400 | mDatePicker->setDate(date); |
401 | } else { | 401 | } else { |
402 | mDatePicker->setDate(QDate::currentDate()); | 402 | mDatePicker->setDate(QDate::currentDate()); |
403 | } | 403 | } |
404 | mDateFrame->show(); | 404 | mDateFrame->show(); |
405 | } | 405 | } |
406 | } | 406 | } |
407 | 407 | ||
408 | 408 | ||
409 | void KDateEdit::lineEnterPressed() | 409 | void KDateEdit::lineEnterPressed() |
410 | { | 410 | { |
411 | QDate date = readDate(); | 411 | QDate date = readDate(); |
412 | 412 | ||
413 | if(date.isValid()) | 413 | if(date.isValid()) |
414 | { | 414 | { |
415 | // Update the edit. This is needed if the user has entered a | 415 | // Update the edit. This is needed if the user has entered a |
416 | // word rather than the actual date. | 416 | // word rather than the actual date. |
417 | setDate(date); | 417 | setDate(date); |
418 | emit(dateChanged(date)); | 418 | emit(dateChanged(date)); |
419 | emit returnPressed(); | 419 | emit returnPressed(); |
420 | } | 420 | } |
421 | else | 421 | else |
422 | { | 422 | { |
423 | if ( withoutDp ) { | 423 | if ( withoutDp ) { |
424 | KNotifyClient::beep(); | 424 | KNotifyClient::beep(); |
425 | } else { | 425 | } else { |
426 | if ( !mDateEdit->text().isEmpty() ) { | 426 | if ( !mDateEdit->text().isEmpty() ) { |
427 | mTextChanged = false; | 427 | mTextChanged = false; |
428 | QString text = i18n( "You entered an invalid date!\n Will use current date instead." ); | 428 | QString text = i18n( "You entered an invalid date!\n Will use current date instead." ); |
429 | if ( KMessageBox::warningContinueCancel( 0, text ) == KMessageBox::Continue ) { | 429 | if ( isVisible() ) |
430 | setDate( QDate::currentDate() ); | 430 | if ( KMessageBox::warningContinueCancel( 0, text ) == KMessageBox::Continue ) { |
431 | emit dateChanged( QDate::currentDate() ); | 431 | setDate( QDate::currentDate() ); |
432 | } | 432 | emit dateChanged( QDate::currentDate() ); |
433 | } | ||
433 | } | 434 | } |
434 | } | 435 | } |
435 | } | 436 | } |
436 | } | 437 | } |
437 | 438 | ||
438 | bool KDateEdit::inputIsValid() | 439 | bool KDateEdit::inputIsValid() |
439 | { | 440 | { |
440 | return readDate().isValid(); | 441 | return readDate().isValid(); |
441 | } | 442 | } |
442 | 443 | ||
443 | QDate KDateEdit::readDate() const | 444 | QDate KDateEdit::readDate() const |
444 | { | 445 | { |
445 | QString text = mDateEdit->text(); | 446 | QString text = mDateEdit->text(); |
446 | QDate date; | 447 | QDate date; |
447 | 448 | ||
448 | if (mKeywordMap.contains(text.lower())) | 449 | if (mKeywordMap.contains(text.lower())) |
449 | { | 450 | { |
450 | date = QDate::currentDate().addDays(mKeywordMap[text.lower()]); | 451 | date = QDate::currentDate().addDays(mKeywordMap[text.lower()]); |
451 | } | 452 | } |
452 | else | 453 | else |
453 | { | 454 | { |
454 | date = KGlobal::locale()->readDate(text); | 455 | date = KGlobal::locale()->readDate(text); |
455 | } | 456 | } |
456 | 457 | ||
457 | return date; | 458 | return date; |
458 | } | 459 | } |
459 | 460 | ||
460 | bool KDateEdit::eventFilter(QObject *, QEvent *e) | 461 | bool KDateEdit::eventFilter(QObject *, QEvent *e) |
461 | { | 462 | { |
462 | // We only process the focus out event if the text has changed | 463 | // We only process the focus out event if the text has changed |
463 | // since we got focus | 464 | // since we got focus |
464 | if ((e->type() == QEvent::FocusOut) && mTextChanged) | 465 | if ((e->type() == QEvent::FocusOut) && mTextChanged) |
465 | { | 466 | { |
466 | lineEnterPressed(); | 467 | lineEnterPressed(); |
467 | mTextChanged = false; | 468 | mTextChanged = false; |
468 | } | 469 | } |
469 | // switch dateFormShort by double klick with mouse | 470 | // switch dateFormShort by double klick with mouse |
470 | else if (e->type() == QEvent::MouseButtonDblClick) | 471 | else if (e->type() == QEvent::MouseButtonDblClick) |
471 | { | 472 | { |
472 | toggleDateFormat(); | 473 | toggleDateFormat(); |
473 | } | 474 | } |
474 | else if (e->type() == QEvent::FocusIn) | 475 | else if (e->type() == QEvent::FocusIn) |
475 | { | 476 | { |
476 | maxDay = readDate().day(); | 477 | maxDay = readDate().day(); |
477 | } | 478 | } |
478 | 479 | ||
479 | return false; | 480 | return false; |
480 | } | 481 | } |
481 | void KDateEdit::toggleDateFormat() | 482 | void KDateEdit::toggleDateFormat() |
482 | { | 483 | { |
483 | dateFormShort = ! dateFormShort; | 484 | dateFormShort = ! dateFormShort; |
484 | mDateEdit->setText(KGlobal::locale()->formatDate(readDate(),dateFormShort)); | 485 | mDateEdit->setText(KGlobal::locale()->formatDate(readDate(),dateFormShort)); |
485 | 486 | ||
486 | } | 487 | } |
487 | 488 | ||
488 | void KDateEdit::textChanged(const QString &) | 489 | void KDateEdit::textChanged(const QString &) |
489 | { | 490 | { |
490 | if(mHandleInvalid && mDateEdit->text().stripWhiteSpace().isEmpty()) { | 491 | if(mHandleInvalid && mDateEdit->text().stripWhiteSpace().isEmpty()) { |
491 | QDate date; //invalid date | 492 | QDate date; //invalid date |
492 | emit(dateChanged(date)); | 493 | emit(dateChanged(date)); |
493 | } else { | 494 | } else { |
494 | mTextChanged = true; | 495 | mTextChanged = true; |
495 | } | 496 | } |
496 | maxDay = readDate().day(); | 497 | maxDay = readDate().day(); |
497 | } | 498 | } |