summaryrefslogtreecommitdiffabout
path: root/korganizer/ktimeedit.cpp
authorMichael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
committer Michael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
commita08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff)
tree8ee90d686081c52e7c69b5ce946e9b1a7d690001 /korganizer/ktimeedit.cpp
parent11edc920afe4f274c0964436633aa632c8288a40 (diff)
downloadkdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2
initial public commit of qt4 portp1
Diffstat (limited to 'korganizer/ktimeedit.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/ktimeedit.cpp89
1 files changed, 46 insertions, 43 deletions
diff --git a/korganizer/ktimeedit.cpp b/korganizer/ktimeedit.cpp
index df9b2fc..e2ae4a6 100644
--- a/korganizer/ktimeedit.cpp
+++ b/korganizer/ktimeedit.cpp
@@ -23,3 +23,3 @@
23 23
24#include <qkeycode.h> 24#include <qnamespace.h>
25#include <qcombobox.h> 25#include <qcombobox.h>
@@ -27,4 +27,7 @@
27#include <qlineedit.h> 27#include <qlineedit.h>
28#include <qlistbox.h> 28#include <q3listbox.h>
29#include <qapplication.h> 29#include <qapplication.h>
30#include <QDesktopWidget>
31//Added by qt3to4:
32#include <QKeyEvent>
30 33
@@ -47,3 +50,3 @@
47KOTimeEdit::KOTimeEdit(QWidget *parent, QTime qt, const char *name) 50KOTimeEdit::KOTimeEdit(QWidget *parent, QTime qt, const char *name)
48 : QComboBox(TRUE, parent, name) 51 : Q3ComboBox(TRUE, parent, name)
49{ 52{
@@ -66,3 +69,3 @@ KOTimeEdit::KOTimeEdit(QWidget *parent, QTime qt, const char *name)
66 timeEntry = timeEntry.addSecs(60*15); 69 timeEntry = timeEntry.addSecs(60*15);
67 } while (!timeEntry.isNull()); 70 } while ( !( timeEntry.hour() || timeEntry.minute() ) );
68 // Add end of day. 71 // Add end of day.
@@ -71,3 +74,3 @@ KOTimeEdit::KOTimeEdit(QWidget *parent, QTime qt, const char *name)
71 updateText(); 74 updateText();
72 setFocusPolicy(QWidget::StrongFocus); 75 setFocusPolicy(Qt::StrongFocus);
73 76
@@ -210,4 +213,4 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e)
210 // Tap -> Focus Next Widget 213 // Tap -> Focus Next Widget
211 if ( e->key() == Key_Tab ) { 214 if ( e->key() == Qt::Key_Tab ) {
212 QComboBox::keyPressEvent(e); 215 Q3ComboBox::keyPressEvent(e);
213 return; 216 return;
@@ -222,8 +225,8 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e)
222 switch(e->key()) { 225 switch(e->key()) {
223 case Key_Escape: 226 case Qt::Key_Escape:
224 lineEdit()->deselect(); 227 lineEdit()->deselect();
225 case Key_Tab: 228 case Qt::Key_Tab:
226 QComboBox::keyPressEvent(e); 229 Q3ComboBox::keyPressEvent(e);
227 break; 230 break;
228 case Key_Up: 231 case Qt::Key_Up:
229 if ( e->state () == Qt::ControlButton ) { 232 if ( e->state () == Qt::ControlButton ) {
@@ -269,3 +272,3 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e)
269 break; 272 break;
270 case Key_Down: 273 case Qt::Key_Down:
271 if ( e->state () == Qt::ControlButton ) { 274 if ( e->state () == Qt::ControlButton ) {
@@ -312,3 +315,3 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e)
312 // set cursor to correct place 315 // set cursor to correct place
313 case Key_Left: 316 case Qt::Key_Left:
314 if ( cpos == 3 ) 317 if ( cpos == 3 )
@@ -323,3 +326,3 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e)
323 // set cursor to correct place 326 // set cursor to correct place
324 case Key_Right: 327 case Qt::Key_Right:
325 if ( cpos == 1 ) 328 if ( cpos == 1 )
@@ -332,9 +335,9 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e)
332 // rest 335 // rest
333 case Key_Prior: 336 case Qt::Key_Prior:
334 subTime(QTime(1,0,0)); 337 subTime(QTime(1,0,0));
335 break; 338 break;
336 case Key_Next: 339 case Qt::Key_Next:
337 addTime(QTime(1,0,0)); 340 addTime(QTime(1,0,0));
338 break; 341 break;
339 case Key_Backspace: 342 case Qt::Key_Backspace:
340 if ( cpos > 0) { 343 if ( cpos > 0) {
@@ -344,3 +347,3 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e)
344 cpos = 5; 347 cpos = 5;
345 text.at( cpos-1 ) = '0'; 348 text[ cpos-1 ] = '0';
346 lineEdit()->setText( text ); 349 lineEdit()->setText( text );
@@ -354,3 +357,3 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e)
354 // if cursor at string end, alltext market and keyEvent don't ArrowLeft -> deselect and cpos 357 // if cursor at string end, alltext market and keyEvent don't ArrowLeft -> deselect and cpos
355 if( cpos > 4 && lineEdit()->markedText().length() == 5 && e->key() != Key_Left ) { 358 if( cpos > 4 && lineEdit()->markedText().length() == 5 && e->key() != Qt::Key_Left ) {
356 lineEdit()->deselect(); 359 lineEdit()->deselect();
@@ -369,4 +372,4 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e)
369 switch(e->key()) { 372 switch(e->key()) {
370 case Key_Delete: 373 case Qt::Key_Delete:
371 text.at( cpos ) = '0'; 374 text[ cpos ] = '0';
372 lineEdit()->setText( text ); 375 lineEdit()->setText( text );
@@ -376,6 +379,6 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e)
376 break; 379 break;
377 case Key_9: 380 case Qt::Key_9:
378 case Key_8: 381 case Qt::Key_8:
379 case Key_7: 382 case Qt::Key_7:
380 case Key_6: 383 case Qt::Key_6:
381 if ( !(cpos == 1 || cpos == 4) ) 384 if ( !(cpos == 1 || cpos == 4) )
@@ -383,6 +386,6 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e)
383 if ( cpos == 1 && text.at( 0 ) > '1') 386 if ( cpos == 1 && text.at( 0 ) > '1')
384 text.at( 0 ) = '1'; 387 text[ 0 ] = '1';
385 case Key_5: 388 case Qt::Key_5:
386 case Key_4: 389 case Qt::Key_4:
387 case Key_3: 390 case Qt::Key_3:
388 if ( cpos < 1 ) 391 if ( cpos < 1 )
@@ -391,3 +394,3 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e)
391 return; 394 return;
392 case Key_2: 395 case Qt::Key_2:
393 if ( hour12Format && cpos == 0 ) 396 if ( hour12Format && cpos == 0 )
@@ -395,12 +398,12 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e)
395 if ( cpos == 0 && text.at( 1 ) > '3') 398 if ( cpos == 0 && text.at( 1 ) > '3')
396 text.at( 1 ) = '3'; 399 text[ 1 ] = '3';
397 case Key_1: 400 case Qt::Key_1:
398 case Key_0: 401 case Qt::Key_0:
399 if ( hour12Format ) { 402 if ( hour12Format ) {
400 if ( e->key() == Key_0 && cpos == 1 && text.at( 0 ) == '0' ) 403 if ( e->key() == Qt::Key_0 && cpos == 1 && text.at( 0 ) == '0' )
401 return; 404 return;
402 if ( e->key() == Key_0 && cpos == 0 && text.at( 1 ) == '0' ) 405 if ( e->key() == Qt::Key_0 && cpos == 0 && text.at( 1 ) == '0' )
403 text.at( 1 ) = '1'; 406 text[ 1 ] = '1';
404 } 407 }
405 text.at( cpos ) = QChar ( e->key() ); 408 text[ cpos ] = QChar ( e->key() );
406 lineEdit()->setText( text ); 409 lineEdit()->setText( text );
@@ -413,3 +416,3 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e)
413 break; 416 break;
414 case Key_Home: 417 case Qt::Key_Home:
415 lineEdit()->setCursorPosition(0); 418 lineEdit()->setCursorPosition(0);
@@ -417,3 +420,3 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e)
417 break; 420 break;
418 case Key_End: 421 case Qt::Key_End:
419 lineEdit()->setCursorPosition(5); 422 lineEdit()->setCursorPosition(5);
@@ -427,4 +430,4 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e)
427 if ( hour12Format ) { 430 if ( hour12Format ) {
428 if ( e->key() == Key_A ) { 431 if ( e->key() == Qt::Key_A ) {
429 text.at( 5 ) = 'a'; 432 text[ 5 ] = 'a';
430 lineEdit()->setText( text ); 433 lineEdit()->setText( text );
@@ -432,4 +435,4 @@ void KOTimeEdit::keyPressEvent(QKeyEvent *e)
432 435
433 } else if ( e->key() == Key_P ) { 436 } else if ( e->key() == Qt::Key_P ) {
434 text.at( 5 ) = 'p'; 437 text[ 5 ] = 'p';
435 lineEdit()->setText( text ); 438 lineEdit()->setText( text );