-rw-r--r-- | microkde/kdatetbl.cpp | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/microkde/kdatetbl.cpp b/microkde/kdatetbl.cpp index 4271b55..353f78d 100644 --- a/microkde/kdatetbl.cpp +++ b/microkde/kdatetbl.cpp @@ -242,5 +242,6 @@ KDateTable::keyPressEvent( QKeyEvent *e ) bool irgnore = true; + int add = 0; if ( e->state() != Qt::ControlButton ) { if ( e->key() == Qt::Key_Up ) { - pos -= 7; + add -= 7; irgnore = false; @@ -248,3 +249,3 @@ KDateTable::keyPressEvent( QKeyEvent *e ) if ( e->key() == Qt::Key_Down ) { - pos += 7; + add += 7; irgnore = false; @@ -252,3 +253,3 @@ KDateTable::keyPressEvent( QKeyEvent *e ) if ( e->key() == Qt::Key_Left ) { - pos--; + --add; irgnore = false; @@ -256,3 +257,3 @@ KDateTable::keyPressEvent( QKeyEvent *e ) if ( e->key() == Qt::Key_Right ) { - pos++; + ++add; irgnore = false; @@ -260,25 +261,12 @@ KDateTable::keyPressEvent( QKeyEvent *e ) } - if ( irgnore ) + if ( irgnore ) { e->ignore(); - - if(pos+dayoff<=firstday) - { // this day is in the previous month - KNotifyClient::beep(); - return; - } - if(firstday+numdays<pos+dayoff) - { // this date is in the next month - KNotifyClient::beep(i18n( "Month not long enough" )); - return; - } - - if ( pos == temp ) return; + } - setDate(QDate(date.year(), date.month(), pos-firstday+dayoff)); + pos += add; + setDate(date.addDays( add )); updateCell(temp/7+1, temp%7); // Update the previously selected cell updateCell(pos/7+1, pos%7); // Update the selected cell - assert(QDate(date.year(), date.month(), pos-firstday+dayoff).isValid()); - - + } |