-rw-r--r-- | korganizer/koagendaitem.cpp | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index a8e0678..a42d07b 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp | |||
@@ -92,60 +92,64 @@ QString KOAgendaItem::getWhatsThisText() | |||
92 | { | 92 | { |
93 | if ( mIncidence ) | 93 | if ( mIncidence ) |
94 | return KIncidenceFormatter::instance()->getFormattedText( mIncidence, | 94 | return KIncidenceFormatter::instance()->getFormattedText( mIncidence, |
95 | KOPrefs::instance()->mWTshowDetails, | 95 | KOPrefs::instance()->mWTshowDetails, |
96 | KOPrefs::instance()->mWTshowCreated, | 96 | KOPrefs::instance()->mWTshowCreated, |
97 | KOPrefs::instance()->mWTshowChanged); | 97 | KOPrefs::instance()->mWTshowChanged); |
98 | return "KOAgendaItem::getWhatsThisText()::internal error"; | 98 | return "KOAgendaItem::getWhatsThisText()::internal error"; |
99 | } | 99 | } |
100 | void KOAgendaItem::init ( Incidence *incidence, QDate qd ) | ||
101 | { | ||
102 | mIncidence = incidence; | ||
103 | mDate = qd; | ||
104 | mFirstMultiItem = 0; | ||
105 | mNextMultiItem = 0; | ||
106 | mLastMultiItem = 0; | ||
107 | computeText(); | ||
108 | 100 | ||
109 | if ( (incidence->typeID() == todoID ) && | 101 | void KOAgendaItem::initColor () |
110 | ( !((static_cast<Todo*>(incidence))->isCompleted()) && | 102 | { |
111 | ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { | 103 | if ( (mIncidence->typeID() == todoID ) && |
112 | if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) | 104 | ( !((static_cast<Todo*>(mIncidence))->isCompleted()) && |
105 | ((static_cast<Todo*>(mIncidence))->dtDue().date() <= QDate::currentDate()) ) ) { | ||
106 | if ( (static_cast<Todo*>(mIncidence))->dtDue() < QDateTime::currentDateTime().date()) | ||
113 | mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; | 107 | mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; |
114 | else | 108 | else |
115 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; | 109 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; |
116 | } | 110 | } |
117 | else { | 111 | else { |
118 | QStringList categories = mIncidence->categories(); | 112 | QStringList categories = mIncidence->categories(); |
119 | QString cat = categories.first(); | 113 | QString cat = categories.first(); |
120 | if (cat.isEmpty()) { | 114 | if (cat.isEmpty()) { |
121 | if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) ) | 115 | if ( (mIncidence->typeID() == todoID ) &&((static_cast<Todo*>(mIncidence))->isCompleted()) ) |
122 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; | 116 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; |
123 | else | 117 | else |
124 | mBackgroundColor =KOPrefs::instance()->defaultColor( incidence->calID() ); | 118 | mBackgroundColor =KOPrefs::instance()->defaultColor( mIncidence->calID() ); |
125 | } else { | 119 | } else { |
126 | mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); | 120 | mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); |
127 | if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) ) { | 121 | if ( (mIncidence->typeID() == todoID ) &&((static_cast<Todo*>(mIncidence))->isCompleted()) ) { |
128 | if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) | 122 | if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) |
129 | mBackgroundColor = KOPrefs::instance()->mTodoDoneColor; | 123 | mBackgroundColor = KOPrefs::instance()->mTodoDoneColor; |
130 | } | 124 | } |
131 | } | 125 | } |
132 | 126 | ||
133 | } | 127 | } |
134 | 128 | ||
135 | QColor BackgroundColor ( mBackgroundColor ); | 129 | QColor BackgroundColor ( mBackgroundColor ); |
136 | if ( mIncidence->calID() > 1 ) { | 130 | if ( mIncidence->calID() > 1 ) { |
137 | BackgroundColor = KOPrefs::instance()->defaultColor( mIncidence->calID() ); | 131 | BackgroundColor = KOPrefs::instance()->defaultColor( mIncidence->calID() ); |
138 | } | 132 | } |
139 | mColorGroup = QColorGroup( BackgroundColor.light(), | 133 | mColorGroup = QColorGroup( BackgroundColor.light(), |
140 | BackgroundColor.dark(),BackgroundColor.light(), | 134 | BackgroundColor.dark(),BackgroundColor.light(), |
141 | BackgroundColor.dark(),BackgroundColor, black, BackgroundColor) ; | 135 | BackgroundColor.dark(),BackgroundColor, black, BackgroundColor) ; |
142 | setBackgroundColor( mBackgroundColor ); | 136 | setBackgroundColor( mBackgroundColor ); |
143 | mWhiteText = (mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue() < 250); | 137 | mWhiteText = (mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue() < 250); |
138 | } | ||
139 | void KOAgendaItem::init ( Incidence *incidence, QDate qd ) | ||
140 | { | ||
141 | mIncidence = incidence; | ||
142 | mDate = qd; | ||
143 | mFirstMultiItem = 0; | ||
144 | mNextMultiItem = 0; | ||
145 | mLastMultiItem = 0; | ||
146 | computeText(); | ||
147 | initColor(); | ||
144 | mConflictItems.clear(); | 148 | mConflictItems.clear(); |
145 | setCellXY(0,0,1); | 149 | setCellXY(0,0,1); |
146 | setCellXWidth(0); | 150 | setCellXWidth(0); |
147 | setSubCell(0); | 151 | setSubCell(0); |
148 | setSubCells(1); | 152 | setSubCells(1); |
149 | setMultiItem(0,0,0); | 153 | setMultiItem(0,0,0); |
150 | startMove(); | 154 | startMove(); |
151 | mSelected = true; | 155 | mSelected = true; |