From b96161e4dd7fc19eea87257c2455b85420dad35a Mon Sep 17 00:00:00 2001 From: zautrix Date: Thu, 10 Mar 2005 10:40:57 +0000 Subject: todo month view fix --- (limited to 'korganizer') diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index f983ff9..4bf9dea 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -277,6 +277,22 @@ void MonthViewItem::paint(QPainter *p) x += sizeM/2 + 1; x += sizeM + 1; } + + if ( mIncidence->type() == "Todo" ){ + Todo* td = ( Todo* ) mIncidence; + if ( td->isCompleted() ) { + int half = size/2; + p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ; + p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ; + x += half+half + 4; + + } 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); + x += size + 3; + } + } QFontMetrics fm = p->fontMetrics(); int yPos; int pmheight = size; @@ -602,7 +618,7 @@ void MonthViewCell::insertTodo(Todo *todo) text += " "; } } - text += i18n("T: %1").arg(todo->summary()); + text += todo->summary(); MonthViewItem *item = new MonthViewItem( todo, mDate, text ); //item->setPalette( mStandardPalette ); @@ -661,7 +677,7 @@ void MonthViewCell::finishUpdateCell() } void MonthViewCell::updateCell() { - qDebug("MonthViewCell::updateCell() "); + //qDebug("MonthViewCell::updateCell() "); if ( !mMonthView->isUpdatePossible() ) return; startUpdateCell(); @@ -1218,6 +1234,7 @@ void KOMonthView::updateView() return; //QTime ti; //ti.start(); + clearSelection(); QPtrVector *cells; if ( mShowWeekView ) { cells = &mCellsW; @@ -1593,7 +1610,7 @@ MonthViewCell * KOMonthView::selectedCell( ) } void KOMonthView::setSelectedCell( MonthViewCell *cell ) { - // qDebug("KOMonthView::setSelectedCell "); + //qDebug("KOMonthView::setSelectedCell "); if ( mSelectedCell && mSelectedCell != cell ) { MonthViewCell * mvc = mSelectedCell; mSelectedCell = cell; @@ -1615,6 +1632,7 @@ void KOMonthView::processSelectionChange() emit incidenceSelected( incidences.first() ); } else { emit incidenceSelected( 0 ); + clearSelection(); } } @@ -1663,6 +1681,14 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e ) } e->accept(); break; + case Key_D: + if ( mSelectedCell ) { + mSelectedCell->showDay(); + e->accept(); + } else { + e->ignore(); + } + break; default: e->ignore(); break; diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index f92a69a..fd8cbf2 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h @@ -170,13 +170,16 @@ class MonthViewCell : public QWidget QString mToolTip; void resizeEvent( QResizeEvent * ); + +public slots: + void showDay(); + protected slots: void defaultAction( QListBoxItem * ); void contextMenu( QListBoxItem * ); void selection( QListBoxItem * ); void cellClicked( QListBoxItem * ); void newEvent(); - void showDay(); private: KOMonthView *mMonthView; -- cgit v0.9.0.2