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;