Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F118216406
D50.1775690143.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
5 KB
Referenced Files
None
Subscribers
None
D50.1775690143.diff
View Options
Index: akonadi/calendar/incidencechanger.cpp
===================================================================
--- akonadi/calendar/incidencechanger.cpp
+++ akonadi/calendar/incidencechanger.cpp
@@ -63,10 +63,34 @@
}
}
-bool weAreOrganizer(Incidence::Ptr incidence)
+QString actAs(Incidence::Ptr incidence, Change::Ptr change)
+{
+ if (!change->actAs.isEmpty()) {
+ return change->actAs;
+ }
+
+ QStringList mes;
+ const QString email = incidence->organizer()->email();
+ const Attendee::List &attendees = incidence->attendees();
+ if (Akonadi::CalendarUtils::thatIsMe(email)) {
+ mes.append(email);
+ }
+ for (int i = 0; i < attendees.size(); i++) {
+ if (Akonadi::CalendarUtils::thatIsMe(attendees[i])) {
+ mes.append(attendees[i]->email());
+ }
+ }
+ //TODO: ask user as what person he wanna act.
+ change->actAs = mes.first();
+ return change->actAs;
+}
+
+bool weAreOrganizer(Incidence::Ptr incidence, Change::Ptr change)
{
const QString email = incidence->organizer()->email();
- return Akonadi::CalendarUtils::thatIsMe(email);
+ const QString me = actAs(incidence, change);
+
+ return me == email;
}
bool allowedModificationsWithoutRevisionUpdate(Incidence::Ptr incidence)
@@ -136,7 +160,7 @@
return list;
}
-void resetAttendeeStatus(Incidence::Ptr incidence)
+void resetAttendeeStatus(Incidence::Ptr incidence, Change::Ptr change)
{
//Reset attendee status, when resceduling
QSet<IncidenceBase::Field> resetPartStatus;
@@ -147,7 +171,7 @@
<< IncidenceBase::FieldDtDue
<< IncidenceBase::FieldDuration
<< IncidenceBase::FieldRecurrence;
- if (!(incidence->dirtyFields() & resetPartStatus).isEmpty() && weAreOrganizer(incidence)) {
+ if (!(incidence->dirtyFields() & resetPartStatus).isEmpty() && weAreOrganizer(incidence, change)) {
foreach (const Attendee::Ptr &attendee, incidence->attendees()) {
if ( attendee->role() != Attendee::NonParticipant &&
attendee->status() != Attendee::Delegated && !Akonadi::CalendarUtils::thatIsMe(attendee)) {
@@ -618,7 +642,7 @@
}
// We only send CANCEL if we're the organizer.
// If we're not, then we send REPLY with PartStat=Declined in handleInvitationsAfterChange()
- if (weAreOrganizer(incidence)) {
+ if (weAreOrganizer(incidence, change)) {
//TODO: not to popup all delete message dialogs at once :(
sendOk = false;
handler->sendIncidenceDeletedMessage(KCalCore::iTIPCancel, incidence, Akonadi::Attendees);
@@ -658,7 +682,7 @@
return;
}
- if (RUNNING_UNIT_TESTS && !weAreOrganizer(newIncidence)) {
+ if (RUNNING_UNIT_TESTS && !weAreOrganizer(newIncidence, change)) {
// This is a bit of a workaround when running tests. I don't want to show the
// "You're not organizer, do you want to modify event?" dialog in unit-tests, but want
// to emulate a "yes" and a "no" press.
@@ -672,7 +696,7 @@
}
ITIPHandlerHelper handler(mFactory, change->parentWidget);
- const bool modify = handler.handleIncidenceAboutToBeModified(newIncidence, weAreOrganizer(newIncidence) ? Akonadi::Attendees : Akonadi::Organizer);
+ const bool modify = handler.handleIncidenceAboutToBeModified(newIncidence, weAreOrganizer(newIncidence, change) ? Akonadi::Attendees : Akonadi::Organizer);
if (modify) {
break;
} else {
@@ -736,7 +760,7 @@
if (!incidence->supportsGroupwareCommunication())
continue;
- if (!weAreOrganizer(incidence)) {
+ if (!weAreOrganizer(incidence, change)) {
const QStringList myEmails = Akonadi::CalendarUtils::allEmails();
bool notifyOrganizer = false;
KCalCore::Attendee::Ptr me(incidence->attendeeByMails(myEmails));
@@ -785,7 +809,7 @@
oldIncidence,
Akonadi::CalendarUtils::allEmails());
if (attendeeStatusChanged) {
- if (!weAreOrganizer(newIncidence)) {
+ if (!weAreOrganizer(newIncidence, change)) {
KCalCore::Incidence::Ptr clone(newIncidence->clone());
clone->clearAttendees();
@@ -803,7 +827,7 @@
}
} else {
kDebug() << "Attendeestatus " << attendeeStatusChanged;
- handler->sendIncidenceModifiedMessage(KCalCore::iTIPRequest, newIncidence, false, weAreOrganizer(newIncidence)? Akonadi::Attendees: Akonadi::Organizer);
+ handler->sendIncidenceModifiedMessage(KCalCore::iTIPRequest, newIncidence, false, weAreOrganizer(newIncidence, change)? Akonadi::Attendees: Akonadi::Organizer);
}
return;
@@ -888,7 +912,7 @@
return changeId;
}
if (incidence->recurrenceId().isValid()) {
- resetAttendeeStatus(incidence);
+ resetAttendeeStatus(incidence, change);
}
Item item;
@@ -1158,7 +1182,7 @@
incidence->setRevision(revision + 1);
}
- resetAttendeeStatus(incidence);
+ resetAttendeeStatus(incidence, change);
}
// Dav Fix
Index: akonadi/calendar/incidencechanger_p.h
===================================================================
--- akonadi/calendar/incidencechanger_p.h
+++ akonadi/calendar/incidencechanger_p.h
@@ -93,6 +93,7 @@
Akonadi::Item newItem;
QString errorString;
+ QString actAs;
IncidenceChanger::ResultCode resultCode;
bool completed;
bool queuedModification;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Apr 8, 11:15 PM (10 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18828662
Default Alt Text
D50.1775690143.diff (5 KB)
Attached To
Mode
D50: save and reuse the decision of thatIsMe.
Attached
Detach File
Event Timeline