|
| 1 | +/** |
| 2 | + * This file is part of GPGFrontend. |
| 3 | + * |
| 4 | + * GPGFrontend is free software: you can redistribute it and/or modify |
| 5 | + * it under the terms of the GNU General Public License as published by |
| 6 | + * the Free Software Foundation, either version 3 of the License, or |
| 7 | + * (at your option) any later version. |
| 8 | + * |
| 9 | + * Foobar is distributed in the hope that it will be useful, |
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | + * GNU General Public License for more details. |
| 13 | + * |
| 14 | + * You should have received a copy of the GNU General Public License |
| 15 | + * along with Foobar. If not, see <https://www.gnu.org/licenses/>. |
| 16 | + * |
| 17 | + * The initial version of the source code is inherited from gpg4usb-team. |
| 18 | + * Their source code version also complies with GNU General Public License. |
| 19 | + * |
| 20 | + * The source code version of this software was modified and released |
| 21 | + * by Saturneric<[email protected]> starting on May 12, 2021. |
| 22 | + * |
| 23 | + */ |
| 24 | + |
| 25 | +#ifndef GPGFRONTEND_SENDMAILDIALOG_H |
| 26 | +#define GPGFRONTEND_SENDMAILDIALOG_H |
| 27 | + |
| 28 | +#include "GpgFrontend.h" |
| 29 | + |
| 30 | +class SendMailDialog : public QDialog { |
| 31 | +Q_OBJECT |
| 32 | +public: |
| 33 | + explicit SendMailDialog(QString text, QWidget *parent = nullptr); |
| 34 | + |
| 35 | +private slots: |
| 36 | + |
| 37 | + void slotConfirm(); |
| 38 | + |
| 39 | +private: |
| 40 | + |
| 41 | + QString appPath; |
| 42 | + QSettings settings; |
| 43 | + |
| 44 | + QLineEdit *senderEdit; |
| 45 | + QTextEdit *recipientEdit; |
| 46 | + QLineEdit *subjectEdit; |
| 47 | + QPushButton *confirmButton; |
| 48 | + |
| 49 | + QLabel *errorLabel; |
| 50 | + QString mText; |
| 51 | + |
| 52 | + QString smtpAddress = settings.value("sendMail/smtpAddress", QString()).toString(); |
| 53 | + QString username = settings.value("sendMail/username", QString()).toString(); |
| 54 | + QString password = settings.value("sendMail/password", QString()).toString(); |
| 55 | + QString defaultSender = settings.value("sendMail/defaultSender", QString()).toString(); |
| 56 | + QString connectionTypeSettings = settings.value("sendMail/connectionType", QString()).toString(); |
| 57 | + int port = settings.value("sendMail/port", QString()).toInt(); |
| 58 | + |
| 59 | + QRegularExpression re_email{ |
| 60 | + R"((?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\]))"}; |
| 61 | + |
| 62 | + bool check_email_address(const QString &str); |
| 63 | +}; |
| 64 | + |
| 65 | + |
| 66 | +#endif //GPGFRONTEND_SENDMAILDIALOG_H |
0 commit comments