Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117851793
D49.1775314241.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
9 KB
Referenced Files
None
Subscribers
None
D49.1775314241.diff
View Options
Index: akonadi/calendar/incidencechanger.cpp
===================================================================
--- akonadi/calendar/incidencechanger.cpp
+++ akonadi/calendar/incidencechanger.cpp
@@ -621,7 +621,7 @@
if (weAreOrganizer(incidence)) {
//TODO: not to popup all delete message dialogs at once :(
sendOk = false;
- handler->sendIncidenceDeletedMessage(KCalCore::iTIPCancel, incidence);
+ handler->sendIncidenceDeletedMessage(KCalCore::iTIPCancel, incidence, Akonadi::Attendees);
if (change->atomicOperationId) {
mInvitationStatusByAtomicOperation.insert(change->atomicOperationId, status);
}
@@ -672,7 +672,7 @@
}
ITIPHandlerHelper handler(mFactory, change->parentWidget);
- const bool modify = handler.handleIncidenceAboutToBeModified(newIncidence);
+ const bool modify = handler.handleIncidenceAboutToBeModified(newIncidence, weAreOrganizer(newIncidence) ? Akonadi::Attendees : Akonadi::Organizer);
if (modify) {
break;
} else {
@@ -719,7 +719,7 @@
{
Incidence::Ptr incidence = CalendarUtils::incidence(change->newItem);
if (incidence->supportsGroupwareCommunication()) {
- handler->sendIncidenceCreatedMessage(KCalCore::iTIPRequest, incidence);
+ handler->sendIncidenceCreatedMessage(KCalCore::iTIPRequest, incidence, Akonadi::Organizer);
return;
}
}
@@ -793,17 +793,17 @@
if (!attendees.isEmpty()) {
Attendee::Ptr a = attendees.first();
clone->addAttendee(a);
- handler->sendIncidenceModifiedMessage(KCalCore::iTIPReply, clone, attendeeStatusChanged);
+ handler->sendIncidenceModifiedMessage(KCalCore::iTIPReply, clone, attendeeStatusChanged, Akonadi::Organizer);
} else {
kWarning() << "No attendee found";
change->emitUserDialogClosedAfterChange(ITIPHandlerHelper::ResultCanceled);
}
} else {
- handler->sendIncidenceModifiedMessage(KCalCore::iTIPRequest, newIncidence, attendeeStatusChanged);
+ handler->sendIncidenceModifiedMessage(KCalCore::iTIPRequest, newIncidence, attendeeStatusChanged, Akonadi::Attendees);
}
} else {
kDebug() << "Attendeestatus " << attendeeStatusChanged;
- handler->sendIncidenceModifiedMessage(KCalCore::iTIPRequest, newIncidence, false);
+ handler->sendIncidenceModifiedMessage(KCalCore::iTIPRequest, newIncidence, false, weAreOrganizer(newIncidence)? Akonadi::Attendees: Akonadi::Organizer);
}
return;
Index: akonadi/calendar/itiphandler_p.cpp
===================================================================
--- akonadi/calendar/itiphandler_p.cpp
+++ akonadi/calendar/itiphandler_p.cpp
@@ -140,7 +140,7 @@
m_helper->setDialogParent(m_parentWidget);
m_helper->sendIncidenceModifiedMessage(KCalCore::iTIPRequest,
KCalCore::Incidence::Ptr(m_incidence->clone()),
- false);
+ false, Akonadi::Attendees);
m_incidence.clear();
return;
} else {
Index: akonadi/calendar/itiphandlerhelper_p.h
===================================================================
--- akonadi/calendar/itiphandlerhelper_p.h
+++ akonadi/calendar/itiphandlerhelper_p.h
@@ -44,6 +44,11 @@
StatusSendingInvitation
};
+enum Recipient {
+ Attendees,
+ Organizer
+};
+
/**
This class handles sending of invitations to attendees when Incidences (e.g.
events or todos) are created/modified/deleted.
@@ -108,7 +113,7 @@
@param incidence The new incidence.
*/
void sendIncidenceCreatedMessage(KCalCore::iTIPMethod method,
- const KCalCore::Incidence::Ptr &incidence);
+ const KCalCore::Incidence::Ptr &incidence, Akonadi::Recipient recipient);
/**
Checks if the incidence should really be modified.
@@ -120,7 +125,7 @@
@param incidence The modified incidence. It may not be null.
*/
- bool handleIncidenceAboutToBeModified(const KCalCore::Incidence::Ptr &incidence);
+ bool handleIncidenceAboutToBeModified(const KCalCore::Incidence::Ptr &incidence, Akonadi::Recipient recipient);
/**
Handles sending of invitations for modified incidences.
@@ -129,14 +134,14 @@
*/
void sendIncidenceModifiedMessage(KCalCore::iTIPMethod method,
const KCalCore::Incidence::Ptr &incidence,
- bool attendeeStatusChanged);
+ bool attendeeStatusChanged, Akonadi::Recipient recipient);
/**
Handles sending of ivitations for deleted incidences.
@param incidence The deleted incidence.
*/
void sendIncidenceDeletedMessage(KCalCore::iTIPMethod method,
- const KCalCore::Incidence::Ptr &incidence);
+ const KCalCore::Incidence::Ptr &incidence, Akonadi::Recipient recipient);
/**
Send counter proposal message.
@@ -172,13 +177,6 @@
KCalCore::iTIPMethod method);
/**
- We are the organizer. If there is more than one attendee, or if there is
- only one, and it's not the same as the organizer, ask the user to send
- mail.
- */
- bool weAreOrganizerOf(const KCalCore::Incidence::Ptr &incidence);
-
- /**
Assumes that we are the organizer. If there is more than one attendee, or if
there is only one, and it's not the same as the organizer, ask the user to send
mail.
Index: akonadi/calendar/itiphandlerhelper_p.cpp
===================================================================
--- akonadi/calendar/itiphandlerhelper_p.cpp
+++ akonadi/calendar/itiphandlerhelper_p.cpp
@@ -160,23 +160,8 @@
}
}
-bool ITIPHandlerHelper::weAreOrganizerOf(const KCalCore::Incidence::Ptr &incidence)
-{
- const QString email = incidence->organizer()->email();
- return Akonadi::CalendarUtils::thatIsMe(email) || email.isEmpty()
- || email == QLatin1String("invalid@email.address");
-}
-
bool ITIPHandlerHelper::weNeedToSendMailFor(const KCalCore::Incidence::Ptr &incidence)
{
- if (!weAreOrganizerOf(incidence)) {
- kError() << "We should be the organizer of this incidence."
- << "; email= " << incidence->organizer()->email()
- << "; thatIsMe() = " << Akonadi::CalendarUtils::thatIsMe(incidence->organizer()->email());
- Q_ASSERT(false);
- return false;
- }
-
if (incidence->attendees().isEmpty()) {
return false;
}
@@ -214,11 +199,11 @@
}
void ITIPHandlerHelper::sendIncidenceCreatedMessage(KCalCore::iTIPMethod method,
- const KCalCore::Incidence::Ptr &incidence)
+ const KCalCore::Incidence::Ptr &incidence, Akonadi::Recipient recipient)
{
/// When we created the incidence, we *must* be the organizer.
- if (!weAreOrganizerOf(incidence)) {
+ if (recipient == Akonadi::Attendees) {
kWarning() << "Creating incidence which has another organizer! Will skip sending invitations."
<< "; email= " << incidence->organizer()->email()
<< "; thatIsMe() = " << Akonadi::CalendarUtils::thatIsMe(incidence->organizer()->email());
@@ -259,10 +244,10 @@
emit sendIncidenceCreatedMessageFinished(status, method, incidence);
}
-bool ITIPHandlerHelper::handleIncidenceAboutToBeModified(const KCalCore::Incidence::Ptr &incidence)
+bool ITIPHandlerHelper::handleIncidenceAboutToBeModified(const KCalCore::Incidence::Ptr &incidence, Recipient recipient)
{
Q_ASSERT(incidence);
- if (!weAreOrganizerOf(incidence)) {
+ if (recipient == Akonadi::Attendees) {
switch (incidence->type()) {
case KCalCore::Incidence::TypeEvent:
{
@@ -292,9 +277,9 @@
void ITIPHandlerHelper::sendIncidenceModifiedMessage(KCalCore::iTIPMethod method,
const KCalCore::Incidence::Ptr &incidence,
- bool attendeeStatusChanged)
+ bool attendeeStatusChanged, Akonadi::Recipient recipient)
{
- if (!weAreOrganizerOf(incidence)) {
+ if (recipient == Akonadi::Attendees) {
if (incidence->type() == KCalCore::Incidence::TypeTodo) {
if (method == KCalCore::iTIPRequest) {
// This is an update to be sent to the organizer
@@ -308,7 +293,7 @@
connect(askDelegator, SIGNAL(dialogClosed(int,KCalCore::iTIPMethod,KCalCore::Incidence::Ptr)),
SLOT(slotIncidenceModifiedDialogClosed(int,KCalCore::iTIPMethod,KCalCore::Incidence::Ptr)));
// For a modified incidence, either we are the organizer or someone else.
- if (weAreOrganizerOf(incidence)) {
+ if (recipient == Akonadi::Organizer) {
if (weNeedToSendMailFor(incidence)) {
const QString question = i18n("You changed the invitation \"%1\".\n"
"Do you want to email the attendees an update message?",
@@ -355,7 +340,7 @@
}
void ITIPHandlerHelper::sendIncidenceDeletedMessage(KCalCore::iTIPMethod method,
- const KCalCore::Incidence::Ptr &incidence)
+ const KCalCore::Incidence::Ptr &incidence, Akonadi::Recipient recipient)
{
Q_ASSERT(incidence);
@@ -365,7 +350,7 @@
SLOT(slotIncidenceDeletedDialogClosed(int,KCalCore::iTIPMethod,KCalCore::Incidence::Ptr)));
// For a modified incidence, either we are the organizer or someone else.
- if (weAreOrganizerOf(incidence)) {
+ if (recipient == Akonadi::Organizer) {
if (weNeedToSendMailFor(incidence)) {
QString question;
if (incidence->type() == KCalCore::Incidence::TypeEvent) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 4, 2:50 PM (1 d, 2 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18830032
Default Alt Text
D49.1775314241.diff (9 KB)
Attached To
Mode
D49: Make decision as who we act only once.
Attached
Detach File
Event Timeline