UI/EmailDialog.py

branch
Py2 comp.
changeset 3058
0a02c433f52d
parent 3057
10516539f238
parent 3030
4a0a82ddd9d2
child 3060
5883ce99ee12
equal deleted inserted replaced
3057:10516539f238 3058:0a02c433f52d
118 Re-implemented to handle the user pressing the escape key. 118 Re-implemented to handle the user pressing the escape key.
119 119
120 @param ev key event (QKeyEvent) 120 @param ev key event (QKeyEvent)
121 """ 121 """
122 if ev.key() == Qt.Key_Escape: 122 if ev.key() == Qt.Key_Escape:
123 res = E5MessageBox.yesNo(self, 123 res = E5MessageBox.yesNo(
124 self,
124 self.trUtf8("Close dialog"), 125 self.trUtf8("Close dialog"),
125 self.trUtf8("""Do you really want to close the dialog?""")) 126 self.trUtf8("""Do you really want to close the dialog?"""))
126 if res: 127 if res:
127 self.reject() 128 self.reject()
128 129
137 138
138 def on_buttonBox_rejected(self): 139 def on_buttonBox_rejected(self):
139 """ 140 """
140 Private slot to handle the rejected signal of the button box. 141 Private slot to handle the rejected signal of the button box.
141 """ 142 """
142 res = E5MessageBox.yesNo(self, 143 res = E5MessageBox.yesNo(
144 self,
143 self.trUtf8("Close dialog"), 145 self.trUtf8("Close dialog"),
144 self.trUtf8("""Do you really want to close the dialog?""")) 146 self.trUtf8("""Do you really want to close the dialog?"""))
145 if res: 147 if res:
146 self.reject() 148 self.reject()
147 149
218 Private method to create a multipart mail message. 220 Private method to create a multipart mail message.
219 221
220 @return string containing the mail message 222 @return string containing the mail message
221 """ 223 """
222 mpPreamble = ("This is a MIME-encoded message with attachments. " 224 mpPreamble = ("This is a MIME-encoded message with attachments. "
223 "If you see this message, your mail client is not " 225 "If you see this message, your mail client is not "
224 "capable of displaying the attachments.") 226 "capable of displaying the attachments.")
225 227
226 msgtext = "{0}\r\n----\r\n{1}----\r\n{2}----\r\n{3}".format( 228 msgtext = "{0}\r\n----\r\n{1}----\r\n{2}----\r\n{3}".format(
227 self.message.toPlainText(), 229 self.message.toPlainText(),
228 Utilities.generateVersionInfo("\r\n"), 230 Utilities.generateVersionInfo("\r\n"),
229 Utilities.generatePluginsVersionInfo("\r\n"), 231 Utilities.generatePluginsVersionInfo("\r\n"),
301 errorStr = e.smtp_error.decode() 303 errorStr = e.smtp_error.decode()
302 elif isinstance(e, socket.error): 304 elif isinstance(e, socket.error):
303 errorStr = e[1] 305 errorStr = e[1]
304 else: 306 else:
305 errorStr = str(e) 307 errorStr = str(e)
306 res = E5MessageBox.retryAbort(self, 308 res = E5MessageBox.retryAbort(
309 self,
307 self.trUtf8("Send bug report"), 310 self.trUtf8("Send bug report"),
308 self.trUtf8( 311 self.trUtf8(
309 """<p>Authentication failed.<br>Reason: {0}</p>""") 312 """<p>Authentication failed.<br>Reason: {0}</p>""")
310 .format(errorStr), 313 .format(errorStr),
311 E5MessageBox.Critical) 314 E5MessageBox.Critical)
326 errorStr = e.smtp_error.decode() 329 errorStr = e.smtp_error.decode()
327 elif isinstance(e, socket.error): 330 elif isinstance(e, socket.error):
328 errorStr = e[1] 331 errorStr = e[1]
329 else: 332 else:
330 errorStr = str(e) 333 errorStr = str(e)
331 res = E5MessageBox.retryAbort(self, 334 res = E5MessageBox.retryAbort(
335 self,
332 self.trUtf8("Send bug report"), 336 self.trUtf8("Send bug report"),
333 self.trUtf8( 337 self.trUtf8(
334 """<p>Message could not be sent.<br>Reason: {0}</p>""") 338 """<p>Message could not be sent.<br>Reason: {0}</p>""")
335 .format(errorStr), 339 .format(errorStr),
336 E5MessageBox.Critical) 340 E5MessageBox.Critical)

eric ide

mercurial