[harmattan] added option for minimal ssl version, closes #117

This commit is contained in:
Hauke Schade 2014-11-16 18:23:18 +01:00
parent 970670bdf0
commit b41b3bff88
4 changed files with 56 additions and 4 deletions

View file

@ -26,7 +26,7 @@
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
#include <QtCore/QStandardPaths>
#else
#include <QtCore/QDesktopServices>
#include <QtGui/QDesktopServices>
#endif
#include "mynetworkmanager.hh"

View file

@ -27,6 +27,7 @@ Button {
property alias model: comboboxDialog.model
property bool withTimer: true
property alias currentIndex: comboboxDialog.selectedIndex
property alias title: comboboxDialog.titleText
signal currentIndexChanged()
@ -52,8 +53,8 @@ Button {
timer.start()
}
text: comboboxDialog.model.get(0).text
onClicked: comboboxDialog.open();
text: comboboxDialog.model.get(0).name
onClicked: comboboxDialog.open()
ToolIcon {
id: filterImage

View file

@ -54,7 +54,7 @@ Page {
Column {
id: settingsColumn
anchors {
top: pageHeader.bottom
top: parent.top
topMargin: MyTheme.paddingMedium
left: parent.left
leftMargin: MyTheme.paddingMedium
@ -83,6 +83,39 @@ Page {
onCheckedChanged: settings.useAllFeedsOnStartup = checked
}
Label {
width: parent.width
text: qsTr("Minimum Ssl Version")
font.pixelSize: MyTheme.fontSizeMedium
}
Label {
width: parent.width
text: qsTr("Specify a minimum protocol version for your SSL connection. This might be necessary when your server does not allow connections with older (insecure) protocols. However, your server might not support the newest protocol.")
font.pixelSize: MyTheme.fontSizeSmall
}
ListModel {
id: possibleProtocols
ListElement { value: 0; name: "" }
ListElement { value: 1; name: "" }
ListElement { value: 2; name: "" }
ListElement { value: 3; name: "" }
Component.onCompleted: {
possibleProtocols.setProperty(0, "name", qsTr("Any"))
possibleProtocols.setProperty(1, "name", qsTr("SslV2"))
possibleProtocols.setProperty(2, "name", qsTr("SslV3"))
possibleProtocols.setProperty(3, "name", qsTr("TlsV1"))
}
}
ComboBoxList {
id: minimumSSLVersionSetting
initialValue: settings.minSSLVersion
model: possibleProtocols
onCurrentIndexChanged: settings.minSSLVersion = currentIndex
title: qsTr("Minimum Ssl Version")
}
// -- Items --
Label {
width: parent.width

View file

@ -101,6 +101,7 @@ QSsl::SslProtocol Settings::getMinSSLVersion() const {
case 2:
minSSLVersionProtocol = QSsl::SslV3;
break;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
case 3:
minSSLVersionProtocol = QSsl::TlsV1_0;
break;
@ -110,6 +111,11 @@ QSsl::SslProtocol Settings::getMinSSLVersion() const {
case 5:
minSSLVersionProtocol = QSsl::TlsV1_2;
break;
#else
case 3:
minSSLVersionProtocol = QSsl::TlsV1;
break;
#endif
}
return minSSLVersionProtocol;
}
@ -120,19 +126,28 @@ bool Settings::isMinSSlVersionGreaterThan(QSsl::SslProtocol otherVersion) const
switch (otherVersion) {
case QSsl::SslV2:
result = currentVersion == QSsl::SslV3 ||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
currentVersion == QSsl::TlsV1_0 ||
currentVersion == QSsl::TlsV1_1 ||
currentVersion == QSsl::TlsV1_2
#else
currentVersion == QSsl::TlsV1
#endif
;
break;
case QSsl::SslV3:
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
case QSsl::TlsV1SslV3:
case QSsl::SecureProtocols:
result = currentVersion == QSsl::TlsV1_0 ||
currentVersion == QSsl::TlsV1_1 ||
currentVersion == QSsl::TlsV1_2
#else
result = currentVersion == QSsl::TlsV1
#endif
;
break;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
case QSsl::TlsV1_0:
result = currentVersion == QSsl::TlsV1_1 ||
currentVersion == QSsl::TlsV1_2
@ -143,6 +158,9 @@ bool Settings::isMinSSlVersionGreaterThan(QSsl::SslProtocol otherVersion) const
;
break;
case QSsl::TlsV1_2:
#else
case QSsl::TlsV1:
#endif
case QSsl::UnknownProtocol:
result = false;
break;