def makeChange(self, item, change): event = EventStamp(item) changeType = change[1] if changeType == 'set': EventStamp(item).changeThis(change[2], change[3]) return change[2] elif changeType in ('addStamp', 'removeStamp'): event.changeThis() method = getattr(change[0], change[1]) return method(item, *change[2:]) elif changeType == 'add' and change[2] is schema.ns( "osaf.pim", item.itsView).trashCollection: event.deleteThis() elif changeType in ('add', 'append', 'remove'): attrName, newValue = _multiChange(item, change) EventStamp(item).changeThis(attrName, newValue) return attrName
def appendChange(self, desc, op, attr, *args): super(RecurrenceProxy, self).appendChange(desc, op, attr, *args) item = self.proxiedItem if (not stamping.has_stamp(item, EventStamp) or EventStamp(item).rruleset is None): super(RecurrenceProxy, self).makeChanges() elif self.changing is not None: self.makeChanges()
def markProxyEdited(self, proxy, attrs): if self.editedItems: for item in self.editedItems: if not reminders.isDead(item): with EventStamp(item).noRecurrenceChanges(): for attr in self.EDIT_ATTRIBUTES: if item.hasLocalAttributeValue(attr): delattr(item, attr) del self.editedItems super(CHANGE_ALL, self).markProxyEdited(proxy, attrs)
def makeChange(self, item, change): # easy for set, not too bad for stamp addition, del is maybe # tricky, and add/remove require duplicating reflists event = EventStamp(item) changeType = change[1] if changeType == 'set': attr = change[2] self._updateEdited(item for item in event.modifications if not item.hasModifiedAttribute(attr)) event.changeAll(attr, change[3]) return attr elif changeType == 'addStamp': self._updateEdited(item for item in event.modifications if not stamping.has_stamp(item, change[2])) event.addStampToAll(change[2].stamp_type) return stamping.Stamp.stamp_types.name elif changeType == 'removeStamp': self._updateEdited(item for item in event.modifications if stamping.has_stamp(item, change[2])) event.removeStampFromAll(change[2].stamp_type) return stamping.Stamp.stamp_types.name elif changeType in ('add', 'remove', 'append'): attr = change[0].descriptor.name self._updateEdited(item for item in event.modifications if not item.hasModifiedAttribute(attr)) masterItem = event.getMaster().itsItem attrName, newValue = _multiChange(masterItem, change) with EventStamp(masterItem).noRecurrenceChanges(): setattr(masterItem, attrName, newValue) return attrName elif (changeType == 'delete' and change[0].descriptor.name == EventStamp.rruleset.name): event.removeRecurrence() return EventStamp.rruleset.name else: assert False
def makeChange(self, item, change): event = EventStamp(item) changeType = change[1] # as above, for CHANGE_ALL if changeType == 'set': attr = change[2] event.changeThisAndFuture(attr, change[3]) self._updateEdited(item for item in event.modifications if not item.hasModifiedAttribute(attr)) return attr elif changeType == 'add' and change[2] is schema.ns( "osaf.pim", item.itsView).trashCollection: event.deleteThisAndFuture() elif changeType in ('addStamp', 'removeStamp', 'add', 'remove', 'append'): event.changeThisAndFuture() return super(CHANGE_FUTURE, self).makeChange(item, change) else: assert False