Commits

Steve Borho  committed a90731f

visdiff: add CTRL+D shortcut for row activation

  • Participants
  • Parent commits d3cf952
  • Branches stable

Comments (0)

Files changed (1)

File tortoisehg/hgqt/visdiff.py

         QDialog.__init__(self)
         self.curFile = None
 
-        # TODO: Connect CTRL-D to row activation
         self.setWindowIcon(qtlib.geticon('visualdiff'))
 
         if ctx2.rev() is None:
         self.updateDiffButtons(preferred)
 
         callable = lambda: self.fillmodel(repo, sa, sb)
+        QShortcut(QKeySequence('CTRL+D'), self.list, self.activateCurrent)
         QTimer.singleShot(0, callable)
 
     def fillmodel(self, repo, sa, sb):
             if name == selected:
                 combo.setCurrentIndex(i)
 
+    def activateCurrent(self):
+        'CTRL+D has been pressed'
+        row = self.list.currentRow()
+        if row >= 0:
+            self.launch(self.list.item(row).text()[2:])
+
     def itemActivated(self, item):
         'A QListWidgetItem has been activated'
         self.launch(item.text()[2:])