Commits

Yuya Nishihara committed bb2f9dd Merge

Merge with stable

  • Participants
  • Parent commits bb48548, 65c71e1

Comments (0)

Files changed (3)

File tortoisehg/hgqt/archive.py

         else:
             caption = _('Select Destination File')
             ext = '*' + select['ext']
-            filter = '%s (%s)\nAll Files (*.*)' % (select['label'], ext)
-        response = FD.getSaveFileName(parent=self, caption=caption,
-                directory=dest, filter=filter, options=FD.ReadOnly)
+            filter = ';;'.join(['%s (%s)' % (select['label'], ext),
+                                _('All files (*)')])
+        response = FD.getSaveFileName(self, caption, dest, filter, None,
+                                      FD.ReadOnly)
         if response:
             self.dest_edit.setText(response)
             self.update_path()

File tortoisehg/hgqt/sync.py

 
     def unbundle(self):
         caption = _("Select bundle file")
-        _FILE_FILTER = "%s" % _("Bundle files (*.hg)")
-        bundlefile = QFileDialog.getOpenFileName(parent=self, caption=caption,
-                                    directory=self.repo.root,
-                                    filter=_FILE_FILTER)
+        _FILE_FILTER = ';;'.join([_("Bundle files (*.hg)"),
+                                  _("All files (*)")])
+        bundlefile = QFileDialog.getOpenFileName(
+            self, caption, hglib.tounicode(self.repo.root), _FILE_FILTER)
         if bundlefile:
             # Set the pull source to the selected bundle file
             self.urlentry.setText(bundlefile)

File tortoisehg/hgqt/thgimport.py

         statbox.addWidget(self.status)
         self.targetcombo = QComboBox()
         self.targetcombo.currentIndexChanged.connect(self.updatestatus)
-        self.targetcombo.addItem(_('Repository'))
-        self.targetcombo.addItem(_('Shelf'))
-        self.targetcombo.addItem(_('Working Directory'))
+        self.targetcombo.addItem(_('Repository'), ('import',))
+        self.targetcombo.addItem(_('Shelf'), ('copy',))
+        self.targetcombo.addItem(_('Working Directory'),
+                                 ('import', '--no-commit'))
         cur = self.repo.getcurrentqqueue()
         if cur:
-            self.targetcombo.addItem(hglib.tounicode(cur))
+            self.targetcombo.addItem(hglib.tounicode(cur), ('qimport',))
+        self.targetcombo.currentIndexChanged.connect(self._updatep0chk)
         statbox.addWidget(self.targetcombo)
         grid.addItem(statbox, 3, 1)
 
         self.cancel_btn.setHidden(True)
         self.detail_btn.setHidden(True)
         self.p0chk.setHidden(False)
+        self._updatep0chk()
         self.preview()
 
     ### Private Methods ###
         else:
             self.src_combo.setEditText(filename)
 
+    def _targetcommand(self):
+        index = self.targetcombo.currentIndex()
+        return self.targetcombo.itemData(index).toPyObject()
+
+    @pyqtSlot()
+    def _updatep0chk(self):
+        cmd = self._targetcommand()[0]
+        self.p0chk.setEnabled(cmd == 'import')
+        if not self.p0chk.isEnabled():
+            self.p0chk.setChecked(False)
+
     def updatestatus(self):
         items = self.cslist.curitems
         count = items and len(items) or 0