4 # |
4 # |
5 |
5 |
6 """ |
6 """ |
7 Module implementing a dialog to send bug reports or feature requests. |
7 Module implementing a dialog to send bug reports or feature requests. |
8 """ |
8 """ |
9 |
|
10 |
9 |
11 import os |
10 import os |
12 import mimetypes |
11 import mimetypes |
13 import smtplib |
12 import smtplib |
14 import socket |
13 import socket |
15 |
14 |
16 from PyQt5.QtCore import Qt, pyqtSlot |
15 from PyQt5.QtCore import Qt, pyqtSlot |
17 from PyQt5.QtGui import QCursor, QTextOption |
16 from PyQt5.QtGui import QTextOption |
18 from PyQt5.QtWidgets import ( |
17 from PyQt5.QtWidgets import ( |
19 QHeaderView, QLineEdit, QDialog, QInputDialog, QApplication, |
18 QHeaderView, QLineEdit, QDialog, QInputDialog, QDialogButtonBox, |
20 QDialogButtonBox, QTreeWidgetItem |
19 QTreeWidgetItem |
21 ) |
20 ) |
22 |
21 |
23 from E5Gui import E5MessageBox, E5FileDialog |
22 from E5Gui import E5MessageBox, E5FileDialog |
|
23 from E5Gui.E5OverrideCursor import E5OverrideCursor |
24 |
24 |
25 from .Ui_EmailDialog import Ui_EmailDialog |
25 from .Ui_EmailDialog import Ui_EmailDialog |
26 |
26 |
27 from .Info import BugAddress, FeatureAddress |
27 from .Info import BugAddress, FeatureAddress |
28 import Preferences |
28 import Preferences |
348 if res: |
348 if res: |
349 return self.__sendmail(msg) |
349 return self.__sendmail(msg) |
350 else: |
350 else: |
351 return False |
351 return False |
352 |
352 |
353 QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) |
353 with E5OverrideCursor(): |
354 QApplication.processEvents() |
354 server.sendmail(Preferences.getUser("Email"), self.__toAddress, |
355 server.sendmail(Preferences.getUser("Email"), self.__toAddress, |
355 msg) |
356 msg) |
356 server.quit() |
357 server.quit() |
|
358 QApplication.restoreOverrideCursor() |
|
359 except (smtplib.SMTPException, socket.error) as e: |
357 except (smtplib.SMTPException, socket.error) as e: |
360 QApplication.restoreOverrideCursor() |
|
361 if isinstance(e, smtplib.SMTPResponseException): |
358 if isinstance(e, smtplib.SMTPResponseException): |
362 errorStr = e.smtp_error.decode() |
359 errorStr = e.smtp_error.decode() |
363 elif isinstance(e, smtplib.SMTPException): |
360 elif isinstance(e, smtplib.SMTPException): |
364 errorStr = str(e) |
361 errorStr = str(e) |
365 elif isinstance(e, socket.error): |
362 elif isinstance(e, socket.error): |