author | zautrix <zautrix> | 2005-03-10 10:40:57 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-10 10:40:57 (UTC) |
commit | b96161e4dd7fc19eea87257c2455b85420dad35a (patch) (side-by-side diff) | |
tree | d2e518cdc4c6c314f6e42960d12653ad6c7083d3 | |
parent | 4b05d69b961309df5d56714889c62ca530580914 (diff) | |
download | kdepimpi-b96161e4dd7fc19eea87257c2455b85420dad35a.zip kdepimpi-b96161e4dd7fc19eea87257c2455b85420dad35a.tar.gz kdepimpi-b96161e4dd7fc19eea87257c2455b85420dad35a.tar.bz2 |
todo month view fix
-rw-r--r-- | bin/kdepim/WhatsNew.txt | 2 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 32 | ||||
-rw-r--r-- | korganizer/komonthview.h | 5 |
3 files changed, 35 insertions, 4 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index d4b7971..95a1866 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt @@ -5,24 +5,26 @@ Info about the changes in new versions of KDE-Pim/Pi PwM/Pi: Added keyboard shorcuts for - toggling summary view (space bar) - delete item (delete + backspace key) - add new item ( i + n key) Fixed length of info in the title. KO/Pi-KA/Pi: Changed "ME" menu bar entry to an icon. KO/Pi: Fixed two minor bugs in displaying todos. +If in month view a cell is selected, the key shortcut "d" shows now that date. +Added complete info for a todo in month view as an icon left of the text. ********** VERSION 2.0.14 ************ Made Passwordmanager PwM/Pi more userfriendly: Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more. Fixed bug in KO/Pi todo printing. Made Qtopia calendar import possible on desktop . ********** VERSION 2.0.13 ************ Fixed a problem in the addressee select dialog and made it more user friendly by adding a minimize splitter. diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index f983ff9..4bf9dea 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -268,24 +268,40 @@ void MonthViewItem::paint(QPainter *p) // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); } if ( mMultiday == 3 ) { // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); } 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; if( pmheight < fm.height() ) yPos = fm.ascent() + fm.leading()/2; else yPos = pmheight/2 - fm.height()/2 + fm.ascent(); p->setPen( palette().color( QPalette::Normal, sel ? \ QColorGroup::HighlightedText : QColorGroup::Foreground ) ); p->drawText( x, yPos, text() ); if ( mIncidence->cancelled() ) { int wid = fm.width( text() ); @@ -593,25 +609,25 @@ void MonthViewCell::insertEvent(Event *event) mToolTip += "\n"; } void MonthViewCell::insertTodo(Todo *todo) { mItemList->setFocusPolicy(WheelFocus); QString text; if (todo->hasDueDate()) { if (!todo->doesFloat()) { text += KGlobal::locale()->formatTime(todo->dtDue().time()); text += " "; } } - text += i18n("T: %1").arg(todo->summary()); + text += todo->summary(); MonthViewItem *item = new MonthViewItem( todo, mDate, text ); //item->setPalette( mStandardPalette ); QPalette pal; if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { QStringList categories = todo->categories(); QString cat = categories.first(); if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { pal = getPalette(); if (cat.isEmpty()) { pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); } else { @@ -652,25 +668,25 @@ void MonthViewCell::finishUpdateCell() mLabel->resize( mLabelBigSize ); text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); } else { mLabel->resize( mLabelSize ); text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); } mLabel->setText( text ); resizeEvent( 0 ); } void MonthViewCell::updateCell() { - qDebug("MonthViewCell::updateCell() "); + //qDebug("MonthViewCell::updateCell() "); if ( !mMonthView->isUpdatePossible() ) return; startUpdateCell(); //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); Event *event; for( event = events.first(); event; event = events.next() ) { // for event insertEvent(event); } // insert due todos QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); Todo *todo; @@ -1209,24 +1225,25 @@ void KOMonthView::changeEventDisplay(Event *, int) // this should be re-written to be much more efficient, but this // quick-and-dirty-hack gets the job done for right now. updateView(); } void KOMonthView::updateView() { if ( !updatePossible ) return; //QTime ti; //ti.start(); + clearSelection(); QPtrVector<MonthViewCell> *cells; if ( mShowWeekView ) { cells = &mCellsW; } else { cells = &mCells; } #if 1 int i; int timeSpan = (*cells).size()-1; if ( KOPrefs::instance()->mMonthViewWeek ) timeSpan = 6; for( i = 0; i < timeSpan + 1; ++i ) { @@ -1584,46 +1601,47 @@ void KOMonthView::showContextMenu( Incidence *incidence ) mContextMenu->showEventPopup(event); } else { kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; } */ } MonthViewCell * KOMonthView::selectedCell( ) { return mSelectedCell; } void KOMonthView::setSelectedCell( MonthViewCell *cell ) { - // qDebug("KOMonthView::setSelectedCell "); + //qDebug("KOMonthView::setSelectedCell "); if ( mSelectedCell && mSelectedCell != cell ) { MonthViewCell * mvc = mSelectedCell; mSelectedCell = cell; mvc->deselect(); } else mSelectedCell = cell; // if ( mSelectedCell ) // mSelectedCell->select(); if ( !mSelectedCell ) emit incidenceSelected( 0 ); else emit incidenceSelected( mSelectedCell->selectedIncidence() ); } void KOMonthView::processSelectionChange() { QPtrList<Incidence> incidences = selectedIncidences(); if (incidences.count() > 0) { emit incidenceSelected( incidences.first() ); } else { emit incidenceSelected( 0 ); + clearSelection(); } } void KOMonthView::clearSelection() { if ( mSelectedCell ) { mSelectedCell->deselect(); mSelectedCell = 0; } } void KOMonthView::keyPressEvent ( QKeyEvent * e ) { @@ -1654,17 +1672,25 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e ) } } e->accept(); break; case Key_Return: case Key_Enter: { selectInternalWeekNum ( currentWeek() ); } 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 @@ -161,31 +161,34 @@ class MonthViewCell : public QWidget #ifdef DESKTOP_VERSION static QToolTipGroup *toolTipGroup(); #endif signals: void defaultAction( Incidence * ); void newEventSignal( QDateTime ); void showDaySignal( QDate ); protected: 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; QDate mDate; bool mPrimary; bool mHoliday; QString mHolidayString; //QLabel *mLabel; QPushButton *mLabel; QListBox *mItemList; |