-rw-r--r-- | bin/kdepim/WhatsNew.txt | 5 | ||||
-rw-r--r-- | korganizer/koeditorgeneralevent.cpp | 17 | ||||
-rw-r--r-- | korganizer/koeditorgeneraltodo.cpp | 12 | ||||
-rw-r--r-- | korganizer/ktimeedit.cpp | 106 | ||||
-rw-r--r-- | korganizer/ktimeedit.h | 3 | ||||
-rw-r--r-- | microkde/kdecore/klocale.cpp | 4 |
6 files changed, 33 insertions, 114 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index c8293b2..5d8ef41 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -7,24 +7,29 @@ Please read the changelog of VERSION 1.9.17 as well. | |||
7 | 7 | ||
8 | Cleaned up the syncing config dialog. | 8 | Cleaned up the syncing config dialog. |
9 | Added sync config options for date range for events. | 9 | Added sync config options for date range for events. |
10 | Added sync config options for filters on incoming data. | 10 | Added sync config options for filters on incoming data. |
11 | Added sync config options for filters on outgoing data. | 11 | Added sync config options for filters on outgoing data. |
12 | Please read the updated SyncHowTo about the new filter settings. | 12 | Please read the updated SyncHowTo about the new filter settings. |
13 | These filter settings make it now possible to sync with shared | 13 | These filter settings make it now possible to sync with shared |
14 | calendars without writing back private or confidential data | 14 | calendars without writing back private or confidential data |
15 | (via the outgoing filters). | 15 | (via the outgoing filters). |
16 | To sync only with particular parts of a shared calendar, | 16 | To sync only with particular parts of a shared calendar, |
17 | the incoming filter settings can be used. | 17 | the incoming filter settings can be used. |
18 | An example can be found in the SyncHowTo. | 18 | An example can be found in the SyncHowTo. |
19 | |||
20 | KO/Pi: | ||
21 | The timeedit input has a pulldown list for times. | ||
22 | If opened, this pulldown list should now has the right time highlighted. | ||
23 | |||
19 | 24 | ||
20 | 25 | ||
21 | ********** VERSION 1.9.17 ************ | 26 | ********** VERSION 1.9.17 ************ |
22 | 27 | ||
23 | KO/Pi: | 28 | KO/Pi: |
24 | Fixed that tooltips were not updated after moving an item in agenda view. | 29 | Fixed that tooltips were not updated after moving an item in agenda view. |
25 | Fixed a bug in sorting start date for recurring events in list view. | 30 | Fixed a bug in sorting start date for recurring events in list view. |
26 | Changed the left button in todo viewer from "Agenda" to "Set completed". | 31 | Changed the left button in todo viewer from "Agenda" to "Set completed". |
27 | This makes it possible to change a todo in the What's Next View quickly to the completed state without leaving the What's Next View. | 32 | This makes it possible to change a todo in the What's Next View quickly to the completed state without leaving the What's Next View. |
28 | Added more info in the todo viewer: Startdate, parent/sub todos. | 33 | Added more info in the todo viewer: Startdate, parent/sub todos. |
29 | 34 | ||
30 | 35 | ||
diff --git a/korganizer/koeditorgeneralevent.cpp b/korganizer/koeditorgeneralevent.cpp index fc5be71..30b792b 100644 --- a/korganizer/koeditorgeneralevent.cpp +++ b/korganizer/koeditorgeneralevent.cpp | |||
@@ -385,41 +385,24 @@ void KOEditorGeneralEvent::emitDateTimeStr() | |||
385 | from = l->formatDateTime(mCurrStartDateTime); | 385 | from = l->formatDateTime(mCurrStartDateTime); |
386 | to = l->formatDateTime(mCurrEndDateTime); | 386 | to = l->formatDateTime(mCurrEndDateTime); |
387 | } | 387 | } |
388 | 388 | ||
389 | QString str = i18n("From: %1 To: %2 %3").arg(from).arg(to) | 389 | QString str = i18n("From: %1 To: %2 %3").arg(from).arg(to) |
390 | .arg(mDurationLabel->text()); | 390 | .arg(mDurationLabel->text()); |
391 | 391 | ||
392 | emit dateTimeStrChanged(str); | 392 | emit dateTimeStrChanged(str); |
393 | } | 393 | } |
394 | 394 | ||
395 | bool KOEditorGeneralEvent::validateInput() | 395 | bool KOEditorGeneralEvent::validateInput() |
396 | { | 396 | { |
397 | // kdDebug() << "KOEditorGeneralEvent::validateInput()" << endl; | ||
398 | |||
399 | if (!mNoTimeButton->isChecked()) { | ||
400 | if (!mStartTimeEdit->inputIsValid()) { | ||
401 | KMessageBox::sorry( 0, | ||
402 | i18n("Please specify a valid start time, for example '%1'.") | ||
403 | .arg( KGlobal::locale()->formatTime( QTime::currentTime() ) ) ); | ||
404 | return false; | ||
405 | } | ||
406 | |||
407 | if (!mEndTimeEdit->inputIsValid()) { | ||
408 | KMessageBox::sorry( 0, | ||
409 | i18n("Please specify a valid end time, for example '%1'.") | ||
410 | .arg( KGlobal::locale()->formatTime( QTime::currentTime() ) ) ); | ||
411 | return false; | ||
412 | } | ||
413 | } | ||
414 | 397 | ||
415 | if (!mStartDateEdit->inputIsValid()) { | 398 | if (!mStartDateEdit->inputIsValid()) { |
416 | KMessageBox::sorry( 0, | 399 | KMessageBox::sorry( 0, |
417 | i18n("Please specify a valid start date, for example '%1'.") | 400 | i18n("Please specify a valid start date, for example '%1'.") |
418 | .arg( KGlobal::locale()->formatDate( QDate::currentDate() ) ) ); | 401 | .arg( KGlobal::locale()->formatDate( QDate::currentDate() ) ) ); |
419 | return false; | 402 | return false; |
420 | } | 403 | } |
421 | 404 | ||
422 | if (!mEndDateEdit->inputIsValid()) { | 405 | if (!mEndDateEdit->inputIsValid()) { |
423 | KMessageBox::sorry( 0, | 406 | KMessageBox::sorry( 0, |
424 | i18n("Please specify a valid end date, for example '%1'.") | 407 | i18n("Please specify a valid end date, for example '%1'.") |
425 | .arg( KGlobal::locale()->formatDate( QDate::currentDate() ) ) ); | 408 | .arg( KGlobal::locale()->formatDate( QDate::currentDate() ) ) ); |
diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp index 7db7da0..158a7d3 100644 --- a/korganizer/koeditorgeneraltodo.cpp +++ b/korganizer/koeditorgeneraltodo.cpp | |||
@@ -375,43 +375,31 @@ void KOEditorGeneralTodo::showAlarm() | |||
375 | else { | 375 | else { |
376 | alarmDisable(true); | 376 | alarmDisable(true); |
377 | } | 377 | } |
378 | } | 378 | } |
379 | 379 | ||
380 | bool KOEditorGeneralTodo::validateInput() | 380 | bool KOEditorGeneralTodo::validateInput() |
381 | { | 381 | { |
382 | if (mDueCheck->isChecked()) { | 382 | if (mDueCheck->isChecked()) { |
383 | if (!mDueDateEdit->inputIsValid()) { | 383 | if (!mDueDateEdit->inputIsValid()) { |
384 | KMessageBox::sorry(0,i18n("Please specify a valid due date.")); | 384 | KMessageBox::sorry(0,i18n("Please specify a valid due date.")); |
385 | return false; | 385 | return false; |
386 | } | 386 | } |
387 | if (mTimeButton->isChecked()) { | ||
388 | if (!mDueTimeEdit->inputIsValid()) { | ||
389 | KMessageBox::sorry(0,i18n("Please specify a valid due time.")); | ||
390 | return false; | ||
391 | } | ||
392 | } | ||
393 | } | 387 | } |
394 | 388 | ||
395 | if (mStartCheck->isChecked()) { | 389 | if (mStartCheck->isChecked()) { |
396 | if (!mStartDateEdit->inputIsValid()) { | 390 | if (!mStartDateEdit->inputIsValid()) { |
397 | KMessageBox::sorry(0,i18n("Please specify a valid start date.")); | 391 | KMessageBox::sorry(0,i18n("Please specify a valid start date.")); |
398 | return false; | 392 | return false; |
399 | } | 393 | } |
400 | if (mTimeButton->isChecked()) { | ||
401 | if (!mStartTimeEdit->inputIsValid()) { | ||
402 | KMessageBox::sorry(0,i18n("Please specify a valid start time.")); | ||
403 | return false; | ||
404 | } | ||
405 | } | ||
406 | } | 394 | } |
407 | 395 | ||
408 | if (mStartCheck->isChecked() && mDueCheck->isChecked()) { | 396 | if (mStartCheck->isChecked() && mDueCheck->isChecked()) { |
409 | QDateTime startDate; | 397 | QDateTime startDate; |
410 | QDateTime dueDate; | 398 | QDateTime dueDate; |
411 | startDate.setDate(mStartDateEdit->date()); | 399 | startDate.setDate(mStartDateEdit->date()); |
412 | dueDate.setDate(mDueDateEdit->date()); | 400 | dueDate.setDate(mDueDateEdit->date()); |
413 | if (mTimeButton->isChecked()) { | 401 | if (mTimeButton->isChecked()) { |
414 | startDate.setTime(mStartTimeEdit->getTime()); | 402 | startDate.setTime(mStartTimeEdit->getTime()); |
415 | dueDate.setTime(mDueTimeEdit->getTime()); | 403 | dueDate.setTime(mDueTimeEdit->getTime()); |
416 | } | 404 | } |
417 | if (startDate > dueDate) { | 405 | if (startDate > dueDate) { |
diff --git a/korganizer/ktimeedit.cpp b/korganizer/ktimeedit.cpp index f5a1c50..5222ac9 100644 --- a/korganizer/ktimeedit.cpp +++ b/korganizer/ktimeedit.cpp | |||
@@ -16,85 +16,47 @@ | |||
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qkeycode.h> | 24 | #include <qkeycode.h> |
25 | #include <qcombobox.h> | 25 | #include <qcombobox.h> |
26 | #include <qdatetime.h> | 26 | #include <qdatetime.h> |
27 | #include <qlineedit.h> | 27 | #include <qlineedit.h> |
28 | #include <qlistbox.h> | ||
28 | #include <qapplication.h> | 29 | #include <qapplication.h> |
29 | 30 | ||
30 | #include <kmessagebox.h> | 31 | #include <kmessagebox.h> |
31 | #include <kglobal.h> | 32 | #include <kglobal.h> |
32 | #include <kdebug.h> | 33 | #include <kdebug.h> |
33 | #include <klocale.h> | 34 | #include <klocale.h> |
34 | #include <kpimglobalprefs.h> | 35 | #include <kpimglobalprefs.h> |
35 | 36 | ||
36 | #include "ktimeedit.h" | 37 | #include "ktimeedit.h" |
37 | #include "koprefs.h" | 38 | #include "koprefs.h" |
38 | #include <qvalidator.h> | 39 | #include <qvalidator.h> |
39 | 40 | ||
40 | // Validator for a time value with only hours and minutes (no seconds) | 41 | // Validator for a time value with only hours and minutes (no seconds) |
41 | // Mostly locale aware. Author: David Faure <faure@kde.org> | 42 | // Mostly locale aware. Author: David Faure <faure@kde.org> |
42 | class KOTimeValidator : public QValidator | ||
43 | { | ||
44 | public: | ||
45 | KOTimeValidator(QWidget* parent, const char* name=0) : QValidator(parent, name) {} | ||
46 | |||
47 | virtual State validate(QString& str, int& /*cursorPos*/) const | ||
48 | { | ||
49 | return Acceptable; | ||
50 | bool ok = false; | ||
51 | // TODO use KLocale::WithoutSeconds in HEAD | ||
52 | /*QTime time =*/ KGlobal::locale()->readTime(str, &ok); | ||
53 | if ( ok ) | ||
54 | return Acceptable; | ||
55 | // readTime doesn't help knowing when the string is "Intermediate". | ||
56 | int length = str.length(); | ||
57 | if ( !str ) // empty string? | ||
58 | return Invalid; // there should always be a ':' in it, right? | ||
59 | // HACK. Not fully locale aware etc. (esp. the separator is '.' in sv_SE...) | ||
60 | QChar sep = ':'; | ||
61 | // I want to allow "HH:", ":MM" and ":" to make editing easier | ||
62 | if ( str[0] == sep ) | ||
63 | { | ||
64 | if ( length == 1 ) // just ":" | ||
65 | return Intermediate; | ||
66 | QString minutes = str.mid(1); | ||
67 | int m = minutes.toInt(&ok); | ||
68 | if ( ok && m >= 0 && m < 60 ) | ||
69 | return Intermediate; | ||
70 | } else if ( str.at(str.length()-1) == sep ) | ||
71 | { | ||
72 | QString hours = str.left(length-1); | ||
73 | int h = hours.toInt(&ok); | ||
74 | if ( ok && h >= 0 && h < 24 ) | ||
75 | return Intermediate; | ||
76 | } | ||
77 | return Invalid; | ||
78 | } | ||
79 | }; | ||
80 | 43 | ||
81 | // KTimeWidget/QTimeEdit provide nicer editing, but don't provide a combobox. | 44 | // KTimeWidget/QTimeEdit provide nicer editing, but don't provide a combobox. |
82 | // Difficult to get all in one... | 45 | // Difficult to get all in one... |
83 | // But Qt-3.2 will offer QLineEdit::setMask, so a "99:99" mask would help. | 46 | // But Qt-3.2 will offer QLineEdit::setMask, so a "99:99" mask would help. |
84 | KOTimeEdit::KOTimeEdit(QWidget *parent, QTime qt, const char *name) | 47 | KOTimeEdit::KOTimeEdit(QWidget *parent, QTime qt, const char *name) |
85 | : QComboBox(TRUE, parent, name) | 48 | : QComboBox(TRUE, parent, name) |
86 | { | 49 | { |
87 | setInsertionPolicy(NoInsertion); | 50 | setInsertionPolicy(NoInsertion); |
88 | setValidator( new KOTimeValidator( this ) ); | ||
89 | mFlagKeyPressed = false; | 51 | mFlagKeyPressed = false; |
90 | 52 | ||
91 | if ( QApplication::desktop()->width() < 650 ) | 53 | if ( QApplication::desktop()->width() < 650 ) |
92 | setSizeLimit ( 6 ); | 54 | setSizeLimit ( 6 ); |
93 | mTime = qt; | 55 | mTime = qt; |
94 | 56 | ||
95 | // mNoTimeString = i18n("No Time"); | 57 | // mNoTimeString = i18n("No Time"); |
96 | // insertItem( mNoTimeString ); | 58 | // insertItem( mNoTimeString ); |
97 | 59 | ||
98 | // Fill combo box with selection of times in localized format. | 60 | // Fill combo box with selection of times in localized format. |
99 | QTime timeEntry(0,0,0); | 61 | QTime timeEntry(0,0,0); |
100 | do { | 62 | do { |
@@ -136,46 +98,40 @@ KOTimeEdit::~KOTimeEdit() | |||
136 | 98 | ||
137 | bool KOTimeEdit::hasTime() const | 99 | bool KOTimeEdit::hasTime() const |
138 | { | 100 | { |
139 | // Can't happen | 101 | // Can't happen |
140 | if ( currentText().isEmpty() ) return false; | 102 | if ( currentText().isEmpty() ) return false; |
141 | //if ( currentText() == mNoTimeString ) return false; | 103 | //if ( currentText() == mNoTimeString ) return false; |
142 | 104 | ||
143 | return true; // always | 105 | return true; // always |
144 | } | 106 | } |
145 | 107 | ||
146 | QTime KOTimeEdit::getTime() const | 108 | QTime KOTimeEdit::getTime() const |
147 | { | 109 | { |
148 | //kdDebug(5850) << "KOTimeEdit::getTime(), currentText() = " << currentText() << endl; | 110 | return KGlobal::locale()->readTime(currentText()); |
149 | // TODO use KLocale::WithoutSeconds in HEAD | ||
150 | QTime time = KGlobal::locale()->readTime(currentText()); | ||
151 | // kdDebug(5850) << "KOTimeEdit::getTime(): " << time.toString() << endl; | ||
152 | return time; | ||
153 | } | 111 | } |
154 | /* | 112 | /* |
155 | QSizePolicy KOTimeEdit::sizePolicy() const | 113 | QSizePolicy KOTimeEdit::sizePolicy() const |
156 | { | 114 | { |
157 | // Set size policy to Fixed, because edit cannot contain more text than the | 115 | // Set size policy to Fixed, because edit cannot contain more text than the |
158 | // string representing the time. It doesn't make sense to provide more space. | 116 | // string representing the time. It doesn't make sense to provide more space. |
159 | QSizePolicy sizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); | 117 | QSizePolicy sizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); |
160 | 118 | ||
161 | return sizePolicy; | 119 | return sizePolicy; |
162 | } | 120 | } |
163 | */ | 121 | */ |
164 | void KOTimeEdit::setTime(QTime newTime) | 122 | void KOTimeEdit::setTime(QTime newTime) |
165 | { | 123 | { |
166 | if ( mTime != newTime ) | 124 | if ( mTime != newTime ) |
167 | { | 125 | { |
168 | kdDebug(5850) << "KOTimeEdit::setTime(): " << newTime.toString() << endl; | ||
169 | |||
170 | mTime = newTime; | 126 | mTime = newTime; |
171 | updateText(); | 127 | updateText(); |
172 | } | 128 | } |
173 | 129 | ||
174 | } | 130 | } |
175 | 131 | ||
176 | void KOTimeEdit::activ(int i) | 132 | void KOTimeEdit::activ(int i) |
177 | { | 133 | { |
178 | // The last entry, 23:59, is a special case | 134 | // The last entry, 23:59, is a special case |
179 | if( i == count() - 1 ) | 135 | if( i == count() - 1 ) |
180 | mTime = QTime( 23, 59, 0 ); | 136 | mTime = QTime( 23, 59, 0 ); |
181 | else | 137 | else |
@@ -370,34 +326,36 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e) | |||
370 | lineEdit()->setCursorPosition(++cpos); | 326 | lineEdit()->setCursorPosition(++cpos); |
371 | setSelect ( cpos , 1 ); | 327 | setSelect ( cpos , 1 ); |
372 | } | 328 | } |
373 | break; | 329 | break; |
374 | // rest | 330 | // rest |
375 | case Key_Prior: | 331 | case Key_Prior: |
376 | subTime(QTime(1,0,0)); | 332 | subTime(QTime(1,0,0)); |
377 | break; | 333 | break; |
378 | case Key_Next: | 334 | case Key_Next: |
379 | addTime(QTime(1,0,0)); | 335 | addTime(QTime(1,0,0)); |
380 | break; | 336 | break; |
381 | case Key_Backspace: | 337 | case Key_Backspace: |
338 | qDebug("+++++++++++back "); | ||
382 | if ( cpos > 0) { | 339 | if ( cpos > 0) { |
383 | if ( cpos == 3 ) | 340 | if ( cpos == 3 ) |
384 | --cpos; | 341 | --cpos; |
385 | if ( cpos > 5) | 342 | if ( cpos > 5) |
386 | cpos = 5; | 343 | cpos = 5; |
387 | text.at( cpos-1 ) = '0'; | 344 | text.at( cpos-1 ) = '0'; |
388 | lineEdit()->setText( text ); | 345 | lineEdit()->setText( text ); |
389 | lineEdit()->setCursorPosition(--cpos); | 346 | lineEdit()->setCursorPosition(--cpos); |
390 | setSelect ( cpos , 1 ); | 347 | setSelect ( cpos , 1 ); |
391 | changedText(); | 348 | changedText(); |
349 | qDebug("---------back "); | ||
392 | } | 350 | } |
393 | break; | 351 | break; |
394 | } // switch arrows | 352 | } // switch arrows |
395 | 353 | ||
396 | // if cursor at string end, alltext market and keyEvent don't ArrowLeft -> deselect and cpos | 354 | // if cursor at string end, alltext market and keyEvent don't ArrowLeft -> deselect and cpos |
397 | if( cpos > 4 && lineEdit()->markedText().length() == 5 && e->key() != Key_Left ) { | 355 | if( cpos > 4 && lineEdit()->markedText().length() == 5 && e->key() != Key_Left ) { |
398 | lineEdit()->deselect(); | 356 | lineEdit()->deselect(); |
399 | cpos = 0; | 357 | cpos = 0; |
400 | lineEdit()->setCursorPosition(cpos); | 358 | lineEdit()->setCursorPosition(cpos); |
401 | setSelect(cpos , 1); | 359 | setSelect(cpos , 1); |
402 | } | 360 | } |
403 | 361 | ||
@@ -476,53 +434,41 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e) | |||
476 | text.at( 5 ) = 'p'; | 434 | text.at( 5 ) = 'p'; |
477 | lineEdit()->setText( text ); | 435 | lineEdit()->setText( text ); |
478 | lineEdit()->setCursorPosition(5); | 436 | lineEdit()->setCursorPosition(5); |
479 | 437 | ||
480 | } | 438 | } |
481 | } | 439 | } |
482 | } | 440 | } |
483 | 441 | ||
484 | 442 | ||
485 | } | 443 | } |
486 | 444 | ||
487 | void KOTimeEdit::updateText() | 445 | void KOTimeEdit::updateText() |
488 | { | 446 | { |
489 | // kdDebug(5850) << "KOTimeEdit::updateText() " << endl | 447 | listBox()->blockSignals( true ); |
490 | QString s = KGlobal::locale()->formatTime(mTime); | 448 | blockSignals( true ); |
491 | // Set the text but without emitting signals, nor losing the cursor position | 449 | QString s = KGlobal::locale()->formatTime(mTime); |
492 | QLineEdit *line = lineEdit(); | 450 | // Set the text but without emitting signals, nor losing the cursor position |
493 | line->blockSignals(true); | 451 | QLineEdit *line = lineEdit(); |
494 | int pos = line->cursorPosition(); | 452 | line->blockSignals(true); |
495 | // qDebug(" settext *%s* ", s.latin1()); | 453 | int pos = line->cursorPosition(); |
496 | line->setText(s); | ||
497 | // line->setCursorPosition(pos); | ||
498 | // line->blockSignals(false); | ||
499 | |||
500 | // kdDebug(5850) << "KOTimeEdit::updateText(): " << s << endl; | ||
501 | |||
502 | if (!mTime.minute() % 15) { | ||
503 | setCurrentItem((mTime.hour()*4)+(mTime.minute()/15)); | 454 | setCurrentItem((mTime.hour()*4)+(mTime.minute()/15)); |
504 | } | 455 | line->setText(s); |
505 | line->setCursorPosition(pos); | 456 | line->setCursorPosition(pos); |
506 | line->blockSignals(false); | 457 | line->blockSignals(false); |
507 | 458 | blockSignals( false ); | |
508 | } | 459 | listBox()->blockSignals( false ); |
509 | 460 | ||
510 | bool KOTimeEdit::inputIsValid() const | ||
511 | { | ||
512 | int cursorPos = lineEdit()->cursorPosition(); | ||
513 | QString str = currentText(); | ||
514 | return validator()->validate( str, cursorPos ) == QValidator::Acceptable; | ||
515 | } | 461 | } |
516 | 462 | ||
517 | void KOTimeEdit::changedText() | 463 | void KOTimeEdit::changedText() |
518 | { | 464 | { |
519 | //kdDebug(5850) << "KOTimeEdit::changedText()" << endl; | 465 | int pos = lineEdit()->cursorPosition(); |
520 | if ( inputIsValid() ) | 466 | mTime = getTime(); |
521 | { | 467 | blockSignals( true ); |
522 | int pos = lineEdit()->cursorPosition(); | 468 | QString text = lineEdit()->text(); |
523 | mTime = getTime(); | 469 | setCurrentItem((mTime.hour()*4)+(mTime.minute()/15)); |
524 | // updateText(); | 470 | lineEdit()->setText(text); |
525 | emit timeChanged(mTime); | 471 | blockSignals( false ); |
526 | lineEdit()->setCursorPosition(pos); | 472 | emit timeChanged(mTime); |
527 | } | 473 | lineEdit()->setCursorPosition(pos); |
528 | } | 474 | } |
diff --git a/korganizer/ktimeedit.h b/korganizer/ktimeedit.h index 7923070..b3d842d 100644 --- a/korganizer/ktimeedit.h +++ b/korganizer/ktimeedit.h | |||
@@ -49,27 +49,24 @@ class KOTimeEdit : public QComboBox | |||
49 | 49 | ||
50 | /** | 50 | /** |
51 | Returns, if a time is selected. Can not return false anymore.... | 51 | Returns, if a time is selected. Can not return false anymore.... |
52 | */ | 52 | */ |
53 | bool hasTime() const; | 53 | bool hasTime() const; |
54 | 54 | ||
55 | /** returns the time that is currently set in the timeLineEdit. */ | 55 | /** returns the time that is currently set in the timeLineEdit. */ |
56 | QTime getTime() const; | 56 | QTime getTime() const; |
57 | 57 | ||
58 | /** returns the prefered size policy of the KOTimeEdit */ | 58 | /** returns the prefered size policy of the KOTimeEdit */ |
59 | //QSizePolicy sizePolicy() const; | 59 | //QSizePolicy sizePolicy() const; |
60 | 60 | ||
61 | /** return true if input is a valid time and false if not */ | ||
62 | bool inputIsValid() const; | ||
63 | |||
64 | signals: | 61 | signals: |
65 | /** | 62 | /** |
66 | Emitted every time the time displayed changes. "newt" is the new | 63 | Emitted every time the time displayed changes. "newt" is the new |
67 | time. | 64 | time. |
68 | */ | 65 | */ |
69 | void timeChanged(QTime newt); | 66 | void timeChanged(QTime newt); |
70 | 67 | ||
71 | public slots: | 68 | public slots: |
72 | /** used to set the time which is displayed to a specific value. */ | 69 | /** used to set the time which is displayed to a specific value. */ |
73 | void setTime(QTime qt); | 70 | void setTime(QTime qt); |
74 | 71 | ||
75 | protected slots: | 72 | protected slots: |
diff --git a/microkde/kdecore/klocale.cpp b/microkde/kdecore/klocale.cpp index d7e384c..7f31ab1 100644 --- a/microkde/kdecore/klocale.cpp +++ b/microkde/kdecore/klocale.cpp | |||
@@ -553,27 +553,27 @@ QDate KLocale::readDate(const QString &intstr, const QString &fmt, bool* ok) con | |||
553 | { | 553 | { |
554 | if (ok) *ok = true; | 554 | if (ok) *ok = true; |
555 | return QDate(year, month, day); | 555 | return QDate(year, month, day); |
556 | } | 556 | } |
557 | error: | 557 | error: |
558 | if (ok) *ok = false; | 558 | if (ok) *ok = false; |
559 | return QDate(); // invalid date | 559 | return QDate(); // invalid date |
560 | } | 560 | } |
561 | 561 | ||
562 | QTime KLocale::readTime(const QString &intstr, bool *ok) const | 562 | QTime KLocale::readTime(const QString &intstr, bool *ok) const |
563 | { | 563 | { |
564 | QTime _time; | 564 | QTime _time; |
565 | _time = readTime(intstr, true, ok); | 565 | _time = readTime(intstr, false, ok); |
566 | if (_time.isValid()) return _time; | 566 | if (_time.isValid()) return _time; |
567 | return readTime(intstr, false, ok); | 567 | return readTime(intstr, true, ok); |
568 | } | 568 | } |
569 | 569 | ||
570 | QTime KLocale::readTime(const QString &intstr, bool seconds, bool *ok) const | 570 | QTime KLocale::readTime(const QString &intstr, bool seconds, bool *ok) const |
571 | { | 571 | { |
572 | QString str = intstr.simplifyWhiteSpace().lower(); | 572 | QString str = intstr.simplifyWhiteSpace().lower(); |
573 | QString Format = timeFormat().simplifyWhiteSpace(); | 573 | QString Format = timeFormat().simplifyWhiteSpace(); |
574 | if (!seconds) | 574 | if (!seconds) |
575 | Format.replace(QRegExp(QString::fromLatin1(".%S")), QString::null); | 575 | Format.replace(QRegExp(QString::fromLatin1(".%S")), QString::null); |
576 | 576 | ||
577 | int hour = -1, minute = -1, second = seconds ? -1 : 0; // don't require seconds | 577 | int hour = -1, minute = -1, second = seconds ? -1 : 0; // don't require seconds |
578 | 578 | ||
579 | bool g_12h = false; | 579 | bool g_12h = false; |