-rw-r--r-- | korganizer/komonthview.cpp | 55 |
1 files changed, 39 insertions, 16 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 940d288..ca35a86 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -103,3 +103,3 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) { - + //qDebug("KNoScrollListBox::keyPressEvent "); switch(e->key()) { @@ -156,2 +156,13 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) e->ignore(); + break; + case Key_Return: + case Key_Enter: + { + if ( currentItem() >= 0 ) { + emit doubleClicked( item( currentItem() ) ); + e->accept(); + } else { + e->ignore(); + } + } break; @@ -315,4 +326,4 @@ void MonthViewItem::paint(QPainter *p) int val = td->percentComplete()/20; - p->fillRect ( x+1, y-1, val ,size+2,Qt::black ); - p->drawRect ( x, y-1,7,size+2); + p->fillRect ( x+1, y-2, val ,size+4,Qt::black ); + p->drawRect ( x, y-2,7,size+4); x += size + 3; @@ -1054,2 +1065,3 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) mWeekLabels[mNumWeeks]->setText( i18n("W")); + mWeekLabels[0]->setFocusPolicy(WheelFocus); QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); @@ -1069,2 +1081,3 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) mWeekLabelsW[1]->setText( i18n("W")); + mWeekLabelsW[0]->setFocusPolicy(WheelFocus); @@ -1468,5 +1481,3 @@ void KOMonthView::updateView() } - (*cells)[0]->setFocus(); - - + setKeyBFocus(); #else @@ -1488,2 +1499,22 @@ void KOMonthView::updateView() +void KOMonthView::setKeyBoardFocus() +{ + bool shootAgain = false; + if ( mShowWeekView ) { + shootAgain = !mWeekLabelsW[0]->hasFocus(); + mWeekLabelsW[0]->setFocus(); + } + else { + shootAgain = !mWeekLabels[0]->hasFocus(); + mWeekLabels[0]->setFocus(); + } + if ( shootAgain ) { + QTimer::singleShot( 0, this, SLOT ( setKeyBFocus() ) ); + } +} +void KOMonthView::setKeyBFocus() +{ + //qDebug("KOMonthView::setKeyBFocus() "); + QTimer::singleShot( 0, this, SLOT ( setKeyBoardFocus() ) ); +} void KOMonthView::resizeEvent(QResizeEvent * e) @@ -1503,8 +1534,4 @@ void KOMonthView::slotComputeLayout() computeLayout(); - clPending = true; - if ( mShowWeekView ) - mCellsW[0]->setFocus(); - else - mCells[0]->setFocus(); - + clPending = true; + setKeyBFocus(); } @@ -1819,3 +1846,2 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e ) if ( mShowWeekView ) { - mCellsW[0]->setFocus(); emit selectWeekNum ( currentWeek() - 1 ); @@ -1823,3 +1849,2 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e ) else { - mCells[0]->setFocus(); emit prevMonth(); @@ -1832,3 +1857,2 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e ) if ( mShowWeekView ) { - mCellsW[0]->setFocus(); emit selectWeekNum ( currentWeek() +1); @@ -1836,3 +1860,2 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e ) else { - mCells[0]->setFocus(); emit nextMonth(); |