summaryrefslogtreecommitdiffabout
path: root/korganizer/incomingdialog.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/incomingdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/incomingdialog.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/incomingdialog.cpp b/korganizer/incomingdialog.cpp
index 490d21e..f3bd09f 100644
--- a/korganizer/incomingdialog.cpp
+++ b/korganizer/incomingdialog.cpp
@@ -335,193 +335,193 @@ bool IncomingDialog::incomeCounter(ScheduleItemIn *item)
//the counter-sender's email is missing...
//now every attendee gets an declinecounter :-(
mOutgoing->addMessage(counterEvent,Scheduler::Declinecounter);
delete item;
emit numMessagesChanged(mMessageListView->childCount());
mScheduler->deleteTransaction(item->event());
delete item;
emit numMessagesChanged(mMessageListView->childCount());
return true;
}
//mScheduler->deleteTransaction(item->event());
delete item;
emit numMessagesChanged(mMessageListView->childCount());
return false;
}
bool IncomingDialog::incomeDeclineCounter(ScheduleItemIn *item)
{
Event *even = mCalendar->event(item->event()->uid());
if (even) {
mOutgoing->addMessage(even,Scheduler::Refresh);
mScheduler->deleteTransaction(item->event());
delete item;
emit numMessagesChanged(mMessageListView->childCount());
return true;
}
mScheduler->deleteTransaction(item->event());
delete item;
emit numMessagesChanged(mMessageListView->childCount());
return false;
}
bool IncomingDialog::incomeAdd(ScheduleItemIn *item)
{
IncidenceBase *incidence = ((ScheduleItemIn *)item)->event();
if (incidence->type() == "Event" ) {
Event *refr = static_cast<Event *>( incidence );
mOutgoing->addMessage(refr,Scheduler::Refresh);
mScheduler->deleteTransaction( incidence );
delete item;
emit numMessagesChanged(mMessageListView->childCount());
return true;
}
else {
kdDebug() << "IncomingDialog::incomeAdd - only Events are supportet yet" << endl;
mScheduler->deleteTransaction( incidence );
delete item;
emit numMessagesChanged(mMessageListView->childCount());
return false;
}
}
bool IncomingDialog::incomeDefault(ScheduleItemIn *item)
{
if (mScheduler->acceptTransaction(item->event(),item->method(),item->status())) {
delete item;
emit numMessagesChanged(mMessageListView->childCount());
return true;
}
else {
KMessageBox::error(this,i18n("Unable to accept the IMIP-message. It may be a problem with the email addresses."));
kdDebug() << "IncomingDialog::acceptMessage(): Error!" << endl;
return false;
}
return false;
}
bool IncomingDialog::incomeRequest(ScheduleItemIn *item)
{
if (item->event()->type()=="FreeBusy") {
//handel freebusy request
IncidenceBase *inc = item->event();
QDateTime start = inc->dtStart();
QDateTime end = start.addDays(inc->duration()/86400);
FreeBusy *freebusy = new FreeBusy(mCalendar, start, end);
freebusy->setOrganizer(inc->organizer());
Attendee *att = new Attendee(KOPrefs::instance()->fullName(),
KOPrefs::instance()->email());
freebusy->addAttendee(att);
kdDebug() << "calendarview: schedule_publish_freebusy: startDate: "
<< KGlobal::locale()->formatDateTime( start ) << " End Date: "
<< KGlobal::locale()->formatDateTime( end ) << endl;
if (mOutgoing->addMessage(freebusy,Scheduler::Reply)) {
delete item;
emit numMessagesChanged(mMessageListView->childCount());
delete(freebusy);
return true;
}
return false;
} else {
return incomeDefault(item);
}
return false;
}
bool IncomingDialog::automaticAction(ScheduleItemIn *item)
{
bool autoAction = false;
IncidenceBase *inc = item->event();
Scheduler::Method method = item->method();
if( inc->type()=="FreeBusy" ) {
if ( method==Scheduler::Request ) {
if ( KOPrefs::instance()->mIMIPAutoFreeBusy==KOPrefs::addressbookAuto ) {
// reply freebusy information
if ( checkOrganizerInAddressbook(inc->organizer()) ) {
incomeRequest(item);
}
} else return false;
} else {
if ( method==Scheduler::Reply ) {
if ( KOPrefs::instance()->mIMIPAutoFreeBusy==KOPrefs::addressbookAuto ) {
// insert freebusy information
//if ( checkAttendeesInAddressbook(inc) )
} else return false;
} else {
if ( method==Scheduler::Publish) {
if ( KOPrefs::instance()->mIMIPAutoFreeBusy==KOPrefs::addressbookAuto ) {
// insert freebusy information
//if ( checkOrganizerInAddressbook(inc->organizer()) )
}
} else return false;
}
}
}
if ( inc->type()=="Event" ) {
if ( method==Scheduler::Request || method==Scheduler::Publish ) {
if ( KOPrefs::instance()->mIMIPAutoInsertRequest==KOPrefs::addressbookAuto ) {
// insert event
if ( checkOrganizerInAddressbook(inc->organizer()) )
autoAction = acceptMessage(item);
} else return false;
} else {
if ( method==Scheduler::Reply ) {
if ( KOPrefs::instance()->mIMIPAutoInsertReply==KOPrefs::addressbookAuto ) {
// update event information
if ( checkAttendeesInAddressbook(inc) )
autoAction = acceptMessage(item);
} else return false;
} else {
if ( method==Scheduler::Refresh ) {
if ( KOPrefs::instance()->mIMIPAutoRefresh==KOPrefs::addressbookAuto ) {
// send refresh-information
if ( checkAttendeesInAddressbook(inc) )
autoAction = acceptMessage(item);
else return false;
} else return false;
} else return false;
}
}
}
return autoAction;
}
bool IncomingDialog::checkOrganizerInAddressbook(QString organizer)
{
bool inBook = false;
#ifndef KORG_NOKABC
KABC::AddressBook *add_book = KABC::StdAddressBook::self();
KABC::Addressee::List addressList;
addressList = add_book->findByEmail(organizer);
if ( addressList.size()>0 ) inBook = true;
#endif
return inBook;
}
bool IncomingDialog::checkAttendeesInAddressbook(IncidenceBase *inc)
{
bool inBook = false;
#ifndef KORG_NOKABC
KABC::AddressBook *add_book = KABC::StdAddressBook::self();
KABC::Addressee::List addressList;
QPtrList <Attendee> attendees;
Attendee *att;
attendees = inc->attendees();
for (att=attendees.first();att;att=attendees.next()) {
addressList = add_book->findByEmail(att->email());
if (addressList.size()>0 ) inBook = true;
}
#endif
return inBook;
}
-#include "incomingdialog.moc"
+//#include "incomingdialog.moc"