All pastes #404165 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-03-20 21:03 UTC
rendered paste body
     def onTriageEvent(self, event):
+        # Hack for Philippe, disabled until I can talk w/Jeffrey about it...
+        autoTriageToo = False # wx.GetMouseState().AltDown()
+        if autoTriageToo and wx.MessageBox(
+            _(u"Are you sure you want to reset the triage status of everything in this collection?"),
+            _(u"Caution!"), wx.OK | wx.CANCEL | wx.ICON_HAND) != wx.OK:
+            return
+
         # triaging a recurring event can cause later keys to disappear from the
         # collection, which upsets iterkeys, so wrap the iterator in a list
         recurringEventsHandled = []
         modificationForAttr = pim.EventStamp.modificationFor.name
         for key in list(self.contents.iterkeys()):
-            if self.itsView.findValue(key, '_sectionTriageStatus',
-                                      default=None) is not None:
+            if autoTriageToo \
+               or self.itsView.findValue(key, '_sectionTriageStatus',
+                                         default=None) is not None:
                 item = self.itsView[key]
                 item.purgeSectionTriageStatus()
+                if autoTriageToo:
+                    if item.hasLocalAttributeValue('doAutoTriageOnDateChange'):
+                        del item.doAutoTriageOnDateChange
+                    item.setTriageStatus('auto')
+
             master = self.itsView.findValue(key, modificationForAttr,
                                             default=None)
             if master is not None and master not in recurringEventsHandled:
                 recurringEventsHandled.append(master)
-                pim.EventStamp(master).updateTriageStatus()
+                pim.EventStamp(master).updateTriageStatus(checkOccurrences=autoTriageToo)