FEATURE: Added support for secure SMTP connection (SSL)

FEATURE: Added support for SMTP authentication
This commit is contained in:
Christophe Dumez
2011-04-09 17:39:51 +00:00
parent 0a6f591cf5
commit 58bfa6f1bb
9 changed files with 599 additions and 173 deletions

View File

@@ -506,9 +506,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>-344</y>
<y>-387</y>
<width>499</width>
<height>728</height>
<height>849</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
@@ -853,26 +853,76 @@ QGroupBox {
<property name="checked">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_15">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Destination email:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="dest_email_txt"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>SMTP server:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="smtp_server_txt"/>
<layout class="QVBoxLayout" name="verticalLayout_21">
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Destination email:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="dest_email_txt"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>SMTP server:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="smtp_server_txt"/>
</item>
<item row="3" column="1">
<widget class="QGroupBox" name="groupMailNotifAuth">
<property name="title">
<string>Authentication</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Username:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="mailNotifUsername"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Password:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="mailNotifPassword">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="checkSmtpSSL">
<property name="text">
<string>This server requires a secure connection (SSL)</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
@@ -927,7 +977,7 @@ QGroupBox {
<rect>
<x>0</x>
<y>0</y>
<width>499</width>
<width>392</width>
<height>426</height>
</rect>
</property>
@@ -1407,8 +1457,8 @@ QGroupBox {
<rect>
<x>0</x>
<y>0</y>
<width>514</width>
<height>384</height>
<width>328</width>
<height>306</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_33">
@@ -1786,7 +1836,7 @@ QGroupBox {
<rect>
<x>0</x>
<y>0</y>
<width>499</width>
<width>486</width>
<height>408</height>
</rect>
</property>
@@ -2149,8 +2199,8 @@ QGroupBox {
<rect>
<x>0</x>
<y>0</y>
<width>514</width>
<height>384</height>
<width>316</width>
<height>236</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_23">
@@ -2298,8 +2348,8 @@ QGroupBox {
<rect>
<x>0</x>
<y>0</y>
<width>514</width>
<height>384</height>
<width>86</width>
<height>16</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_36"/>
@@ -2365,5 +2415,38 @@ QGroupBox {
<resources>
<include location="../icons.qrc"/>
</resources>
<connections/>
<connections>
<connection>
<sender>checkUploadLimit</sender>
<signal>toggled(bool)</signal>
<receiver>spinUploadLimit</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>367</x>
<y>61</y>
</hint>
<hint type="destinationlabel">
<x>448</x>
<y>62</y>
</hint>
</hints>
</connection>
<connection>
<sender>checkDownloadLimit</sender>
<signal>toggled(bool)</signal>
<receiver>spinDownloadLimit</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>377</x>
<y>81</y>
</hint>
<hint type="destinationlabel">
<x>430</x>
<y>87</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@@ -113,9 +113,6 @@ options_imp::options_imp(QWidget *parent):
// Connect signals / slots
// General tab
connect(checkShowSystray, SIGNAL(toggled(bool)), this, SLOT(setSystrayOptionsState(bool)));
// Connection tab
connect(checkUploadLimit, SIGNAL(toggled(bool)), this, SLOT(enableUploadLimit(bool)));
connect(checkDownloadLimit, SIGNAL(toggled(bool)), this, SLOT(enableDownloadLimit(bool)));
// Bittorrent tab
connect(checkMaxConnecs, SIGNAL(toggled(bool)), this, SLOT(enableMaxConnecsLimit(bool)));
connect(checkMaxConnecsPerTorrent, SIGNAL(toggled(bool)), this, SLOT(enableMaxConnecsLimitPerTorrent(bool)));
@@ -158,6 +155,10 @@ options_imp::options_imp(QWidget *parent):
connect(groupMailNotification, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(dest_email_txt, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
connect(smtp_server_txt, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
connect(checkSmtpSSL, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(groupMailNotifAuth, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(mailNotifUsername, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
connect(mailNotifPassword, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
connect(autoRunBox, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(autoRun_txt, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
// Connection tab
@@ -366,6 +367,10 @@ void options_imp::saveOptions(){
pref.setMailNotificationEnabled(groupMailNotification->isChecked());
pref.setMailNotificationEmail(dest_email_txt->text());
pref.setMailNotificationSMTP(smtp_server_txt->text());
pref.setMailNotificationSMTPSSL(checkSmtpSSL->isChecked());
pref.setMailNotificationSMTPAuth(groupMailNotifAuth->isChecked());
pref.setMailNotificationSMTPUsername(mailNotifUsername->text());
pref.setMailNotificationSMTPPassword(mailNotifPassword->text());
pref.setAutoRunEnabled(autoRunBox->isChecked());
pref.setAutoRunProgram(autoRun_txt->text());
pref.setActionOnDblClOnTorrentDl(getActionOnDblClOnTorrentDl());
@@ -522,6 +527,10 @@ void options_imp::loadOptions(){
groupMailNotification->setChecked(pref.isMailNotificationEnabled());
dest_email_txt->setText(pref.getMailNotificationEmail());
smtp_server_txt->setText(pref.getMailNotificationSMTP());
checkSmtpSSL->setChecked(pref.getMailNotificationSMTPSSL());
groupMailNotifAuth->setChecked(pref.getMailNotificationSMTPAuth());
mailNotifUsername->setText(pref.getMailNotificationSMTPUsername());
mailNotifPassword->setText(pref.getMailNotificationSMTPPassword());
autoRunBox->setChecked(pref.isAutoRunEnabled());
autoRun_txt->setText(pref.getAutoRunProgram());
intValue = pref.getActionOnDblClOnTorrentDl();
@@ -832,14 +841,6 @@ void options_imp::on_buttonBox_rejected(){
reject();
}
void options_imp::enableDownloadLimit(bool checked){
if(checked){
spinDownloadLimit->setEnabled(true);
}else{
spinDownloadLimit->setEnabled(false);
}
}
bool options_imp::useAdditionDialog() const{
return checkAdditionDialog->isChecked();
}
@@ -880,10 +881,6 @@ void options_imp::enableMaxUploadsLimitPerTorrent(bool checked){
}
}
void options_imp::enableUploadLimit(bool checked){
spinUploadLimit->setEnabled(checked);
}
void options_imp::enableApplyButton(){
applyButton->setEnabled(true);
}

View File

@@ -55,8 +55,6 @@ public:
QSize sizeFittingScreen();
protected slots:
void enableUploadLimit(bool checked);
void enableDownloadLimit(bool checked);
void enableProxy(int comboIndex);
void enableProxyAuth(bool checked);
void enableMaxConnecsLimit(bool checked);

View File

@@ -306,6 +306,38 @@ public:
setValue(QString::fromUtf8("Preferences/MailNotification/smtp_server"), smtp_server);
}
bool getMailNotificationSMTPSSL() const {
return value(QString::fromUtf8("Preferences/MailNotification/req_ssl"), false).toBool();
}
void setMailNotificationSMTPSSL(bool use) {
setValue(QString::fromUtf8("Preferences/MailNotification/req_ssl"), use);
}
bool getMailNotificationSMTPAuth() const {
return value(QString::fromUtf8("Preferences/MailNotification/req_auth"), false).toBool();
}
void setMailNotificationSMTPAuth(bool use) {
setValue(QString::fromUtf8("Preferences/MailNotification/req_auth"), use);
}
QString getMailNotificationSMTPUsername() const {
return value(QString::fromUtf8("Preferences/MailNotification/username")).toString();
}
void setMailNotificationSMTPUsername(const QString &username) {
setValue(QString::fromUtf8("Preferences/MailNotification/username"), username);
}
QString getMailNotificationSMTPPassword() const {
return value(QString::fromUtf8("Preferences/MailNotification/password")).toString();
}
void setMailNotificationSMTPPassword(const QString &password) {
setValue(QString::fromUtf8("Preferences/MailNotification/password"), password);
}
int getActionOnDblClOnTorrentDl() const {
return value(QString::fromUtf8("Preferences/Downloads/DblClOnTorDl"), 0).toInt();
}