Commits

Yuya Nishihara committed 4b11f79

mqdock: update qdelete action by applied state of model

Because PatchQueueModel manages applied state of each patch, MQPatchesWidget
should use it for consistency.

Comments (0)

Files changed (1)

tortoisehg/hgqt/mq.py

             return []
         return map(hglib.tounicode, self._seriesguards[index.row()])
 
+    def isApplied(self, index):
+        if not index.isValid():
+            return False
+        patch = self._series[index.row()]
+        return self._statusmap.get(patch) == 'applied'
+
     def _statusIcon(self, index):
         assert index.isValid()
         patch = self._series[index.row()]
         index = self.queueListWidget.currentIndex()
         if index.isValid():
             model = self.queueListWidget.model()
-            patch = hglib.fromunicode(model.patchName(index))
-            applied = set([p.name for p in self.repo.mq.applied])
-            self.qdeleteAct.setEnabled(patch not in applied)
+            self.qdeleteAct.setEnabled(not model.isApplied(index))
             self.setGuardsAct.setEnabled(True)
             self.qrenameAct.setEnabled(True)
         else: