-rw-r--r-- | korganizer/koagendaitem.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index a42d07b..c055eb8 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp | |||
@@ -1,586 +1,600 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
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> |
44 | extern int globalFlagBlockAgenda; | 44 | extern int globalFlagBlockAgenda; |
45 | extern int globalFlagBlockAgendaItemPaint; | 45 | extern int globalFlagBlockAgendaItemPaint; |
46 | extern int globalFlagBlockAgendaItemUpdate; | 46 | extern 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 | ||
56 | QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; | 56 | QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; |
57 | 57 | ||
58 | //-------------------------------------------------------------------------- | 58 | //-------------------------------------------------------------------------- |
59 | 59 | ||
60 | class KOAgendaItemWhatsThis :public QWhatsThis | 60 | class KOAgendaItemWhatsThis :public QWhatsThis |
61 | { | 61 | { |
62 | public: | 62 | public: |
63 | KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { }; | 63 | KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { }; |
64 | 64 | ||
65 | protected: | 65 | protected: |
66 | virtual QString text( const QPoint& ) | 66 | virtual QString text( const QPoint& ) |
67 | { | 67 | { |
68 | return _view->getWhatsThisText() ; | 68 | return _view->getWhatsThisText() ; |
69 | } | 69 | } |
70 | private: | 70 | private: |
71 | KOAgendaItem * _view; | 71 | KOAgendaItem * _view; |
72 | }; | 72 | }; |
73 | 73 | ||
74 | KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, | 74 | KOAgendaItem::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 | } |
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 | 100 | ||
101 | void KOAgendaItem::initColor () | 101 | void 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 | } |
139 | void KOAgendaItem::init ( Incidence *incidence, QDate qd ) | 139 | void 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 | ||
165 | KOAgendaItem::~KOAgendaItem() | 165 | KOAgendaItem::~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 | ||
175 | void KOAgendaItem::recreateIncidence() | 175 | void 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 | } |
191 | bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) | 191 | bool 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() +3; |
198 | int y; | 198 | int y; |
199 | if ( mAllDay ) | 199 | if ( mAllDay ) |
200 | y = pos().y()+3; | 200 | y = pos().y()+3; |
201 | else | 201 | else |
202 | y = mCellYTop * ( height() / cellHeight() ) +3; | 202 | y = mCellYTop * ( height() / cellHeight() ) +3; |
203 | |||
204 | |||
205 | 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() ) ); | ||
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 ); | ||
208 | if ( horLayout ){ | ||
209 | ++xOff; | ||
210 | ++x; | ||
211 | } | ||
212 | else { | ||
213 | ++yOff; | ||
214 | ++y; | ||
215 | } | ||
216 | } | ||
203 | if (mIncidence->cancelled()) { | 217 | if (mIncidence->cancelled()) { |
204 | int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; | 218 | int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; |
205 | int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; | 219 | int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; |
206 | p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); | 220 | p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); |
207 | p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); | 221 | p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); |
208 | if ( horLayout ) | 222 | if ( horLayout ) |
209 | ++xOff; | 223 | ++xOff; |
210 | else | 224 | else |
211 | ++yOff; | 225 | ++yOff; |
212 | } | 226 | } |
213 | if (mIncidence->isAlarmEnabled() && mIncidence->alarmEnabled()) { | 227 | if (mIncidence->isAlarmEnabled() && mIncidence->alarmEnabled()) { |
214 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); | 228 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); |
215 | if ( horLayout ) | 229 | if ( horLayout ) |
216 | ++xOff; | 230 | ++xOff; |
217 | else | 231 | else |
218 | ++yOff; | 232 | ++yOff; |
219 | } | 233 | } |
220 | if (mIncidence->recurrence()->doesRecur()) { | 234 | if (mIncidence->recurrence()->doesRecur()) { |
221 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); | 235 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); |
222 | if ( horLayout ) | 236 | if ( horLayout ) |
223 | ++xOff; | 237 | ++xOff; |
224 | else | 238 | else |
225 | ++yOff; | 239 | ++yOff; |
226 | } | 240 | } |
227 | if (mIncidence->description().length() > 0) { | 241 | if (mIncidence->description().length() > 0) { |
228 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); | 242 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); |
229 | if ( horLayout ) | 243 | if ( horLayout ) |
230 | ++xOff; | 244 | ++xOff; |
231 | else | 245 | else |
232 | ++yOff; | 246 | ++yOff; |
233 | } | 247 | } |
234 | if (mIncidence->isReadOnly()) { | 248 | if (mIncidence->isReadOnly()) { |
235 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); | 249 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); |
236 | if ( horLayout ) | 250 | if ( horLayout ) |
237 | ++xOff; | 251 | ++xOff; |
238 | else | 252 | else |
239 | ++yOff; | 253 | ++yOff; |
240 | } | 254 | } |
241 | 255 | ||
242 | if (mIncidence->attendeeCount()>0) { | 256 | if (mIncidence->attendeeCount()>0) { |
243 | 257 | ||
244 | if (mIncidence->organizer() == KOPrefs::instance()->email()) { | 258 | if (mIncidence->organizer() == KOPrefs::instance()->email()) { |
245 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); | 259 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); |
246 | if ( horLayout ) | 260 | if ( horLayout ) |
247 | ++xOff; | 261 | ++xOff; |
248 | else | 262 | else |
249 | ++yOff; | 263 | ++yOff; |
250 | } else { | 264 | } else { |
251 | Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 265 | Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
252 | if (me!=0) { | 266 | if (me!=0) { |
253 | 267 | ||
254 | 268 | ||
255 | } else { | 269 | } else { |
256 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); | 270 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); |
257 | if ( horLayout ) | 271 | if ( horLayout ) |
258 | ++xOff; | 272 | ++xOff; |
259 | else | 273 | else |
260 | ++yOff; | 274 | ++yOff; |
261 | 275 | ||
262 | } | 276 | } |
263 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); | 277 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); |
264 | if ( horLayout ) | 278 | if ( horLayout ) |
265 | ++xOff; | 279 | ++xOff; |
266 | else | 280 | else |
267 | ++yOff; | 281 | ++yOff; |
268 | 282 | ||
269 | } | 283 | } |
270 | 284 | ||
271 | } | 285 | } |
272 | return ( yOff || xOff ); | 286 | return ( yOff || xOff ); |
273 | } | 287 | } |
274 | 288 | ||
275 | 289 | ||
276 | void KOAgendaItem::select(bool selected) | 290 | void KOAgendaItem::select(bool selected) |
277 | { | 291 | { |
278 | //qDebug("select %d %d",firstMultiItem(), nextMultiItem() ); | 292 | //qDebug("select %d %d",firstMultiItem(), nextMultiItem() ); |
279 | if (mSelected == selected) return; | 293 | if (mSelected == selected) return; |
280 | mSelected = selected; | 294 | mSelected = selected; |
281 | if ( ! isVisible() ) | 295 | if ( ! isVisible() ) |
282 | return; | 296 | return; |
283 | if ( firstMultiItem() ) | 297 | if ( firstMultiItem() ) |
284 | firstMultiItem()->select( selected ); | 298 | firstMultiItem()->select( selected ); |
285 | if ( !firstMultiItem() && nextMultiItem() ) { | 299 | if ( !firstMultiItem() && nextMultiItem() ) { |
286 | KOAgendaItem * placeItem = nextMultiItem(); | 300 | KOAgendaItem * placeItem = nextMultiItem(); |
287 | while ( placeItem ) { | 301 | while ( placeItem ) { |
288 | placeItem->select( selected ); | 302 | placeItem->select( selected ); |
289 | placeItem = placeItem->nextMultiItem(); | 303 | placeItem = placeItem->nextMultiItem(); |
290 | } | 304 | } |
291 | } | 305 | } |
292 | globalFlagBlockAgendaItemUpdate = 0; | 306 | globalFlagBlockAgendaItemUpdate = 0; |
293 | paintMe( selected ); | 307 | paintMe( selected ); |
294 | globalFlagBlockAgendaItemUpdate = 1; | 308 | globalFlagBlockAgendaItemUpdate = 1; |
295 | repaint( false ); | 309 | repaint( false ); |
296 | } | 310 | } |
297 | 311 | ||
298 | 312 | ||
299 | /* | 313 | /* |
300 | The eventFilter has to filter the mouse events of the agenda item childs. The | 314 | The eventFilter has to filter the mouse events of the agenda item childs. The |
301 | events are fed into the event handling method of KOAgendaItem. This allows the | 315 | events are fed into the event handling method of KOAgendaItem. This allows the |
302 | KOAgenda to handle the KOAgendaItems by using an eventFilter. | 316 | KOAgenda to handle the KOAgendaItems by using an eventFilter. |
303 | */ | 317 | */ |
304 | bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e ) | 318 | bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e ) |
305 | { | 319 | { |
306 | if (e->type() == QEvent::MouseButtonPress || | 320 | if (e->type() == QEvent::MouseButtonPress || |
307 | e->type() == QEvent::MouseButtonDblClick || | 321 | e->type() == QEvent::MouseButtonDblClick || |
308 | e->type() == QEvent::MouseButtonRelease || | 322 | e->type() == QEvent::MouseButtonRelease || |
309 | e->type() == QEvent::MouseMove) { | 323 | e->type() == QEvent::MouseMove) { |
310 | QMouseEvent *me = (QMouseEvent *)e; | 324 | QMouseEvent *me = (QMouseEvent *)e; |
311 | QPoint itemPos = this->mapFromGlobal(((QWidget *)object)-> | 325 | QPoint itemPos = this->mapFromGlobal(((QWidget *)object)-> |
312 | mapToGlobal(me->pos())); | 326 | mapToGlobal(me->pos())); |
313 | QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state()); | 327 | QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state()); |
314 | return event(&returnEvent); | 328 | return event(&returnEvent); |
315 | } else { | 329 | } else { |
316 | return false; | 330 | return false; |
317 | } | 331 | } |
318 | } | 332 | } |
319 | void KOAgendaItem::repaintMe( ) | 333 | void KOAgendaItem::repaintMe( ) |
320 | { | 334 | { |
321 | paintMe ( mSelected ); | 335 | paintMe ( mSelected ); |
322 | } | 336 | } |
323 | void KOAgendaItem::paintMe( bool selected, QPainter* paint ) | 337 | void KOAgendaItem::paintMe( bool selected, QPainter* paint ) |
324 | { | 338 | { |
325 | if ( globalFlagBlockAgendaItemUpdate && ! selected) | 339 | if ( globalFlagBlockAgendaItemUpdate && ! selected) |
326 | return; | 340 | return; |
327 | QPainter pa; | 341 | QPainter pa; |
328 | 342 | ||
329 | if ( mSelected ) { | 343 | if ( mSelected ) { |
330 | pa.begin( paintPixSel() ); | 344 | pa.begin( paintPixSel() ); |
331 | } else { | 345 | } else { |
332 | if ( mAllDay ) | 346 | if ( mAllDay ) |
333 | pa.begin( paintPixAllday() ); | 347 | pa.begin( paintPixAllday() ); |
334 | else | 348 | else |
335 | pa.begin( paintPix() ); | 349 | pa.begin( paintPix() ); |
336 | } | 350 | } |
337 | int x, yy, w, h; | 351 | int x, yy, w, h; |
338 | float nfh = 7.0; | 352 | float nfh = 7.0; |
339 | x = pos().x(); w = width(); h = height (); | 353 | x = pos().x(); w = width(); h = height (); |
340 | if ( mAllDay ) | 354 | if ( mAllDay ) |
341 | yy = y(); | 355 | yy = y(); |
342 | else | 356 | else |
343 | yy = mCellYTop * ( height() / cellHeight() ); | 357 | yy = mCellYTop * ( height() / cellHeight() ); |
344 | xPaintCoord= x; | 358 | xPaintCoord= x; |
345 | yPaintCoord = yy; | 359 | yPaintCoord = yy; |
346 | wPaintCoord = width(); | 360 | wPaintCoord = width(); |
347 | hPaintCoord = height(); | 361 | hPaintCoord = height(); |
348 | //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height()); | 362 | //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height()); |
349 | if ( paint == 0 ) | 363 | if ( paint == 0 ) |
350 | paint = &pa; | 364 | paint = &pa; |
351 | bool horLayout = ( w < h ); | 365 | bool horLayout = ( w < h ); |
352 | int maxhei = mFontPixelSize+4; | 366 | int maxhei = mFontPixelSize+4; |
353 | if ( horLayout ) | 367 | if ( horLayout ) |
354 | maxhei += AGENDA_ICON_SIZE -4; | 368 | maxhei += AGENDA_ICON_SIZE -4; |
355 | bool small = ( h < maxhei ); | 369 | bool small = ( h < maxhei ); |
356 | if ( ! small ) | 370 | if ( ! small ) |
357 | paint->setFont(KOPrefs::instance()->mAgendaViewFont); | 371 | paint->setFont(KOPrefs::instance()->mAgendaViewFont); |
358 | else { | 372 | else { |
359 | QFont f = KOPrefs::instance()->mAgendaViewFont; | 373 | QFont f = KOPrefs::instance()->mAgendaViewFont; |
360 | f.setBold( false ); | 374 | f.setBold( false ); |
361 | int fh = f.pointSize(); | 375 | int fh = f.pointSize(); |
362 | nfh = (((float)height())/(float)(mFontPixelSize+4))*fh; | 376 | nfh = (((float)height())/(float)(mFontPixelSize+4))*fh; |
363 | if ( nfh < 6 ) | 377 | if ( nfh < 6 ) |
364 | nfh = 6; | 378 | nfh = 6; |
365 | f.setPointSize( nfh ); | 379 | f.setPointSize( nfh ); |
366 | paint->setFont(f); | 380 | paint->setFont(f); |
367 | } | 381 | } |
368 | paint->fillRect ( x, yy, w, h, mBackgroundColor ); | 382 | paint->fillRect ( x, yy, w, h, mBackgroundColor ); |
369 | static const QPixmap completedPxmp = SmallIcon("greenhook16"); | 383 | static const QPixmap completedPxmp = SmallIcon("greenhook16"); |
370 | static const QPixmap overduePxmp = SmallIcon("redcross16"); | 384 | static const QPixmap overduePxmp = SmallIcon("redcross16"); |
371 | if ( mIncidence->typeID() == todoID ) { | 385 | if ( mIncidence->typeID() == todoID ) { |
372 | Todo* tempTodo = static_cast<Todo*>(mIncidence); | 386 | Todo* tempTodo = static_cast<Todo*>(mIncidence); |
373 | int xx = pos().x()+(width()-completedPxmp.width()-3 ); | 387 | int xx = pos().x()+(width()-completedPxmp.width()-3 ); |
374 | int yyy = yy+3; | 388 | int yyy = yy+3; |
375 | if ( tempTodo->isCompleted() ) | 389 | if ( tempTodo->isCompleted() ) |
376 | paint->drawPixmap ( xx, yyy, completedPxmp ); | 390 | paint->drawPixmap ( xx, yyy, completedPxmp ); |
377 | else { | 391 | else { |
378 | paint->drawPixmap ( xx, yyy, overduePxmp ); | 392 | paint->drawPixmap ( xx, yyy, overduePxmp ); |
379 | 393 | ||
380 | } | 394 | } |
381 | } | 395 | } |
382 | bool addIcon = false; | 396 | bool addIcon = false; |
383 | if ( ! small || w > 3 * h || h > 3* w ) | 397 | if ( ! small || w > 3 * h || h > 3* w ) |
384 | addIcon = updateIcons( paint, horLayout ); | 398 | addIcon = updateIcons( paint, horLayout ); |
385 | 399 | ||
386 | //qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0); | 400 | //qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0); |
387 | qDrawWinPanel (paint, x, yy, w, h, mColorGroup, selected ,0); | 401 | qDrawWinPanel (paint, x, yy, w, h, mColorGroup, selected ,0); |
388 | //qDebug("draw rect %d %d %d %d ",x, yy, w, h ); | 402 | //qDebug("draw rect %d %d %d %d ",x, yy, w, h ); |
389 | if ( ! small ) { | 403 | if ( ! small ) { |
390 | x += 3; yy += 3;w -= 6; h-= 5; | 404 | x += 3; yy += 3;w -= 6; h-= 5; |
391 | } else { | 405 | } else { |
392 | x += 2; yy += 1;w -= 4; h-= 4; | 406 | x += 2; yy += 1;w -= 4; h-= 4; |
393 | if ( nfh < 6.01 ) { | 407 | if ( nfh < 6.01 ) { |
394 | yy -= 2; | 408 | yy -= 2; |
395 | h += 4; | 409 | h += 4; |
396 | } | 410 | } |
397 | else | 411 | else |
398 | if ( nfh < h -2 ) | 412 | if ( nfh < h -2 ) |
399 | ++yy; | 413 | ++yy; |
400 | } | 414 | } |
401 | int align; | 415 | int align; |
402 | #ifndef DESKTOP_VERSION | 416 | #ifndef DESKTOP_VERSION |
403 | align = ( AlignLeft|WordBreak|AlignTop); | 417 | align = ( AlignLeft|WordBreak|AlignTop); |
404 | #else | 418 | #else |
405 | align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop); | 419 | align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop); |
406 | #endif | 420 | #endif |
407 | if ( addIcon ) { | 421 | if ( addIcon ) { |
408 | if ( ! horLayout ) { | 422 | if ( ! horLayout ) { |
409 | x += AGENDA_ICON_SIZE+3; | 423 | x += AGENDA_ICON_SIZE+3; |
410 | w -= (AGENDA_ICON_SIZE+3); | 424 | w -= (AGENDA_ICON_SIZE+3); |
411 | } | 425 | } |
412 | else { | 426 | else { |
413 | yy+= AGENDA_ICON_SIZE+2; | 427 | yy+= AGENDA_ICON_SIZE+2; |
414 | h -=(AGENDA_ICON_SIZE+3); | 428 | h -=(AGENDA_ICON_SIZE+3); |
415 | } | 429 | } |
416 | } | 430 | } |
417 | if ( mWhiteText ) | 431 | if ( mWhiteText ) |
418 | paint->setPen ( white); | 432 | paint->setPen ( white); |
419 | if ( x < 0 ) { | 433 | if ( x < 0 ) { |
420 | w = w+x-3; | 434 | w = w+x-3; |
421 | x = 3; | 435 | x = 3; |
422 | if ( w > parentWidget()->width() ){ | 436 | if ( w > parentWidget()->width() ){ |
423 | w = parentWidget()->width() - 6; | 437 | w = parentWidget()->width() - 6; |
424 | #ifndef DESKTOP_VERSION | 438 | #ifndef DESKTOP_VERSION |
425 | align = ( AlignHCenter|WordBreak|AlignTop); | 439 | align = ( AlignHCenter|WordBreak|AlignTop); |
426 | #else | 440 | #else |
427 | align = ( AlignHCenter|BreakAnywhere|WordBreak|AlignTop); | 441 | align = ( AlignHCenter|BreakAnywhere|WordBreak|AlignTop); |
428 | #endif | 442 | #endif |
429 | 443 | ||
430 | } | 444 | } |
431 | } | 445 | } |
432 | QRect dr; | 446 | QRect dr; |
433 | if ( w + x > parentWidget()->width() ) | 447 | if ( w + x > parentWidget()->width() ) |
434 | w = parentWidget()->width()-x; | 448 | w = parentWidget()->width()-x; |
435 | paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr ); | 449 | paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr ); |
436 | //qDebug("%d %d %d %d ", x, yy, w, h ); | 450 | //qDebug("%d %d %d %d ", x, yy, w, h ); |
437 | if ( mIncidence->cancelled() ){ | 451 | if ( mIncidence->cancelled() ){ |
438 | 452 | ||
439 | 453 | ||
440 | small = ( height() < 20 ); | 454 | small = ( height() < 20 ); |
441 | 455 | ||
442 | if ( ! small ) { | 456 | if ( ! small ) { |
443 | QFontMetrics fm ( paint->font() ); | 457 | QFontMetrics fm ( paint->font() ); |
444 | paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2); | 458 | paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2); |
445 | } | 459 | } |
446 | 460 | ||
447 | } | 461 | } |
448 | pa.end(); | 462 | pa.end(); |
449 | 463 | ||
450 | } | 464 | } |
451 | void KOAgendaItem::resizePixmap( int w , int h ) | 465 | void KOAgendaItem::resizePixmap( int w , int h ) |
452 | { | 466 | { |
453 | paintPix()->resize( w, h ); | 467 | paintPix()->resize( w, h ); |
454 | paintPixSel()->resize( w, h ); | 468 | paintPixSel()->resize( w, h ); |
455 | 469 | ||
456 | } | 470 | } |
457 | QPixmap * KOAgendaItem::paintPix() | 471 | QPixmap * KOAgendaItem::paintPix() |
458 | { | 472 | { |
459 | static QPixmap* mPaintPix = 0; | 473 | static QPixmap* mPaintPix = 0; |
460 | if ( ! mPaintPix ) { | 474 | if ( ! mPaintPix ) { |
461 | int w = QApplication::desktop()->width(); | 475 | int w = QApplication::desktop()->width(); |
462 | int h = QApplication::desktop()->height(); | 476 | int h = QApplication::desktop()->height(); |
463 | mPaintPix = new QPixmap(w,h); | 477 | mPaintPix = new QPixmap(w,h); |
464 | } | 478 | } |
465 | return mPaintPix ; | 479 | return mPaintPix ; |
466 | } | 480 | } |
467 | QPixmap * KOAgendaItem::paintPixAllday() | 481 | QPixmap * KOAgendaItem::paintPixAllday() |
468 | { | 482 | { |
469 | static QPixmap* mPaintPixA = 0; | 483 | static QPixmap* mPaintPixA = 0; |
470 | if ( ! mPaintPixA ) { | 484 | if ( ! mPaintPixA ) { |
471 | int w = QApplication::desktop()->width(); | 485 | int w = QApplication::desktop()->width(); |
472 | int h = QApplication::desktop()->height()/3; | 486 | int h = QApplication::desktop()->height()/3; |
473 | mPaintPixA = new QPixmap(w,h); | 487 | mPaintPixA = new QPixmap(w,h); |
474 | } | 488 | } |
475 | return mPaintPixA ; | 489 | return mPaintPixA ; |
476 | } | 490 | } |
477 | QPixmap * KOAgendaItem::paintPixSel() | 491 | QPixmap * KOAgendaItem::paintPixSel() |
478 | { | 492 | { |
479 | static QPixmap* mPaintPixSel = 0; | 493 | static QPixmap* mPaintPixSel = 0; |
480 | if ( ! mPaintPixSel ) { | 494 | if ( ! mPaintPixSel ) { |
481 | int w = QApplication::desktop()->width(); | 495 | int w = QApplication::desktop()->width(); |
482 | int h = QApplication::desktop()->height(); | 496 | int h = QApplication::desktop()->height(); |
483 | mPaintPixSel = new QPixmap(w,h); | 497 | mPaintPixSel = new QPixmap(w,h); |
484 | } | 498 | } |
485 | return mPaintPixSel ; | 499 | return mPaintPixSel ; |
486 | } | 500 | } |
487 | void KOAgendaItem::paintEvent ( QPaintEvent *e ) | 501 | void KOAgendaItem::paintEvent ( QPaintEvent *e ) |
488 | { | 502 | { |
489 | 503 | ||
490 | if ( globalFlagBlockAgendaItemPaint ) | 504 | if ( globalFlagBlockAgendaItemPaint ) |
491 | return; | 505 | return; |
492 | if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 ) | 506 | if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 ) |
493 | return; | 507 | return; |
494 | int yy; | 508 | int yy; |
495 | if ( mAllDay ) | 509 | if ( mAllDay ) |
496 | yy = y(); | 510 | yy = y(); |
497 | else | 511 | else |
498 | yy = mCellYTop * ( height() / cellHeight() ); | 512 | yy = mCellYTop * ( height() / cellHeight() ); |
499 | int xx = x(); | 513 | int xx = x(); |
500 | 514 | ||
501 | if ( xPaintCoord != xx || yPaintCoord != yy || | 515 | if ( xPaintCoord != xx || yPaintCoord != yy || |
502 | wPaintCoord != width() || hPaintCoord != height()) { | 516 | wPaintCoord != width() || hPaintCoord != height()) { |
503 | xPaintCoord= xx; | 517 | xPaintCoord= xx; |
504 | yPaintCoord = yy; | 518 | yPaintCoord = yy; |
505 | wPaintCoord = width(); | 519 | wPaintCoord = width(); |
506 | hPaintCoord = height(); | 520 | hPaintCoord = height(); |
507 | globalFlagBlockAgendaItemUpdate = 0; | 521 | globalFlagBlockAgendaItemUpdate = 0; |
508 | paintMe( mSelected ); | 522 | paintMe( mSelected ); |
509 | //qDebug("calling paintMe "); | 523 | //qDebug("calling paintMe "); |
510 | globalFlagBlockAgendaItemUpdate = 1; | 524 | globalFlagBlockAgendaItemUpdate = 1; |
511 | } | 525 | } |
512 | int rx, ry, rw, rh; | 526 | int rx, ry, rw, rh; |
513 | rx = e->rect().x(); | 527 | rx = e->rect().x(); |
514 | ry = e->rect().y(); | 528 | ry = e->rect().y(); |
515 | rw = e->rect().width(); | 529 | rw = e->rect().width(); |
516 | rh = e->rect().height(); | 530 | rh = e->rect().height(); |
517 | //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height()); | 531 | //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height()); |
518 | 532 | ||
519 | QPixmap* paintFrom ; | 533 | QPixmap* paintFrom ; |
520 | if ( mSelected ) { | 534 | if ( mSelected ) { |
521 | paintFrom = paintPixSel(); | 535 | paintFrom = paintPixSel(); |
522 | } else { | 536 | } else { |
523 | if ( mAllDay ) | 537 | if ( mAllDay ) |
524 | paintFrom = paintPixAllday(); | 538 | paintFrom = paintPixAllday(); |
525 | else | 539 | else |
526 | paintFrom = paintPix(); | 540 | paintFrom = paintPix(); |
527 | } | 541 | } |
528 | xx += rx; | 542 | xx += rx; |
529 | 543 | ||
530 | if ( xx < 0 ) { | 544 | if ( xx < 0 ) { |
531 | rw = rw + xx; | 545 | rw = rw + xx; |
532 | rx -= xx; | 546 | rx -= xx; |
533 | xx = 0; | 547 | xx = 0; |
534 | if ( rw <= 1 ) { | 548 | if ( rw <= 1 ) { |
535 | //qDebug("KOAgendaItem::Width1 <= 1 (%d). Returning. %s",rw,mDisplayedText.latin1()); | 549 | //qDebug("KOAgendaItem::Width1 <= 1 (%d). Returning. %s",rw,mDisplayedText.latin1()); |
536 | return; | 550 | return; |
537 | } | 551 | } |
538 | } | 552 | } |
539 | if ( paintFrom->width() < xx+rw ) { | 553 | if ( paintFrom->width() < xx+rw ) { |
540 | rw = paintFrom->width() - xx; | 554 | rw = paintFrom->width() - xx; |
541 | if ( rw <= 1 ) { | 555 | if ( rw <= 1 ) { |
542 | //qDebug("KOAgendaItem::Width2 <= 1 (%d). Returning.%s ",rw,mDisplayedText.latin1() ); | 556 | //qDebug("KOAgendaItem::Width2 <= 1 (%d). Returning.%s ",rw,mDisplayedText.latin1() ); |
543 | return; | 557 | return; |
544 | } | 558 | } |
545 | } | 559 | } |
546 | //qDebug("%d %d %d %d %d %d %d",rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh); | 560 | //qDebug("%d %d %d %d %d %d %d",rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh); |
547 | bitBlt (this, rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh ,CopyROP); | 561 | bitBlt (this, rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh ,CopyROP); |
548 | } | 562 | } |
549 | void KOAgendaItem::computeText() | 563 | void KOAgendaItem::computeText() |
550 | { | 564 | { |
551 | mDisplayedText = mIncidence->summary(); | 565 | mDisplayedText = mIncidence->summary(); |
552 | if ( (mIncidence->typeID() == todoID ) ) { | 566 | if ( (mIncidence->typeID() == todoID ) ) { |
553 | if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) { | 567 | if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) { |
554 | if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() ) | 568 | if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() ) |
555 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")"; | 569 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")"; |
556 | else if ( !(mIncidence->doesFloat())) | 570 | else if ( !(mIncidence->doesFloat())) |
557 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")"; | 571 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")"; |
558 | } | 572 | } |
559 | } else { | 573 | } else { |
560 | if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda) | 574 | if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda) |
561 | mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + " - " + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ; | 575 | mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + " - " + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ; |
562 | 576 | ||
563 | if ( mAllDay ) { | 577 | if ( mAllDay ) { |
564 | if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) { | 578 | if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) { |
565 | if ( mIncidence->doesRecur() ) { | 579 | if ( mIncidence->doesRecur() ) { |
566 | mDisplayedText += " (" + mIncidence->recurrence()->recurrenceText() + ")"; | 580 | mDisplayedText += " (" + mIncidence->recurrence()->recurrenceText() + ")"; |
567 | } else { | 581 | } else { |
568 | mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ; | 582 | mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ; |
569 | } | 583 | } |
570 | } | 584 | } |
571 | } | 585 | } |
572 | } | 586 | } |
573 | 587 | ||
574 | if ( !mIncidence->location().isEmpty() ) { | 588 | if ( !mIncidence->location().isEmpty() ) { |
575 | if ( mAllDay ) | 589 | if ( mAllDay ) |
576 | mDisplayedText += " ("; | 590 | mDisplayedText += " ("; |
577 | else | 591 | else |
578 | mDisplayedText += "\n("; | 592 | mDisplayedText += "\n("; |
579 | mDisplayedText += mIncidence->location() +")"; | 593 | mDisplayedText += mIncidence->location() +")"; |
580 | } | 594 | } |
581 | #ifdef DESKTOP_VERSION | 595 | #ifdef DESKTOP_VERSION |
582 | QString tipText = mIncidence->summary(); | 596 | QString tipText = mIncidence->summary(); |
583 | if ( !mIncidence->doesFloat() ) { | 597 | if ( !mIncidence->doesFloat() ) { |
584 | if ( mIncidence->typeID() == eventID ) { | 598 | if ( mIncidence->typeID() == eventID ) { |
585 | if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { | 599 | if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { |
586 | tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); | 600 | tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); |