author | zautrix <zautrix> | 2005-03-30 19:13:02 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-30 19:13:02 (UTC) |
commit | b9ec42913b1dc7fc39848f245e55c7b36d7c2fa6 (patch) (side-by-side diff) | |
tree | 1ef705404ced1d9616f5334923d8d1db446766c9 | |
parent | 5e354884787756ceaf663ea48167c5193dad6bf1 (diff) | |
download | kdepimpi-b9ec42913b1dc7fc39848f245e55c7b36d7c2fa6.zip kdepimpi-b9ec42913b1dc7fc39848f245e55c7b36d7c2fa6.tar.gz kdepimpi-b9ec42913b1dc7fc39848f245e55c7b36d7c2fa6.tar.bz2 |
more fixes
-rw-r--r-- | korganizer/komonthview.cpp | 53 | ||||
-rw-r--r-- | korganizer/komonthview.h | 8 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 2 |
3 files changed, 47 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()) { @@ -157,2 +157,13 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) break; + case Key_Return: + case Key_Enter: + { + if ( currentItem() >= 0 ) { + emit doubleClicked( item( currentItem() ) ); + e->accept(); + } else { + e->ignore(); + } + } + break; case Key_Shift: @@ -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) @@ -1504,7 +1535,3 @@ void KOMonthView::slotComputeLayout() clPending = true; - if ( mShowWeekView ) - mCellsW[0]->setFocus(); - else - mCells[0]->setFocus(); - + 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(); diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index 9e724c7..c1ca3d4 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h @@ -63,2 +63,7 @@ private: int mNumber; + void keyPressEvent ( QKeyEvent * e ) + { + e->ignore(); + } + private slots : @@ -165,3 +170,2 @@ class MonthViewCell : public KNoScrollListBox void select(); - #ifdef DESKTOP_VERSION @@ -259,2 +263,4 @@ class KOMonthView: public KOEventView void switchView(); + void setKeyBoardFocus(); + void setKeyBFocus(); diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index 53cd011..548ffd3 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp @@ -649,2 +649,3 @@ void KOViewManager::showMonthViewWeek() showView(mMonthView, full ); + mMonthView->setKeyBFocus(); } @@ -678,2 +679,3 @@ void KOViewManager::showMonthView() showView(mMonthView, full ); + mMonthView->setKeyBFocus(); |