summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-07-03 20:25:46 (UTC)
committer zautrix <zautrix>2005-07-03 20:25:46 (UTC)
commitad66f0fe56bb88104fb0065ccb599ab0edd35cf4 (patch) (unidiff)
tree13936362717d3a3ca36404ad5b522574418d1d89
parentf9a1b1e8ac52218360731fae67993704c20f17fe (diff)
downloadkdepimpi-ad66f0fe56bb88104fb0065ccb599ab0edd35cf4.zip
kdepimpi-ad66f0fe56bb88104fb0065ccb599ab0edd35cf4.tar.gz
kdepimpi-ad66f0fe56bb88104fb0065ccb599ab0edd35cf4.tar.bz2
icon agenda fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaitem.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index c055eb8..9fe1be4 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -5,623 +5,628 @@
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#include <qlabel.h> 20#include <qlabel.h>
21#include <qlayout.h> 21#include <qlayout.h>
22#include <qhbox.h> 22#include <qhbox.h>
23#include <qvbox.h> 23#include <qvbox.h>
24#include <qtooltip.h> 24#include <qtooltip.h>
25#include <qwhatsthis.h> 25#include <qwhatsthis.h>
26#include <qdragobject.h> 26#include <qdragobject.h>
27#include <qdrawutil.h> 27#include <qdrawutil.h>
28#include <qpainter.h> 28#include <qpainter.h>
29 29
30#include <kiconloader.h> 30#include <kiconloader.h>
31#include <kdebug.h> 31#include <kdebug.h>
32#include <kglobal.h> 32#include <kglobal.h>
33#include <klocale.h> 33#include <klocale.h>
34#ifndef DESKTOP_VERSION 34#ifndef DESKTOP_VERSION
35#include <qpe/qpeapplication.h> 35#include <qpe/qpeapplication.h>
36#define AGENDA_ICON_SIZE 5 36#define AGENDA_ICON_SIZE 5
37#else 37#else
38#include <qapplication.h> 38#include <qapplication.h>
39#define AGENDA_ICON_SIZE 7 39#define AGENDA_ICON_SIZE 7
40#endif 40#endif
41#include <libkcal/icaldrag.h> 41#include <libkcal/icaldrag.h>
42#include <libkcal/vcaldrag.h> 42#include <libkcal/vcaldrag.h>
43#include <libkcal/kincidenceformatter.h> 43#include <libkcal/kincidenceformatter.h>
44extern int globalFlagBlockAgenda; 44extern int globalFlagBlockAgenda;
45extern int globalFlagBlockAgendaItemPaint; 45extern int globalFlagBlockAgendaItemPaint;
46extern int globalFlagBlockAgendaItemUpdate; 46extern int globalFlagBlockAgendaItemUpdate;
47 47
48#include "koprefs.h" 48#include "koprefs.h"
49 49
50#include "koagendaitem.h" 50#include "koagendaitem.h"
51//#include "koagendaitem.moc" 51//#include "koagendaitem.moc"
52 52
53 53
54//-------------------------------------------------------------------------- 54//--------------------------------------------------------------------------
55 55
56QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; 56QToolTipGroup *KOAgendaItem::mToolTipGroup = 0;
57 57
58//-------------------------------------------------------------------------- 58//--------------------------------------------------------------------------
59 59
60class KOAgendaItemWhatsThis :public QWhatsThis 60class KOAgendaItemWhatsThis :public QWhatsThis
61{ 61{
62public: 62public:
63 KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { }; 63 KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { };
64 64
65protected: 65protected:
66 virtual QString text( const QPoint& ) 66 virtual QString text( const QPoint& )
67 { 67 {
68 return _view->getWhatsThisText() ; 68 return _view->getWhatsThisText() ;
69 } 69 }
70private: 70private:
71 KOAgendaItem * _view; 71 KOAgendaItem * _view;
72}; 72};
73 73
74KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, 74KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday,
75 const char *name,WFlags) : 75 const char *name,WFlags) :
76 QWidget(parent, name), mIncidence(incidence), mDate(qd) 76 QWidget(parent, name), mIncidence(incidence), mDate(qd)
77{ 77{
78#ifndef DESKTOP_VERSION 78#ifndef DESKTOP_VERSION
79 //QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); 79 //QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold );
80#endif 80#endif
81 mKOAgendaItemWhatsThis = new KOAgendaItemWhatsThis(this); 81 mKOAgendaItemWhatsThis = new KOAgendaItemWhatsThis(this);
82 int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase 82 int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase
83 setWFlags ( wflags); 83 setWFlags ( wflags);
84 mAllDay = allday; 84 mAllDay = allday;
85 init ( incidence, qd ); 85 init ( incidence, qd );
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}
91QString KOAgendaItem::getWhatsThisText() 91QString 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 100
101void KOAgendaItem::initColor () 101void KOAgendaItem::initColor ()
102{ 102{
103 if ( (mIncidence->typeID() == todoID ) && 103 if ( (mIncidence->typeID() == todoID ) &&
104 ( !((static_cast<Todo*>(mIncidence))->isCompleted()) && 104 ( !((static_cast<Todo*>(mIncidence))->isCompleted()) &&
105 ((static_cast<Todo*>(mIncidence))->dtDue().date() <= QDate::currentDate()) ) ) { 105 ((static_cast<Todo*>(mIncidence))->dtDue().date() <= QDate::currentDate()) ) ) {
106 if ( (static_cast<Todo*>(mIncidence))->dtDue() < QDateTime::currentDateTime().date()) 106 if ( (static_cast<Todo*>(mIncidence))->dtDue() < QDateTime::currentDateTime().date())
107 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; 107 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ;
108 else 108 else
109 mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; 109 mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor;
110 } 110 }
111 else { 111 else {
112 QStringList categories = mIncidence->categories(); 112 QStringList categories = mIncidence->categories();
113 QString cat = categories.first(); 113 QString cat = categories.first();
114 if (cat.isEmpty()) { 114 if (cat.isEmpty()) {
115 if ( (mIncidence->typeID() == todoID ) &&((static_cast<Todo*>(mIncidence))->isCompleted()) ) 115 if ( (mIncidence->typeID() == todoID ) &&((static_cast<Todo*>(mIncidence))->isCompleted()) )
116 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; 116 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
117 else 117 else
118 mBackgroundColor =KOPrefs::instance()->defaultColor( mIncidence->calID() ); 118 mBackgroundColor =KOPrefs::instance()->defaultColor( mIncidence->calID() );
119 } else { 119 } else {
120 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); 120 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat);
121 if ( (mIncidence->typeID() == todoID ) &&((static_cast<Todo*>(mIncidence))->isCompleted()) ) { 121 if ( (mIncidence->typeID() == todoID ) &&((static_cast<Todo*>(mIncidence))->isCompleted()) ) {
122 if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) 122 if ( mBackgroundColor == KOPrefs::instance()->mEventColor )
123 mBackgroundColor = KOPrefs::instance()->mTodoDoneColor; 123 mBackgroundColor = KOPrefs::instance()->mTodoDoneColor;
124 } 124 }
125 } 125 }
126 126
127 } 127 }
128 128
129 QColor BackgroundColor ( mBackgroundColor ); 129 QColor BackgroundColor ( mBackgroundColor );
130 if ( mIncidence->calID() > 1 ) { 130 if ( mIncidence->calID() > 1 ) {
131 //BackgroundColor = KOPrefs::instance()->defaultColor( mIncidence->calID() ); 131 //BackgroundColor = KOPrefs::instance()->defaultColor( mIncidence->calID() );
132 } 132 }
133 mColorGroup = QColorGroup( BackgroundColor.light(), 133 mColorGroup = QColorGroup( BackgroundColor.light(),
134 BackgroundColor.dark(),BackgroundColor.light(), 134 BackgroundColor.dark(),BackgroundColor.light(),
135 BackgroundColor.dark(),BackgroundColor, black, BackgroundColor) ; 135 BackgroundColor.dark(),BackgroundColor, black, BackgroundColor) ;
136 setBackgroundColor( mBackgroundColor ); 136 setBackgroundColor( mBackgroundColor );
137 mWhiteText = (mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue() < 250); 137 mWhiteText = (mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue() < 250);
138} 138}
139void KOAgendaItem::init ( Incidence *incidence, QDate qd ) 139void KOAgendaItem::init ( Incidence *incidence, QDate qd )
140{ 140{
141 mIncidence = incidence; 141 mIncidence = incidence;
142 mDate = qd; 142 mDate = qd;
143 mFirstMultiItem = 0; 143 mFirstMultiItem = 0;
144 mNextMultiItem = 0; 144 mNextMultiItem = 0;
145 mLastMultiItem = 0; 145 mLastMultiItem = 0;
146 computeText(); 146 computeText();
147 initColor(); 147 initColor();
148 mConflictItems.clear(); 148 mConflictItems.clear();
149 setCellXY(0,0,1); 149 setCellXY(0,0,1);
150 setCellXWidth(0); 150 setCellXWidth(0);
151 setSubCell(0); 151 setSubCell(0);
152 setSubCells(1); 152 setSubCells(1);
153 setMultiItem(0,0,0); 153 setMultiItem(0,0,0);
154 startMove(); 154 startMove();
155 mSelected = true; 155 mSelected = true;
156 select(false); 156 select(false);
157 QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); 157 QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont);
158 mFontPixelSize = fontinf.height();; 158 mFontPixelSize = fontinf.height();;
159 hide(); 159 hide();
160 xPaintCoord = -1; 160 xPaintCoord = -1;
161 yPaintCoord = -1; 161 yPaintCoord = -1;
162} 162}
163 163
164 164
165KOAgendaItem::~KOAgendaItem() 165KOAgendaItem::~KOAgendaItem()
166{ 166{
167#if QT_VERSION >= 0x030000 167#if QT_VERSION >= 0x030000
168 168
169#else 169#else
170 delete mKOAgendaItemWhatsThis; 170 delete mKOAgendaItemWhatsThis;
171#endif 171#endif
172 172
173} 173}
174 174
175void KOAgendaItem::recreateIncidence() 175void KOAgendaItem::recreateIncidence()
176{ 176{
177#if 0 177#if 0
178 Incidence* newInc = mIncidence->clone(); 178 Incidence* newInc = mIncidence->clone();
179 newInc->recreate(); 179 newInc->recreate();
180 if ( mIncidence->doesRecur() ) { 180 if ( mIncidence->doesRecur() ) {
181 mIncidence->addExDate( mDate ); 181 mIncidence->addExDate( mDate );
182 newInc->recurrence()->unsetRecurs(); 182 newInc->recurrence()->unsetRecurs();
183 int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); 183 int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd());
184 QTime tim = mIncidence->dtStart().time(); 184 QTime tim = mIncidence->dtStart().time();
185 newInc->setDtStart( QDateTime(mDate, tim) ); 185 newInc->setDtStart( QDateTime(mDate, tim) );
186 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); 186 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) );
187 } 187 }
188#endif 188#endif
189 mIncidence = mIncidence->recreateCloneException( mDate ); 189 mIncidence = mIncidence->recreateCloneException( mDate );
190} 190}
191bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) 191bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout)
192{ 192{
193 int size = AGENDA_ICON_SIZE; 193 int size = AGENDA_ICON_SIZE;
194 194
195 int yOff = 0; 195 int yOff = 0;
196 int xOff = 0; 196 int xOff = 0;
197 int x = pos().x() +3; 197 int x = pos().x();
198
199 if ( x < 0 ) x = 0;
200 x += 3;
198 int y; 201 int y;
199 if ( mAllDay ) 202 if ( mAllDay )
200 y = pos().y()+3; 203 y = pos().y()+3;
201 else 204 else
202 y = mCellYTop * ( height() / cellHeight() ) +3; 205 y = mCellYTop * ( height() / cellHeight() ) +3;
203 206
204 207
205 if ( mIncidence->calID() > 1 ) { 208 if ( mIncidence->calID() > 1 ) {
206 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, KOPrefs::instance()->defaultColor( mIncidence->calID() ) ); 209 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, KOPrefs::instance()->defaultColor( mIncidence->calID() ) );
207 p->drawRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x-1, yOff*( 1 +AGENDA_ICON_SIZE)+y-1, AGENDA_ICON_SIZE+2, AGENDA_ICON_SIZE+2 ); 210 p->drawRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x-1, yOff*( 1 +AGENDA_ICON_SIZE)+y-1, AGENDA_ICON_SIZE+2, AGENDA_ICON_SIZE+2 );
208 if ( horLayout ){ 211 if ( horLayout ){
209 ++xOff; 212 ++xOff;
210 ++x; 213 ++x;
211 } 214 }
212 else { 215 else {
213 ++yOff; 216 ++yOff;
214 ++y; 217 ++y;
215 } 218 }
216 } 219 }
217 if (mIncidence->cancelled()) { 220 if (mIncidence->cancelled() && height() < 20 ) {
218 int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; 221 int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x;
219 int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; 222 int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y;
220 p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); 223 p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 );
221 p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); 224 p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos );
222 if ( horLayout ) 225 if ( horLayout )
223 ++xOff; 226 ++xOff;
224 else 227 else
225 ++yOff; 228 ++yOff;
226 } 229 }
227 if (mIncidence->isAlarmEnabled() && mIncidence->alarmEnabled()) { 230 if (mIncidence->isAlarmEnabled() && mIncidence->alarmEnabled()) {
228 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); 231 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red );
229 if ( horLayout ) 232 if ( horLayout )
230 ++xOff; 233 ++xOff;
231 else 234 else
232 ++yOff; 235 ++yOff;
233 } 236 }
234 if (mIncidence->recurrence()->doesRecur()) { 237 if (mIncidence->recurrence()->doesRecur()) {
235 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); 238 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue );
236 if ( horLayout ) 239 if ( horLayout )
237 ++xOff; 240 ++xOff;
238 else 241 else
239 ++yOff; 242 ++yOff;
240 } 243 }
241 if (mIncidence->description().length() > 0) { 244 if (mIncidence->description().length() > 0) {
242 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); 245 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen );
243 if ( horLayout ) 246 if ( horLayout )
244 ++xOff; 247 ++xOff;
245 else 248 else
246 ++yOff; 249 ++yOff;
247 } 250 }
248 if (mIncidence->isReadOnly()) { 251 if (mIncidence->isReadOnly()) {
249 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); 252 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white );
250 if ( horLayout ) 253 if ( horLayout )
251 ++xOff; 254 ++xOff;
252 else 255 else
253 ++yOff; 256 ++yOff;
254 } 257 }
255 258
256 if (mIncidence->attendeeCount()>0) { 259 if (mIncidence->attendeeCount()>0) {
257 260
258 if (mIncidence->organizer() == KOPrefs::instance()->email()) { 261 if (mIncidence->organizer() == KOPrefs::instance()->email()) {
259 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); 262 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black );
260 if ( horLayout ) 263 if ( horLayout )
261 ++xOff; 264 ++xOff;
262 else 265 else
263 ++yOff; 266 ++yOff;
264 } else { 267 } else {
265 Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 268 Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
266 if (me!=0) { 269 if (me!=0) {
267 270
268 271
269 } else { 272 } else {
270 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); 273 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow );
271 if ( horLayout ) 274 if ( horLayout )
272 ++xOff; 275 ++xOff;
273 else 276 else
274 ++yOff; 277 ++yOff;
275 278
276 } 279 }
277 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); 280 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow );
278 if ( horLayout ) 281 if ( horLayout )
279 ++xOff; 282 ++xOff;
280 else 283 else
281 ++yOff; 284 ++yOff;
282 285
283 } 286 }
284 287
285 } 288 }
286 return ( yOff || xOff ); 289 return ( yOff || xOff );
287} 290}
288 291
289 292
290void KOAgendaItem::select(bool selected) 293void KOAgendaItem::select(bool selected)
291{ 294{
292 //qDebug("select %d %d",firstMultiItem(), nextMultiItem() ); 295 //qDebug("select %d %d",firstMultiItem(), nextMultiItem() );
293 if (mSelected == selected) return; 296 if (mSelected == selected) return;
294 mSelected = selected; 297 mSelected = selected;
295 if ( ! isVisible() ) 298 if ( ! isVisible() )
296 return; 299 return;
297 if ( firstMultiItem() ) 300 if ( firstMultiItem() )
298 firstMultiItem()->select( selected ); 301 firstMultiItem()->select( selected );
299 if ( !firstMultiItem() && nextMultiItem() ) { 302 if ( !firstMultiItem() && nextMultiItem() ) {
300 KOAgendaItem * placeItem = nextMultiItem(); 303 KOAgendaItem * placeItem = nextMultiItem();
301 while ( placeItem ) { 304 while ( placeItem ) {
302 placeItem->select( selected ); 305 placeItem->select( selected );
303 placeItem = placeItem->nextMultiItem(); 306 placeItem = placeItem->nextMultiItem();
304 } 307 }
305 } 308 }
306 globalFlagBlockAgendaItemUpdate = 0; 309 globalFlagBlockAgendaItemUpdate = 0;
307 paintMe( selected ); 310 paintMe( selected );
308 globalFlagBlockAgendaItemUpdate = 1; 311 globalFlagBlockAgendaItemUpdate = 1;
309 repaint( false ); 312 repaint( false );
310} 313}
311 314
312 315
313/* 316/*
314 The eventFilter has to filter the mouse events of the agenda item childs. The 317 The eventFilter has to filter the mouse events of the agenda item childs. The
315 events are fed into the event handling method of KOAgendaItem. This allows the 318 events are fed into the event handling method of KOAgendaItem. This allows the
316 KOAgenda to handle the KOAgendaItems by using an eventFilter. 319 KOAgenda to handle the KOAgendaItems by using an eventFilter.
317*/ 320*/
318bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e ) 321bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e )
319{ 322{
320 if (e->type() == QEvent::MouseButtonPress || 323 if (e->type() == QEvent::MouseButtonPress ||
321 e->type() == QEvent::MouseButtonDblClick || 324 e->type() == QEvent::MouseButtonDblClick ||
322 e->type() == QEvent::MouseButtonRelease || 325 e->type() == QEvent::MouseButtonRelease ||
323 e->type() == QEvent::MouseMove) { 326 e->type() == QEvent::MouseMove) {
324 QMouseEvent *me = (QMouseEvent *)e; 327 QMouseEvent *me = (QMouseEvent *)e;
325 QPoint itemPos = this->mapFromGlobal(((QWidget *)object)-> 328 QPoint itemPos = this->mapFromGlobal(((QWidget *)object)->
326 mapToGlobal(me->pos())); 329 mapToGlobal(me->pos()));
327 QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state()); 330 QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state());
328 return event(&returnEvent); 331 return event(&returnEvent);
329 } else { 332 } else {
330 return false; 333 return false;
331 } 334 }
332} 335}
333void KOAgendaItem::repaintMe( ) 336void KOAgendaItem::repaintMe( )
334{ 337{
335 paintMe ( mSelected ); 338 paintMe ( mSelected );
336} 339}
337void KOAgendaItem::paintMe( bool selected, QPainter* paint ) 340void KOAgendaItem::paintMe( bool selected, QPainter* paint )
338{ 341{
339 if ( globalFlagBlockAgendaItemUpdate && ! selected) 342 if ( globalFlagBlockAgendaItemUpdate && ! selected)
340 return; 343 return;
341 QPainter pa; 344 QPainter pa;
342 345
343 if ( mSelected ) { 346 if ( mSelected ) {
344 pa.begin( paintPixSel() ); 347 pa.begin( paintPixSel() );
345 } else { 348 } else {
346 if ( mAllDay ) 349 if ( mAllDay )
347 pa.begin( paintPixAllday() ); 350 pa.begin( paintPixAllday() );
348 else 351 else
349 pa.begin( paintPix() ); 352 pa.begin( paintPix() );
350 } 353 }
351 int x, yy, w, h; 354 int x, yy, w, h;
352 float nfh = 7.0; 355 float nfh = 7.0;
353 x = pos().x(); w = width(); h = height (); 356 x = pos().x(); w = width(); h = height ();
354 if ( mAllDay ) 357 if ( mAllDay )
355 yy = y(); 358 yy = y();
356 else 359 else
357 yy = mCellYTop * ( height() / cellHeight() ); 360 yy = mCellYTop * ( height() / cellHeight() );
358 xPaintCoord= x; 361 xPaintCoord= x;
359 yPaintCoord = yy; 362 yPaintCoord = yy;
360 wPaintCoord = width(); 363 wPaintCoord = width();
361 hPaintCoord = height(); 364 hPaintCoord = height();
362 //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height()); 365 //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height());
363 if ( paint == 0 ) 366 if ( paint == 0 )
364 paint = &pa; 367 paint = &pa;
365 bool horLayout = ( w < h ); 368 bool horLayout = ( w < h );
366 int maxhei = mFontPixelSize+4; 369 int maxhei = mFontPixelSize+4;
367 if ( horLayout ) 370 if ( horLayout )
368 maxhei += AGENDA_ICON_SIZE -4; 371 maxhei += AGENDA_ICON_SIZE -4;
369 bool small = ( h < maxhei ); 372 bool small = ( h < maxhei );
370 if ( ! small ) 373 if ( ! small )
371 paint->setFont(KOPrefs::instance()->mAgendaViewFont); 374 paint->setFont(KOPrefs::instance()->mAgendaViewFont);
372 else { 375 else {
373 QFont f = KOPrefs::instance()->mAgendaViewFont; 376 QFont f = KOPrefs::instance()->mAgendaViewFont;
374 f.setBold( false ); 377 f.setBold( false );
375 int fh = f.pointSize(); 378 int fh = f.pointSize();
376 nfh = (((float)height())/(float)(mFontPixelSize+4))*fh; 379 nfh = (((float)height())/(float)(mFontPixelSize+4))*fh;
377 if ( nfh < 6 ) 380 if ( nfh < 6 )
378 nfh = 6; 381 nfh = 6;
379 f.setPointSize( nfh ); 382 f.setPointSize( nfh );
380 paint->setFont(f); 383 paint->setFont(f);
381 } 384 }
382 paint->fillRect ( x, yy, w, h, mBackgroundColor ); 385 paint->fillRect ( x, yy, w, h, mBackgroundColor );
383 static const QPixmap completedPxmp = SmallIcon("greenhook16"); 386 static const QPixmap completedPxmp = SmallIcon("greenhook16");
384 static const QPixmap overduePxmp = SmallIcon("redcross16"); 387 static const QPixmap overduePxmp = SmallIcon("redcross16");
385 if ( mIncidence->typeID() == todoID ) { 388 if ( mIncidence->typeID() == todoID ) {
386 Todo* tempTodo = static_cast<Todo*>(mIncidence); 389 Todo* tempTodo = static_cast<Todo*>(mIncidence);
387 int xx = pos().x()+(width()-completedPxmp.width()-3 ); 390 int xx = pos().x()+(width()-completedPxmp.width()-3 );
388 int yyy = yy+3; 391 int yyy = yy+3;
389 if ( tempTodo->isCompleted() ) 392 if ( tempTodo->isCompleted() )
390 paint->drawPixmap ( xx, yyy, completedPxmp ); 393 paint->drawPixmap ( xx, yyy, completedPxmp );
391 else { 394 else {
392 paint->drawPixmap ( xx, yyy, overduePxmp ); 395 paint->drawPixmap ( xx, yyy, overduePxmp );
393 396
394 } 397 }
395 } 398 }
396 bool addIcon = false; 399 bool addIcon = false;
397 if ( ! small || w > 3 * h || h > 3* w ) 400 if ( ! small || w > 3 * h || h > 3* w )
398 addIcon = updateIcons( paint, horLayout ); 401 addIcon = updateIcons( paint, horLayout );
399 402
400 //qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0); 403 //qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0);
401 qDrawWinPanel (paint, x, yy, w, h, mColorGroup, selected ,0); 404 qDrawWinPanel (paint, x, yy, w, h, mColorGroup, selected ,0);
402 //qDebug("draw rect %d %d %d %d ",x, yy, w, h ); 405 //qDebug("draw rect %d %d %d %d ",x, yy, w, h );
403 if ( ! small ) { 406 if ( ! small ) {
404 x += 3; yy += 3;w -= 6; h-= 5; 407 x += 3; yy += 3;w -= 6; h-= 5;
405 } else { 408 } else {
406 x += 2; yy += 1;w -= 4; h-= 4; 409 x += 2; yy += 1;w -= 4; h-= 4;
407 if ( nfh < 6.01 ) { 410 if ( nfh < 6.01 ) {
408 yy -= 2; 411 yy -= 2;
409 h += 4; 412 h += 4;
410 } 413 }
411 else 414 else
412 if ( nfh < h -2 ) 415 if ( nfh < h -2 )
413 ++yy; 416 ++yy;
414 } 417 }
415 int align; 418 int align;
416#ifndef DESKTOP_VERSION 419#ifndef DESKTOP_VERSION
417 align = ( AlignLeft|WordBreak|AlignTop); 420 align = ( AlignLeft|WordBreak|AlignTop);
418#else 421#else
419 align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop); 422 align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
420#endif 423#endif
421 if ( addIcon ) { 424 if ( addIcon ) {
422 if ( ! horLayout ) { 425 if ( ! horLayout ) {
423 x += AGENDA_ICON_SIZE+3; 426 x += AGENDA_ICON_SIZE+3;
424 w -= (AGENDA_ICON_SIZE+3); 427 w -= (AGENDA_ICON_SIZE+3);
425 } 428 }
426 else { 429 else {
427 yy+= AGENDA_ICON_SIZE+2; 430 yy+= AGENDA_ICON_SIZE+2;
428 h -=(AGENDA_ICON_SIZE+3); 431 h -=(AGENDA_ICON_SIZE+3);
429 } 432 }
430 } 433 }
431 if ( mWhiteText ) 434 if ( mWhiteText )
432 paint->setPen ( white); 435 paint->setPen ( white);
433 if ( x < 0 ) { 436 if ( x < 0 ) {
434 w = w+x-3; 437 w = w+x-3;
435 x = 3; 438 x = 3;
439 if ( !horLayout && addIcon )
440 x += AGENDA_ICON_SIZE+3;
436 if ( w > parentWidget()->width() ){ 441 if ( w > parentWidget()->width() ){
437 w = parentWidget()->width() - 6; 442 w = parentWidget()->width() - 6;
438#ifndef DESKTOP_VERSION 443#ifndef DESKTOP_VERSION
439 align = ( AlignHCenter|WordBreak|AlignTop); 444 align = ( AlignHCenter|WordBreak|AlignTop);
440#else 445#else
441 align = ( AlignHCenter|BreakAnywhere|WordBreak|AlignTop); 446 align = ( AlignHCenter|BreakAnywhere|WordBreak|AlignTop);
442#endif 447#endif
443 448
444 } 449 }
445 } 450 }
446 QRect dr; 451 QRect dr;
447 if ( w + x > parentWidget()->width() ) 452 if ( w + x > parentWidget()->width() )
448 w = parentWidget()->width()-x; 453 w = parentWidget()->width()-x;
449 paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr ); 454 paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr );
450 //qDebug("%d %d %d %d ", x, yy, w, h ); 455 //qDebug("%d %d %d %d ", x, yy, w, h );
451 if ( mIncidence->cancelled() ){ 456 if ( mIncidence->cancelled() ){
452 457
453 458
454 small = ( height() < 20 ); 459 small = ( height() < 20 );
455 460
456 if ( ! small ) { 461 if ( ! small ) {
457 QFontMetrics fm ( paint->font() ); 462 QFontMetrics fm ( paint->font() );
458 paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2); 463 paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2);
459 } 464 }
460 465
461 } 466 }
462 pa.end(); 467 pa.end();
463 468
464} 469}
465void KOAgendaItem::resizePixmap( int w , int h ) 470void KOAgendaItem::resizePixmap( int w , int h )
466{ 471{
467 paintPix()->resize( w, h ); 472 paintPix()->resize( w, h );
468 paintPixSel()->resize( w, h ); 473 paintPixSel()->resize( w, h );
469 474
470} 475}
471QPixmap * KOAgendaItem::paintPix() 476QPixmap * KOAgendaItem::paintPix()
472{ 477{
473 static QPixmap* mPaintPix = 0; 478 static QPixmap* mPaintPix = 0;
474 if ( ! mPaintPix ) { 479 if ( ! mPaintPix ) {
475 int w = QApplication::desktop()->width(); 480 int w = QApplication::desktop()->width();
476 int h = QApplication::desktop()->height(); 481 int h = QApplication::desktop()->height();
477 mPaintPix = new QPixmap(w,h); 482 mPaintPix = new QPixmap(w,h);
478 } 483 }
479 return mPaintPix ; 484 return mPaintPix ;
480} 485}
481QPixmap * KOAgendaItem::paintPixAllday() 486QPixmap * KOAgendaItem::paintPixAllday()
482{ 487{
483 static QPixmap* mPaintPixA = 0; 488 static QPixmap* mPaintPixA = 0;
484 if ( ! mPaintPixA ) { 489 if ( ! mPaintPixA ) {
485 int w = QApplication::desktop()->width(); 490 int w = QApplication::desktop()->width();
486 int h = QApplication::desktop()->height()/3; 491 int h = QApplication::desktop()->height()/3;
487 mPaintPixA = new QPixmap(w,h); 492 mPaintPixA = new QPixmap(w,h);
488 } 493 }
489 return mPaintPixA ; 494 return mPaintPixA ;
490} 495}
491QPixmap * KOAgendaItem::paintPixSel() 496QPixmap * KOAgendaItem::paintPixSel()
492{ 497{
493 static QPixmap* mPaintPixSel = 0; 498 static QPixmap* mPaintPixSel = 0;
494 if ( ! mPaintPixSel ) { 499 if ( ! mPaintPixSel ) {
495 int w = QApplication::desktop()->width(); 500 int w = QApplication::desktop()->width();
496 int h = QApplication::desktop()->height(); 501 int h = QApplication::desktop()->height();
497 mPaintPixSel = new QPixmap(w,h); 502 mPaintPixSel = new QPixmap(w,h);
498 } 503 }
499 return mPaintPixSel ; 504 return mPaintPixSel ;
500} 505}
501void KOAgendaItem::paintEvent ( QPaintEvent *e ) 506void KOAgendaItem::paintEvent ( QPaintEvent *e )
502{ 507{
503 508
504 if ( globalFlagBlockAgendaItemPaint ) 509 if ( globalFlagBlockAgendaItemPaint )
505 return; 510 return;
506 if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 ) 511 if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 )
507 return; 512 return;
508 int yy; 513 int yy;
509 if ( mAllDay ) 514 if ( mAllDay )
510 yy = y(); 515 yy = y();
511 else 516 else
512 yy = mCellYTop * ( height() / cellHeight() ); 517 yy = mCellYTop * ( height() / cellHeight() );
513 int xx = x(); 518 int xx = x();
514 519
515 if ( xPaintCoord != xx || yPaintCoord != yy || 520 if ( xPaintCoord != xx || yPaintCoord != yy ||
516 wPaintCoord != width() || hPaintCoord != height()) { 521 wPaintCoord != width() || hPaintCoord != height()) {
517 xPaintCoord= xx; 522 xPaintCoord= xx;
518 yPaintCoord = yy; 523 yPaintCoord = yy;
519 wPaintCoord = width(); 524 wPaintCoord = width();
520 hPaintCoord = height(); 525 hPaintCoord = height();
521 globalFlagBlockAgendaItemUpdate = 0; 526 globalFlagBlockAgendaItemUpdate = 0;
522 paintMe( mSelected ); 527 paintMe( mSelected );
523 //qDebug("calling paintMe "); 528 //qDebug("calling paintMe ");
524 globalFlagBlockAgendaItemUpdate = 1; 529 globalFlagBlockAgendaItemUpdate = 1;
525 } 530 }
526 int rx, ry, rw, rh; 531 int rx, ry, rw, rh;
527 rx = e->rect().x(); 532 rx = e->rect().x();
528 ry = e->rect().y(); 533 ry = e->rect().y();
529 rw = e->rect().width(); 534 rw = e->rect().width();
530 rh = e->rect().height(); 535 rh = e->rect().height();
531 //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height()); 536 //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height());
532 537
533 QPixmap* paintFrom ; 538 QPixmap* paintFrom ;
534 if ( mSelected ) { 539 if ( mSelected ) {
535 paintFrom = paintPixSel(); 540 paintFrom = paintPixSel();
536 } else { 541 } else {
537 if ( mAllDay ) 542 if ( mAllDay )
538 paintFrom = paintPixAllday(); 543 paintFrom = paintPixAllday();
539 else 544 else
540 paintFrom = paintPix(); 545 paintFrom = paintPix();
541 } 546 }
542 xx += rx; 547 xx += rx;
543 548
544 if ( xx < 0 ) { 549 if ( xx < 0 ) {
545 rw = rw + xx; 550 rw = rw + xx;
546 rx -= xx; 551 rx -= xx;
547 xx = 0; 552 xx = 0;
548 if ( rw <= 1 ) { 553 if ( rw <= 1 ) {
549 //qDebug("KOAgendaItem::Width1 <= 1 (%d). Returning. %s",rw,mDisplayedText.latin1()); 554 //qDebug("KOAgendaItem::Width1 <= 1 (%d). Returning. %s",rw,mDisplayedText.latin1());
550 return; 555 return;
551 } 556 }
552 } 557 }
553 if ( paintFrom->width() < xx+rw ) { 558 if ( paintFrom->width() < xx+rw ) {
554 rw = paintFrom->width() - xx; 559 rw = paintFrom->width() - xx;
555 if ( rw <= 1 ) { 560 if ( rw <= 1 ) {
556 //qDebug("KOAgendaItem::Width2 <= 1 (%d). Returning.%s ",rw,mDisplayedText.latin1() ); 561 //qDebug("KOAgendaItem::Width2 <= 1 (%d). Returning.%s ",rw,mDisplayedText.latin1() );
557 return; 562 return;
558 } 563 }
559 } 564 }
560 //qDebug("%d %d %d %d %d %d %d",rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh); 565 //qDebug("%d %d %d %d %d %d %d",rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh);
561 bitBlt (this, rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh ,CopyROP); 566 bitBlt (this, rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh ,CopyROP);
562} 567}
563void KOAgendaItem::computeText() 568void KOAgendaItem::computeText()
564{ 569{
565 mDisplayedText = mIncidence->summary(); 570 mDisplayedText = mIncidence->summary();
566 if ( (mIncidence->typeID() == todoID ) ) { 571 if ( (mIncidence->typeID() == todoID ) ) {
567 if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) { 572 if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) {
568 if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() ) 573 if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() )
569 mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")"; 574 mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")";
570 else if ( !(mIncidence->doesFloat())) 575 else if ( !(mIncidence->doesFloat()))
571 mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")"; 576 mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")";
572 } 577 }
573 } else { 578 } else {
574 if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda) 579 if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda)
575 mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + " - " + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ; 580 mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + " - " + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ;
576 581
577 if ( mAllDay ) { 582 if ( mAllDay ) {
578 if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) { 583 if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) {
579 if ( mIncidence->doesRecur() ) { 584 if ( mIncidence->doesRecur() ) {
580 mDisplayedText += " (" + mIncidence->recurrence()->recurrenceText() + ")"; 585 mDisplayedText += " (" + mIncidence->recurrence()->recurrenceText() + ")";
581 } else { 586 } else {
582 mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ; 587 mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ;
583 } 588 }
584 } 589 }
585 } 590 }
586 } 591 }
587 592
588 if ( !mIncidence->location().isEmpty() ) { 593 if ( !mIncidence->location().isEmpty() ) {
589 if ( mAllDay ) 594 if ( mAllDay )
590 mDisplayedText += " ("; 595 mDisplayedText += " (";
591 else 596 else
592 mDisplayedText += "\n("; 597 mDisplayedText += "\n(";
593 mDisplayedText += mIncidence->location() +")"; 598 mDisplayedText += mIncidence->location() +")";
594 } 599 }
595#ifdef DESKTOP_VERSION 600#ifdef DESKTOP_VERSION
596 QString tipText = mIncidence->summary(); 601 QString tipText = mIncidence->summary();
597 if ( !mIncidence->doesFloat() ) { 602 if ( !mIncidence->doesFloat() ) {
598 if ( mIncidence->typeID() == eventID ) { 603 if ( mIncidence->typeID() == eventID ) {
599 if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { 604 if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) {
600 tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); 605 tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr();
601 tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr(); 606 tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr();
602 } 607 }
603 else { 608 else {
604 tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr(); 609 tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr();
605 tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr(); 610 tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr();
606 } 611 }
607 } 612 }
608 else if ( mIncidence->typeID() == todoID ) { 613 else if ( mIncidence->typeID() == todoID ) {
609 if (mIncidence->hasStartDate()) 614 if (mIncidence->hasStartDate())
610 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr(); 615 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr();
611 if (((Todo*)mIncidence)->hasDueDate()) 616 if (((Todo*)mIncidence)->hasDueDate())
612 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr(); 617 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr();
613 } 618 }
614 } else if ( mIncidence->typeID() == todoID ) { 619 } else if ( mIncidence->typeID() == todoID ) {
615 if (mIncidence->hasStartDate()) 620 if (mIncidence->hasStartDate())
616 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr(); 621 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr();
617 if (((Todo*)mIncidence)->hasDueDate()) 622 if (((Todo*)mIncidence)->hasDueDate())
618 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr(); 623 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr();
619 } 624 }
620 625
621 if (!mIncidence->location().isEmpty()) { 626 if (!mIncidence->location().isEmpty()) {
622 tipText += "\n"+i18n("Location: ")+mIncidence->location(); 627 tipText += "\n"+i18n("Location: ")+mIncidence->location();
623 } 628 }
624 QToolTip::add(this,tipText,toolTipGroup(),""); 629 QToolTip::add(this,tipText,toolTipGroup(),"");
625#endif 630#endif
626} 631}
627void KOAgendaItem::updateItem() 632void KOAgendaItem::updateItem()