author | zautrix <zautrix> | 2005-10-27 23:22:36 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-10-27 23:22:36 (UTC) |
commit | cbda16d4966c7483d20d1b6b5a64c8af367ea732 (patch) (side-by-side diff) | |
tree | 47099fd5b318c47eb1d8fff3d8a3eef6e34f6f23 /microkde/kdatetbl.cpp | |
parent | d6d384e50cfd511866958e58cdd3adeb35ed1c4e (diff) | |
download | kdepimpi-cbda16d4966c7483d20d1b6b5a64c8af367ea732.zip kdepimpi-cbda16d4966c7483d20d1b6b5a64c8af367ea732.tar.gz kdepimpi-cbda16d4966c7483d20d1b6b5a64c8af367ea732.tar.bz2 |
us fix
-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 @@ -227,73 +227,61 @@ KDateTable::keyPressEvent( QKeyEvent *e ) KNotifyClient::beep(); return; } int day = date.day(); if ( day > 27 ) while ( !QDate::isValid( date.year(), date.month()+1, day ) ) day--; setDate(QDate(date.year(), date.month()+1, day)); return; } */ int dayoff = KGlobal::locale()->weekStartsMonday() ? 1 : 0; int temp=firstday+date.day()-dayoff; int pos = temp; bool irgnore = true; + int add = 0; if ( e->state() != Qt::ControlButton ) { if ( e->key() == Qt::Key_Up ) { - pos -= 7; + add -= 7; irgnore = false; } if ( e->key() == Qt::Key_Down ) { - pos += 7; + add += 7; irgnore = false; } if ( e->key() == Qt::Key_Left ) { - pos--; + --add; irgnore = false; } if ( e->key() == Qt::Key_Right ) { - pos++; + ++add; irgnore = false; } } - 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()); - - + } void KDateTable::viewportResizeEvent(QResizeEvent * e) { QGridView::viewportResizeEvent(e); setCellWidth(viewport()->width()/7); setCellHeight(viewport()->height()/7); } void KDateTable::setFontSize(int size) { int count; QRect rect; |