Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9, 1.9.1, and 1.9.2

hgemail: keep history of user input

Changeset 4f774a908de1

Parent cd01adba0e9b

by Yuya Nishihara

Changes to one file · Browse files at 4f774a908de1 Showing diff from parent cd01adba0e9b Diff from another changeset...

 
41
42
43
 
44
45
46
 
72
73
74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
76
77
 
207
208
209
 
210
211
212
 
41
42
43
44
45
46
47
 
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
 
228
229
230
231
232
233
234
@@ -41,6 +41,7 @@
    self._initpreviewtab()   self._initintrobox() + self._readhistory()   self._filldefaults()   self._connectvalidateform()   self._validateform() @@ -72,6 +73,26 @@
  s.setValue('email/intor_changesets_splitter',   self._qui.intro_changesets_splitter.saveState())   + def _readhistory(self): + s = QSettings() + for k in ('to', 'cc', 'from', 'flag'): + w = getattr(self._qui, '%s_edit' % k) + w.addItems(s.value('email/%s_history' % k).toStringList()) + w.setCurrentIndex(-1) # unselect + + def _writehistory(self): + def itercombo(w): + if w.currentText(): + yield w.currentText() + for i in xrange(w.count()): + if w.itemText(i) != w.currentText(): + yield w.itemText(i) + + s = QSettings() + for k in ('to', 'cc', 'from', 'flag'): + w = getattr(self._qui, '%s_edit' % k) + s.setValue('email/%s_history' % k, list(itercombo(w))[:10]) +   def _filldefaults(self):   """Fill form by default values"""   def getfromaddr(ui): @@ -207,6 +228,7 @@
  cmd.setWindowTitle(_('Sending Email'))   cmd.show_output(False)   if cmd.exec_(): + self._writehistory()   super(EmailDialog, self).accept()   finally:   if 'desc' in opts: