Commits

Angel Ezquerra committed e882f63

filelistview: Add handler for subrepository double click

When double clicking on a subrepository item, the corresponding item will be
open, or a warning message will be shown if the subrepository is not found in
the working directory.

  • Participants
  • Parent commits 8e16e0f
  • Branches stable

Comments (0)

Files changed (1)

tortoisehg/hgqt/filelistview.py

 
         self.createActions()
 
-        self.doubleClicked.connect(self.vdiff)
+        self.doubleClicked.connect(self.doubleClickHandler)
         self._diff_dialogs = {}
         self._nav_dialogs = {}
 
             dlg.raise_()
             dlg.activateWindow()
 
+    def opensubrepo(self):
+        path = os.path.join(self.model().repo.root, self.currentFile())
+        if os.path.isdir(path):
+            self.linkActivated.emit(u'subrepo:'+hglib.tounicode(path))
+        else:
+            QMessageBox.warning(self,
+                _("Cannot open subrepository"),
+                _("The selected subrepository does not exist on the working directory"))
+    
+    def doubleClickHandler(self):
+        itemissubrepo = (self.model().dataFromIndex(self.currentIndex())['status'] == 'S')
+        if itemissubrepo:
+            self.opensubrepo()
+        else:
+            self.vdiff()
+        
     def createActions(self):
         self.actionShowAllMerge = QAction(_('Show All'), self)
         self.actionShowAllMerge.setToolTip(
             self._actions[name] = act
             self.addAction(act)
     
-    def opensubrepo(self):
-        path = os.path.join(self.model().repo.root, self.currentFile())
-        if os.path.isdir(path):
-            self.linkActivated.emit(u'subrepo:'+hglib.tounicode(path))
-        else:
-            QMessageBox.warning(self,
-                _("Cannot open subrepository"),
-                _("The selected subrepository does not exist on the working directory"))
-        
     def contextMenuEvent(self, event):
         itemissubrepo = (self.model().dataFromIndex(self.currentIndex())['status'] == 'S')