-rw-r--r-- | korganizer/incomingdialog.cpp | 14 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 14 | ||||
-rw-r--r-- | korganizer/koeditorrecurrence.cpp | 2 | ||||
-rw-r--r-- | korganizer/koeventviewerdialog.cpp | 12 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 4 | ||||
-rw-r--r-- | korganizer/outgoingdialog.cpp | 12 |
6 files changed, 29 insertions, 29 deletions
diff --git a/korganizer/incomingdialog.cpp b/korganizer/incomingdialog.cpp index 50e3077..fe78356 100644 --- a/korganizer/incomingdialog.cpp +++ b/korganizer/incomingdialog.cpp | |||
@@ -117,412 +117,412 @@ bool ScheduleItemVisitor::visit(Todo *e) | |||
117 | } | 117 | } |
118 | } | 118 | } |
119 | mItem->setText(5,e->organizer()+" "); | 119 | mItem->setText(5,e->organizer()+" "); |
120 | 120 | ||
121 | return true; | 121 | return true; |
122 | } | 122 | } |
123 | 123 | ||
124 | bool ScheduleItemVisitor::visit(Journal *) | 124 | bool ScheduleItemVisitor::visit(Journal *) |
125 | { | 125 | { |
126 | return false; | 126 | return false; |
127 | } | 127 | } |
128 | 128 | ||
129 | 129 | ||
130 | /* | 130 | /* |
131 | * Constructs a IncomingDialog which is a child of 'parent', with the | 131 | * Constructs a IncomingDialog which is a child of 'parent', with the |
132 | * name 'name' and widget flags set to 'f' | 132 | * name 'name' and widget flags set to 'f' |
133 | * | 133 | * |
134 | * The dialog will by default be modeless, unless you set 'modal' to | 134 | * The dialog will by default be modeless, unless you set 'modal' to |
135 | * TRUE to construct a modal dialog. | 135 | * TRUE to construct a modal dialog. |
136 | */ | 136 | */ |
137 | IncomingDialog::IncomingDialog(Calendar *calendar,OutgoingDialog *outgoing, | 137 | IncomingDialog::IncomingDialog(Calendar *calendar,OutgoingDialog *outgoing, |
138 | QWidget* parent,const char* name,bool modal,WFlags fl) : | 138 | QWidget* parent,const char* name,bool modal,WFlags fl) : |
139 | IncomingDialog_base(parent,name,modal,fl) | 139 | IncomingDialog_base(parent,name,modal,fl) |
140 | { | 140 | { |
141 | mCalendar = calendar; | 141 | mCalendar = calendar; |
142 | mOutgoing = outgoing; | 142 | mOutgoing = outgoing; |
143 | #ifndef KORG_NOMAIL | 143 | #ifndef KORG_NOMAIL |
144 | mScheduler = new MailScheduler(mCalendar); | 144 | mScheduler = new MailScheduler(mCalendar); |
145 | #else | 145 | #else |
146 | mScheduler = new DummyScheduler(mCalendar); | 146 | mScheduler = new DummyScheduler(mCalendar); |
147 | #endif | 147 | #endif |
148 | mMessageListView->setColumnAlignment(1,AlignHCenter); | 148 | mMessageListView->setColumnAlignment(1,AlignHCenter); |
149 | mMessageListView->setColumnAlignment(2,AlignHCenter); | 149 | mMessageListView->setColumnAlignment(2,AlignHCenter); |
150 | mMessageListView->setColumnAlignment(3,AlignHCenter); | 150 | mMessageListView->setColumnAlignment(3,AlignHCenter); |
151 | mMessageListView->setColumnAlignment(4,AlignHCenter); | 151 | mMessageListView->setColumnAlignment(4,AlignHCenter); |
152 | QObject::connect(mMessageListView,SIGNAL(doubleClicked(QListViewItem *)), | 152 | QObject::connect(mMessageListView,SIGNAL(doubleClicked(QListViewItem *)), |
153 | this,SLOT(showEvent(QListViewItem *))); | 153 | this,SLOT(showEvent(QListViewItem *))); |
154 | retrieve(); | 154 | retrieve(); |
155 | } | 155 | } |
156 | 156 | ||
157 | /* | 157 | /* |
158 | * Destroys the object and frees any allocated resources | 158 | * Destroys the object and frees any allocated resources |
159 | */ | 159 | */ |
160 | IncomingDialog::~IncomingDialog() | 160 | IncomingDialog::~IncomingDialog() |
161 | { | 161 | { |
162 | // no need to delete child widgets, Qt does it all for us | 162 | // no need to delete child widgets, Qt does it all for us |
163 | } | 163 | } |
164 | 164 | ||
165 | void IncomingDialog::setOutgoingDialog(OutgoingDialog *outgoing) | 165 | void IncomingDialog::setOutgoingDialog(OutgoingDialog *outgoing) |
166 | { | 166 | { |
167 | mOutgoing = outgoing; | 167 | mOutgoing = outgoing; |
168 | } | 168 | } |
169 | 169 | ||
170 | void IncomingDialog::retrieve() | 170 | void IncomingDialog::retrieve() |
171 | { | 171 | { |
172 | QPtrList <ScheduleMessage> messages = mScheduler->retrieveTransactions(); | 172 | QPtrList <ScheduleMessage> messages = mScheduler->retrieveTransactions(); |
173 | 173 | ||
174 | ScheduleMessage *message; | 174 | ScheduleMessage *message; |
175 | for(message = messages.first();message;message = messages.next()) { | 175 | for(message = messages.first();message;message = messages.next()) { |
176 | IncidenceBase *inc = message->event(); | 176 | IncidenceBase *inc = message->event(); |
177 | Scheduler::Method method = (Scheduler::Method)message->method(); | 177 | Scheduler::Method method = (Scheduler::Method)message->method(); |
178 | ScheduleMessage::Status status = message->status(); | 178 | ScheduleMessage::Status status = message->status(); |
179 | 179 | ||
180 | ScheduleItemIn *item = new ScheduleItemIn(mMessageListView,inc,method,status); | 180 | ScheduleItemIn *item = new ScheduleItemIn(mMessageListView,inc,method,status); |
181 | if(inc->type()!="FreeBusy") { | 181 | if(inc->typeID() != freebusyID ) { |
182 | Incidence *incidence = static_cast<Incidence *>(inc); | 182 | Incidence *incidence = static_cast<Incidence *>(inc); |
183 | ScheduleItemVisitor v(item); | 183 | ScheduleItemVisitor v(item); |
184 | if (!incidence->accept(v)) delete item; | 184 | if (!incidence->accept(v)) delete item; |
185 | } else { | 185 | } else { |
186 | FreeBusy *fb = static_cast<FreeBusy *>(item->event()); | 186 | FreeBusy *fb = static_cast<FreeBusy *>(item->event()); |
187 | item->setText(0, "FreeBusy"); | 187 | item->setText(0, "FreeBusy"); |
188 | item->setText(1, KGlobal::locale()->formatDate( fb->dtStart().date() ) ); | 188 | item->setText(1, KGlobal::locale()->formatDate( fb->dtStart().date() ) ); |
189 | item->setText(2, KGlobal::locale()->formatTime( fb->dtStart().time() ) ); | 189 | item->setText(2, KGlobal::locale()->formatTime( fb->dtStart().time() ) ); |
190 | item->setText(3, KGlobal::locale()->formatDate( fb->dtEnd().date() ) ); | 190 | item->setText(3, KGlobal::locale()->formatDate( fb->dtEnd().date() ) ); |
191 | item->setText(4, KGlobal::locale()->formatTime( fb->dtEnd().time() ) ); | 191 | item->setText(4, KGlobal::locale()->formatTime( fb->dtEnd().time() ) ); |
192 | item->setText(5, fb->organizer()); | 192 | item->setText(5, fb->organizer()); |
193 | } | 193 | } |
194 | automaticAction(item); | 194 | automaticAction(item); |
195 | } | 195 | } |
196 | emit numMessagesChanged(mMessageListView->childCount()); | 196 | emit numMessagesChanged(mMessageListView->childCount()); |
197 | } | 197 | } |
198 | 198 | ||
199 | void IncomingDialog::acceptAllMessages() | 199 | void IncomingDialog::acceptAllMessages() |
200 | { | 200 | { |
201 | bool success = false; | 201 | bool success = false; |
202 | 202 | ||
203 | ScheduleItemIn *item = (ScheduleItemIn *)mMessageListView->firstChild(); | 203 | ScheduleItemIn *item = (ScheduleItemIn *)mMessageListView->firstChild(); |
204 | while(item) { | 204 | while(item) { |
205 | ScheduleItemIn *nextitem = (ScheduleItemIn *)(item->nextSibling()); | 205 | ScheduleItemIn *nextitem = (ScheduleItemIn *)(item->nextSibling()); |
206 | if (acceptMessage(item)) success = true; | 206 | if (acceptMessage(item)) success = true; |
207 | item = nextitem; | 207 | item = nextitem; |
208 | } | 208 | } |
209 | 209 | ||
210 | if (success) emit calendarUpdated(); | 210 | if (success) emit calendarUpdated(); |
211 | } | 211 | } |
212 | 212 | ||
213 | void IncomingDialog::acceptMessage() | 213 | void IncomingDialog::acceptMessage() |
214 | { | 214 | { |
215 | ScheduleItemIn *item = (ScheduleItemIn *)mMessageListView->selectedItem(); | 215 | ScheduleItemIn *item = (ScheduleItemIn *)mMessageListView->selectedItem(); |
216 | if (item) { | 216 | if (item) { |
217 | if (acceptMessage(item)) emit calendarUpdated(); | 217 | if (acceptMessage(item)) emit calendarUpdated(); |
218 | } | 218 | } |
219 | } | 219 | } |
220 | 220 | ||
221 | bool IncomingDialog::acceptMessage(ScheduleItemIn *item) | 221 | bool IncomingDialog::acceptMessage(ScheduleItemIn *item) |
222 | { | 222 | { |
223 | switch (item->method()) { | 223 | switch (item->method()) { |
224 | case Scheduler::Refresh: | 224 | case Scheduler::Refresh: |
225 | return incomeRefresh(item); | 225 | return incomeRefresh(item); |
226 | break; | 226 | break; |
227 | case Scheduler::Counter: | 227 | case Scheduler::Counter: |
228 | return incomeCounter(item); | 228 | return incomeCounter(item); |
229 | break; | 229 | break; |
230 | case Scheduler::Declinecounter: | 230 | case Scheduler::Declinecounter: |
231 | return incomeDeclineCounter(item); | 231 | return incomeDeclineCounter(item); |
232 | break; | 232 | break; |
233 | case Scheduler::Add: | 233 | case Scheduler::Add: |
234 | return incomeAdd(item); | 234 | return incomeAdd(item); |
235 | break; | 235 | break; |
236 | case Scheduler::Request: | 236 | case Scheduler::Request: |
237 | return incomeRequest(item); | 237 | return incomeRequest(item); |
238 | break; | 238 | break; |
239 | default: | 239 | default: |
240 | return incomeDefault(item); | 240 | return incomeDefault(item); |
241 | } | 241 | } |
242 | return false; | 242 | return false; |
243 | } | 243 | } |
244 | 244 | ||
245 | void IncomingDialog::rejectMessage() | 245 | void IncomingDialog::rejectMessage() |
246 | { | 246 | { |
247 | ScheduleItemIn *item = (ScheduleItemIn *)mMessageListView->selectedItem(); | 247 | ScheduleItemIn *item = (ScheduleItemIn *)mMessageListView->selectedItem(); |
248 | if (item) { | 248 | if (item) { |
249 | mScheduler->deleteTransaction(item->event()); | 249 | mScheduler->deleteTransaction(item->event()); |
250 | delete item; | 250 | delete item; |
251 | emit numMessagesChanged(mMessageListView->childCount()); | 251 | emit numMessagesChanged(mMessageListView->childCount()); |
252 | } | 252 | } |
253 | } | 253 | } |
254 | 254 | ||
255 | void IncomingDialog::showEvent(QListViewItem *item) | 255 | void IncomingDialog::showEvent(QListViewItem *item) |
256 | { | 256 | { |
257 | IncidenceBase *incidence = ((ScheduleItemIn *)item)->event(); | 257 | IncidenceBase *incidence = ((ScheduleItemIn *)item)->event(); |
258 | if( incidence && incidence->type() == "Event" ) { | 258 | if( incidence && incidence->typeID() == eventID ) { |
259 | Event *event = static_cast<Event *>(incidence); | 259 | Event *event = static_cast<Event *>(incidence); |
260 | KOEventViewerDialog *eventViewer = new KOEventViewerDialog(this); | 260 | KOEventViewerDialog *eventViewer = new KOEventViewerDialog(this); |
261 | eventViewer->setEvent(event); | 261 | eventViewer->setEvent(event); |
262 | eventViewer->show(); | 262 | eventViewer->show(); |
263 | } | 263 | } |
264 | } | 264 | } |
265 | 265 | ||
266 | bool IncomingDialog::incomeRefresh(ScheduleItemIn *item) | 266 | bool IncomingDialog::incomeRefresh(ScheduleItemIn *item) |
267 | { | 267 | { |
268 | Event *ev = mCalendar->event(item->event()->uid()); | 268 | Event *ev = mCalendar->event(item->event()->uid()); |
269 | if (ev) { | 269 | if (ev) { |
270 | //user interaction before?? | 270 | //user interaction before?? |
271 | Attendee *att; | 271 | Attendee *att; |
272 | QPtrList<Attendee> attlist = ev->attendees(); | 272 | QPtrList<Attendee> attlist = ev->attendees(); |
273 | for (att=attlist.first(); att; att=attlist.next()) { | 273 | for (att=attlist.first(); att; att=attlist.next()) { |
274 | Event *event = new Event(*ev); | 274 | Event *event = new Event(*ev); |
275 | mOutgoing->addMessage(event,Scheduler::Request,att->email()); | 275 | mOutgoing->addMessage(event,Scheduler::Request,att->email()); |
276 | delete(event); | 276 | delete(event); |
277 | } | 277 | } |
278 | mScheduler->deleteTransaction(item->event()); | 278 | mScheduler->deleteTransaction(item->event()); |
279 | delete item; | 279 | delete item; |
280 | emit numMessagesChanged(mMessageListView->childCount()); | 280 | emit numMessagesChanged(mMessageListView->childCount()); |
281 | return true; | 281 | return true; |
282 | } | 282 | } |
283 | mScheduler->deleteTransaction(item->event()); | 283 | mScheduler->deleteTransaction(item->event()); |
284 | delete item; | 284 | delete item; |
285 | emit numMessagesChanged(mMessageListView->childCount()); | 285 | emit numMessagesChanged(mMessageListView->childCount()); |
286 | return false; | 286 | return false; |
287 | } | 287 | } |
288 | 288 | ||
289 | bool IncomingDialog::incomeCounter(ScheduleItemIn *item) | 289 | bool IncomingDialog::incomeCounter(ScheduleItemIn *item) |
290 | { | 290 | { |
291 | IncidenceBase *incidence = ((ScheduleItemIn *)item)->event(); | 291 | IncidenceBase *incidence = ((ScheduleItemIn *)item)->event(); |
292 | // currently only events supportet - attetion at insertion below! | 292 | // currently only events supportet - attetion at insertion below! |
293 | if ( incidence->type() != "Event" ) return false; | 293 | if ( incidence->typeID() != eventID ) return false; |
294 | 294 | ||
295 | Event *counterEvent = static_cast<Event *>( incidence ); | 295 | Event *counterEvent = static_cast<Event *>( incidence ); |
296 | 296 | ||
297 | Event *even = mCalendar->event(counterEvent->uid()); | 297 | Event *even = mCalendar->event(counterEvent->uid()); |
298 | 298 | ||
299 | KOCounterDialog *eventViewer = new KOCounterDialog(this); | 299 | KOCounterDialog *eventViewer = new KOCounterDialog(this); |
300 | eventViewer->addText(i18n("counter proposal event","<b>Counter-event:</b><p>")); | 300 | eventViewer->addText(i18n("counter proposal event","<b>Counter-event:</b><p>")); |
301 | eventViewer->addEvent(counterEvent); | 301 | eventViewer->addEvent(counterEvent); |
302 | eventViewer->addText("<hr>"); | 302 | eventViewer->addText("<hr>"); |
303 | eventViewer->addText(i18n("<b>Original event:</b><p>")); | 303 | eventViewer->addText(i18n("<b>Original event:</b><p>")); |
304 | if (even) eventViewer->addEvent(even); | 304 | if (even) eventViewer->addEvent(even); |
305 | else eventViewer->addText(i18n("A corresponding event is missing in your calendar!")); | 305 | else eventViewer->addText(i18n("A corresponding event is missing in your calendar!")); |
306 | eventViewer->addText("<hr>"); | 306 | eventViewer->addText("<hr>"); |
307 | eventViewer->addText(i18n("If this counter-event is a good proposal for your event, press 'Accept'. All Attendees will then get the new version of this event")); | 307 | eventViewer->addText(i18n("If this counter-event is a good proposal for your event, press 'Accept'. All Attendees will then get the new version of this event")); |
308 | eventViewer->show(); | 308 | eventViewer->show(); |
309 | 309 | ||
310 | eventViewer->exec(); | 310 | eventViewer->exec(); |
311 | if (eventViewer->result()) { | 311 | if (eventViewer->result()) { |
312 | kdDebug() << "IncomingDialog::Counter:Accept" << endl; | 312 | kdDebug() << "IncomingDialog::Counter:Accept" << endl; |
313 | int revision = 0; | 313 | int revision = 0; |
314 | if (even) { | 314 | if (even) { |
315 | revision = even->revision(); | 315 | revision = even->revision(); |
316 | mCalendar->deleteEvent(even); | 316 | mCalendar->deleteEvent(even); |
317 | } | 317 | } |
318 | mCalendar->addIncidence(counterEvent); | 318 | mCalendar->addIncidence(counterEvent); |
319 | 319 | ||
320 | even = mCalendar->event(item->event()->uid()); | 320 | even = mCalendar->event(item->event()->uid()); |
321 | if (even) { | 321 | if (even) { |
322 | if (revision < even->revision()) | 322 | if (revision < even->revision()) |
323 | even->setRevision(even->revision()+1); | 323 | even->setRevision(even->revision()+1); |
324 | else | 324 | else |
325 | even->setRevision(revision+1); | 325 | even->setRevision(revision+1); |
326 | Event *ev = new Event(*even); | 326 | Event *ev = new Event(*even); |
327 | mOutgoing->addMessage(ev,Scheduler::Request); | 327 | mOutgoing->addMessage(ev,Scheduler::Request); |
328 | delete(ev); | 328 | delete(ev); |
329 | } | 329 | } |
330 | mScheduler->deleteTransaction(item->event()); | 330 | mScheduler->deleteTransaction(item->event()); |
331 | delete item; | 331 | delete item; |
332 | emit numMessagesChanged(mMessageListView->childCount()); | 332 | emit numMessagesChanged(mMessageListView->childCount()); |
333 | return true; | 333 | return true; |
334 | } else { | 334 | } else { |
335 | kdDebug() << "IncomingDialog::Counter:Decline" << endl; | 335 | kdDebug() << "IncomingDialog::Counter:Decline" << endl; |
336 | //the counter-sender's email is missing... | 336 | //the counter-sender's email is missing... |
337 | //now every attendee gets an declinecounter :-( | 337 | //now every attendee gets an declinecounter :-( |
338 | mOutgoing->addMessage(counterEvent,Scheduler::Declinecounter); | 338 | mOutgoing->addMessage(counterEvent,Scheduler::Declinecounter); |
339 | delete item; | 339 | delete item; |
340 | emit numMessagesChanged(mMessageListView->childCount()); | 340 | emit numMessagesChanged(mMessageListView->childCount()); |
341 | mScheduler->deleteTransaction(item->event()); | 341 | mScheduler->deleteTransaction(item->event()); |
342 | delete item; | 342 | delete item; |
343 | emit numMessagesChanged(mMessageListView->childCount()); | 343 | emit numMessagesChanged(mMessageListView->childCount()); |
344 | return true; | 344 | return true; |
345 | } | 345 | } |
346 | //mScheduler->deleteTransaction(item->event()); | 346 | //mScheduler->deleteTransaction(item->event()); |
347 | delete item; | 347 | delete item; |
348 | emit numMessagesChanged(mMessageListView->childCount()); | 348 | emit numMessagesChanged(mMessageListView->childCount()); |
349 | return false; | 349 | return false; |
350 | } | 350 | } |
351 | 351 | ||
352 | bool IncomingDialog::incomeDeclineCounter(ScheduleItemIn *item) | 352 | bool IncomingDialog::incomeDeclineCounter(ScheduleItemIn *item) |
353 | { | 353 | { |
354 | Event *even = mCalendar->event(item->event()->uid()); | 354 | Event *even = mCalendar->event(item->event()->uid()); |
355 | if (even) { | 355 | if (even) { |
356 | mOutgoing->addMessage(even,Scheduler::Refresh); | 356 | mOutgoing->addMessage(even,Scheduler::Refresh); |
357 | mScheduler->deleteTransaction(item->event()); | 357 | mScheduler->deleteTransaction(item->event()); |
358 | delete item; | 358 | delete item; |
359 | emit numMessagesChanged(mMessageListView->childCount()); | 359 | emit numMessagesChanged(mMessageListView->childCount()); |
360 | return true; | 360 | return true; |
361 | } | 361 | } |
362 | mScheduler->deleteTransaction(item->event()); | 362 | mScheduler->deleteTransaction(item->event()); |
363 | delete item; | 363 | delete item; |
364 | emit numMessagesChanged(mMessageListView->childCount()); | 364 | emit numMessagesChanged(mMessageListView->childCount()); |
365 | return false; | 365 | return false; |
366 | } | 366 | } |
367 | 367 | ||
368 | bool IncomingDialog::incomeAdd(ScheduleItemIn *item) | 368 | bool IncomingDialog::incomeAdd(ScheduleItemIn *item) |
369 | { | 369 | { |
370 | IncidenceBase *incidence = ((ScheduleItemIn *)item)->event(); | 370 | IncidenceBase *incidence = ((ScheduleItemIn *)item)->event(); |
371 | if (incidence->type() == "Event" ) { | 371 | if (incidence->typeID() == eventID ) { |
372 | Event *refr = static_cast<Event *>( incidence ); | 372 | Event *refr = static_cast<Event *>( incidence ); |
373 | mOutgoing->addMessage(refr,Scheduler::Refresh); | 373 | mOutgoing->addMessage(refr,Scheduler::Refresh); |
374 | mScheduler->deleteTransaction( incidence ); | 374 | mScheduler->deleteTransaction( incidence ); |
375 | delete item; | 375 | delete item; |
376 | emit numMessagesChanged(mMessageListView->childCount()); | 376 | emit numMessagesChanged(mMessageListView->childCount()); |
377 | return true; | 377 | return true; |
378 | } | 378 | } |
379 | else { | 379 | else { |
380 | kdDebug() << "IncomingDialog::incomeAdd - only Events are supportet yet" << endl; | 380 | kdDebug() << "IncomingDialog::incomeAdd - only Events are supportet yet" << endl; |
381 | mScheduler->deleteTransaction( incidence ); | 381 | mScheduler->deleteTransaction( incidence ); |
382 | delete item; | 382 | delete item; |
383 | emit numMessagesChanged(mMessageListView->childCount()); | 383 | emit numMessagesChanged(mMessageListView->childCount()); |
384 | return false; | 384 | return false; |
385 | } | 385 | } |
386 | } | 386 | } |
387 | 387 | ||
388 | bool IncomingDialog::incomeDefault(ScheduleItemIn *item) | 388 | bool IncomingDialog::incomeDefault(ScheduleItemIn *item) |
389 | { | 389 | { |
390 | if (mScheduler->acceptTransaction(item->event(),item->method(),item->status())) { | 390 | if (mScheduler->acceptTransaction(item->event(),item->method(),item->status())) { |
391 | delete item; | 391 | delete item; |
392 | emit numMessagesChanged(mMessageListView->childCount()); | 392 | emit numMessagesChanged(mMessageListView->childCount()); |
393 | return true; | 393 | return true; |
394 | } | 394 | } |
395 | else { | 395 | else { |
396 | KMessageBox::error(this,i18n("Unable to accept the IMIP-message. It may be a problem with the email addresses.")); | 396 | KMessageBox::error(this,i18n("Unable to accept the IMIP-message. It may be a problem with the email addresses.")); |
397 | kdDebug() << "IncomingDialog::acceptMessage(): Error!" << endl; | 397 | kdDebug() << "IncomingDialog::acceptMessage(): Error!" << endl; |
398 | return false; | 398 | return false; |
399 | } | 399 | } |
400 | return false; | 400 | return false; |
401 | } | 401 | } |
402 | 402 | ||
403 | bool IncomingDialog::incomeRequest(ScheduleItemIn *item) | 403 | bool IncomingDialog::incomeRequest(ScheduleItemIn *item) |
404 | { | 404 | { |
405 | if (item->event()->type()=="FreeBusy") { | 405 | if (item->event()->typeID() == freebusyID ) { |
406 | //handel freebusy request | 406 | //handel freebusy request |
407 | IncidenceBase *inc = item->event(); | 407 | IncidenceBase *inc = item->event(); |
408 | QDateTime start = inc->dtStart(); | 408 | QDateTime start = inc->dtStart(); |
409 | QDateTime end = start.addDays(inc->duration()/86400); | 409 | QDateTime end = start.addDays(inc->duration()/86400); |
410 | 410 | ||
411 | FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); | 411 | FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); |
412 | freebusy->setOrganizer(inc->organizer()); | 412 | freebusy->setOrganizer(inc->organizer()); |
413 | Attendee *att = new Attendee(KOPrefs::instance()->fullName(), | 413 | Attendee *att = new Attendee(KOPrefs::instance()->fullName(), |
414 | KOPrefs::instance()->email()); | 414 | KOPrefs::instance()->email()); |
415 | freebusy->addAttendee(att); | 415 | freebusy->addAttendee(att); |
416 | 416 | ||
417 | kdDebug() << "calendarview: schedule_publish_freebusy: startDate: " | 417 | kdDebug() << "calendarview: schedule_publish_freebusy: startDate: " |
418 | << KGlobal::locale()->formatDateTime( start ) << " End Date: " | 418 | << KGlobal::locale()->formatDateTime( start ) << " End Date: " |
419 | << KGlobal::locale()->formatDateTime( end ) << endl; | 419 | << KGlobal::locale()->formatDateTime( end ) << endl; |
420 | 420 | ||
421 | if (mOutgoing->addMessage(freebusy,Scheduler::Reply)) { | 421 | if (mOutgoing->addMessage(freebusy,Scheduler::Reply)) { |
422 | delete item; | 422 | delete item; |
423 | emit numMessagesChanged(mMessageListView->childCount()); | 423 | emit numMessagesChanged(mMessageListView->childCount()); |
424 | delete(freebusy); | 424 | delete(freebusy); |
425 | return true; | 425 | return true; |
426 | } | 426 | } |
427 | return false; | 427 | return false; |
428 | } else { | 428 | } else { |
429 | return incomeDefault(item); | 429 | return incomeDefault(item); |
430 | } | 430 | } |
431 | return false; | 431 | return false; |
432 | } | 432 | } |
433 | 433 | ||
434 | bool IncomingDialog::automaticAction(ScheduleItemIn *item) | 434 | bool IncomingDialog::automaticAction(ScheduleItemIn *item) |
435 | { | 435 | { |
436 | bool autoAction = false; | 436 | bool autoAction = false; |
437 | IncidenceBase *inc = item->event(); | 437 | IncidenceBase *inc = item->event(); |
438 | Scheduler::Method method = item->method(); | 438 | Scheduler::Method method = item->method(); |
439 | 439 | ||
440 | if( inc->type()=="FreeBusy" ) { | 440 | if( inc->typeID() == freebusyID ) { |
441 | if ( method==Scheduler::Request ) { | 441 | if ( method==Scheduler::Request ) { |
442 | if ( KOPrefs::instance()->mIMIPAutoFreeBusy==KOPrefs::addressbookAuto ) { | 442 | if ( KOPrefs::instance()->mIMIPAutoFreeBusy==KOPrefs::addressbookAuto ) { |
443 | // reply freebusy information | 443 | // reply freebusy information |
444 | if ( checkOrganizerInAddressbook(inc->organizer()) ) { | 444 | if ( checkOrganizerInAddressbook(inc->organizer()) ) { |
445 | incomeRequest(item); | 445 | incomeRequest(item); |
446 | } | 446 | } |
447 | } else return false; | 447 | } else return false; |
448 | } else { | 448 | } else { |
449 | 449 | ||
450 | if ( method==Scheduler::Reply ) { | 450 | if ( method==Scheduler::Reply ) { |
451 | if ( KOPrefs::instance()->mIMIPAutoFreeBusy==KOPrefs::addressbookAuto ) { | 451 | if ( KOPrefs::instance()->mIMIPAutoFreeBusy==KOPrefs::addressbookAuto ) { |
452 | // insert freebusy information | 452 | // insert freebusy information |
453 | //if ( checkAttendeesInAddressbook(inc) ) | 453 | //if ( checkAttendeesInAddressbook(inc) ) |
454 | 454 | ||
455 | } else return false; | 455 | } else return false; |
456 | } else { | 456 | } else { |
457 | if ( method==Scheduler::Publish) { | 457 | if ( method==Scheduler::Publish) { |
458 | if ( KOPrefs::instance()->mIMIPAutoFreeBusy==KOPrefs::addressbookAuto ) { | 458 | if ( KOPrefs::instance()->mIMIPAutoFreeBusy==KOPrefs::addressbookAuto ) { |
459 | // insert freebusy information | 459 | // insert freebusy information |
460 | //if ( checkOrganizerInAddressbook(inc->organizer()) ) | 460 | //if ( checkOrganizerInAddressbook(inc->organizer()) ) |
461 | 461 | ||
462 | } | 462 | } |
463 | } else return false; | 463 | } else return false; |
464 | } | 464 | } |
465 | } | 465 | } |
466 | } | 466 | } |
467 | 467 | ||
468 | if ( inc->type()=="Event" ) { | 468 | if ( inc->typeID() == eventID ) { |
469 | if ( method==Scheduler::Request || method==Scheduler::Publish ) { | 469 | if ( method==Scheduler::Request || method==Scheduler::Publish ) { |
470 | if ( KOPrefs::instance()->mIMIPAutoInsertRequest==KOPrefs::addressbookAuto ) { | 470 | if ( KOPrefs::instance()->mIMIPAutoInsertRequest==KOPrefs::addressbookAuto ) { |
471 | // insert event | 471 | // insert event |
472 | if ( checkOrganizerInAddressbook(inc->organizer()) ) | 472 | if ( checkOrganizerInAddressbook(inc->organizer()) ) |
473 | autoAction = acceptMessage(item); | 473 | autoAction = acceptMessage(item); |
474 | } else return false; | 474 | } else return false; |
475 | } else { | 475 | } else { |
476 | 476 | ||
477 | if ( method==Scheduler::Reply ) { | 477 | if ( method==Scheduler::Reply ) { |
478 | if ( KOPrefs::instance()->mIMIPAutoInsertReply==KOPrefs::addressbookAuto ) { | 478 | if ( KOPrefs::instance()->mIMIPAutoInsertReply==KOPrefs::addressbookAuto ) { |
479 | // update event information | 479 | // update event information |
480 | if ( checkAttendeesInAddressbook(inc) ) | 480 | if ( checkAttendeesInAddressbook(inc) ) |
481 | autoAction = acceptMessage(item); | 481 | autoAction = acceptMessage(item); |
482 | } else return false; | 482 | } else return false; |
483 | } else { | 483 | } else { |
484 | 484 | ||
485 | if ( method==Scheduler::Refresh ) { | 485 | if ( method==Scheduler::Refresh ) { |
486 | if ( KOPrefs::instance()->mIMIPAutoRefresh==KOPrefs::addressbookAuto ) { | 486 | if ( KOPrefs::instance()->mIMIPAutoRefresh==KOPrefs::addressbookAuto ) { |
487 | // send refresh-information | 487 | // send refresh-information |
488 | if ( checkAttendeesInAddressbook(inc) ) | 488 | if ( checkAttendeesInAddressbook(inc) ) |
489 | autoAction = acceptMessage(item); | 489 | autoAction = acceptMessage(item); |
490 | else return false; | 490 | else return false; |
491 | } else return false; | 491 | } else return false; |
492 | } else return false; | 492 | } else return false; |
493 | } | 493 | } |
494 | } | 494 | } |
495 | } | 495 | } |
496 | return autoAction; | 496 | return autoAction; |
497 | } | 497 | } |
498 | 498 | ||
499 | bool IncomingDialog::checkOrganizerInAddressbook(QString organizer) | 499 | bool IncomingDialog::checkOrganizerInAddressbook(QString organizer) |
500 | { | 500 | { |
501 | bool inBook = false; | 501 | bool inBook = false; |
502 | #ifndef KORG_NOKABC | 502 | #ifndef KORG_NOKABC |
503 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); | 503 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); |
504 | KABC::Addressee::List addressList; | 504 | KABC::Addressee::List addressList; |
505 | addressList = add_book->findByEmail(organizer); | 505 | addressList = add_book->findByEmail(organizer); |
506 | if ( addressList.size()>0 ) inBook = true; | 506 | if ( addressList.size()>0 ) inBook = true; |
507 | #endif | 507 | #endif |
508 | return inBook; | 508 | return inBook; |
509 | } | 509 | } |
510 | 510 | ||
511 | bool IncomingDialog::checkAttendeesInAddressbook(IncidenceBase *inc) | 511 | bool IncomingDialog::checkAttendeesInAddressbook(IncidenceBase *inc) |
512 | { | 512 | { |
513 | bool inBook = false; | 513 | bool inBook = false; |
514 | #ifndef KORG_NOKABC | 514 | #ifndef KORG_NOKABC |
515 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); | 515 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); |
516 | KABC::Addressee::List addressList; | 516 | KABC::Addressee::List addressList; |
517 | QPtrList <Attendee> attendees; | 517 | QPtrList <Attendee> attendees; |
518 | Attendee *att; | 518 | Attendee *att; |
519 | attendees = inc->attendees(); | 519 | attendees = inc->attendees(); |
520 | for (att=attendees.first();att;att=attendees.next()) { | 520 | for (att=attendees.first();att;att=attendees.next()) { |
521 | addressList = add_book->findByEmail(att->email()); | 521 | addressList = add_book->findByEmail(att->email()); |
522 | if (addressList.size()>0 ) inBook = true; | 522 | if (addressList.size()>0 ) inBook = true; |
523 | } | 523 | } |
524 | #endif | 524 | #endif |
525 | return inBook; | 525 | return inBook; |
526 | } | 526 | } |
527 | 527 | ||
528 | //#include "incomingdialog.moc" | 528 | //#include "incomingdialog.moc" |
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 1320a2e..b2b136a 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -520,129 +520,129 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | |||
520 | 520 | ||
521 | connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), | 521 | connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), |
522 | SIGNAL(editIncidenceSignal(Incidence *))); | 522 | SIGNAL(editIncidenceSignal(Incidence *))); |
523 | connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), | 523 | connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), |
524 | SIGNAL(editIncidenceSignal(Incidence *))); | 524 | SIGNAL(editIncidenceSignal(Incidence *))); |
525 | connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), | 525 | connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), |
526 | SIGNAL(showIncidenceSignal(Incidence *))); | 526 | SIGNAL(showIncidenceSignal(Incidence *))); |
527 | connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), | 527 | connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), |
528 | SIGNAL(showIncidenceSignal(Incidence *))); | 528 | SIGNAL(showIncidenceSignal(Incidence *))); |
529 | connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), | 529 | connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), |
530 | SIGNAL(deleteIncidenceSignal(Incidence *))); | 530 | SIGNAL(deleteIncidenceSignal(Incidence *))); |
531 | connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), | 531 | connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), |
532 | SIGNAL(deleteIncidenceSignal(Incidence *))); | 532 | SIGNAL(deleteIncidenceSignal(Incidence *))); |
533 | 533 | ||
534 | connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), | 534 | connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), |
535 | SLOT(updateEventDates(KOAgendaItem *, int ))); | 535 | SLOT(updateEventDates(KOAgendaItem *, int ))); |
536 | connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), | 536 | connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), |
537 | SLOT(updateEventDates(KOAgendaItem *, int))); | 537 | SLOT(updateEventDates(KOAgendaItem *, int))); |
538 | 538 | ||
539 | // event indicator update | 539 | // event indicator update |
540 | connect(mAgenda,SIGNAL(lowerYChanged(int)), | 540 | connect(mAgenda,SIGNAL(lowerYChanged(int)), |
541 | SLOT(updateEventIndicatorTop(int))); | 541 | SLOT(updateEventIndicatorTop(int))); |
542 | connect(mAgenda,SIGNAL(upperYChanged(int)), | 542 | connect(mAgenda,SIGNAL(upperYChanged(int)), |
543 | SLOT(updateEventIndicatorBottom(int))); | 543 | SLOT(updateEventIndicatorBottom(int))); |
544 | // drag signals | 544 | // drag signals |
545 | /* | 545 | /* |
546 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), | 546 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), |
547 | SLOT(startDrag(Event *))); | 547 | SLOT(startDrag(Event *))); |
548 | connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), | 548 | connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), |
549 | SLOT(startDrag(Event *))); | 549 | SLOT(startDrag(Event *))); |
550 | */ | 550 | */ |
551 | // synchronize selections | 551 | // synchronize selections |
552 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 552 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
553 | mAllDayAgenda, SLOT( deselectItem() ) ); | 553 | mAllDayAgenda, SLOT( deselectItem() ) ); |
554 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 554 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
555 | mAgenda, SLOT( deselectItem() ) ); | 555 | mAgenda, SLOT( deselectItem() ) ); |
556 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 556 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
557 | SIGNAL( incidenceSelected( Incidence * ) ) ); | 557 | SIGNAL( incidenceSelected( Incidence * ) ) ); |
558 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 558 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
559 | SIGNAL( incidenceSelected( Incidence * ) ) ); | 559 | SIGNAL( incidenceSelected( Incidence * ) ) ); |
560 | connect( mAgenda, SIGNAL( resizedSignal() ), | 560 | connect( mAgenda, SIGNAL( resizedSignal() ), |
561 | SLOT( updateConfig( ) ) ); | 561 | SLOT( updateConfig( ) ) ); |
562 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), | 562 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), |
563 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); | 563 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); |
564 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), | 564 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), |
565 | SLOT( addToCalSlot(Incidence * , Incidence *) ) ); | 565 | SLOT( addToCalSlot(Incidence * , Incidence *) ) ); |
566 | // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); | 566 | // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); |
567 | //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); | 567 | //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); |
568 | 568 | ||
569 | connect( mAllDayAgenda, SIGNAL( signalClearSelection() ),mAgenda, SLOT( slotClearSelection()) ); | 569 | connect( mAllDayAgenda, SIGNAL( signalClearSelection() ),mAgenda, SLOT( slotClearSelection()) ); |
570 | connect( mAgenda, SIGNAL( signalClearSelection() ),mAllDayAgenda, SLOT( slotClearSelection()) ); | 570 | connect( mAgenda, SIGNAL( signalClearSelection() ),mAllDayAgenda, SLOT( slotClearSelection()) ); |
571 | 571 | ||
572 | } | 572 | } |
573 | 573 | ||
574 | void KOAgendaView::toggleAllDay() | 574 | void KOAgendaView::toggleAllDay() |
575 | { | 575 | { |
576 | if ( mSplitterAgenda->firstHandle() ) | 576 | if ( mSplitterAgenda->firstHandle() ) |
577 | mSplitterAgenda->firstHandle()->toggle(); | 577 | mSplitterAgenda->firstHandle()->toggle(); |
578 | } | 578 | } |
579 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) | 579 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) |
580 | { | 580 | { |
581 | calendar()->addIncidence( inc ); | 581 | calendar()->addIncidence( inc ); |
582 | 582 | ||
583 | if ( incOld ) { | 583 | if ( incOld ) { |
584 | if ( incOld->type() == "Todo" ) | 584 | if ( incOld->typeID() == todoID ) |
585 | emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); | 585 | emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); |
586 | else | 586 | else |
587 | emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); | 587 | emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); |
588 | } | 588 | } |
589 | 589 | ||
590 | } | 590 | } |
591 | 591 | ||
592 | KOAgendaView::~KOAgendaView() | 592 | KOAgendaView::~KOAgendaView() |
593 | { | 593 | { |
594 | delete mAllAgendaPopup; | 594 | delete mAllAgendaPopup; |
595 | //delete mAllDayAgendaPopup; | 595 | //delete mAllDayAgendaPopup; |
596 | delete KOAgendaItem::paintPix(); | 596 | delete KOAgendaItem::paintPix(); |
597 | delete KOAgendaItem::paintPixSel(); | 597 | delete KOAgendaItem::paintPixSel(); |
598 | } | 598 | } |
599 | void KOAgendaView::resizeEvent( QResizeEvent* e ) | 599 | void KOAgendaView::resizeEvent( QResizeEvent* e ) |
600 | { | 600 | { |
601 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); | 601 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); |
602 | bool uc = false; | 602 | bool uc = false; |
603 | int ow = e->oldSize().width(); | 603 | int ow = e->oldSize().width(); |
604 | int oh = e->oldSize().height(); | 604 | int oh = e->oldSize().height(); |
605 | int w = e->size().width(); | 605 | int w = e->size().width(); |
606 | int h = e->size().height(); | 606 | int h = e->size().height(); |
607 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { | 607 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { |
608 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) | 608 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) |
609 | uc = true; | 609 | uc = true; |
610 | //qDebug("view changed %d %d %d %d ", ow, oh , w , h); | 610 | //qDebug("view changed %d %d %d %d ", ow, oh , w , h); |
611 | } | 611 | } |
612 | mUpcomingWidth = e->size().width() ; | 612 | mUpcomingWidth = e->size().width() ; |
613 | if ( mBlockUpdating || uc ) { | 613 | if ( mBlockUpdating || uc ) { |
614 | mBlockUpdating = false; | 614 | mBlockUpdating = false; |
615 | //mAgenda->setMinimumSize(800 , 600 ); | 615 | //mAgenda->setMinimumSize(800 , 600 ); |
616 | //qDebug("mAgenda->resize+++++++++++++++ "); | 616 | //qDebug("mAgenda->resize+++++++++++++++ "); |
617 | updateConfig(); | 617 | updateConfig(); |
618 | //qDebug("KOAgendaView::Updating now possible "); | 618 | //qDebug("KOAgendaView::Updating now possible "); |
619 | } else | 619 | } else |
620 | createDayLabels(); | 620 | createDayLabels(); |
621 | //qDebug("resizeEvent end "); | 621 | //qDebug("resizeEvent end "); |
622 | 622 | ||
623 | } | 623 | } |
624 | void KOAgendaView::slotDaylabelClicked( int num ) | 624 | void KOAgendaView::slotDaylabelClicked( int num ) |
625 | { | 625 | { |
626 | 626 | ||
627 | QDate firstDate = mSelectedDates.first(); | 627 | QDate firstDate = mSelectedDates.first(); |
628 | if ( num == -1 ) | 628 | if ( num == -1 ) |
629 | emit showDateView( 6, firstDate ); | 629 | emit showDateView( 6, firstDate ); |
630 | else if (num >= 0 ) { | 630 | else if (num >= 0 ) { |
631 | if ( mSelectedDates.count() == 1) | 631 | if ( mSelectedDates.count() == 1) |
632 | emit showDateView( 9, firstDate.addDays( num ) ); | 632 | emit showDateView( 9, firstDate.addDays( num ) ); |
633 | else | 633 | else |
634 | emit showDateView( 3, firstDate.addDays( num ) ); | 634 | emit showDateView( 3, firstDate.addDays( num ) ); |
635 | } | 635 | } |
636 | else | 636 | else |
637 | showDateView( 10, firstDate.addDays(1) ); | 637 | showDateView( 10, firstDate.addDays(1) ); |
638 | } | 638 | } |
639 | 639 | ||
640 | KOAgendaButton* KOAgendaView::getNewDaylabel() | 640 | KOAgendaButton* KOAgendaView::getNewDaylabel() |
641 | { | 641 | { |
642 | 642 | ||
643 | KOAgendaButton * dayLabel = new KOAgendaButton(mDayLabels); | 643 | KOAgendaButton * dayLabel = new KOAgendaButton(mDayLabels); |
644 | connect( dayLabel, SIGNAL( numClicked(int) ), this, SLOT ( slotDaylabelClicked(int) ) ); | 644 | connect( dayLabel, SIGNAL( numClicked(int) ), this, SLOT ( slotDaylabelClicked(int) ) ); |
645 | mDayLabelsList.append( dayLabel ); | 645 | mDayLabelsList.append( dayLabel ); |
646 | mLayoutDayLabels->addWidget(dayLabel); | 646 | mLayoutDayLabels->addWidget(dayLabel); |
647 | return dayLabel ; | 647 | return dayLabel ; |
648 | } | 648 | } |
@@ -906,200 +906,200 @@ void KOAgendaView::updateView() | |||
906 | 906 | ||
907 | 907 | ||
908 | /* | 908 | /* |
909 | Update configuration settings for the agenda view. This method is not | 909 | Update configuration settings for the agenda view. This method is not |
910 | complete. | 910 | complete. |
911 | */ | 911 | */ |
912 | void KOAgendaView::updateConfig() | 912 | void KOAgendaView::updateConfig() |
913 | { | 913 | { |
914 | if ( mBlockUpdating ) | 914 | if ( mBlockUpdating ) |
915 | return; | 915 | return; |
916 | if ( mAgenda->height() > 96 * KOPrefs::instance()->mHourSize ) { | 916 | if ( mAgenda->height() > 96 * KOPrefs::instance()->mHourSize ) { |
917 | int old = KOPrefs::instance()->mHourSize; | 917 | int old = KOPrefs::instance()->mHourSize; |
918 | KOPrefs::instance()->mHourSize = mAgenda->height()/96 +1; | 918 | KOPrefs::instance()->mHourSize = mAgenda->height()/96 +1; |
919 | //qDebug("KOPrefs::instance()->mHourSize adjusted %d to %d ", old,KOPrefs::instance()->mHourSize ); | 919 | //qDebug("KOPrefs::instance()->mHourSize adjusted %d to %d ", old,KOPrefs::instance()->mHourSize ); |
920 | } | 920 | } |
921 | 921 | ||
922 | 922 | ||
923 | // update config for children | 923 | // update config for children |
924 | mTimeLabels->updateConfig(); | 924 | mTimeLabels->updateConfig(); |
925 | mAgenda->storePosition(); | 925 | mAgenda->storePosition(); |
926 | mAgenda->updateConfig(); | 926 | mAgenda->updateConfig(); |
927 | mAllDayAgenda->updateConfig(); | 927 | mAllDayAgenda->updateConfig(); |
928 | // widget synchronization | 928 | // widget synchronization |
929 | //TODO: find a better way, maybe signal/slot | 929 | //TODO: find a better way, maybe signal/slot |
930 | mTimeLabels->positionChanged(); | 930 | mTimeLabels->positionChanged(); |
931 | 931 | ||
932 | // for some reason, this needs to be called explicitly | 932 | // for some reason, this needs to be called explicitly |
933 | mTimeLabels->repaint(); | 933 | mTimeLabels->repaint(); |
934 | 934 | ||
935 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); | 935 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); |
936 | 936 | ||
937 | // ToolTips displaying summary of events | 937 | // ToolTips displaying summary of events |
938 | KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() | 938 | KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() |
939 | ->mEnableToolTips); | 939 | ->mEnableToolTips); |
940 | 940 | ||
941 | //setHolidayMasks(); | 941 | //setHolidayMasks(); |
942 | 942 | ||
943 | //createDayLabels(); called by via updateView(); | 943 | //createDayLabels(); called by via updateView(); |
944 | mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth()); | 944 | mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth()); |
945 | updateView(); | 945 | updateView(); |
946 | mAgenda->restorePosition(); | 946 | mAgenda->restorePosition(); |
947 | } | 947 | } |
948 | 948 | ||
949 | 949 | ||
950 | void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) | 950 | void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) |
951 | { | 951 | { |
952 | 952 | ||
953 | 953 | ||
954 | int xxx = item->cellX(); | 954 | int xxx = item->cellX(); |
955 | //qDebug("KOAgendaView::updateEventDates %d %d %d %d %d", xxx, mMinY.at(xxx),mMaxY.at(xxx),item->cellYTop(),item->cellYBottom() ); | 955 | //qDebug("KOAgendaView::updateEventDates %d %d %d %d %d", xxx, mMinY.at(xxx),mMaxY.at(xxx),item->cellYTop(),item->cellYBottom() ); |
956 | if ( mMinY.at(xxx) > item->cellYTop() ) | 956 | if ( mMinY.at(xxx) > item->cellYTop() ) |
957 | mMinY.at(xxx) = item->cellYTop(); | 957 | mMinY.at(xxx) = item->cellYTop(); |
958 | if ( mMaxY.at(xxx) < item->cellYBottom() ) | 958 | if ( mMaxY.at(xxx) < item->cellYBottom() ) |
959 | mMaxY.at(xxx) = item->cellYBottom(); | 959 | mMaxY.at(xxx) = item->cellYBottom(); |
960 | 960 | ||
961 | QDateTime startDt,endDt; | 961 | QDateTime startDt,endDt; |
962 | QDate startDate; | 962 | QDate startDate; |
963 | int lenInSecs; | 963 | int lenInSecs; |
964 | // if ( type == KOAgenda::RESIZETOP ) | 964 | // if ( type == KOAgenda::RESIZETOP ) |
965 | // qDebug("RESIZETOP "); | 965 | // qDebug("RESIZETOP "); |
966 | // if ( type == KOAgenda::RESIZEBOTTOM ) | 966 | // if ( type == KOAgenda::RESIZEBOTTOM ) |
967 | // qDebug("RESIZEBOTTOM "); | 967 | // qDebug("RESIZEBOTTOM "); |
968 | // if ( type == KOAgenda::MOVE ) | 968 | // if ( type == KOAgenda::MOVE ) |
969 | // qDebug("MOVE "); | 969 | // qDebug("MOVE "); |
970 | if ( item->incidence()->type() == "Event" ) { | 970 | if ( item->incidence()->typeID() == eventID ) { |
971 | startDt =item->incidence()->dtStart(); | 971 | startDt =item->incidence()->dtStart(); |
972 | endDt = item->incidence()->dtEnd(); | 972 | endDt = item->incidence()->dtEnd(); |
973 | lenInSecs = startDt.secsTo( endDt ); | 973 | lenInSecs = startDt.secsTo( endDt ); |
974 | } | 974 | } |
975 | 975 | ||
976 | // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED ); | 976 | // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED ); |
977 | 977 | ||
978 | if ( item->incidence()->type()=="Todo" && item->mLastMoveXPos > 0 ) { | 978 | if ( item->incidence()->typeID()== todoID && item->mLastMoveXPos > 0 ) { |
979 | startDate = mSelectedDates[item->mLastMoveXPos]; | 979 | startDate = mSelectedDates[item->mLastMoveXPos]; |
980 | } else { | 980 | } else { |
981 | if (item->cellX() < 0) { | 981 | if (item->cellX() < 0) { |
982 | startDate = (mSelectedDates.first()).addDays(item->cellX()); | 982 | startDate = (mSelectedDates.first()).addDays(item->cellX()); |
983 | } else { | 983 | } else { |
984 | startDate = mSelectedDates[item->cellX()]; | 984 | startDate = mSelectedDates[item->cellX()]; |
985 | } | 985 | } |
986 | } | 986 | } |
987 | startDt.setDate(startDate); | 987 | startDt.setDate(startDate); |
988 | 988 | ||
989 | if (item->incidence()->doesFloat()) { | 989 | if (item->incidence()->doesFloat()) { |
990 | endDt.setDate(startDate.addDays(item->cellWidth() - 1)); | 990 | endDt.setDate(startDate.addDays(item->cellWidth() - 1)); |
991 | } else { | 991 | } else { |
992 | if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE ) | 992 | if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE ) |
993 | startDt.setTime(mAgenda->gyToTime(item->cellYTop())); | 993 | startDt.setTime(mAgenda->gyToTime(item->cellYTop())); |
994 | if ( item->incidence()->type() == "Event" ) { | 994 | if ( item->incidence()->typeID() == eventID ) { |
995 | if ( type == KOAgenda::MOVE ) { | 995 | if ( type == KOAgenda::MOVE ) { |
996 | endDt = startDt.addSecs(lenInSecs); | 996 | endDt = startDt.addSecs(lenInSecs); |
997 | 997 | ||
998 | } else if ( type == KOAgenda::RESIZEBOTTOM ) { | 998 | } else if ( type == KOAgenda::RESIZEBOTTOM ) { |
999 | if (item->lastMultiItem()) { | 999 | if (item->lastMultiItem()) { |
1000 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); | 1000 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); |
1001 | endDt.setDate(startDate. | 1001 | endDt.setDate(startDate. |
1002 | addDays(item->lastMultiItem()->cellX() - item->cellX())); | 1002 | addDays(item->lastMultiItem()->cellX() - item->cellX())); |
1003 | } else { | 1003 | } else { |
1004 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); | 1004 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); |
1005 | endDt.setDate(startDate); | 1005 | endDt.setDate(startDate); |
1006 | } | 1006 | } |
1007 | } | 1007 | } |
1008 | } else { | 1008 | } else { |
1009 | // todo | 1009 | // todo |
1010 | if (item->lastMultiItem()) { | 1010 | if (item->lastMultiItem()) { |
1011 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); | 1011 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); |
1012 | endDt.setDate(startDate. | 1012 | endDt.setDate(startDate. |
1013 | addDays(item->lastMultiItem()->cellX() - item->cellX())); | 1013 | addDays(item->lastMultiItem()->cellX() - item->cellX())); |
1014 | } else { | 1014 | } else { |
1015 | //qDebug("tem->cellYBottom() %d",item->cellYBottom() ); | 1015 | //qDebug("tem->cellYBottom() %d",item->cellYBottom() ); |
1016 | if ( item->cellYBottom() > 0 ) | 1016 | if ( item->cellYBottom() > 0 ) |
1017 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); | 1017 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); |
1018 | else | 1018 | else |
1019 | endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); | 1019 | endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); |
1020 | endDt.setDate(startDate); | 1020 | endDt.setDate(startDate); |
1021 | } | 1021 | } |
1022 | } | 1022 | } |
1023 | } | 1023 | } |
1024 | if ( item->incidence()->type() == "Event" ) { | 1024 | if ( item->incidence()->typeID() == eventID ) { |
1025 | item->incidence()->setDtStart(startDt); | 1025 | item->incidence()->setDtStart(startDt); |
1026 | (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); | 1026 | (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); |
1027 | } else if ( item->incidence()->type() == "Todo" ) { | 1027 | } else if ( item->incidence()->typeID() == todoID ) { |
1028 | Todo* to = static_cast<Todo*>(item->incidence()); | 1028 | Todo* to = static_cast<Todo*>(item->incidence()); |
1029 | 1029 | ||
1030 | to->setDtDue(endDt); | 1030 | to->setDtDue(endDt); |
1031 | if ( to->hasStartDate() ) { | 1031 | if ( to->hasStartDate() ) { |
1032 | if (to->dtStart() >= to->dtDue() ) | 1032 | if (to->dtStart() >= to->dtDue() ) |
1033 | to->setDtStart(to->dtDue().addDays( -2 )); | 1033 | to->setDtStart(to->dtDue().addDays( -2 )); |
1034 | } | 1034 | } |
1035 | 1035 | ||
1036 | } | 1036 | } |
1037 | //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); | 1037 | //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); |
1038 | item->incidence()->setRevision(item->incidence()->revision()+1); | 1038 | item->incidence()->setRevision(item->incidence()->revision()+1); |
1039 | item->setItemDate(startDt.date()); | 1039 | item->setItemDate(startDt.date()); |
1040 | //item->updateItem(); | 1040 | //item->updateItem(); |
1041 | if ( item->incidence()->type() == "Todo" ) { | 1041 | if ( item->incidence()->typeID() == todoID ) { |
1042 | emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); | 1042 | emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); |
1043 | 1043 | ||
1044 | } | 1044 | } |
1045 | else | 1045 | else |
1046 | emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); | 1046 | emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); |
1047 | item->updateItem(); | 1047 | item->updateItem(); |
1048 | } | 1048 | } |
1049 | 1049 | ||
1050 | void KOAgendaView::showDates( const QDate &start, const QDate &end ) | 1050 | void KOAgendaView::showDates( const QDate &start, const QDate &end ) |
1051 | { | 1051 | { |
1052 | // kdDebug() << "KOAgendaView::selectDates" << endl; | 1052 | // kdDebug() << "KOAgendaView::selectDates" << endl; |
1053 | 1053 | ||
1054 | mSelectedDates.clear(); | 1054 | mSelectedDates.clear(); |
1055 | // qDebug("KOAgendaView::showDates "); | 1055 | // qDebug("KOAgendaView::showDates "); |
1056 | QDate d = start; | 1056 | QDate d = start; |
1057 | while (d <= end) { | 1057 | while (d <= end) { |
1058 | mSelectedDates.append(d); | 1058 | mSelectedDates.append(d); |
1059 | d = d.addDays( 1 ); | 1059 | d = d.addDays( 1 ); |
1060 | } | 1060 | } |
1061 | 1061 | ||
1062 | // and update the view | 1062 | // and update the view |
1063 | fillAgenda(); | 1063 | fillAgenda(); |
1064 | } | 1064 | } |
1065 | 1065 | ||
1066 | 1066 | ||
1067 | void KOAgendaView::showEvents(QPtrList<Event>) | 1067 | void KOAgendaView::showEvents(QPtrList<Event>) |
1068 | { | 1068 | { |
1069 | kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; | 1069 | kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; |
1070 | } | 1070 | } |
1071 | 1071 | ||
1072 | void KOAgendaView::changeEventDisplay(Event *, int) | 1072 | void KOAgendaView::changeEventDisplay(Event *, int) |
1073 | { | 1073 | { |
1074 | // qDebug("KOAgendaView::changeEventDisplay "); | 1074 | // qDebug("KOAgendaView::changeEventDisplay "); |
1075 | // kdDebug() << "KOAgendaView::changeEventDisplay" << endl; | 1075 | // kdDebug() << "KOAgendaView::changeEventDisplay" << endl; |
1076 | // this should be re-written to be MUCH smarter. Right now we | 1076 | // this should be re-written to be MUCH smarter. Right now we |
1077 | // are just playing dumb. | 1077 | // are just playing dumb. |
1078 | fillAgenda(); | 1078 | fillAgenda(); |
1079 | } | 1079 | } |
1080 | 1080 | ||
1081 | void KOAgendaView::fillAgenda(const QDate &) | 1081 | void KOAgendaView::fillAgenda(const QDate &) |
1082 | { | 1082 | { |
1083 | // qDebug("KOAgendaView::fillAgenda "); | 1083 | // qDebug("KOAgendaView::fillAgenda "); |
1084 | fillAgenda(); | 1084 | fillAgenda(); |
1085 | } | 1085 | } |
1086 | 1086 | ||
1087 | void KOAgendaView::fillAgenda() | 1087 | void KOAgendaView::fillAgenda() |
1088 | { | 1088 | { |
1089 | if ( globalFlagBlockStartup ) | 1089 | if ( globalFlagBlockStartup ) |
1090 | return; | 1090 | return; |
1091 | if ( globalFlagBlockAgenda == 1 ) | 1091 | if ( globalFlagBlockAgenda == 1 ) |
1092 | return; | 1092 | return; |
1093 | static bool onlyOne = false; | 1093 | static bool onlyOne = false; |
1094 | if ( onlyOne ) | 1094 | if ( onlyOne ) |
1095 | return; | 1095 | return; |
1096 | onlyOne = true; | 1096 | onlyOne = true; |
1097 | //if ( globalFlagBlockAgenda == 2 ) | 1097 | //if ( globalFlagBlockAgenda == 2 ) |
1098 | //globalFlagBlockAgenda = 0; | 1098 | //globalFlagBlockAgenda = 0; |
1099 | // globalFlagBlockPainting = false; | 1099 | // globalFlagBlockPainting = false; |
1100 | if ( globalFlagBlockAgenda == 0 ) | 1100 | if ( globalFlagBlockAgenda == 0 ) |
1101 | globalFlagBlockAgenda = 1; | 1101 | globalFlagBlockAgenda = 1; |
1102 | // clearView(); | 1102 | // clearView(); |
1103 | //qDebug("fillAgenda()++++ "); | 1103 | //qDebug("fillAgenda()++++ "); |
1104 | globalFlagBlockAgendaItemPaint = 1; | 1104 | globalFlagBlockAgendaItemPaint = 1; |
1105 | 1105 | ||
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp index e165017..dea8981 100644 --- a/korganizer/koeditorrecurrence.cpp +++ b/korganizer/koeditorrecurrence.cpp | |||
@@ -810,129 +810,129 @@ void KOEditorRecurrence::setEnabled( bool enabled ) | |||
810 | 810 | ||
811 | void KOEditorRecurrence::showCurrentRule( int current ) | 811 | void KOEditorRecurrence::showCurrentRule( int current ) |
812 | { | 812 | { |
813 | switch ( current ) { | 813 | switch ( current ) { |
814 | case Daily: | 814 | case Daily: |
815 | mRuleStack->raiseWidget( mDaily ); | 815 | mRuleStack->raiseWidget( mDaily ); |
816 | break; | 816 | break; |
817 | case Weekly: | 817 | case Weekly: |
818 | mRuleStack->raiseWidget( mWeekly ); | 818 | mRuleStack->raiseWidget( mWeekly ); |
819 | break; | 819 | break; |
820 | case Monthly: | 820 | case Monthly: |
821 | mRuleStack->raiseWidget( mMonthly ); | 821 | mRuleStack->raiseWidget( mMonthly ); |
822 | break; | 822 | break; |
823 | default: | 823 | default: |
824 | case Yearly: | 824 | case Yearly: |
825 | mRuleStack->raiseWidget( mYearly ); | 825 | mRuleStack->raiseWidget( mYearly ); |
826 | break; | 826 | break; |
827 | } | 827 | } |
828 | } | 828 | } |
829 | 829 | ||
830 | void KOEditorRecurrence::setDateTimes( QDateTime start, QDateTime end ) | 830 | void KOEditorRecurrence::setDateTimes( QDateTime start, QDateTime end ) |
831 | { | 831 | { |
832 | // kdDebug() << "KOEditorRecurrence::setDateTimes" << endl; | 832 | // kdDebug() << "KOEditorRecurrence::setDateTimes" << endl; |
833 | 833 | ||
834 | mRecurrenceRange->setDateTimes( start, end ); | 834 | mRecurrenceRange->setDateTimes( start, end ); |
835 | mExceptions->setDefaults( end ); | 835 | mExceptions->setDefaults( end ); |
836 | 836 | ||
837 | } | 837 | } |
838 | 838 | ||
839 | void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to, bool ) | 839 | void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to, bool ) |
840 | { | 840 | { |
841 | 841 | ||
842 | // qDebug("KOEditorRecurrence::setDefaults %s %s ",from.toString().latin1(),to.toString().latin1() ); | 842 | // qDebug("KOEditorRecurrence::setDefaults %s %s ",from.toString().latin1(),to.toString().latin1() ); |
843 | setDateTimes( from, to ); | 843 | setDateTimes( from, to ); |
844 | 844 | ||
845 | bool enabled = false; | 845 | bool enabled = false; |
846 | mEnabledCheck->setChecked( enabled ); | 846 | mEnabledCheck->setChecked( enabled ); |
847 | setEnabled( enabled ); | 847 | setEnabled( enabled ); |
848 | 848 | ||
849 | mExceptions->setDefaults( to ); | 849 | mExceptions->setDefaults( to ); |
850 | mRecurrenceRange->setDefaults( to ); | 850 | mRecurrenceRange->setDefaults( to ); |
851 | 851 | ||
852 | mRecurrenceChooser->setType( RecurrenceChooser::Weekly ); | 852 | mRecurrenceChooser->setType( RecurrenceChooser::Weekly ); |
853 | showCurrentRule( mRecurrenceChooser->type() ); | 853 | showCurrentRule( mRecurrenceChooser->type() ); |
854 | 854 | ||
855 | mDaily->setFrequency( 1 ); | 855 | mDaily->setFrequency( 1 ); |
856 | 856 | ||
857 | mWeekly->setFrequency( 1 ); | 857 | mWeekly->setFrequency( 1 ); |
858 | QBitArray days( 7 ); | 858 | QBitArray days( 7 ); |
859 | days.fill( 0 ); | 859 | days.fill( 0 ); |
860 | days.setBit( from.date().dayOfWeek()- 1); | 860 | days.setBit( from.date().dayOfWeek()- 1); |
861 | mWeekly->setDays( days ); | 861 | mWeekly->setDays( days ); |
862 | mMonthly->setFrequency( 1 ); | 862 | mMonthly->setFrequency( 1 ); |
863 | mMonthly->setByPos((from.date().day()/7), from.date().dayOfWeek()-1 ); | 863 | mMonthly->setByPos((from.date().day()/7), from.date().dayOfWeek()-1 ); |
864 | mMonthly->setByDay( from.date().day()-1 ); | 864 | mMonthly->setByDay( from.date().day()-1 ); |
865 | mYearly->setFrequency( 1 ); | 865 | mYearly->setFrequency( 1 ); |
866 | mYearly->setByDay( from.date().dayOfYear() ); | 866 | mYearly->setByDay( from.date().dayOfYear() ); |
867 | mYearly->setByMonth( from.date().month(), from.date().day() ); | 867 | mYearly->setByMonth( from.date().month(), from.date().day() ); |
868 | } | 868 | } |
869 | 869 | ||
870 | void KOEditorRecurrence::readEvent(Incidence *event) | 870 | void KOEditorRecurrence::readEvent(Incidence *event) |
871 | { | 871 | { |
872 | 872 | ||
873 | QDateTime dtEnd; | 873 | QDateTime dtEnd; |
874 | if ( event->type() == "Event" ) | 874 | if ( event->typeID() == eventID ) |
875 | dtEnd = ((Event*)event)->dtEnd(); | 875 | dtEnd = ((Event*)event)->dtEnd(); |
876 | else | 876 | else |
877 | dtEnd = ((Todo*)event)->dtDue(); | 877 | dtEnd = ((Todo*)event)->dtDue(); |
878 | 878 | ||
879 | setDefaults( event->dtStart(), dtEnd, true ); | 879 | setDefaults( event->dtStart(), dtEnd, true ); |
880 | QBitArray rDays( 7 ); | 880 | QBitArray rDays( 7 ); |
881 | QPtrList<Recurrence::rMonthPos> rmp; | 881 | QPtrList<Recurrence::rMonthPos> rmp; |
882 | QPtrList<int> rmd; | 882 | QPtrList<int> rmd; |
883 | int day = 0; | 883 | int day = 0; |
884 | int count = 0; | 884 | int count = 0; |
885 | int month = 0; | 885 | int month = 0; |
886 | setDateTimes( event->dtStart(), dtEnd ); | 886 | setDateTimes( event->dtStart(), dtEnd ); |
887 | 887 | ||
888 | Recurrence *r = event->recurrence(); | 888 | Recurrence *r = event->recurrence(); |
889 | int f = r->frequency(); | 889 | int f = r->frequency(); |
890 | 890 | ||
891 | int recurs = r->doesRecur(); | 891 | int recurs = r->doesRecur(); |
892 | 892 | ||
893 | mEnabledCheck->setChecked( recurs ); | 893 | mEnabledCheck->setChecked( recurs ); |
894 | setEnabled( recurs ); | 894 | setEnabled( recurs ); |
895 | 895 | ||
896 | int recurrenceType = RecurrenceChooser::Weekly; | 896 | int recurrenceType = RecurrenceChooser::Weekly; |
897 | 897 | ||
898 | switch ( recurs ) { | 898 | switch ( recurs ) { |
899 | case Recurrence::rNone: | 899 | case Recurrence::rNone: |
900 | setDefaults( event->dtStart(), dtEnd, true ); | 900 | setDefaults( event->dtStart(), dtEnd, true ); |
901 | break; | 901 | break; |
902 | case Recurrence::rDaily: | 902 | case Recurrence::rDaily: |
903 | recurrenceType = RecurrenceChooser::Daily; | 903 | recurrenceType = RecurrenceChooser::Daily; |
904 | mDaily->setFrequency( f ); | 904 | mDaily->setFrequency( f ); |
905 | break; | 905 | break; |
906 | case Recurrence::rWeekly: | 906 | case Recurrence::rWeekly: |
907 | recurrenceType = RecurrenceChooser::Weekly; | 907 | recurrenceType = RecurrenceChooser::Weekly; |
908 | mWeekly->setFrequency( f ); | 908 | mWeekly->setFrequency( f ); |
909 | mWeekly->setDays( r->days() ); | 909 | mWeekly->setDays( r->days() ); |
910 | break; | 910 | break; |
911 | case Recurrence::rMonthlyPos: | 911 | case Recurrence::rMonthlyPos: |
912 | // we only handle one possibility in the list right now, | 912 | // we only handle one possibility in the list right now, |
913 | // so I have hardcoded calls with first(). If we make the GUI | 913 | // so I have hardcoded calls with first(). If we make the GUI |
914 | // more extended, this can be changed. | 914 | // more extended, this can be changed. |
915 | recurrenceType = RecurrenceChooser::Monthly; | 915 | recurrenceType = RecurrenceChooser::Monthly; |
916 | 916 | ||
917 | rmp = r->monthPositions(); | 917 | rmp = r->monthPositions(); |
918 | if ( rmp.first()->negative ) | 918 | if ( rmp.first()->negative ) |
919 | count = 5 - rmp.first()->rPos - 1; | 919 | count = 5 - rmp.first()->rPos - 1; |
920 | else | 920 | else |
921 | count = rmp.first()->rPos - 1; | 921 | count = rmp.first()->rPos - 1; |
922 | day = 0; | 922 | day = 0; |
923 | while ( !rmp.first()->rDays.testBit( day ) ) ++day; | 923 | while ( !rmp.first()->rDays.testBit( day ) ) ++day; |
924 | mMonthly->setByPos( count, day ); | 924 | mMonthly->setByPos( count, day ); |
925 | 925 | ||
926 | mMonthly->setFrequency( f ); | 926 | mMonthly->setFrequency( f ); |
927 | 927 | ||
928 | break; | 928 | break; |
929 | case Recurrence::rMonthlyDay: | 929 | case Recurrence::rMonthlyDay: |
930 | recurrenceType = RecurrenceChooser::Monthly; | 930 | recurrenceType = RecurrenceChooser::Monthly; |
931 | 931 | ||
932 | rmd = r->monthDays(); | 932 | rmd = r->monthDays(); |
933 | day = *rmd.first() - 1; | 933 | day = *rmd.first() - 1; |
934 | mMonthly->setByDay( day ); | 934 | mMonthly->setByDay( day ); |
935 | 935 | ||
936 | mMonthly->setFrequency( f ); | 936 | mMonthly->setFrequency( f ); |
937 | 937 | ||
938 | break; | 938 | break; |
diff --git a/korganizer/koeventviewerdialog.cpp b/korganizer/koeventviewerdialog.cpp index e5ff8af..02f13c7 100644 --- a/korganizer/koeventviewerdialog.cpp +++ b/korganizer/koeventviewerdialog.cpp | |||
@@ -87,142 +87,142 @@ void KOEventViewerDialog::showMe() | |||
87 | showMaximized(); | 87 | showMaximized(); |
88 | #endif | 88 | #endif |
89 | QTimer::singleShot( 1, this, SLOT ( setMyFocus() ) ); | 89 | QTimer::singleShot( 1, this, SLOT ( setMyFocus() ) ); |
90 | 90 | ||
91 | } | 91 | } |
92 | void KOEventViewerDialog::setMyFocus() | 92 | void KOEventViewerDialog::setMyFocus() |
93 | { | 93 | { |
94 | 94 | ||
95 | setActiveWindow(); | 95 | setActiveWindow(); |
96 | mEventViewer->setFocus(); | 96 | mEventViewer->setFocus(); |
97 | 97 | ||
98 | } | 98 | } |
99 | void KOEventViewerDialog::print() | 99 | void KOEventViewerDialog::print() |
100 | { | 100 | { |
101 | mEventViewer->printMe(); | 101 | mEventViewer->printMe(); |
102 | 102 | ||
103 | } | 103 | } |
104 | void KOEventViewerDialog::setSyncMode( bool b ) | 104 | void KOEventViewerDialog::setSyncMode( bool b ) |
105 | { | 105 | { |
106 | mSyncMode = b; | 106 | mSyncMode = b; |
107 | //qDebug("KOEventViewerDialog::setSyncMode %d ",mSyncMode ); | 107 | //qDebug("KOEventViewerDialog::setSyncMode %d ",mSyncMode ); |
108 | if ( mSyncMode ) { | 108 | if ( mSyncMode ) { |
109 | findButton( Close )->setText( i18n("Cancel Sync")); | 109 | findButton( Close )->setText( i18n("Cancel Sync")); |
110 | findButton( Ok )->setText( i18n("Remote")); | 110 | findButton( Ok )->setText( i18n("Remote")); |
111 | findButton( User1 )->setText( i18n("Local")); | 111 | findButton( User1 )->setText( i18n("Local")); |
112 | } else { | 112 | } else { |
113 | findButton( Close )->setText( i18n("Close")); | 113 | findButton( Close )->setText( i18n("Close")); |
114 | findButton( Ok )->setText( i18n("Edit")); | 114 | findButton( Ok )->setText( i18n("Edit")); |
115 | findButton( User1 )->setText( i18n("Agenda")); | 115 | findButton( User1 )->setText( i18n("Agenda")); |
116 | } | 116 | } |
117 | mEventViewer->setSyncMode( b ); | 117 | mEventViewer->setSyncMode( b ); |
118 | } | 118 | } |
119 | void KOEventViewerDialog::setColorMode( int m ) | 119 | void KOEventViewerDialog::setColorMode( int m ) |
120 | { | 120 | { |
121 | mEventViewer->setColorMode( m ); | 121 | mEventViewer->setColorMode( m ); |
122 | } | 122 | } |
123 | int KOEventViewerDialog::executeS( bool local ) | 123 | int KOEventViewerDialog::executeS( bool local ) |
124 | { | 124 | { |
125 | mSyncResult = 3; | 125 | mSyncResult = 3; |
126 | if ( local ) | 126 | if ( local ) |
127 | findButton( User1 )->setFocus(); | 127 | findButton( User1 )->setFocus(); |
128 | else | 128 | else |
129 | findButton( Ok )->setFocus(); | 129 | findButton( Ok )->setFocus(); |
130 | exec(); | 130 | exec(); |
131 | return mSyncResult; | 131 | return mSyncResult; |
132 | } | 132 | } |
133 | 133 | ||
134 | void KOEventViewerDialog::updateConfig() | 134 | void KOEventViewerDialog::updateConfig() |
135 | { | 135 | { |
136 | mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); | 136 | mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); |
137 | 137 | ||
138 | } | 138 | } |
139 | void KOEventViewerDialog::setEvent(Event *event) | 139 | void KOEventViewerDialog::setEvent(Event *event) |
140 | { | 140 | { |
141 | mEventViewer->setEvent(event); | 141 | mEventViewer->setEvent(event); |
142 | mIncidence = event; | 142 | mIncidence = event; |
143 | mEventViewer->setFocus(); | 143 | mEventViewer->setFocus(); |
144 | //findButton( Close )->setFocus(); | 144 | //findButton( Close )->setFocus(); |
145 | if ( !mSyncMode ) { | 145 | if ( !mSyncMode ) { |
146 | findButton( User1 )->setText( i18n("Agenda")); | 146 | findButton( User1 )->setText( i18n("Agenda")); |
147 | } | 147 | } |
148 | } | 148 | } |
149 | void KOEventViewerDialog::setIncidence(Incidence *in ) | 149 | void KOEventViewerDialog::setIncidence(Incidence *in ) |
150 | { | 150 | { |
151 | if ( in->type() == "Event" ) | 151 | if ( in->typeID() == eventID ) |
152 | setEvent( (Event*) in ); | 152 | setEvent( (Event*) in ); |
153 | else if ( in->type() =="Todo" ) | 153 | else if ( in->typeID() == todoID ) |
154 | setTodo( (Todo*) in ); | 154 | setTodo( (Todo*) in ); |
155 | else if ( in->type() =="Journal" ) | 155 | else if ( in->typeID() == journalID ) |
156 | setJournal( (Journal*) in ); | 156 | setJournal( (Journal*) in ); |
157 | } | 157 | } |
158 | void KOEventViewerDialog::addIncidence(Incidence *in) | 158 | void KOEventViewerDialog::addIncidence(Incidence *in) |
159 | { | 159 | { |
160 | if ( in->type() == "Event" ) | 160 | if ( in->typeID() == eventID ) |
161 | addEvent( (Event*) in ); | 161 | addEvent( (Event*) in ); |
162 | else if ( in->type() =="Todo" ) | 162 | else if ( in->typeID() == todoID ) |
163 | mEventViewer->setTodo( (Todo*) in, false ); | 163 | mEventViewer->setTodo( (Todo*) in, false ); |
164 | else if ( in->type() =="Journal" ) | 164 | else if ( in->typeID() == journalID ) |
165 | mEventViewer->setJournal( (Journal*) in, false ); | 165 | mEventViewer->setJournal( (Journal*) in, false ); |
166 | if ( mSyncMode ) { | 166 | if ( mSyncMode ) { |
167 | findButton( User1 )->setFocus(); | 167 | findButton( User1 )->setFocus(); |
168 | setCaption(i18n("Conflict! Please choose entry")); | 168 | setCaption(i18n("Conflict! Please choose entry")); |
169 | } | 169 | } |
170 | } | 170 | } |
171 | 171 | ||
172 | void KOEventViewerDialog::addEvent(Event *event) | 172 | void KOEventViewerDialog::addEvent(Event *event) |
173 | { | 173 | { |
174 | mEventViewer->addEvent(event); | 174 | mEventViewer->addEvent(event); |
175 | mIncidence = event; | 175 | mIncidence = event; |
176 | mEventViewer->setFocus(); | 176 | mEventViewer->setFocus(); |
177 | //findButton( Close )->setFocus(); | 177 | //findButton( Close )->setFocus(); |
178 | if ( !mSyncMode ) { | 178 | if ( !mSyncMode ) { |
179 | findButton( User1 )->setText( i18n("Agenda")); | 179 | findButton( User1 )->setText( i18n("Agenda")); |
180 | } | 180 | } |
181 | } | 181 | } |
182 | 182 | ||
183 | void KOEventViewerDialog::setTodo(Todo *event) | 183 | void KOEventViewerDialog::setTodo(Todo *event) |
184 | { | 184 | { |
185 | mEventViewer->setTodo(event); | 185 | mEventViewer->setTodo(event); |
186 | mIncidence = (Incidence*)event; | 186 | mIncidence = (Incidence*)event; |
187 | mEventViewer->setFocus(); | 187 | mEventViewer->setFocus(); |
188 | //findButton( Close )->setFocus(); | 188 | //findButton( Close )->setFocus(); |
189 | if ( !mSyncMode ) { | 189 | if ( !mSyncMode ) { |
190 | findButton( User1 )->setText( i18n("Set complete")); | 190 | findButton( User1 )->setText( i18n("Set complete")); |
191 | } | 191 | } |
192 | } | 192 | } |
193 | void KOEventViewerDialog::setJournal(Journal *j) | 193 | void KOEventViewerDialog::setJournal(Journal *j) |
194 | { | 194 | { |
195 | mEventViewer->setJournal(j); | 195 | mEventViewer->setJournal(j); |
196 | mIncidence = (Incidence*)j; | 196 | mIncidence = (Incidence*)j; |
197 | mEventViewer->setFocus(); | 197 | mEventViewer->setFocus(); |
198 | //findButton( Close )->setFocus(); | 198 | //findButton( Close )->setFocus(); |
199 | if ( !mSyncMode ) { | 199 | if ( !mSyncMode ) { |
200 | findButton( User1 )->setText( i18n("Agenda")); | 200 | findButton( User1 )->setText( i18n("Agenda")); |
201 | } | 201 | } |
202 | } | 202 | } |
203 | 203 | ||
204 | void KOEventViewerDialog::addText(QString text) | 204 | void KOEventViewerDialog::addText(QString text) |
205 | { | 205 | { |
206 | mEventViewer->addText(text); | 206 | mEventViewer->addText(text); |
207 | mEventViewer->setFocus(); | 207 | mEventViewer->setFocus(); |
208 | //findButton( Close )->setFocus(); | 208 | //findButton( Close )->setFocus(); |
209 | } | 209 | } |
210 | void KOEventViewerDialog::editIncidence() | 210 | void KOEventViewerDialog::editIncidence() |
211 | { | 211 | { |
212 | sendSignalViewerClosed = false; | 212 | sendSignalViewerClosed = false; |
213 | if ( mSyncMode ) { | 213 | if ( mSyncMode ) { |
214 | mSyncResult = 2; | 214 | mSyncResult = 2; |
215 | accept(); | 215 | accept(); |
216 | return; | 216 | return; |
217 | } | 217 | } |
218 | if ( mIncidence ){ | 218 | if ( mIncidence ){ |
219 | close(); | 219 | close(); |
220 | emit editIncidence( mIncidence ); | 220 | emit editIncidence( mIncidence ); |
221 | } | 221 | } |
222 | } | 222 | } |
223 | void KOEventViewerDialog::showIncidence() | 223 | void KOEventViewerDialog::showIncidence() |
224 | { | 224 | { |
225 | sendSignalViewerClosed = false; | 225 | sendSignalViewerClosed = false; |
226 | if ( mSyncMode ) { | 226 | if ( mSyncMode ) { |
227 | mSyncResult = 1; | 227 | mSyncResult = 1; |
228 | accept(); | 228 | accept(); |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 678cab6..c868270 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -321,129 +321,129 @@ void MonthViewItem::paint(QPainter *p) | |||
321 | { | 321 | { |
322 | p->setBackgroundColor( palette().color( QPalette::Normal, \ | 322 | p->setBackgroundColor( palette().color( QPalette::Normal, \ |
323 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); | 323 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); |
324 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); | 324 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); |
325 | } | 325 | } |
326 | int x = 1; | 326 | int x = 1; |
327 | //int y = 3;//(height() - mRecurPixmap.height()) /2; | 327 | //int y = 3;//(height() - mRecurPixmap.height()) /2; |
328 | int size = PIXMAP_SIZE; | 328 | int size = PIXMAP_SIZE; |
329 | if ( QApplication::desktop()->width() < 300 ) | 329 | if ( QApplication::desktop()->width() < 300 ) |
330 | size = 3; | 330 | size = 3; |
331 | int heihei = height( listBox () ); | 331 | int heihei = height( listBox () ); |
332 | int y = (heihei - size -1 ) /2; | 332 | int y = (heihei - size -1 ) /2; |
333 | 333 | ||
334 | if ( KOPrefs::instance()->mMonthShowIcons ) { | 334 | if ( KOPrefs::instance()->mMonthShowIcons ) { |
335 | if ( mInfo ) { | 335 | if ( mInfo ) { |
336 | p->fillRect ( x, y,size,size, Qt::darkGreen ); | 336 | p->fillRect ( x, y,size,size, Qt::darkGreen ); |
337 | x += size + 1; | 337 | x += size + 1; |
338 | } | 338 | } |
339 | if ( mRecur ) { | 339 | if ( mRecur ) { |
340 | p->fillRect ( x, y,size,size, Qt::blue ); | 340 | p->fillRect ( x, y,size,size, Qt::blue ); |
341 | x += size + 1; | 341 | x += size + 1; |
342 | } | 342 | } |
343 | if ( mAlarm ) { | 343 | if ( mAlarm ) { |
344 | p->fillRect ( x, y,size,size, Qt::red ); | 344 | p->fillRect ( x, y,size,size, Qt::red ); |
345 | x += size + 1; | 345 | x += size + 1; |
346 | } | 346 | } |
347 | if ( mReply ) { | 347 | if ( mReply ) { |
348 | p->fillRect ( x, y,size,size, Qt::yellow ); | 348 | p->fillRect ( x, y,size,size, Qt::yellow ); |
349 | x += size + 1; | 349 | x += size + 1; |
350 | } | 350 | } |
351 | } | 351 | } |
352 | if ( mMultiday ) { | 352 | if ( mMultiday ) { |
353 | int yyy = y+(size/2); | 353 | int yyy = y+(size/2); |
354 | int sizeM = size+2; | 354 | int sizeM = size+2; |
355 | p->setBrush( QBrush::SolidPattern ); | 355 | p->setBrush( QBrush::SolidPattern ); |
356 | p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; | 356 | p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; |
357 | if ( mMultiday == 2 || mMultiday == 3 ) { | 357 | if ( mMultiday == 2 || mMultiday == 3 ) { |
358 | QPointArray pa ( 3 ); | 358 | QPointArray pa ( 3 ); |
359 | pa.setPoint (0, x, yyy ); | 359 | pa.setPoint (0, x, yyy ); |
360 | pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); | 360 | pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); |
361 | pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); | 361 | pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); |
362 | p->drawPolygon( pa ); | 362 | p->drawPolygon( pa ); |
363 | } | 363 | } |
364 | if ( mMultiday == 2 || mMultiday == 1 ) { | 364 | if ( mMultiday == 2 || mMultiday == 1 ) { |
365 | QPointArray pa ( 3 ); | 365 | QPointArray pa ( 3 ); |
366 | pa.setPoint (0, x+sizeM +sizeM/2, yyy ); | 366 | pa.setPoint (0, x+sizeM +sizeM/2, yyy ); |
367 | pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); | 367 | pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); |
368 | pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); | 368 | pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); |
369 | p->drawPolygon( pa ); | 369 | p->drawPolygon( pa ); |
370 | } | 370 | } |
371 | if ( mMultiday == 1 ) { | 371 | if ( mMultiday == 1 ) { |
372 | // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); | 372 | // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); |
373 | 373 | ||
374 | p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); | 374 | p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); |
375 | } | 375 | } |
376 | if ( mMultiday == 3 ) { | 376 | if ( mMultiday == 3 ) { |
377 | // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); | 377 | // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); |
378 | p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); | 378 | p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); |
379 | 379 | ||
380 | } | 380 | } |
381 | x += sizeM/2 + 1; | 381 | x += sizeM/2 + 1; |
382 | x += sizeM + 1; | 382 | x += sizeM + 1; |
383 | } | 383 | } |
384 | 384 | ||
385 | if ( mIncidence->type() == "Todo" ){ | 385 | if ( mIncidence->typeID() == todoID ){ |
386 | Todo* td = ( Todo* ) mIncidence; | 386 | Todo* td = ( Todo* ) mIncidence; |
387 | if ( td->isCompleted() ) { | 387 | if ( td->isCompleted() ) { |
388 | int half = size/2; | 388 | int half = size/2; |
389 | p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ; | 389 | p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ; |
390 | p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ; | 390 | p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ; |
391 | x += half+half + 4; | 391 | x += half+half + 4; |
392 | 392 | ||
393 | } else { | 393 | } else { |
394 | int val = td->percentComplete()/20; | 394 | int val = td->percentComplete()/20; |
395 | p->fillRect ( x+1, y-2, val ,size+4,Qt::black ); | 395 | p->fillRect ( x+1, y-2, val ,size+4,Qt::black ); |
396 | p->drawRect ( x, y-2,7,size+4); | 396 | p->drawRect ( x, y-2,7,size+4); |
397 | x += size + 3; | 397 | x += size + 3; |
398 | } | 398 | } |
399 | } | 399 | } |
400 | QFontMetrics fm = p->fontMetrics(); | 400 | QFontMetrics fm = p->fontMetrics(); |
401 | int yPos; | 401 | int yPos; |
402 | int pmheight = size; | 402 | int pmheight = size; |
403 | if( pmheight < fm.height() ) | 403 | if( pmheight < fm.height() ) |
404 | yPos = fm.ascent() + fm.leading()/2; | 404 | yPos = fm.ascent() + fm.leading()/2; |
405 | else | 405 | else |
406 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); | 406 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); |
407 | p->setPen( palette().color( QPalette::Normal, sel ? \ | 407 | p->setPen( palette().color( QPalette::Normal, sel ? \ |
408 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); | 408 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); |
409 | if ( KOPrefs::instance()->mMonthShowTimes || isWeekItem) { | 409 | if ( KOPrefs::instance()->mMonthShowTimes || isWeekItem) { |
410 | p->drawText( x, yPos, text() ); | 410 | p->drawText( x, yPos, text() ); |
411 | if ( mIncidence->cancelled() ) { | 411 | if ( mIncidence->cancelled() ) { |
412 | int wid = fm.width( text() ); | 412 | int wid = fm.width( text() ); |
413 | p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); | 413 | p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); |
414 | } | 414 | } |
415 | } else { | 415 | } else { |
416 | QString pText = text(); | 416 | QString pText = text(); |
417 | if( pText.mid(2,1) == ":" ) | 417 | if( pText.mid(2,1) == ":" ) |
418 | pText = pText.mid( 6 ); | 418 | pText = pText.mid( 6 ); |
419 | p->drawText( x, yPos, pText ); | 419 | p->drawText( x, yPos, pText ); |
420 | if ( mIncidence->cancelled() ) { | 420 | if ( mIncidence->cancelled() ) { |
421 | int wid = fm.width( pText ); | 421 | int wid = fm.width( pText ); |
422 | p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); | 422 | p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); |
423 | } | 423 | } |
424 | } | 424 | } |
425 | } | 425 | } |
426 | 426 | ||
427 | int MonthViewItem::height(const QListBox *lb) const | 427 | int MonthViewItem::height(const QListBox *lb) const |
428 | { | 428 | { |
429 | int ret = 10; | 429 | int ret = 10; |
430 | if ( lb ) | 430 | if ( lb ) |
431 | ret = lb->fontMetrics().lineSpacing()+1; | 431 | ret = lb->fontMetrics().lineSpacing()+1; |
432 | return ret; | 432 | return ret; |
433 | } | 433 | } |
434 | 434 | ||
435 | int MonthViewItem::width(const QListBox *lb) const | 435 | int MonthViewItem::width(const QListBox *lb) const |
436 | { | 436 | { |
437 | if( KOPrefs::instance()->mEnableMonthScroll || isWeekItem ) { | 437 | if( KOPrefs::instance()->mEnableMonthScroll || isWeekItem ) { |
438 | int size = PIXMAP_SIZE; | 438 | int size = PIXMAP_SIZE; |
439 | if ( QApplication::desktop()->width() < 300 ) | 439 | if ( QApplication::desktop()->width() < 300 ) |
440 | size = 3; | 440 | size = 3; |
441 | int x = 1; | 441 | int x = 1; |
442 | if ( KOPrefs::instance()->mMonthShowIcons ) { | 442 | if ( KOPrefs::instance()->mMonthShowIcons ) { |
443 | if ( mInfo ) { | 443 | if ( mInfo ) { |
444 | x += size + 1; | 444 | x += size + 1; |
445 | } | 445 | } |
446 | if( mRecur ) { | 446 | if( mRecur ) { |
447 | x += size+1; | 447 | x += size+1; |
448 | } | 448 | } |
449 | if( mAlarm ) { | 449 | if( mAlarm ) { |
@@ -1882,129 +1882,129 @@ void KOMonthView::computeLayout() | |||
1882 | //qDebug("iii %d ", i); | 1882 | //qDebug("iii %d ", i); |
1883 | w = colWid; | 1883 | w = colWid; |
1884 | if ( ((i) % 7) >= 7-colModulo ) { | 1884 | if ( ((i) % 7) >= 7-colModulo ) { |
1885 | ++w; | 1885 | ++w; |
1886 | } | 1886 | } |
1887 | if ( i == (6-rowModulo)*7) | 1887 | if ( i == (6-rowModulo)*7) |
1888 | ++h; | 1888 | ++h; |
1889 | if ( combinedSatSun ) { | 1889 | if ( combinedSatSun ) { |
1890 | if ( (i)%7 >= daysToShow-1 ) { | 1890 | if ( (i)%7 >= daysToShow-1 ) { |
1891 | if ( (i)%7 == daysToShow-1 ) { | 1891 | if ( (i)%7 == daysToShow-1 ) { |
1892 | w = width()-x-weeklabelwid; | 1892 | w = width()-x-weeklabelwid; |
1893 | max = h/2; | 1893 | max = h/2; |
1894 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); | 1894 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); |
1895 | x -= w ;y += h/2; | 1895 | x -= w ;y += h/2; |
1896 | } else { | 1896 | } else { |
1897 | w = width()-x-weeklabelwid; | 1897 | w = width()-x-weeklabelwid; |
1898 | max = h-h/2; | 1898 | max = h-h/2; |
1899 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); | 1899 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); |
1900 | y -= h/2; | 1900 | y -= h/2; |
1901 | } | 1901 | } |
1902 | } else { | 1902 | } else { |
1903 | max = h; | 1903 | max = h; |
1904 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1904 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1905 | } | 1905 | } |
1906 | 1906 | ||
1907 | } | 1907 | } |
1908 | else { | 1908 | else { |
1909 | max = h; | 1909 | max = h; |
1910 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); | 1910 | mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); |
1911 | } | 1911 | } |
1912 | x += w; | 1912 | x += w; |
1913 | if ( x + w/2 > wid ) { | 1913 | if ( x + w/2 > wid ) { |
1914 | x = 0; | 1914 | x = 0; |
1915 | y += h; | 1915 | y += h; |
1916 | } | 1916 | } |
1917 | //mCells[i]->dateLabel()->setMaximumHeight( max- mCells[i]->lineWidth()*2 ); | 1917 | //mCells[i]->dateLabel()->setMaximumHeight( max- mCells[i]->lineWidth()*2 ); |
1918 | } | 1918 | } |
1919 | y= dayLabelHei; | 1919 | y= dayLabelHei; |
1920 | h = cellHei ; | 1920 | h = cellHei ; |
1921 | for ( i = 0; i < 6; i++) { | 1921 | for ( i = 0; i < 6; i++) { |
1922 | if ( i == (6-rowModulo)) | 1922 | if ( i == (6-rowModulo)) |
1923 | ++h; | 1923 | ++h; |
1924 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); | 1924 | mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); |
1925 | y += h; | 1925 | y += h; |
1926 | } | 1926 | } |
1927 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); | 1927 | mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); |
1928 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); | 1928 | // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); |
1929 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); | 1929 | //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); |
1930 | mShortDayLabelsM = mDayLabels[0]->width()-2 < mWidthLongDayLabel ; | 1930 | mShortDayLabelsM = mDayLabels[0]->width()-2 < mWidthLongDayLabel ; |
1931 | updateDayLabels(); | 1931 | updateDayLabels(); |
1932 | //bool forceUpdate = !updatePossible; | 1932 | //bool forceUpdate = !updatePossible; |
1933 | updatePossible = true; | 1933 | updatePossible = true; |
1934 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); | 1934 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); |
1935 | } | 1935 | } |
1936 | 1936 | ||
1937 | void KOMonthView::showContextMenu( Incidence *incidence ) | 1937 | void KOMonthView::showContextMenu( Incidence *incidence ) |
1938 | { | 1938 | { |
1939 | if( incidence ) | 1939 | if( incidence ) |
1940 | mContextMenu->showIncidencePopup(incidence); | 1940 | mContextMenu->showIncidencePopup(incidence); |
1941 | else { | 1941 | else { |
1942 | //qDebug("KOMonthView::showContextMenu "); | 1942 | //qDebug("KOMonthView::showContextMenu "); |
1943 | mNewItemMenu->popup(QCursor::pos()); | 1943 | mNewItemMenu->popup(QCursor::pos()); |
1944 | } | 1944 | } |
1945 | /* | 1945 | /* |
1946 | if( incidence && incidence->type() == "Event" ) { | 1946 | if( incidence && incidence->typeID() == eventID ) { |
1947 | Event *event = static_cast<Event *>(incidence); | 1947 | Event *event = static_cast<Event *>(incidence); |
1948 | mContextMenu->showEventPopup(event); | 1948 | mContextMenu->showEventPopup(event); |
1949 | } else { | 1949 | } else { |
1950 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; | 1950 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; |
1951 | } | 1951 | } |
1952 | */ | 1952 | */ |
1953 | } | 1953 | } |
1954 | MonthViewCell * KOMonthView::selectedCell( ) | 1954 | MonthViewCell * KOMonthView::selectedCell( ) |
1955 | { | 1955 | { |
1956 | return mSelectedCell; | 1956 | return mSelectedCell; |
1957 | } | 1957 | } |
1958 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) | 1958 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) |
1959 | { | 1959 | { |
1960 | //qDebug("KOMonthView::setSelectedCell %d", cell); | 1960 | //qDebug("KOMonthView::setSelectedCell %d", cell); |
1961 | if ( mSelectedCell && mSelectedCell != cell ) { | 1961 | if ( mSelectedCell && mSelectedCell != cell ) { |
1962 | MonthViewCell * mvc = mSelectedCell; | 1962 | MonthViewCell * mvc = mSelectedCell; |
1963 | mSelectedCell = cell; | 1963 | mSelectedCell = cell; |
1964 | mvc->deselect(); | 1964 | mvc->deselect(); |
1965 | } else | 1965 | } else |
1966 | mSelectedCell = cell; | 1966 | mSelectedCell = cell; |
1967 | // if ( mSelectedCell ) | 1967 | // if ( mSelectedCell ) |
1968 | // mSelectedCell->select(); | 1968 | // mSelectedCell->select(); |
1969 | if ( !mSelectedCell ) | 1969 | if ( !mSelectedCell ) |
1970 | emit incidenceSelected( 0 ); | 1970 | emit incidenceSelected( 0 ); |
1971 | else | 1971 | else |
1972 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); | 1972 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); |
1973 | } | 1973 | } |
1974 | 1974 | ||
1975 | void KOMonthView::processSelectionChange() | 1975 | void KOMonthView::processSelectionChange() |
1976 | { | 1976 | { |
1977 | QPtrList<Incidence> incidences = selectedIncidences(); | 1977 | QPtrList<Incidence> incidences = selectedIncidences(); |
1978 | if (incidences.count() > 0) { | 1978 | if (incidences.count() > 0) { |
1979 | emit incidenceSelected( incidences.first() ); | 1979 | emit incidenceSelected( incidences.first() ); |
1980 | } else { | 1980 | } else { |
1981 | emit incidenceSelected( 0 ); | 1981 | emit incidenceSelected( 0 ); |
1982 | clearSelection(); | 1982 | clearSelection(); |
1983 | } | 1983 | } |
1984 | } | 1984 | } |
1985 | 1985 | ||
1986 | void KOMonthView::clearSelection() | 1986 | void KOMonthView::clearSelection() |
1987 | { | 1987 | { |
1988 | if ( mSelectedCell ) { | 1988 | if ( mSelectedCell ) { |
1989 | mSelectedCell->deselect(); | 1989 | mSelectedCell->deselect(); |
1990 | mSelectedCell = 0; | 1990 | mSelectedCell = 0; |
1991 | } | 1991 | } |
1992 | } | 1992 | } |
1993 | 1993 | ||
1994 | void KOMonthView::keyReleaseEvent ( QKeyEvent * e) | 1994 | void KOMonthView::keyReleaseEvent ( QKeyEvent * e) |
1995 | { | 1995 | { |
1996 | if ( !e->isAutoRepeat() ) { | 1996 | if ( !e->isAutoRepeat() ) { |
1997 | mFlagKeyPressed = false; | 1997 | mFlagKeyPressed = false; |
1998 | } | 1998 | } |
1999 | } | 1999 | } |
2000 | 2000 | ||
2001 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) | 2001 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) |
2002 | { | 2002 | { |
2003 | 2003 | ||
2004 | qApp->processEvents(); | 2004 | qApp->processEvents(); |
2005 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 2005 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
2006 | //e->ignore(); | 2006 | //e->ignore(); |
2007 | e->accept(); | 2007 | e->accept(); |
2008 | return; | 2008 | return; |
2009 | } | 2009 | } |
2010 | if (! e->isAutoRepeat() ) | 2010 | if (! e->isAutoRepeat() ) |
diff --git a/korganizer/outgoingdialog.cpp b/korganizer/outgoingdialog.cpp index 0fc90c4..7253c8e 100644 --- a/korganizer/outgoingdialog.cpp +++ b/korganizer/outgoingdialog.cpp | |||
@@ -1,173 +1,173 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 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 <kdebug.h> | 20 | #include <kdebug.h> |
21 | 21 | ||
22 | #include <qfile.h> | 22 | #include <qfile.h> |
23 | #include <qdir.h> | 23 | #include <qdir.h> |
24 | #include <qtextstream.h> | 24 | #include <qtextstream.h> |
25 | 25 | ||
26 | #include <kglobal.h> | 26 | #include <kglobal.h> |
27 | #include <klocale.h> | 27 | #include <klocale.h> |
28 | #include <ktempfile.h> | 28 | #include <ktempfile.h> |
29 | #include <kstandarddirs.h> | 29 | #include <kstandarddirs.h> |
30 | 30 | ||
31 | #include <libkcal/event.h> | 31 | #include <libkcal/event.h> |
32 | #include <libkcal/freebusy.h> | 32 | #include <libkcal/freebusy.h> |
33 | //#include <libkcal/imipscheduler.h> | 33 | //#include <libkcal/imipscheduler.h> |
34 | #include <libkcal/dummyscheduler.h> | 34 | #include <libkcal/dummyscheduler.h> |
35 | #include <libkcal/icalformat.h> | 35 | #include <libkcal/icalformat.h> |
36 | #include <libkcal/calendar.h> | 36 | #include <libkcal/calendar.h> |
37 | 37 | ||
38 | #ifndef KORG_NOMAIL | 38 | #ifndef KORG_NOMAIL |
39 | #include "mailscheduler.h" | 39 | #include "mailscheduler.h" |
40 | #endif | 40 | #endif |
41 | 41 | ||
42 | #include "koprefs.h" | 42 | #include "koprefs.h" |
43 | #include "outgoingdialog.h" | 43 | #include "outgoingdialog.h" |
44 | #include "koeventviewerdialog.h" | 44 | #include "koeventviewerdialog.h" |
45 | #include "docprefs.h" | 45 | #include "docprefs.h" |
46 | 46 | ||
47 | ScheduleItemOut::ScheduleItemOut(QListView *parent,IncidenceBase *ev, | 47 | ScheduleItemOut::ScheduleItemOut(QListView *parent,IncidenceBase *ev, |
48 | Scheduler::Method method, | 48 | Scheduler::Method method, |
49 | const QString &recipients) | 49 | const QString &recipients) |
50 | : QListViewItem(parent) | 50 | : QListViewItem(parent) |
51 | { | 51 | { |
52 | mIncidence = ev; | 52 | mIncidence = ev; |
53 | mMethod = method; | 53 | mMethod = method; |
54 | mRecipients = recipients; | 54 | mRecipients = recipients; |
55 | 55 | ||
56 | // kdDebug() << "ScheduleItemOut: setting the summary" << endl; | 56 | // kdDebug() << "ScheduleItemOut: setting the summary" << endl; |
57 | //Set the summary | 57 | //Set the summary |
58 | if(ev->type() != "FreeBusy") { | 58 | if(ev->typeID() != freebusyID ) { |
59 | Incidence *incidence = static_cast<Incidence *>(ev); | 59 | Incidence *incidence = static_cast<Incidence *>(ev); |
60 | setText(0,incidence->summary()); | 60 | setText(0,incidence->summary()); |
61 | } else { | 61 | } else { |
62 | setText(0,i18n("Free Busy Object")); | 62 | setText(0,i18n("Free Busy Object")); |
63 | } | 63 | } |
64 | 64 | ||
65 | // kdDebug() << "ScheduleItemOut: checking if the object is an event" << endl; | 65 | // kdDebug() << "ScheduleItemOut: checking if the object is an event" << endl; |
66 | //If the object is an event | 66 | //If the object is an event |
67 | if(ev->type()=="Event") { | 67 | if(ev->typeID()== eventID ) { |
68 | Event *event = static_cast<Event *>(ev); | 68 | Event *event = static_cast<Event *>(ev); |
69 | 69 | ||
70 | setText(1,event->dtStartDateStr()); | 70 | setText(1,event->dtStartDateStr()); |
71 | if (event->doesFloat()) { //If the event floats set the start and end times to no time | 71 | if (event->doesFloat()) { //If the event floats set the start and end times to no time |
72 | setText(2,i18n("no time")); | 72 | setText(2,i18n("no time")); |
73 | setText(4,i18n("no time")); | 73 | setText(4,i18n("no time")); |
74 | } else { //If it does not float | 74 | } else { //If it does not float |
75 | setText(2,event->dtStartTimeStr()); | 75 | setText(2,event->dtStartTimeStr()); |
76 | if (event->hasDuration()) { | 76 | if (event->hasDuration()) { |
77 | setText(4,event->dtEndTimeStr()); | 77 | setText(4,event->dtEndTimeStr()); |
78 | } else { | 78 | } else { |
79 | setText(4,i18n("no time")); | 79 | setText(4,i18n("no time")); |
80 | } | 80 | } |
81 | } | 81 | } |
82 | if (event->hasEndDate()) { | 82 | if (event->hasEndDate()) { |
83 | setText(3,event->dtEndDateStr()); | 83 | setText(3,event->dtEndDateStr()); |
84 | } | 84 | } |
85 | else { | 85 | else { |
86 | setText(3,i18n("no time")); | 86 | setText(3,i18n("no time")); |
87 | } | 87 | } |
88 | } | 88 | } |
89 | 89 | ||
90 | //If the object is an Todo | 90 | //If the object is an Todo |
91 | if(ev->type()=="Todo") { | 91 | if(ev->typeID() == todoID ) { |
92 | Todo *event = static_cast<Todo *>(ev); | 92 | Todo *event = static_cast<Todo *>(ev); |
93 | if (event->hasStartDate()) { | 93 | if (event->hasStartDate()) { |
94 | setText(1,event->dtStartDateStr()); | 94 | setText(1,event->dtStartDateStr()); |
95 | if (!event->doesFloat()) { | 95 | if (!event->doesFloat()) { |
96 | setText(2,event->dtStartTimeStr()); | 96 | setText(2,event->dtStartTimeStr()); |
97 | } | 97 | } |
98 | } | 98 | } |
99 | if (event->hasDueDate()) { | 99 | if (event->hasDueDate()) { |
100 | setText(3,event->dtDueDateStr()); | 100 | setText(3,event->dtDueDateStr()); |
101 | if (!event->doesFloat()) { | 101 | if (!event->doesFloat()) { |
102 | setText(4,event->dtDueTimeStr()); | 102 | setText(4,event->dtDueTimeStr()); |
103 | } | 103 | } |
104 | } | 104 | } |
105 | } | 105 | } |
106 | 106 | ||
107 | // kdDebug() << "ScheduleItemOut: checking if the object is a FreeBusy object" << endl; | 107 | // kdDebug() << "ScheduleItemOut: checking if the object is a FreeBusy object" << endl; |
108 | //If the object is a freebusy object | 108 | //If the object is a freebusy object |
109 | if(ev->type() == "FreeBusy") { | 109 | if(ev->typeID() == freebusyID ) { |
110 | FreeBusy *freebusy = static_cast<FreeBusy *>(ev); | 110 | FreeBusy *freebusy = static_cast<FreeBusy *>(ev); |
111 | 111 | ||
112 | setText(1,freebusy->dtStartDateStr()); | 112 | setText(1,freebusy->dtStartDateStr()); |
113 | setText(2,freebusy->dtStartTimeStr()); | 113 | setText(2,freebusy->dtStartTimeStr()); |
114 | //Must try and get this to the users local settings | 114 | //Must try and get this to the users local settings |
115 | setText(3,KGlobal::locale()->formatDate( freebusy->dtEnd().date() ) ); | 115 | setText(3,KGlobal::locale()->formatDate( freebusy->dtEnd().date() ) ); |
116 | setText(4,KGlobal::locale()->formatTime( freebusy->dtEnd().time() ) ); | 116 | setText(4,KGlobal::locale()->formatTime( freebusy->dtEnd().time() ) ); |
117 | } | 117 | } |
118 | 118 | ||
119 | // kdDebug() << "ScheduleItemOut: Setting the method" << endl; | 119 | // kdDebug() << "ScheduleItemOut: Setting the method" << endl; |
120 | //Set the Method | 120 | //Set the Method |
121 | setText(5,Scheduler::translatedMethodName(mMethod)); | 121 | setText(5,Scheduler::translatedMethodName(mMethod)); |
122 | } | 122 | } |
123 | 123 | ||
124 | OutgoingDialog::OutgoingDialog(Calendar *calendar,QWidget* parent, | 124 | OutgoingDialog::OutgoingDialog(Calendar *calendar,QWidget* parent, |
125 | const char* name,bool modal, | 125 | const char* name,bool modal, |
126 | WFlags fl) | 126 | WFlags fl) |
127 | : OutgoingDialog_base(parent,name,modal,fl) | 127 | : OutgoingDialog_base(parent,name,modal,fl) |
128 | { | 128 | { |
129 | mCalendar = calendar; | 129 | mCalendar = calendar; |
130 | 130 | ||
131 | mFormat = new ICalFormat; | 131 | mFormat = new ICalFormat; |
132 | 132 | ||
133 | if (KOPrefs::instance()->mIMIPScheduler == KOPrefs::IMIPDummy ) { | 133 | if (KOPrefs::instance()->mIMIPScheduler == KOPrefs::IMIPDummy ) { |
134 | mScheduler = new DummyScheduler(mCalendar); | 134 | mScheduler = new DummyScheduler(mCalendar); |
135 | } else { | 135 | } else { |
136 | #ifndef KORG_NOMAIL | 136 | #ifndef KORG_NOMAIL |
137 | mScheduler = new MailScheduler(mCalendar); | 137 | mScheduler = new MailScheduler(mCalendar); |
138 | #else | 138 | #else |
139 | mScheduler = new DummyScheduler(mCalendar); | 139 | mScheduler = new DummyScheduler(mCalendar); |
140 | #endif | 140 | #endif |
141 | } | 141 | } |
142 | mMessageListView->setColumnAlignment(1,AlignHCenter); | 142 | mMessageListView->setColumnAlignment(1,AlignHCenter); |
143 | mMessageListView->setColumnAlignment(2,AlignHCenter); | 143 | mMessageListView->setColumnAlignment(2,AlignHCenter); |
144 | mMessageListView->setColumnAlignment(3,AlignHCenter); | 144 | mMessageListView->setColumnAlignment(3,AlignHCenter); |
145 | mMessageListView->setColumnAlignment(4,AlignHCenter); | 145 | mMessageListView->setColumnAlignment(4,AlignHCenter); |
146 | QObject::connect(mMessageListView,SIGNAL(doubleClicked(QListViewItem *)), | 146 | QObject::connect(mMessageListView,SIGNAL(doubleClicked(QListViewItem *)), |
147 | this,SLOT(showEvent(QListViewItem *))); | 147 | this,SLOT(showEvent(QListViewItem *))); |
148 | mDocPrefs = new DocPrefs("groupschedule"); | 148 | mDocPrefs = new DocPrefs("groupschedule"); |
149 | loadMessages(); | 149 | loadMessages(); |
150 | } | 150 | } |
151 | 151 | ||
152 | OutgoingDialog::~OutgoingDialog() | 152 | OutgoingDialog::~OutgoingDialog() |
153 | { | 153 | { |
154 | delete mDocPrefs; | 154 | delete mDocPrefs; |
155 | delete mFormat; | 155 | delete mFormat; |
156 | } | 156 | } |
157 | 157 | ||
158 | bool OutgoingDialog::addMessage(IncidenceBase *incidence,Scheduler::Method method) | 158 | bool OutgoingDialog::addMessage(IncidenceBase *incidence,Scheduler::Method method) |
159 | { | 159 | { |
160 | kdDebug() << "Outgoing::addMessage" << "Method:" << method << endl; | 160 | kdDebug() << "Outgoing::addMessage" << "Method:" << method << endl; |
161 | if (method == Scheduler::Publish) return false; | 161 | if (method == Scheduler::Publish) return false; |
162 | if( mDocPrefs ) { | 162 | if( mDocPrefs ) { |
163 | if (method != Scheduler::Cancel) { | 163 | if (method != Scheduler::Cancel) { |
164 | mDocPrefs->writeEntry( incidence->uid()+"-scheduled", true ); | 164 | mDocPrefs->writeEntry( incidence->uid()+"-scheduled", true ); |
165 | } else { | 165 | } else { |
166 | if (!mDocPrefs->readBoolEntry(incidence->uid()+"-scheduled") ) | 166 | if (!mDocPrefs->readBoolEntry(incidence->uid()+"-scheduled") ) |
167 | return true; | 167 | return true; |
168 | } | 168 | } |
169 | } | 169 | } |
170 | 170 | ||
171 | if (KOPrefs::instance()->mIMIPSend == KOPrefs::IMIPOutbox) { | 171 | if (KOPrefs::instance()->mIMIPSend == KOPrefs::IMIPOutbox) { |
172 | new ScheduleItemOut(mMessageListView,incidence,method); | 172 | new ScheduleItemOut(mMessageListView,incidence,method); |
173 | saveMessage(incidence,method); | 173 | saveMessage(incidence,method); |
@@ -180,132 +180,132 @@ bool OutgoingDialog::addMessage(IncidenceBase *incidence,Scheduler::Method metho | |||
180 | } | 180 | } |
181 | 181 | ||
182 | bool OutgoingDialog::addMessage(IncidenceBase *incidence,Scheduler::Method method, | 182 | bool OutgoingDialog::addMessage(IncidenceBase *incidence,Scheduler::Method method, |
183 | const QString &recipients) | 183 | const QString &recipients) |
184 | { | 184 | { |
185 | //if (method != Scheduler::Publish) return false; | 185 | //if (method != Scheduler::Publish) return false; |
186 | if( mDocPrefs ) { | 186 | if( mDocPrefs ) { |
187 | if (method != Scheduler::Cancel) { | 187 | if (method != Scheduler::Cancel) { |
188 | mDocPrefs->writeEntry( incidence->uid()+"-scheduled", true ); | 188 | mDocPrefs->writeEntry( incidence->uid()+"-scheduled", true ); |
189 | } else { | 189 | } else { |
190 | if (!mDocPrefs->readBoolEntry(incidence->uid()+"-scheduled") ) | 190 | if (!mDocPrefs->readBoolEntry(incidence->uid()+"-scheduled") ) |
191 | return true; | 191 | return true; |
192 | } | 192 | } |
193 | } | 193 | } |
194 | if (KOPrefs::instance()->mIMIPSend == KOPrefs::IMIPOutbox) { | 194 | if (KOPrefs::instance()->mIMIPSend == KOPrefs::IMIPOutbox) { |
195 | new ScheduleItemOut(mMessageListView,incidence,method,recipients); | 195 | new ScheduleItemOut(mMessageListView,incidence,method,recipients); |
196 | saveMessage(incidence,method,recipients); | 196 | saveMessage(incidence,method,recipients); |
197 | emit numMessagesChanged(mMessageListView->childCount()); | 197 | emit numMessagesChanged(mMessageListView->childCount()); |
198 | } | 198 | } |
199 | else { | 199 | else { |
200 | mScheduler->performTransaction(incidence,method,recipients); | 200 | mScheduler->performTransaction(incidence,method,recipients); |
201 | } | 201 | } |
202 | return true; | 202 | return true; |
203 | } | 203 | } |
204 | 204 | ||
205 | void OutgoingDialog::send() | 205 | void OutgoingDialog::send() |
206 | { | 206 | { |
207 | kdDebug() << "OutgoingDialog::send" << endl; | 207 | kdDebug() << "OutgoingDialog::send" << endl; |
208 | ScheduleItemOut *item = (ScheduleItemOut *)(mMessageListView->firstChild()); | 208 | ScheduleItemOut *item = (ScheduleItemOut *)(mMessageListView->firstChild()); |
209 | while(item) { | 209 | while(item) { |
210 | bool success; | 210 | bool success; |
211 | if (item->method() == Scheduler::Publish) { | 211 | if (item->method() == Scheduler::Publish) { |
212 | success = mScheduler->publish(item->event(),item->recipients()); | 212 | success = mScheduler->publish(item->event(),item->recipients()); |
213 | } else { | 213 | } else { |
214 | success = mScheduler->performTransaction(item->event(),item->method()); | 214 | success = mScheduler->performTransaction(item->event(),item->method()); |
215 | } | 215 | } |
216 | ScheduleItemOut *oldItem = item; | 216 | ScheduleItemOut *oldItem = item; |
217 | item = (ScheduleItemOut *)(item->nextSibling()); | 217 | item = (ScheduleItemOut *)(item->nextSibling()); |
218 | if (success) { | 218 | if (success) { |
219 | deleteMessage(oldItem->event()); | 219 | deleteMessage(oldItem->event()); |
220 | delete (oldItem->event()); | 220 | delete (oldItem->event()); |
221 | delete oldItem; | 221 | delete oldItem; |
222 | } | 222 | } |
223 | } | 223 | } |
224 | 224 | ||
225 | emit numMessagesChanged(mMessageListView->childCount()); | 225 | emit numMessagesChanged(mMessageListView->childCount()); |
226 | } | 226 | } |
227 | 227 | ||
228 | void OutgoingDialog::deleteItem() | 228 | void OutgoingDialog::deleteItem() |
229 | { | 229 | { |
230 | ScheduleItemOut *item = (ScheduleItemOut *)(mMessageListView->selectedItem()); | 230 | ScheduleItemOut *item = (ScheduleItemOut *)(mMessageListView->selectedItem()); |
231 | if(!item) | 231 | if(!item) |
232 | return; | 232 | return; |
233 | deleteMessage(item->event()); | 233 | deleteMessage(item->event()); |
234 | delete(item->event()); | 234 | delete(item->event()); |
235 | mMessageListView->takeItem(item); | 235 | mMessageListView->takeItem(item); |
236 | emit numMessagesChanged(mMessageListView->childCount()); | 236 | emit numMessagesChanged(mMessageListView->childCount()); |
237 | } | 237 | } |
238 | 238 | ||
239 | void OutgoingDialog::showEvent(QListViewItem *qitem) | 239 | void OutgoingDialog::showEvent(QListViewItem *qitem) |
240 | { | 240 | { |
241 | ScheduleItemOut *item = (ScheduleItemOut *)qitem; | 241 | ScheduleItemOut *item = (ScheduleItemOut *)qitem; |
242 | Event *event = 0; | 242 | Event *event = 0; |
243 | Todo *todo = 0; | 243 | Todo *todo = 0; |
244 | if ( item->event()->type()=="Event" ) { | 244 | if ( item->event()->typeID() == eventID ) { |
245 | event = static_cast<Event *>(item->event()); | 245 | event = static_cast<Event *>(item->event()); |
246 | } | 246 | } |
247 | if ( item->event()->type()=="Todo" ) { | 247 | if ( item->event()->typeID() == todoID ) { |
248 | todo = static_cast<Todo *>(item->event()); | 248 | todo = static_cast<Todo *>(item->event()); |
249 | } | 249 | } |
250 | QString sendText; | 250 | QString sendText; |
251 | if (event || todo) { | 251 | if (event || todo) { |
252 | KOEventViewerDialog *eventViewer = new KOEventViewerDialog(this); | 252 | KOEventViewerDialog *eventViewer = new KOEventViewerDialog(this); |
253 | if (event) eventViewer->setEvent(event); | 253 | if (event) eventViewer->setEvent(event); |
254 | if (todo) eventViewer->setTodo(todo); | 254 | if (todo) eventViewer->setTodo(todo); |
255 | sendText = "<hr><h4>"+i18n("Event will be sent to:")+"</h4>"; | 255 | sendText = "<hr><h4>"+i18n("Event will be sent to:")+"</h4>"; |
256 | switch (item->method()) { | 256 | switch (item->method()) { |
257 | case Scheduler::Publish: { | 257 | case Scheduler::Publish: { |
258 | sendText += item->recipients(); | 258 | sendText += item->recipients(); |
259 | break; } | 259 | break; } |
260 | case Scheduler::Request: { | 260 | case Scheduler::Request: { |
261 | sendText += i18n("All attendees"); | 261 | sendText += i18n("All attendees"); |
262 | break; } | 262 | break; } |
263 | case Scheduler::Refresh: { | 263 | case Scheduler::Refresh: { |
264 | sendText += i18n("All attendees"); | 264 | sendText += i18n("All attendees"); |
265 | break; } | 265 | break; } |
266 | case Scheduler::Cancel: { | 266 | case Scheduler::Cancel: { |
267 | sendText += i18n("All attendees"); | 267 | sendText += i18n("All attendees"); |
268 | break; } | 268 | break; } |
269 | case Scheduler::Add: { | 269 | case Scheduler::Add: { |
270 | sendText += i18n("All attendees"); | 270 | sendText += i18n("All attendees"); |
271 | break; } | 271 | break; } |
272 | case Scheduler::Reply: { | 272 | case Scheduler::Reply: { |
273 | sendText += i18n("The organizer %1").arg(item->event()->organizer()); | 273 | sendText += i18n("The organizer %1").arg(item->event()->organizer()); |
274 | break; } | 274 | break; } |
275 | case Scheduler::Counter: { | 275 | case Scheduler::Counter: { |
276 | sendText += i18n("The organizer %1").arg(item->event()->organizer()); | 276 | sendText += i18n("The organizer %1").arg(item->event()->organizer()); |
277 | break; } | 277 | break; } |
278 | case Scheduler::Declinecounter: { | 278 | case Scheduler::Declinecounter: { |
279 | sendText += i18n("All attendees"); | 279 | sendText += i18n("All attendees"); |
280 | break; } | 280 | break; } |
281 | case Scheduler::NoMethod: { | 281 | case Scheduler::NoMethod: { |
282 | sendText += ""; | 282 | sendText += ""; |
283 | break; } | 283 | break; } |
284 | default: | 284 | default: |
285 | sendText = ""; | 285 | sendText = ""; |
286 | } | 286 | } |
287 | eventViewer->addText(sendText); | 287 | eventViewer->addText(sendText); |
288 | eventViewer->show(); | 288 | eventViewer->show(); |
289 | } | 289 | } |
290 | } | 290 | } |
291 | 291 | ||
292 | bool OutgoingDialog::saveMessage(IncidenceBase *incidence,Scheduler::Method method, | 292 | bool OutgoingDialog::saveMessage(IncidenceBase *incidence,Scheduler::Method method, |
293 | const QString &recipients) | 293 | const QString &recipients) |
294 | { | 294 | { |
295 | KTempFile ktfile(locateLocal("data","korganizer/outgoing/"),"ics"); | 295 | KTempFile ktfile(locateLocal("data","korganizer/outgoing/"),"ics"); |
296 | QString messageText = mFormat->createScheduleMessage(incidence,method); | 296 | QString messageText = mFormat->createScheduleMessage(incidence,method); |
297 | QTextStream *qts = ktfile.textStream(); | 297 | QTextStream *qts = ktfile.textStream(); |
298 | *qts << messageText; | 298 | *qts << messageText; |
299 | *qts << "METHOD-BEGIN:" << endl << method << endl << ":METHOD-END" << endl; | 299 | *qts << "METHOD-BEGIN:" << endl << method << endl << ":METHOD-END" << endl; |
300 | *qts << "RECIPIENTS-BEGIN:" << endl << recipients << endl << ":RECIPIENTS-END" << endl; | 300 | *qts << "RECIPIENTS-BEGIN:" << endl << recipients << endl << ":RECIPIENTS-END" << endl; |
301 | mMessageMap[incidence]=ktfile.name(); | 301 | mMessageMap[incidence]=ktfile.name(); |
302 | 302 | ||
303 | return true; | 303 | return true; |
304 | } | 304 | } |
305 | 305 | ||
306 | bool OutgoingDialog::deleteMessage(IncidenceBase *incidence) | 306 | bool OutgoingDialog::deleteMessage(IncidenceBase *incidence) |
307 | { | 307 | { |
308 | QFile f( mMessageMap[incidence] ); | 308 | QFile f( mMessageMap[incidence] ); |
309 | mMessageMap.remove(incidence); | 309 | mMessageMap.remove(incidence); |
310 | if ( !f.exists() ) return false; | 310 | if ( !f.exists() ) return false; |
311 | else | 311 | else |