Commits

Yuya Nishihara committed 775687e

qdelete: remember last state of --keep option

"qdelete --keep" leaves garbage in patches directory, so I always switch
the checkbox off.

Comments (0)

Files changed (1)

tortoisehg/hgqt/qdelete.py

         self.layout().addWidget(lbl)
 
         self._keepchk = QCheckBox(_('Keep patch files'))
-        self._keepchk.setChecked(True)
         self.layout().addWidget(self._keepchk)
 
         BB = QDialogButtonBox
         bbox.accepted.connect(self.accept)
         bbox.rejected.connect(self.reject)
         self.layout().addWidget(bbox)
+        self._readSettings()
+
+    def _readSettings(self):
+        qs = QSettings()
+        qs.beginGroup('qdelete')
+        self._keepchk.setChecked(qs.value('keep', True).toBool())
+        qs.endGroup()
+
+    def _writeSettings(self):
+        qs = QSettings()
+        qs.beginGroup('qdelete')
+        qs.setValue('keep', self._keepchk.isChecked())
+        qs.endGroup()
+
+    def accept(self):
+        self._writeSettings()
+        super(QDeleteDialog, self).accept()
 
     def options(self):
         return {'keep': self._keepchk.isChecked()}