summaryrefslogtreecommitdiffabout
path: root/korganizer/incomingdialog.cpp
Unidiff
Diffstat (limited to 'korganizer/incomingdialog.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/incomingdialog.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/korganizer/incomingdialog.cpp b/korganizer/incomingdialog.cpp
index 50e3077..fe78356 100644
--- a/korganizer/incomingdialog.cpp
+++ b/korganizer/incomingdialog.cpp
@@ -169,25 +169,25 @@ void IncomingDialog::setOutgoingDialog(OutgoingDialog *outgoing)
169 169
170void IncomingDialog::retrieve() 170void 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 }
@@ -246,25 +246,25 @@ 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
255void IncomingDialog::showEvent(QListViewItem *item) 255void 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
266bool IncomingDialog::incomeRefresh(ScheduleItemIn *item) 266bool 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??
@@ -281,25 +281,25 @@ bool IncomingDialog::incomeRefresh(ScheduleItemIn *item)
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
289bool IncomingDialog::incomeCounter(ScheduleItemIn *item) 289bool 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!"));
@@ -359,25 +359,25 @@ bool IncomingDialog::incomeDeclineCounter(ScheduleItemIn *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
368bool IncomingDialog::incomeAdd(ScheduleItemIn *item) 368bool 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());
@@ -393,25 +393,25 @@ bool IncomingDialog::incomeDefault(ScheduleItemIn *item)
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
403bool IncomingDialog::incomeRequest(ScheduleItemIn *item) 403bool 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: "
@@ -428,25 +428,25 @@ bool IncomingDialog::incomeRequest(ScheduleItemIn *item)
428 } else { 428 } else {
429 return incomeDefault(item); 429 return incomeDefault(item);
430 } 430 }
431 return false; 431 return false;
432} 432}
433 433
434bool IncomingDialog::automaticAction(ScheduleItemIn *item) 434bool 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
@@ -456,25 +456,25 @@ bool IncomingDialog::automaticAction(ScheduleItemIn *item)
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) )