Commits

Yuya Nishihara committed 672ea98

sync: restore current row after reload

reload() will recreate the paths model, so the current row is reset to -1.

With this change, reload() will also updates the urlentry, so editurl()
does not need to call setEditUrl().

  • Participants
  • Parent commits 6c4a26f

Comments (0)

Files changed (1)

File tortoisehg/hgqt/sync.py

         cmd.setVisible(False)
         self.cmd = cmd
 
+        self.curalias = None
         self.reload()
-        self.curalias = None
         if 'default' in self.paths:
             self.setUrl('default')
         else:
         sm = self.reltv.selectionModel()
         sm.currentRowChanged.connect(self.pathSelected)
 
+        # restore the current alias and its url
+        if self.curalias in self.paths:
+            self.setUrl(hglib.tounicode(self.curalias))
+
     def currentUrl(self):
         return unicode(self.urlentry.text())
 
         dlg.setWindowModality(Qt.WindowModal)
         if dlg.exec_() == QDialog.Accepted:
             self.curalias = hglib.fromunicode(dlg.aliasentry.text())
-            self.setEditUrl(dlg.urlentry.text())
             self.reload()
 
     def removeurl(self):