From 50b2ececb64a540c6c65b5a7e9a8eff4119e15ee Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 7 Nov 2006 19:34:30 +0000 Subject: [PATCH] Monotone-Parent: cd3467d9325955f5de25492e730817938dea9c3c Monotone-Revision: 76da8aec6316337cc5bf03ff7940ad6b6e408b2f Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2006-11-07T19:34:30 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 4 ++++ UI/Scheduler/UIxComponentEditor.m | 36 +++++++++++++++++++------------ 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 63cd87af1..d2e42d36e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,10 @@ * UI/Scheduler/UIxComponentEditor.m ([UIxComponentEditor -newStartDate]): new method to determine the start date depending on the URL parameters, the current day and the current time. + ([UIxComponentEditor -toolbar]): new method to determine the + filename of the toolbar that should be drawn depending on the + ownership and the list of attendees of the task/event wrt to the + current user... * UI/Scheduler/UIxTimeDateControl.m ([UIxTimeDateControl -setDayStartHour:aStartHour]): adjust the minutes to the next diff --git a/UI/Scheduler/UIxComponentEditor.m b/UI/Scheduler/UIxComponentEditor.m index d5f63f1b7..64cf62d76 100644 --- a/UI/Scheduler/UIxComponentEditor.m +++ b/UI/Scheduler/UIxComponentEditor.m @@ -811,26 +811,34 @@ - (NSString *) _toolbarForCalObject: (iCalEntityObject *) calObject { NSString *filename, *myEmail; + iCalPerson *person; + NSEnumerator *persons; iCalPersonPartStat myParticipationStatus; + BOOL found; myEmail = [[[self context] activeUser] email]; - if ([self canEditComponent]) + if ([[organizer rfc822Email] isEqualToString: myEmail]) filename = @"SOGoAppointmentObject.toolbar"; else { - if ([calObject isParticipant: myEmail]) - { - myParticipationStatus - = [[calObject findParticipantWithEmail: myEmail] participationStatus]; - if (myParticipationStatus == iCalPersonPartStatAccepted) - filename = @"SOGoAppointmentObjectDecline.toolbar"; - else if (myParticipationStatus == iCalPersonPartStatDeclined) - filename = @"SOGoAppointmentObjectAccept.toolbar"; - else - filename = @"SOGoAppointmentObjectAcceptOrDecline.toolbar"; - } - else - filename = @""; + filename = @""; + found = NO; + persons = [participants objectEnumerator]; + person = [persons nextObject]; + while (person && !found) + if ([[person rfc822Email] isEqualToString: myEmail]) + { + found = YES; + myParticipationStatus = [person participationStatus]; + if (myParticipationStatus == iCalPersonPartStatAccepted) + filename = @"SOGoAppointmentObjectDecline.toolbar"; + else if (myParticipationStatus == iCalPersonPartStatDeclined) + filename = @"SOGoAppointmentObjectAccept.toolbar"; + else + filename = @"SOGoAppointmentObjectAcceptOrDecline.toolbar"; + } + else + person = [persons nextObject]; } return filename;