From 793d117812b4da36c9c11d90cccba347cbc6e208 Mon Sep 17 00:00:00 2001 From: zautrix Date: Wed, 08 Jun 2005 10:34:22 +0000 Subject: changed incidence type to a faster access method --- (limited to 'korganizer/koagendaitem.cpp') diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index df2e478..5a3c4d2 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp @@ -106,7 +106,7 @@ void KOAgendaItem::init ( Incidence *incidence, QDate qd ) mLastMultiItem = 0; computeText(); - if ( (incidence->type() == "Todo") && + if ( (incidence->typeID() == todoID ) && ( !((static_cast(incidence))->isCompleted()) && ((static_cast(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { if ( (static_cast(incidence))->dtDue() < QDateTime::currentDateTime().date()) @@ -118,13 +118,13 @@ void KOAgendaItem::init ( Incidence *incidence, QDate qd ) QStringList categories = mIncidence->categories(); QString cat = categories.first(); if (cat.isEmpty()) { - if ( (incidence->type() == "Todo") &&((static_cast(incidence))->isCompleted()) ) + if ( (incidence->typeID() == todoID ) &&((static_cast(incidence))->isCompleted()) ) mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; else mBackgroundColor =KOPrefs::instance()->mEventColor; } else { mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); - if ( (incidence->type() == "Todo") &&((static_cast(incidence))->isCompleted()) ) { + if ( (incidence->typeID() == todoID ) &&((static_cast(incidence))->isCompleted()) ) { if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; } @@ -359,7 +359,7 @@ void KOAgendaItem::paintMe( bool selected, QPainter* paint ) paint->fillRect ( x, yy, w, h, mBackgroundColor ); static const QPixmap completedPxmp = SmallIcon("greenhook16"); static const QPixmap overduePxmp = SmallIcon("redcross16"); - if ( mIncidence->type() == "Todo" ) { + if ( mIncidence->typeID() == todoID ) { Todo* tempTodo = static_cast(mIncidence); int xx = pos().x()+(width()-completedPxmp.width()-3 ); int yyy = yy+3; @@ -540,7 +540,7 @@ void KOAgendaItem::paintEvent ( QPaintEvent *e ) void KOAgendaItem::computeText() { mDisplayedText = mIncidence->summary(); - if ( (mIncidence->type() == "Todo") ) { + if ( (mIncidence->typeID() == todoID ) ) { if ( static_cast(mIncidence)->hasDueDate() ) { if ( static_cast(mIncidence)->dtDue().date() < QDate::currentDate() ) mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast(mIncidence))->dtDue().date(), true)+")"; @@ -572,7 +572,7 @@ void KOAgendaItem::computeText() #ifdef DESKTOP_VERSION QString tipText = mIncidence->summary(); if ( !mIncidence->doesFloat() ) { - if ( mIncidence->type() == "Event" ) { + if ( mIncidence->typeID() == eventID ) { if ( (static_cast(mIncidence))->isMultiDay() ) { tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); tipText += "\n"+i18n("To: ")+(static_cast(mIncidence))->dtEndStr(); @@ -582,13 +582,13 @@ void KOAgendaItem::computeText() tipText += " - "+(static_cast(mIncidence))->dtEndTimeStr(); } } - else if ( mIncidence->type() == "Todo" ) { + else if ( mIncidence->typeID() == todoID ) { if (mIncidence->hasStartDate()) tipText += "\n"+i18n("Start: ")+ (static_cast(mIncidence))->dtStartStr(); if (((Todo*)mIncidence)->hasDueDate()) tipText += "\n"+i18n("Due: ")+ (static_cast(mIncidence))->dtDueStr(); } - } else if ( mIncidence->type() == "Todo" ) { + } else if ( mIncidence->typeID() == todoID ) { if (mIncidence->hasStartDate()) tipText += "\n"+i18n("Start: ")+ (static_cast(mIncidence))->dtStartDateStr(); if (((Todo*)mIncidence)->hasDueDate()) -- cgit v0.9.0.2