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

hgemail: change some QLineEdit to QComboBox as preparation to save history

Changeset cd01adba0e9b

Parent f58911020814

by Yuya Nishihara

Changes to 2 files · Browse files at cd01adba0e9b Showing diff from parent f58911020814 Diff from another changeset...

 
84
85
86
87
 
88
89
 
90
91
 
92
93
94
 
122
123
124
125
126
127
 
 
 
128
129
 
130
131
132
 
156
157
158
159
160
161
 
 
 
162
163
164
165
 
 
166
167
168
 
179
180
181
182
183
 
 
184
 
185
186
187
 
84
85
86
 
87
88
 
89
90
 
91
92
93
94
 
122
123
124
 
 
 
125
126
127
128
 
129
130
131
132
 
156
157
158
 
 
 
159
160
161
162
 
 
 
163
164
165
166
167
 
178
179
180
 
 
181
182
183
184
185
186
187
@@ -84,11 +84,11 @@
  except error.Abort:   return ''   - self._qui.to_edit.setText( + self._qui.to_edit.setEditText(   hglib.tounicode(self._ui.config('email', 'to', ''))) - self._qui.cc_edit.setText( + self._qui.cc_edit.setEditText(   hglib.tounicode(self._ui.config('email', 'cc', ''))) - self._qui.from_edit.setText(hglib.tounicode(getfromaddr(self._ui))) + self._qui.from_edit.setEditText(hglib.tounicode(getfromaddr(self._ui)))     self.setdiffformat(self._ui.configbool('diff', 'git') and 'git' or 'hg')   @@ -122,11 +122,11 @@
    def _patchbombopts(self, **opts):   """Generate opts for patchbomb by form values""" - opts['to'] = [hglib.fromunicode(self._qui.to_edit.text())] - opts['cc'] = [hglib.fromunicode(self._qui.cc_edit.text())] - opts['from'] = hglib.fromunicode(self._qui.from_edit.text()) + opts['to'] = [hglib.fromunicode(self._qui.to_edit.currentText())] + opts['cc'] = [hglib.fromunicode(self._qui.cc_edit.currentText())] + opts['from'] = hglib.fromunicode(self._qui.from_edit.currentText())   opts['in_reply_to'] = hglib.fromunicode(self._qui.inreplyto_edit.text()) - opts['flag'] = [hglib.fromunicode(self._qui.flag_edit.text())] + opts['flag'] = [hglib.fromunicode(self._qui.flag_edit.currentText())]     def diffformat():   n = self.getdiffformat() @@ -156,13 +156,12 @@
    def _isvalid(self):   """Filled all required values?""" - req = ['to_edit', 'from_edit'] - if self._qui.writeintro_check.isChecked(): - req.append('subject_edit') + for e in ('to_edit', 'from_edit'): + if not getattr(self._qui, e).currentText(): + return False   - for e in req: - if not getattr(self._qui, e).text(): - return False + if self._qui.writeintro_check.isChecked() and not self._qui.subject_edit.text(): + return False     # TODO: is it nice if we can choose revisions to send?   if not self._purerevs: @@ -179,9 +178,10 @@
    def _connectvalidateform(self):   # TODO: connect programmatically - for e in ('to_edit', 'from_edit', 'subject_edit'): - getattr(self._qui, e).textChanged.connect(self._validateform) + for e in ('to_edit', 'from_edit'): + getattr(self._qui, e).editTextChanged.connect(self._validateform)   + self._qui.subject_edit.textChanged.connect(self._validateform)   self._qui.writeintro_check.toggled.connect(self._validateform)     def accept(self):
 
53
54
55
56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
58
59
 
66
67
68
69
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
71
72
 
79
80
81
82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
84
85
 
105
106
107
108
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
110
111
 
53
54
55
 
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
 
79
80
81
 
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
 
105
106
107
 
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
 
144
145
146
 
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
@@ -53,7 +53,20 @@
  </widget>   </item>   <item row="0" column="1"> - <widget class="QLineEdit" name="to_edit"/> + <widget class="QComboBox" name="to_edit"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="editable"> + <bool>true</bool> + </property> + <property name="insertPolicy"> + <enum>QComboBox::InsertAtTop</enum> + </property> + </widget>   </item>   <item row="1" column="0">   <widget class="QLabel" name="cc_label"> @@ -66,7 +79,20 @@
  </widget>   </item>   <item row="1" column="1"> - <widget class="QLineEdit" name="cc_edit"/> + <widget class="QComboBox" name="cc_edit"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="editable"> + <bool>true</bool> + </property> + <property name="insertPolicy"> + <enum>QComboBox::InsertAtTop</enum> + </property> + </widget>   </item>   <item row="2" column="0">   <widget class="QLabel" name="from_label"> @@ -79,7 +105,20 @@
  </widget>   </item>   <item row="2" column="1"> - <widget class="QLineEdit" name="from_edit"/> + <widget class="QComboBox" name="from_edit"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="editable"> + <bool>true</bool> + </property> + <property name="insertPolicy"> + <enum>QComboBox::InsertAtTop</enum> + </property> + </widget>   </item>   <item row="3" column="0">   <widget class="QLabel" name="inreplyto_label"> @@ -105,7 +144,20 @@
  </widget>   </item>   <item row="4" column="1"> - <widget class="QLineEdit" name="flag_edit"/> + <widget class="QComboBox" name="flag_edit"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="editable"> + <bool>true</bool> + </property> + <property name="insertPolicy"> + <enum>QComboBox::InsertAtTop</enum> + </property> + </widget>   </item>   </layout>   </widget>