-rw-r--r-- | korganizer/koagendaitem.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index e660c32..a8e0678 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp | |||
@@ -86,99 +86,104 @@ KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool | |||
86 | //setMouseTracking(true); | 86 | //setMouseTracking(true); |
87 | //setAcceptDrops(true); | 87 | //setAcceptDrops(true); |
88 | xPaintCoord = -1; | 88 | xPaintCoord = -1; |
89 | yPaintCoord = -1; | 89 | yPaintCoord = -1; |
90 | } | 90 | } |
91 | QString KOAgendaItem::getWhatsThisText() | 91 | 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 ) | 100 | void KOAgendaItem::init ( Incidence *incidence, QDate qd ) |
101 | { | 101 | { |
102 | mIncidence = incidence; | 102 | mIncidence = incidence; |
103 | mDate = qd; | 103 | mDate = qd; |
104 | mFirstMultiItem = 0; | 104 | mFirstMultiItem = 0; |
105 | mNextMultiItem = 0; | 105 | mNextMultiItem = 0; |
106 | mLastMultiItem = 0; | 106 | mLastMultiItem = 0; |
107 | computeText(); | 107 | computeText(); |
108 | 108 | ||
109 | if ( (incidence->typeID() == todoID ) && | 109 | if ( (incidence->typeID() == todoID ) && |
110 | ( !((static_cast<Todo*>(incidence))->isCompleted()) && | 110 | ( !((static_cast<Todo*>(incidence))->isCompleted()) && |
111 | ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { | 111 | ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { |
112 | if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) | 112 | if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) |
113 | mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; | 113 | mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; |
114 | else | 114 | else |
115 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; | 115 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; |
116 | } | 116 | } |
117 | else { | 117 | else { |
118 | QStringList categories = mIncidence->categories(); | 118 | QStringList categories = mIncidence->categories(); |
119 | QString cat = categories.first(); | 119 | QString cat = categories.first(); |
120 | if (cat.isEmpty()) { | 120 | if (cat.isEmpty()) { |
121 | if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) ) | 121 | if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) ) |
122 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; | 122 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; |
123 | else | 123 | else |
124 | mBackgroundColor =KOPrefs::instance()->defaultColor( incidence->calID() ); | 124 | mBackgroundColor =KOPrefs::instance()->defaultColor( incidence->calID() ); |
125 | } else { | 125 | } else { |
126 | mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); | 126 | mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); |
127 | if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) ) { | 127 | if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) ) { |
128 | if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) | 128 | if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) |
129 | mBackgroundColor = KOPrefs::instance()->mTodoDoneColor; | 129 | mBackgroundColor = KOPrefs::instance()->mTodoDoneColor; |
130 | } | 130 | } |
131 | } | 131 | } |
132 | 132 | ||
133 | } | 133 | } |
134 | mColorGroup = QColorGroup( mBackgroundColor.light(), | 134 | |
135 | mBackgroundColor.dark(),mBackgroundColor.light(), | 135 | QColor BackgroundColor ( mBackgroundColor ); |
136 | mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; | 136 | if ( mIncidence->calID() > 1 ) { |
137 | BackgroundColor = KOPrefs::instance()->defaultColor( mIncidence->calID() ); | ||
138 | } | ||
139 | mColorGroup = QColorGroup( BackgroundColor.light(), | ||
140 | BackgroundColor.dark(),BackgroundColor.light(), | ||
141 | BackgroundColor.dark(),BackgroundColor, black, BackgroundColor) ; | ||
137 | setBackgroundColor( mBackgroundColor ); | 142 | setBackgroundColor( mBackgroundColor ); |
138 | mWhiteText = (mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue() < 250); | 143 | mWhiteText = (mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue() < 250); |
139 | mConflictItems.clear(); | 144 | mConflictItems.clear(); |
140 | setCellXY(0,0,1); | 145 | setCellXY(0,0,1); |
141 | setCellXWidth(0); | 146 | setCellXWidth(0); |
142 | setSubCell(0); | 147 | setSubCell(0); |
143 | setSubCells(1); | 148 | setSubCells(1); |
144 | setMultiItem(0,0,0); | 149 | setMultiItem(0,0,0); |
145 | startMove(); | 150 | startMove(); |
146 | mSelected = true; | 151 | mSelected = true; |
147 | select(false); | 152 | select(false); |
148 | QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); | 153 | QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); |
149 | mFontPixelSize = fontinf.height();; | 154 | mFontPixelSize = fontinf.height();; |
150 | hide(); | 155 | hide(); |
151 | xPaintCoord = -1; | 156 | xPaintCoord = -1; |
152 | yPaintCoord = -1; | 157 | yPaintCoord = -1; |
153 | } | 158 | } |
154 | 159 | ||
155 | 160 | ||
156 | KOAgendaItem::~KOAgendaItem() | 161 | KOAgendaItem::~KOAgendaItem() |
157 | { | 162 | { |
158 | #if QT_VERSION >= 0x030000 | 163 | #if QT_VERSION >= 0x030000 |
159 | 164 | ||
160 | #else | 165 | #else |
161 | delete mKOAgendaItemWhatsThis; | 166 | delete mKOAgendaItemWhatsThis; |
162 | #endif | 167 | #endif |
163 | 168 | ||
164 | } | 169 | } |
165 | 170 | ||
166 | void KOAgendaItem::recreateIncidence() | 171 | void KOAgendaItem::recreateIncidence() |
167 | { | 172 | { |
168 | #if 0 | 173 | #if 0 |
169 | Incidence* newInc = mIncidence->clone(); | 174 | Incidence* newInc = mIncidence->clone(); |
170 | newInc->recreate(); | 175 | newInc->recreate(); |
171 | if ( mIncidence->doesRecur() ) { | 176 | if ( mIncidence->doesRecur() ) { |
172 | mIncidence->addExDate( mDate ); | 177 | mIncidence->addExDate( mDate ); |
173 | newInc->recurrence()->unsetRecurs(); | 178 | newInc->recurrence()->unsetRecurs(); |
174 | int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); | 179 | int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); |
175 | QTime tim = mIncidence->dtStart().time(); | 180 | QTime tim = mIncidence->dtStart().time(); |
176 | newInc->setDtStart( QDateTime(mDate, tim) ); | 181 | newInc->setDtStart( QDateTime(mDate, tim) ); |
177 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); | 182 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); |
178 | } | 183 | } |
179 | #endif | 184 | #endif |
180 | mIncidence = mIncidence->recreateCloneException( mDate ); | 185 | mIncidence = mIncidence->recreateCloneException( mDate ); |
181 | } | 186 | } |
182 | bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) | 187 | bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) |
183 | { | 188 | { |
184 | int size = AGENDA_ICON_SIZE; | 189 | int size = AGENDA_ICON_SIZE; |