author | zautrix <zautrix> | 2005-06-17 07:51:48 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-17 07:51:48 (UTC) |
commit | 825c34c11200f8ff0229cfb00b82b1880ef55b94 (patch) (side-by-side diff) | |
tree | 243df776d77afe55ca36ca8a78586a9e2fca1888 /korganizer/kotodoviewitem.cpp | |
parent | a04fff3ce192e0bebf9243a1fbedb97cf7108d2b (diff) | |
download | kdepimpi-825c34c11200f8ff0229cfb00b82b1880ef55b94.zip kdepimpi-825c34c11200f8ff0229cfb00b82b1880ef55b94.tar.gz kdepimpi-825c34c11200f8ff0229cfb00b82b1880ef55b94.tar.bz2 |
fixes
Diffstat (limited to 'korganizer/kotodoviewitem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/kotodoviewitem.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp index f62aab8..0cf6e4c 100644 --- a/korganizer/kotodoviewitem.cpp +++ b/korganizer/kotodoviewitem.cpp @@ -267,193 +267,193 @@ void KOTodoViewItem::stateChange(bool state) } if (mTodo->hasStartDate()) { QString skeyt = "=="; QString skeyd = "=="; setText(5, mTodo->dtStartDateStr()); QDate d = mTodo->dtStart().date(); skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); if (mTodo->doesFloat()) { setText(6,""); } else { setText(6,mTodo->dtStartTimeStr()); QTime t = mTodo->dtStart().time(); skeyt.sprintf("%02d%02d",t.hour(),t.minute()); } setSortKey(5,skeyd); setSortKey(6,skeyt); } if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt); else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); if (mTodo->percentComplete()<100) { if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); else setSortKey(2,QString::number(mTodo->percentComplete())); } else { if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); else setSortKey(2,QString::number(99)); } if ( state ) { QListViewItem * myChild = firstChild(); KOTodoViewItem *item; while( myChild ) { //qDebug("stateCH "); item = static_cast<KOTodoViewItem*>(myChild); item->stateChange(state); myChild = myChild->nextSibling(); } } else { QListViewItem * myChild = parent(); if ( myChild ) (static_cast<KOTodoViewItem*>(myChild))->stateChange(state); } mTodoView->modified(true); setMyPixmap(); mTodoView->setTodoModified( mTodo ); } bool KOTodoViewItem::isAlternate() { KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); if (lv && lv->alternateBackground().isValid()) { KOTodoViewItem *above = 0; above = static_cast<KOTodoViewItem *>(itemAbove()); m_known = above ? above->m_known : true; if (m_known) { m_odd = above ? !above->m_odd : false; } else { KOTodoViewItem *item; bool previous = true; if (QListViewItem::parent()) { item = static_cast<KOTodoViewItem *>(QListViewItem::parent()); if (item) previous = item->m_odd; item = static_cast<KOTodoViewItem *>(QListViewItem::parent()->firstChild()); } else { item = static_cast<KOTodoViewItem *>(lv->firstChild()); } while(item) { item->m_odd = previous = !previous; item->m_known = true; item = static_cast<KOTodoViewItem *>(item->nextSibling()); } } return m_odd; } return false; } void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) { QColorGroup _cg = cg; QColorGroup::ColorRole role; - if ( KOPrefs::instance()->mTodoViewUsesForegroundColor ) + if ( KOPrefs::instance()->mTodoViewUsesForegroundColor && !mTodo->isRunning()) role = QColorGroup::Text; else role = QColorGroup::Base; //#ifndef KORG_NOLVALTERNATION if (isAlternate()) _cg.setColor(QColorGroup::Base, static_cast< KOTodoListView* >(listView())->alternateBackground()); bool setColor = KOPrefs::instance()->mTodoViewUsesCatColors; QColor colorToSet; if ( column == 0 && mTodo->calID() > 1 ) { setColor = true; colorToSet = KOPrefs::instance()->defaultColor( mTodo->calID() ); } else if ( setColor ) { QStringList categories = mTodo->categories(); QString cat = categories.first(); if ( !cat.isEmpty()) { colorToSet = *(KOPrefs::instance()->categoryColor(cat) ); } else setColor = false; } bool openMode = !isOpen(); // maybe we are in flat-display-mode if ( !firstChild() ) openMode = false; bool colorRunning = mTodo->isRunning(); if ( ! colorRunning && openMode ) colorRunning = mTodo->hasRunningSub(); if ( colorRunning ) { setColor = true; colorToSet = KOPrefs::instance()->mTodoRunColor; } else { int odue = mTodo->hasDueSubTodo( openMode ); if (odue == 2) { colorToSet = KOPrefs::instance()->mTodoOverdueColor; setColor = true; } else if ( odue == 1 ) { colorToSet = KOPrefs::instance()->mTodoDueTodayColor; setColor = true; } } if ( setColor ) { _cg.setColor(role,colorToSet ); if ( role == QColorGroup::Base) { int rgb = colorToSet.red(); rgb += colorToSet.blue()/2; rgb += colorToSet.green(); if ( rgb < 200 ) _cg.setColor(QColorGroup::Text,Qt::white ); } } //#endif if ( column > 0 ){ if ( column == 2 && !KOPrefs::instance()->mTodoViewShowsPercentage ) { p->save(); int progress = (int)(( (width-6)*mTodo->percentComplete())/100.0 + 0.5); p->fillRect( 0, 0, width, height(), _cg.base() ); // background // p->setPen(Qt::black ); //border // p->setBrush( KOPrefs::instance()->mHighlightColorKGlobalSettings::baseColor() ); //filling QColor fc = KOPrefs::instance()->mHighlightColor; if ( mTodo->percentComplete() == 100 ) fc = darkGreen; p->drawRect( 2, 2, width-4, height()-4); p->fillRect( 3, 3, progress, height()-6, fc ); p->restore(); } else { QCheckListItem::paintCell(p, _cg, column, width, alignment); } return; } int align = alignment; if ( !p ) return; p->fillRect( 0, 0, width, height(), _cg.brush( QColorGroup::Base ) ); QListView *lv = listView(); if ( !lv ) return; int marg = 2;//lv->itemMargin(); int r = 0; QCheckListItem::Type myType = QCheckListItem::CheckBox; int BoxSize = 20; int boxOffset = 2; int xOffset = 2; if (qApp->desktop()->width() < 300 ) { BoxSize = 14; boxOffset = -1; xOffset = 1; // marg = 0; } if ( height() < BoxSize ) { |