-rw-r--r-- | korganizer/koagendaitem.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 0f9a38f..d38cb00 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp | |||
@@ -1,315 +1,316 @@ | |||
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 <q3hbox.h> | 22 | #include <q3hbox.h> |
23 | #include <q3vbox.h> | 23 | #include <q3vbox.h> |
24 | #include <qtooltip.h> | 24 | #include <qtooltip.h> |
25 | #include <q3whatsthis.h> | 25 | #include <q3whatsthis.h> |
26 | #include <q3dragobject.h> | 26 | #include <q3dragobject.h> |
27 | #include <qdrawutil.h> | 27 | #include <qdrawutil.h> |
28 | #include <qpainter.h> | 28 | #include <qpainter.h> |
29 | #include <QDesktopWidget> | 29 | #include <QDesktopWidget> |
30 | //Added by qt3to4: | 30 | //Added by qt3to4: |
31 | #include <Q3PtrList> | 31 | #include <Q3PtrList> |
32 | #include <QPixmap> | 32 | #include <QPixmap> |
33 | #include <QDragEnterEvent> | 33 | #include <QDragEnterEvent> |
34 | #include <QDropEvent> | 34 | #include <QDropEvent> |
35 | #include <QResizeEvent> | 35 | #include <QResizeEvent> |
36 | #include <QMouseEvent> | 36 | #include <QMouseEvent> |
37 | #include <QEvent> | 37 | #include <QEvent> |
38 | #include <QPaintEvent> | 38 | #include <QPaintEvent> |
39 | 39 | ||
40 | #include <kiconloader.h> | 40 | #include <kiconloader.h> |
41 | #include <kdebug.h> | 41 | #include <kdebug.h> |
42 | #include <kglobal.h> | 42 | #include <kglobal.h> |
43 | #include <klocale.h> | 43 | #include <klocale.h> |
44 | #ifndef DESKTOP_VERSION | 44 | #ifndef DESKTOP_VERSION |
45 | #include <qpe/qpeapplication.h> | 45 | #include <qpe/qpeapplication.h> |
46 | #define AGENDA_ICON_SIZE 5 | 46 | #define AGENDA_ICON_SIZE 5 |
47 | #else | 47 | #else |
48 | #include <qapplication.h> | 48 | #include <qapplication.h> |
49 | #define AGENDA_ICON_SIZE 7 | 49 | #define AGENDA_ICON_SIZE 7 |
50 | #endif | 50 | #endif |
51 | #include <libkcal/icaldrag.h> | 51 | #include <libkcal/icaldrag.h> |
52 | #include <libkcal/vcaldrag.h> | 52 | #include <libkcal/vcaldrag.h> |
53 | #include <libkcal/kincidenceformatter.h> | 53 | #include <libkcal/kincidenceformatter.h> |
54 | extern int globalFlagBlockAgenda; | 54 | extern int globalFlagBlockAgenda; |
55 | extern int globalFlagBlockAgendaItemPaint; | 55 | extern int globalFlagBlockAgendaItemPaint; |
56 | extern int globalFlagBlockAgendaItemUpdate; | 56 | extern int globalFlagBlockAgendaItemUpdate; |
57 | 57 | ||
58 | #include "koprefs.h" | 58 | #include "koprefs.h" |
59 | 59 | ||
60 | #include "koagendaitem.h" | 60 | #include "koagendaitem.h" |
61 | //#include "koagendaitem.moc" | 61 | //#include "koagendaitem.moc" |
62 | 62 | ||
63 | 63 | ||
64 | //-------------------------------------------------------------------------- | 64 | //-------------------------------------------------------------------------- |
65 | 65 | ||
66 | QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; | 66 | QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; |
67 | 67 | ||
68 | //-------------------------------------------------------------------------- | 68 | //-------------------------------------------------------------------------- |
69 | 69 | ||
70 | class KOAgendaItemWhatsThis :public Q3WhatsThis | 70 | class KOAgendaItemWhatsThis :public Q3WhatsThis |
71 | { | 71 | { |
72 | public: | 72 | public: |
73 | KOAgendaItemWhatsThis( KOAgendaItem* view ) : Q3WhatsThis( view ),_view (view) { }; | 73 | KOAgendaItemWhatsThis( KOAgendaItem* view ) : Q3WhatsThis( view ),_view (view) { }; |
74 | 74 | ||
75 | protected: | 75 | protected: |
76 | virtual QString text( const QPoint& ) | 76 | virtual QString text( const QPoint& ) |
77 | { | 77 | { |
78 | return _view->getWhatsThisText() ; | 78 | return _view->getWhatsThisText() ; |
79 | } | 79 | } |
80 | private: | 80 | private: |
81 | KOAgendaItem * _view; | 81 | KOAgendaItem * _view; |
82 | }; | 82 | }; |
83 | 83 | ||
84 | KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, | 84 | KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, |
85 | const char *name,Qt::WFlags) : | 85 | const char *name,Qt::WFlags) : |
86 | QWidget(parent, name), mIncidence(incidence), mDate(qd) | 86 | QWidget(parent, name), mIncidence(incidence), mDate(qd) |
87 | { | 87 | { |
88 | #ifndef DESKTOP_VERSION | 88 | #ifndef DESKTOP_VERSION |
89 | //QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); | 89 | //QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); |
90 | #endif | 90 | #endif |
91 | mKOAgendaItemWhatsThis = new KOAgendaItemWhatsThis(this); | 91 | mKOAgendaItemWhatsThis = new KOAgendaItemWhatsThis(this); |
92 | Qt::WindowFlags wflags = windowFlags() |Qt::WRepaintNoErase;// WResizeNoErase | 92 | Qt::WindowFlags wflags = windowFlags() |Qt::WRepaintNoErase;// WResizeNoErase |
93 | setWindowFlags ( wflags); | 93 | setWindowFlags ( wflags); |
94 | mAllDay = allday; | 94 | mAllDay = allday; |
95 | init ( incidence, qd ); | 95 | init ( incidence, qd ); |
96 | //setMouseTracking(true); | 96 | //setMouseTracking(true); |
97 | //setAcceptDrops(true); | 97 | //setAcceptDrops(true); |
98 | xPaintCoord = -1; | 98 | xPaintCoord = -1; |
99 | yPaintCoord = -1; | 99 | yPaintCoord = -1; |
100 | } | 100 | } |
101 | QString KOAgendaItem::getWhatsThisText() | 101 | QString KOAgendaItem::getWhatsThisText() |
102 | { | 102 | { |
103 | if ( mIncidence ) | 103 | if ( mIncidence ) |
104 | return KIncidenceFormatter::instance()->getFormattedText( mIncidence, | 104 | return KIncidenceFormatter::instance()->getFormattedText( mIncidence, |
105 | KOPrefs::instance()->mWTshowDetails, | 105 | KOPrefs::instance()->mWTshowDetails, |
106 | KOPrefs::instance()->mWTshowCreated, | 106 | KOPrefs::instance()->mWTshowCreated, |
107 | KOPrefs::instance()->mWTshowChanged); | 107 | KOPrefs::instance()->mWTshowChanged); |
108 | return "KOAgendaItem::getWhatsThisText()::internal error"; | 108 | return "KOAgendaItem::getWhatsThisText()::internal error"; |
109 | } | 109 | } |
110 | 110 | ||
111 | void KOAgendaItem::initColor () | 111 | void KOAgendaItem::initColor () |
112 | { | 112 | { |
113 | if ( (mIncidence->typeID() == todoID ) && | 113 | if ( (mIncidence->typeID() == todoID ) && |
114 | ( !((static_cast<Todo*>(mIncidence))->isCompleted()) && | 114 | ( !((static_cast<Todo*>(mIncidence))->isCompleted()) && |
115 | ((static_cast<Todo*>(mIncidence))->dtDue().date() <= QDate::currentDate()) ) ) { | 115 | ((static_cast<Todo*>(mIncidence))->dtDue().date() <= QDate::currentDate()) ) ) { |
116 | if ( (static_cast<Todo*>(mIncidence))->dtDue() < (QDateTime)QDateTime::currentDateTime().date()) | 116 | if ( (static_cast<Todo*>(mIncidence))->dtDue() < (QDateTime)QDateTime::currentDateTime().date()) |
117 | mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; | 117 | mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; |
118 | else | 118 | else |
119 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; | 119 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; |
120 | } | 120 | } |
121 | else { | 121 | else { |
122 | QStringList categories = mIncidence->categories(); | 122 | QStringList categories = mIncidence->categories(); |
123 | QString cat = categories.first(); | 123 | QString cat; |
124 | if(!categories.isEmpty()) cat = categories.first(); | ||
124 | if (cat.isEmpty()) { | 125 | if (cat.isEmpty()) { |
125 | if ( (mIncidence->typeID() == todoID ) &&((static_cast<Todo*>(mIncidence))->isCompleted()) ) | 126 | if ( (mIncidence->typeID() == todoID ) &&((static_cast<Todo*>(mIncidence))->isCompleted()) ) |
126 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; | 127 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; |
127 | else | 128 | else |
128 | mBackgroundColor =KOPrefs::instance()->defaultColor( mIncidence->calID() ); | 129 | mBackgroundColor =KOPrefs::instance()->defaultColor( mIncidence->calID() ); |
129 | } else { | 130 | } else { |
130 | mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); | 131 | mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); |
131 | if ( (mIncidence->typeID() == todoID ) &&((static_cast<Todo*>(mIncidence))->isCompleted()) ) { | 132 | if ( (mIncidence->typeID() == todoID ) &&((static_cast<Todo*>(mIncidence))->isCompleted()) ) { |
132 | if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) | 133 | if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) |
133 | mBackgroundColor = KOPrefs::instance()->mTodoDoneColor; | 134 | mBackgroundColor = KOPrefs::instance()->mTodoDoneColor; |
134 | } | 135 | } |
135 | } | 136 | } |
136 | 137 | ||
137 | } | 138 | } |
138 | 139 | ||
139 | QColor BackgroundColor ( mBackgroundColor ); | 140 | QColor BackgroundColor ( mBackgroundColor ); |
140 | if ( mIncidence->calID() > 1 ) { | 141 | if ( mIncidence->calID() > 1 ) { |
141 | //BackgroundColor = KOPrefs::instance()->defaultColor( mIncidence->calID() ); | 142 | //BackgroundColor = KOPrefs::instance()->defaultColor( mIncidence->calID() ); |
142 | } | 143 | } |
143 | mColorGroup = QColorGroup( BackgroundColor.light(), | 144 | mColorGroup = QColorGroup( BackgroundColor.light(), |
144 | BackgroundColor.dark(),BackgroundColor.light(), | 145 | BackgroundColor.dark(),BackgroundColor.light(), |
145 | BackgroundColor.dark(),BackgroundColor, Qt::black, BackgroundColor) ; | 146 | BackgroundColor.dark(),BackgroundColor, Qt::black, BackgroundColor) ; |
146 | setBackgroundColor( mBackgroundColor ); | 147 | setBackgroundColor( mBackgroundColor ); |
147 | mWhiteText = (mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue() < 250); | 148 | mWhiteText = (mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue() < 250); |
148 | } | 149 | } |
149 | void KOAgendaItem::init ( Incidence *incidence, QDate qd ) | 150 | void KOAgendaItem::init ( Incidence *incidence, QDate qd ) |
150 | { | 151 | { |
151 | mIncidence = incidence; | 152 | mIncidence = incidence; |
152 | mDate = qd; | 153 | mDate = qd; |
153 | mFirstMultiItem = 0; | 154 | mFirstMultiItem = 0; |
154 | mNextMultiItem = 0; | 155 | mNextMultiItem = 0; |
155 | mLastMultiItem = 0; | 156 | mLastMultiItem = 0; |
156 | computeText(); | 157 | computeText(); |
157 | initColor(); | 158 | initColor(); |
158 | mConflictItems.clear(); | 159 | mConflictItems.clear(); |
159 | setCellXY(0,0,1); | 160 | setCellXY(0,0,1); |
160 | setCellXWidth(0); | 161 | setCellXWidth(0); |
161 | setSubCell(0); | 162 | setSubCell(0); |
162 | setSubCells(1); | 163 | setSubCells(1); |
163 | setMultiItem(0,0,0); | 164 | setMultiItem(0,0,0); |
164 | startMove(); | 165 | startMove(); |
165 | mSelected = true; | 166 | mSelected = true; |
166 | select(false); | 167 | select(false); |
167 | QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); | 168 | QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); |
168 | mFontPixelSize = fontinf.height();; | 169 | mFontPixelSize = fontinf.height();; |
169 | hide(); | 170 | hide(); |
170 | xPaintCoord = -1; | 171 | xPaintCoord = -1; |
171 | yPaintCoord = -1; | 172 | yPaintCoord = -1; |
172 | } | 173 | } |
173 | 174 | ||
174 | 175 | ||
175 | KOAgendaItem::~KOAgendaItem() | 176 | KOAgendaItem::~KOAgendaItem() |
176 | { | 177 | { |
177 | #if QT_VERSION >= 0x030000 | 178 | #if QT_VERSION >= 0x030000 |
178 | 179 | ||
179 | #else | 180 | #else |
180 | delete mKOAgendaItemWhatsThis; | 181 | delete mKOAgendaItemWhatsThis; |
181 | #endif | 182 | #endif |
182 | 183 | ||
183 | } | 184 | } |
184 | 185 | ||
185 | void KOAgendaItem::recreateIncidence() | 186 | void KOAgendaItem::recreateIncidence() |
186 | { | 187 | { |
187 | #if 0 | 188 | #if 0 |
188 | Incidence* newInc = mIncidence->clone(); | 189 | Incidence* newInc = mIncidence->clone(); |
189 | newInc->recreate(); | 190 | newInc->recreate(); |
190 | if ( mIncidence->doesRecur() ) { | 191 | if ( mIncidence->doesRecur() ) { |
191 | mIncidence->addExDate( mDate ); | 192 | mIncidence->addExDate( mDate ); |
192 | newInc->recurrence()->unsetRecurs(); | 193 | newInc->recurrence()->unsetRecurs(); |
193 | int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); | 194 | int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); |
194 | QTime tim = mIncidence->dtStart().time(); | 195 | QTime tim = mIncidence->dtStart().time(); |
195 | newInc->setDtStart( QDateTime(mDate, tim) ); | 196 | newInc->setDtStart( QDateTime(mDate, tim) ); |
196 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); | 197 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); |
197 | } | 198 | } |
198 | #endif | 199 | #endif |
199 | mIncidence = mIncidence->recreateCloneException( mDate ); | 200 | mIncidence = mIncidence->recreateCloneException( mDate ); |
200 | } | 201 | } |
201 | bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) | 202 | bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) |
202 | { | 203 | { |
203 | int size = AGENDA_ICON_SIZE; | 204 | int size = AGENDA_ICON_SIZE; |
204 | 205 | ||
205 | int yOff = 0; | 206 | int yOff = 0; |
206 | int xOff = 0; | 207 | int xOff = 0; |
207 | int x = pos().x(); | 208 | int x = pos().x(); |
208 | 209 | ||
209 | if ( x < 0 ) x = 0; | 210 | if ( x < 0 ) x = 0; |
210 | x += 3; | 211 | x += 3; |
211 | int y; | 212 | int y; |
212 | if ( mAllDay ) | 213 | if ( mAllDay ) |
213 | y = pos().y()+3; | 214 | y = pos().y()+3; |
214 | else | 215 | else |
215 | y = mCellYTop * ( height() / cellHeight() ) +3; | 216 | y = mCellYTop * ( height() / cellHeight() ) +3; |
216 | 217 | ||
217 | 218 | ||
218 | if ( mIncidence->calID() > 1 ) { | 219 | if ( mIncidence->calID() > 1 ) { |
219 | 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() ) ); | 220 | 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() ) ); |
220 | p->drawRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x-1, yOff*( 1 +AGENDA_ICON_SIZE)+y-1, AGENDA_ICON_SIZE+2, AGENDA_ICON_SIZE+2 ); | 221 | p->drawRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x-1, yOff*( 1 +AGENDA_ICON_SIZE)+y-1, AGENDA_ICON_SIZE+2, AGENDA_ICON_SIZE+2 ); |
221 | if ( horLayout ){ | 222 | if ( horLayout ){ |
222 | ++xOff; | 223 | ++xOff; |
223 | ++x; | 224 | ++x; |
224 | } | 225 | } |
225 | else { | 226 | else { |
226 | ++yOff; | 227 | ++yOff; |
227 | ++y; | 228 | ++y; |
228 | } | 229 | } |
229 | } | 230 | } |
230 | if (mIncidence->cancelled() && height() < 20 ) { | 231 | if (mIncidence->cancelled() && height() < 20 ) { |
231 | int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; | 232 | int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; |
232 | int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; | 233 | int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; |
233 | p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); | 234 | p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); |
234 | p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); | 235 | p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); |
235 | if ( horLayout ) | 236 | if ( horLayout ) |
236 | ++xOff; | 237 | ++xOff; |
237 | else | 238 | else |
238 | ++yOff; | 239 | ++yOff; |
239 | } | 240 | } |
240 | if (mIncidence->isAlarmEnabled() && mIncidence->alarmEnabled()) { | 241 | if (mIncidence->isAlarmEnabled() && mIncidence->alarmEnabled()) { |
241 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::red ); | 242 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::red ); |
242 | if ( horLayout ) | 243 | if ( horLayout ) |
243 | ++xOff; | 244 | ++xOff; |
244 | else | 245 | else |
245 | ++yOff; | 246 | ++yOff; |
246 | } | 247 | } |
247 | if (mIncidence->doesRecur()) { | 248 | if (mIncidence->doesRecur()) { |
248 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::blue ); | 249 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::blue ); |
249 | if ( horLayout ) | 250 | if ( horLayout ) |
250 | ++xOff; | 251 | ++xOff; |
251 | else | 252 | else |
252 | ++yOff; | 253 | ++yOff; |
253 | } | 254 | } |
254 | if (mIncidence->description().length() > 0) { | 255 | if (mIncidence->description().length() > 0) { |
255 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::darkGreen ); | 256 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::darkGreen ); |
256 | if ( horLayout ) | 257 | if ( horLayout ) |
257 | ++xOff; | 258 | ++xOff; |
258 | else | 259 | else |
259 | ++yOff; | 260 | ++yOff; |
260 | } | 261 | } |
261 | if (mIncidence->isReadOnly()) { | 262 | if (mIncidence->isReadOnly()) { |
262 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::white ); | 263 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::white ); |
263 | if ( horLayout ) | 264 | if ( horLayout ) |
264 | ++xOff; | 265 | ++xOff; |
265 | else | 266 | else |
266 | ++yOff; | 267 | ++yOff; |
267 | } | 268 | } |
268 | 269 | ||
269 | if (mIncidence->attendeeCount()>0) { | 270 | if (mIncidence->attendeeCount()>0) { |
270 | 271 | ||
271 | if (mIncidence->organizer() == KOPrefs::instance()->email()) { | 272 | if (mIncidence->organizer() == KOPrefs::instance()->email()) { |
272 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::black ); | 273 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::black ); |
273 | if ( horLayout ) | 274 | if ( horLayout ) |
274 | ++xOff; | 275 | ++xOff; |
275 | else | 276 | else |
276 | ++yOff; | 277 | ++yOff; |
277 | } else { | 278 | } else { |
278 | Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 279 | Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
279 | if (me!=0) { | 280 | if (me!=0) { |
280 | 281 | ||
281 | 282 | ||
282 | } else { | 283 | } else { |
283 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::yellow ); | 284 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::yellow ); |
284 | if ( horLayout ) | 285 | if ( horLayout ) |
285 | ++xOff; | 286 | ++xOff; |
286 | else | 287 | else |
287 | ++yOff; | 288 | ++yOff; |
288 | 289 | ||
289 | } | 290 | } |
290 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::darkYellow ); | 291 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, Qt::darkYellow ); |
291 | if ( horLayout ) | 292 | if ( horLayout ) |
292 | ++xOff; | 293 | ++xOff; |
293 | else | 294 | else |
294 | ++yOff; | 295 | ++yOff; |
295 | 296 | ||
296 | } | 297 | } |
297 | 298 | ||
298 | } | 299 | } |
299 | return ( yOff || xOff ); | 300 | return ( yOff || xOff ); |
300 | } | 301 | } |
301 | 302 | ||
302 | 303 | ||
303 | void KOAgendaItem::select(bool selected) | 304 | void KOAgendaItem::select(bool selected) |
304 | { | 305 | { |
305 | //qDebug("select %d %d",firstMultiItem(), nextMultiItem() ); | 306 | //qDebug("select %d %d",firstMultiItem(), nextMultiItem() ); |
306 | if (mSelected == selected) return; | 307 | if (mSelected == selected) return; |
307 | mSelected = selected; | 308 | mSelected = selected; |
308 | if ( ! isVisible() ) | 309 | if ( ! isVisible() ) |
309 | return; | 310 | return; |
310 | if ( firstMultiItem() ) | 311 | if ( firstMultiItem() ) |
311 | firstMultiItem()->select( selected ); | 312 | firstMultiItem()->select( selected ); |
312 | if ( !firstMultiItem() && nextMultiItem() ) { | 313 | if ( !firstMultiItem() && nextMultiItem() ) { |
313 | KOAgendaItem * placeItem = nextMultiItem(); | 314 | KOAgendaItem * placeItem = nextMultiItem(); |
314 | while ( placeItem ) { | 315 | while ( placeItem ) { |
315 | placeItem->select( selected ); | 316 | placeItem->select( selected ); |