[kde-doc-english] [trojita] src/Gui: GUI: add a visual warning for invalid IMAP ports in the settings dialog
Jan Kundrát
jkt at flaska.net
Wed Mar 13 23:53:14 UTC 2013
Git commit 08ab9169e6b0e9f6b134c21eb28673e359f4c9d9 by Jan Kundrát.
Committed on 14/03/2013 at 00:49.
Pushed by jkt into branch 'master'.
GUI: add a visual warning for invalid IMAP ports in the settings dialog
M +18 -0 src/Gui/SettingsDialog.cpp
M +1 -0 src/Gui/SettingsDialog.h
M +25 -15 src/Gui/SettingsImapPage.ui
http://commits.kde.org/trojita/08ab9169e6b0e9f6b134c21eb28673e359f4c9d9
diff --git a/src/Gui/SettingsDialog.cpp b/src/Gui/SettingsDialog.cpp
index 385388b..7dfa82f 100644
--- a/src/Gui/SettingsDialog.cpp
+++ b/src/Gui/SettingsDialog.cpp
@@ -293,6 +293,9 @@ ImapPage::ImapPage(QWidget *parent, QSettings &s): QScrollArea(parent), Ui_ImapP
imapHost->setText(s.value(SettingsNames::imapHostKey).toString());
imapPort->setText(s.value(SettingsNames::imapPortKey, QString::number(Common::PORT_IMAP)).toString());
imapPort->setValidator(new QIntValidator(1, 65535, this));
+ connect(imapPort, SIGNAL(textChanged(QString)), this, SLOT(maybeShowPortWarning()));
+ connect(method, SIGNAL(currentIndexChanged(int)), this, SLOT(maybeShowPortWarning()));
+ portWarning->setStyleSheet(SettingsDialog::warningStyleSheet);
passwordWarning->setStyleSheet(SettingsDialog::warningStyleSheet);
connect(imapPass, SIGNAL(textChanged(QString)), this, SLOT(maybeShowPasswordWarning()));
startTls->setChecked(s.value(SettingsNames::imapStartTlsKey, true).toBool());
@@ -398,6 +401,21 @@ void ImapPage::maybeShowPasswordWarning()
passwordWarning->setVisible(!imapPass->text().isEmpty());
}
+void ImapPage::maybeShowPortWarning()
+{
+ switch (method->currentIndex()) {
+ case TCP:
+ portWarning->setVisible(imapPort->text() != QLatin1String("143"));
+ break;
+ case SSL:
+ portWarning->setVisible(imapPort->text() != QLatin1String("993"));
+ break;
+ default:
+ portWarning->setVisible(false);
+ }
+}
+
+
CachePage::CachePage(QWidget *parent, QSettings &s): QScrollArea(parent), Ui_CachePage()
{
Ui_CachePage::setupUi(this);
diff --git a/src/Gui/SettingsDialog.h b/src/Gui/SettingsDialog.h
index 283f2f9..b94f145 100644
--- a/src/Gui/SettingsDialog.h
+++ b/src/Gui/SettingsDialog.h
@@ -131,6 +131,7 @@ private:
private slots:
void updateWidgets();
void maybeShowPasswordWarning();
+ void maybeShowPortWarning();
private:
ImapPage(const ImapPage &); // don't implement
diff --git a/src/Gui/SettingsImapPage.ui b/src/Gui/SettingsImapPage.ui
index f8243c1..b56437f 100644
--- a/src/Gui/SettingsImapPage.ui
+++ b/src/Gui/SettingsImapPage.ui
@@ -61,7 +61,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
- <item row="3" column="0">
+ <item row="4" column="0">
<widget class="QLabel" name="startTlsLabel">
<property name="text">
<string>Perform S&TARTTLS</string>
@@ -71,7 +71,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
- <item row="4" column="0">
+ <item row="5" column="0">
<widget class="QLabel" name="imapUserLabel">
<property name="text">
<string>&Username</string>
@@ -81,7 +81,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
- <item row="5" column="0">
+ <item row="6" column="0">
<widget class="QLabel" name="imapPassLabel">
<property name="text">
<string>Pass&word</string>
@@ -91,7 +91,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
- <item row="7" column="0">
+ <item row="8" column="0">
<widget class="QLabel" name="processPathLabel">
<property name="text">
<string>Path to Server &Binary</string>
@@ -101,7 +101,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
- <item row="8" column="0">
+ <item row="9" column="0">
<widget class="QLabel" name="startOfflineLabel">
<property name="text">
<string>Start in O&ffline Mode</string>
@@ -134,7 +134,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
- <item row="3" column="1">
+ <item row="4" column="1">
<widget class="QCheckBox" name="startTls">
<property name="toolTip">
<string>Transparently upgrade the plaintext connection to an encrypted one</string>
@@ -153,7 +153,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
- <item row="4" column="1">
+ <item row="5" column="1">
<widget class="QLineEdit" name="imapUser">
<property name="toolTip">
<string>IMAP Username</string>
@@ -166,7 +166,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
- <item row="5" column="1">
+ <item row="6" column="1">
<widget class="QLineEdit" name="imapPass">
<property name="toolTip">
<string>IMAP Password</string>
@@ -190,7 +190,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
- <item row="7" column="1">
+ <item row="8" column="1">
<widget class="QLineEdit" name="processPath">
<property name="whatsThis">
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
@@ -206,7 +206,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
- <item row="8" column="1">
+ <item row="9" column="1">
<widget class="QCheckBox" name="startOffline">
<property name="toolTip">
<string>Don't connect to the IMAP server upon startup</string>
@@ -219,7 +219,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
- <item row="6" column="0" colspan="2">
+ <item row="7" column="0" colspan="2">
<widget class="QLabel" name="passwordWarning">
<property name="text">
<string>This password will be saved on disk in clear text. If you do not enter password here, Trojitá will prompt for one when needed.</string>
@@ -229,7 +229,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
- <item row="9" column="1">
+ <item row="10" column="1">
<widget class="QCheckBox" name="imapEnableId">
<property name="toolTip">
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
@@ -245,7 +245,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
- <item row="9" column="0">
+ <item row="10" column="0">
<widget class="QLabel" name="imapEnableIdLabel">
<property name="text">
<string>Ask for IMAP &ID</string>
@@ -255,7 +255,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
- <item row="10" column="0">
+ <item row="11" column="0">
<widget class="QLabel" name="imapCapabilitiesBlacklistLabel">
<property name="text">
<string>Blacklisted &Capabilities</string>
@@ -265,9 +265,19 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
- <item row="10" column="1">
+ <item row="11" column="1">
<widget class="QLineEdit" name="imapCapabilitiesBlacklist"/>
</item>
+ <item row="3" column="0" colspan="2">
+ <widget class="QLabel" name="portWarning">
+ <property name="text">
+ <string>This port number looks suspicious. The usual numbers for IMAP are 143 (with the TCP connection method or with STARTTLS) and 993 (when using SSL).</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</widget>
More information about the kde-doc-english
mailing list