52 @param mode mode of this dialog (string, "bug" or "feature") |
52 @param mode mode of this dialog (string, "bug" or "feature") |
53 @param parent parent widget of this dialog (QWidget) |
53 @param parent parent widget of this dialog (QWidget) |
54 """ |
54 """ |
55 super(EmailDialog, self).__init__(parent) |
55 super(EmailDialog, self).__init__(parent) |
56 self.setupUi(self) |
56 self.setupUi(self) |
57 self.setWindowFlags(Qt.Window) |
57 self.setWindowFlags(Qt.WindowType.Window) |
58 |
58 |
59 self.message.setWordWrapMode(QTextOption.WordWrap) |
59 self.message.setWordWrapMode(QTextOption.WrapMode.WordWrap) |
60 |
60 |
61 self.__mode = mode |
61 self.__mode = mode |
62 if self.__mode == "feature": |
62 if self.__mode == "feature": |
63 self.setWindowTitle(self.tr("Send feature request")) |
63 self.setWindowTitle(self.tr("Send feature request")) |
64 self.msgLabel.setText(self.tr( |
64 self.msgLabel.setText(self.tr( |
71 "Enter your &bug description below." |
71 "Enter your &bug description below." |
72 " Version information is added automatically.")) |
72 " Version information is added automatically.")) |
73 self.__toAddress = BugAddress |
73 self.__toAddress = BugAddress |
74 |
74 |
75 self.sendButton = self.buttonBox.addButton( |
75 self.sendButton = self.buttonBox.addButton( |
76 self.tr("Send"), QDialogButtonBox.ActionRole) |
76 self.tr("Send"), QDialogButtonBox.ButtonRole.ActionRole) |
77 self.sendButton.setEnabled(False) |
77 self.sendButton.setEnabled(False) |
78 self.sendButton.setDefault(True) |
78 self.sendButton.setDefault(True) |
79 |
79 |
80 self.googleHelpButton = self.buttonBox.addButton( |
80 self.googleHelpButton = self.buttonBox.addButton( |
81 self.tr("Google Mail API Help"), QDialogButtonBox.HelpRole) |
81 self.tr("Google Mail API Help"), |
|
82 QDialogButtonBox.ButtonRole.HelpRole) |
82 |
83 |
83 height = self.height() |
84 height = self.height() |
84 self.mainSplitter.setSizes([int(0.7 * height), int(0.3 * height)]) |
85 self.mainSplitter.setSizes([int(0.7 * height), int(0.3 * height)]) |
85 |
86 |
86 self.attachments.headerItem().setText( |
87 self.attachments.headerItem().setText( |
87 self.attachments.columnCount(), "") |
88 self.attachments.columnCount(), "") |
88 self.attachments.header().setSectionResizeMode( |
89 self.attachments.header().setSectionResizeMode( |
89 QHeaderView.Interactive) |
90 QHeaderView.ResizeMode.Interactive) |
90 |
91 |
91 sig = Preferences.getUser("Signature") |
92 sig = Preferences.getUser("Signature") |
92 if sig: |
93 if sig: |
93 self.message.setPlainText(sig) |
94 self.message.setPlainText(sig) |
94 cursor = self.message.textCursor() |
95 cursor = self.message.textCursor() |
105 """ |
106 """ |
106 Protected method to handle the user pressing the escape key. |
107 Protected method to handle the user pressing the escape key. |
107 |
108 |
108 @param ev key event (QKeyEvent) |
109 @param ev key event (QKeyEvent) |
109 """ |
110 """ |
110 if ev.key() == Qt.Key_Escape: |
111 if ev.key() == Qt.Key.Key_Escape: |
111 res = E5MessageBox.yesNo( |
112 res = E5MessageBox.yesNo( |
112 self, |
113 self, |
113 self.tr("Close dialog"), |
114 self.tr("Close dialog"), |
114 self.tr("""Do you really want to close the dialog?""")) |
115 self.tr("""Do you really want to close the dialog?""")) |
115 if res: |
116 if res: |
320 if not password: |
321 if not password: |
321 password, ok = QInputDialog.getText( |
322 password, ok = QInputDialog.getText( |
322 self, |
323 self, |
323 self.tr("Mail Server Password"), |
324 self.tr("Mail Server Password"), |
324 self.tr("Enter your mail server password"), |
325 self.tr("Enter your mail server password"), |
325 QLineEdit.Password) |
326 QLineEdit.EchoMode.Password) |
326 if not ok: |
327 if not ok: |
327 # abort |
328 # abort |
328 return False |
329 return False |
329 try: |
330 try: |
330 server.login(Preferences.getUser("MailServerUser"), |
331 server.login(Preferences.getUser("MailServerUser"), |
436 """ |
437 """ |
437 mimeType = mimetypes.guess_type(fname)[0] |
438 mimeType = mimetypes.guess_type(fname)[0] |
438 if not mimeType: |
439 if not mimeType: |
439 mimeType = "application/octet-stream" |
440 mimeType = "application/octet-stream" |
440 QTreeWidgetItem(self.attachments, [fname, mimeType]) |
441 QTreeWidgetItem(self.attachments, [fname, mimeType]) |
441 self.attachments.header().resizeSections(QHeaderView.ResizeToContents) |
442 self.attachments.header().resizeSections( |
|
443 QHeaderView.ResizeMode.ResizeToContents) |
442 self.attachments.header().setStretchLastSection(True) |
444 self.attachments.header().setStretchLastSection(True) |
443 |
445 |
444 if deleteFile: |
446 if deleteFile: |
445 self.__deleteFiles.append(fname) |
447 self.__deleteFiles.append(fname) |
446 |
448 |