summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp55
-rw-r--r--korganizer/komonthview.h8
-rw-r--r--korganizer/koviewmanager.cpp2
3 files changed, 48 insertions, 17 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();
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();