summaryrefslogtreecommitdiffabout
path: root/korganizer/komonthview.cpp
authorzautrix <zautrix>2005-03-30 19:13:02 (UTC)
committer zautrix <zautrix>2005-03-30 19:13:02 (UTC)
commitb9ec42913b1dc7fc39848f245e55c7b36d7c2fa6 (patch) (side-by-side diff)
tree1ef705404ced1d9616f5334923d8d1db446766c9 /korganizer/komonthview.cpp
parent5e354884787756ceaf663ea48167c5193dad6bf1 (diff)
downloadkdepimpi-b9ec42913b1dc7fc39848f245e55c7b36d7c2fa6.zip
kdepimpi-b9ec42913b1dc7fc39848f245e55c7b36d7c2fa6.tar.gz
kdepimpi-b9ec42913b1dc7fc39848f245e55c7b36d7c2fa6.tar.bz2
more fixes
Diffstat (limited to 'korganizer/komonthview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp55
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
@@ -101,7 +101,7 @@ QString KNoScrollListBox::getWhatsThisText(QPoint p)
}
void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
{
-
+ //qDebug("KNoScrollListBox::keyPressEvent ");
switch(e->key()) {
case Key_Right:
if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
@@ -154,6 +154,17 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
case Key_I:
QTimer::singleShot( 11, this, SLOT ( oneDown() ) );
e->ignore();
+ break;
+ case Key_Return:
+ case Key_Enter:
+ {
+ if ( currentItem() >= 0 ) {
+ emit doubleClicked( item( currentItem() ) );
+ e->accept();
+ } else {
+ e->ignore();
+ }
+ }
break;
case Key_Shift:
emit shiftDown();
@@ -313,8 +324,8 @@ void MonthViewItem::paint(QPainter *p)
} else {
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;
}
}
@@ -1052,6 +1063,7 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
mWeekLabels.insert( i, label );
}
mWeekLabels[mNumWeeks]->setText( i18n("W"));
+ mWeekLabels[0]->setFocusPolicy(WheelFocus);
QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number"));
for( i = 0; i < 1+1; i++ ) {
@@ -1067,6 +1079,7 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
mWeekLabelsW.insert( i, label );
}
mWeekLabelsW[1]->setText( i18n("W"));
+ mWeekLabelsW[0]->setFocusPolicy(WheelFocus);
int row, col;
@@ -1466,9 +1479,7 @@ void KOMonthView::updateView()
for( i = 0; i < timeSpan+1; ++i ) {
(*cells)[i]->repaintfinishUpdateCell();
}
- (*cells)[0]->setFocus();
-
-
+ setKeyBFocus();
#else
// old code
//qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ");
@@ -1486,6 +1497,26 @@ void KOMonthView::updateView()
//qDebug("update time %d ", ti.elapsed());
}
+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)
{
//qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height());
@@ -1501,12 +1532,8 @@ void KOMonthView::slotComputeLayout()
mComputeLayoutTimer->stop();
//qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() );
computeLayout();
- clPending = true;
- if ( mShowWeekView )
- mCellsW[0]->setFocus();
- else
- mCells[0]->setFocus();
-
+ clPending = true;
+ setKeyBFocus();
}
void KOMonthView::computeLayoutWeek()
{
@@ -1817,11 +1844,9 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e )
case Key_Up:
{
if ( mShowWeekView ) {
- mCellsW[0]->setFocus();
emit selectWeekNum ( currentWeek() - 1 );
}
else {
- mCells[0]->setFocus();
emit prevMonth();
}
}
@@ -1830,11 +1855,9 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e )
case Key_Down:
{
if ( mShowWeekView ) {
- mCellsW[0]->setFocus();
emit selectWeekNum ( currentWeek() +1);
}
else {
- mCells[0]->setFocus();
emit nextMonth();
}