2020-09-08 12:59:34 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2020 by Savoir-faire Linux
|
|
|
|
* Author: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2021-08-23 19:05:06 -04:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
2021-03-17 14:23:21 -04:00
|
|
|
|
2021-08-23 13:24:08 -04:00
|
|
|
import net.jami.Models 1.1
|
|
|
|
import net.jami.Adapters 1.1
|
|
|
|
import net.jami.Constants 1.1
|
2020-10-06 13:58:44 +02:00
|
|
|
|
2020-09-08 12:59:34 -04:00
|
|
|
import "../../commoncomponents"
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
property int itemWidth
|
|
|
|
|
|
|
|
JamiFileDialog {
|
|
|
|
id: caCert_Dialog
|
|
|
|
|
2021-08-26 14:57:24 -04:00
|
|
|
property string oldPath: CurrentAccount.certificateListFile_TLS
|
|
|
|
property string openPath: oldPath === "" ?
|
|
|
|
(UtilsAdapter.getCurrentPath() + "/ringtones/") :
|
|
|
|
(UtilsAdapter.toFileAbsolutepath(oldPath))
|
2020-09-08 12:59:34 -04:00
|
|
|
|
|
|
|
mode: JamiFileDialog.OpenFile
|
2020-09-11 17:30:46 -04:00
|
|
|
title: JamiStrings.selectCACert
|
2020-09-08 12:59:34 -04:00
|
|
|
folder: openPath
|
2021-08-26 14:57:24 -04:00
|
|
|
nameFilters: [qsTr("Certificate File") + " (*.crt)",
|
|
|
|
qsTr("All files") + " (*)"]
|
2020-09-08 12:59:34 -04:00
|
|
|
|
2021-08-26 14:57:24 -04:00
|
|
|
onAccepted: CurrentAccount.certificateListFile_TLS =
|
|
|
|
UtilsAdapter.getAbsPath(file.toString())
|
2020-09-08 12:59:34 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
JamiFileDialog {
|
|
|
|
id: userCert_Dialog
|
|
|
|
|
2021-08-26 14:57:24 -04:00
|
|
|
property string oldPath: CurrentAccount.certificateFile_TLS
|
|
|
|
property string openPath: oldPath === "" ?
|
|
|
|
(UtilsAdapter.getCurrentPath() + "/ringtones/") :
|
|
|
|
(UtilsAdapter.toFileAbsolutepath(oldPath))
|
2020-09-08 12:59:34 -04:00
|
|
|
|
|
|
|
mode: JamiFileDialog.OpenFile
|
2020-09-11 17:30:46 -04:00
|
|
|
title: JamiStrings.selectUserCert
|
2020-09-08 12:59:34 -04:00
|
|
|
folder: openPath
|
2021-08-26 14:57:24 -04:00
|
|
|
nameFilters: [qsTr("Certificate File") + " (*.crt)",
|
|
|
|
qsTr("All files") + " (*)"]
|
2020-09-08 12:59:34 -04:00
|
|
|
|
2021-08-26 14:57:24 -04:00
|
|
|
onAccepted: CurrentAccount.certificateFile_TLS =
|
|
|
|
UtilsAdapter.getAbsPath(file.toString())
|
2020-09-08 12:59:34 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
JamiFileDialog {
|
|
|
|
id: privateKey_Dialog
|
|
|
|
|
2021-08-26 14:57:24 -04:00
|
|
|
property string oldPath: CurrentAccount.privateKeyFile_TLS
|
|
|
|
property string openPath: oldPath === "" ?
|
|
|
|
(UtilsAdapter.getCurrentPath() + "/ringtones/") :
|
|
|
|
(UtilsAdapter.toFileAbsolutepath(oldPath))
|
2020-09-08 12:59:34 -04:00
|
|
|
|
|
|
|
mode: JamiFileDialog.OpenFile
|
2020-09-11 17:30:46 -04:00
|
|
|
title: JamiStrings.selectPrivateKey
|
2020-09-08 12:59:34 -04:00
|
|
|
folder: openPath
|
2021-08-26 14:57:24 -04:00
|
|
|
nameFilters: [qsTr("Key File") + " (*.key)",
|
|
|
|
qsTr("All files") + " (*)"]
|
2020-09-08 12:59:34 -04:00
|
|
|
|
2021-08-26 14:57:24 -04:00
|
|
|
onAccepted: CurrentAccount.privateKeyFile_TLS =
|
|
|
|
UtilsAdapter.getAbsPath(file.toString())
|
2020-09-08 12:59:34 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
ElidedTextLabel {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: JamiTheme.preferredFieldHeight
|
|
|
|
|
2020-09-11 17:30:46 -04:00
|
|
|
eText: JamiStrings.security
|
2020-09-08 12:59:34 -04:00
|
|
|
fontSize: JamiTheme.headerFontSize
|
|
|
|
maxWidth: width
|
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.leftMargin: JamiTheme.preferredMarginSize
|
|
|
|
|
|
|
|
SettingMaterialButton {
|
|
|
|
id: btnCACert
|
2021-08-26 14:57:24 -04:00
|
|
|
|
2020-09-08 12:59:34 -04:00
|
|
|
Layout.fillWidth: true
|
2020-09-16 17:08:21 -04:00
|
|
|
Layout.minimumHeight: JamiTheme.preferredFieldHeight
|
2020-09-08 12:59:34 -04:00
|
|
|
|
2021-08-26 14:57:24 -04:00
|
|
|
enabled: CurrentAccount.enable_TLS
|
|
|
|
textField: UtilsAdapter.toFileInfoName(CurrentAccount.certificateListFile_TLS)
|
2020-09-11 17:30:46 -04:00
|
|
|
titleField: JamiStrings.caCertificate
|
2021-07-19 23:52:58 -04:00
|
|
|
source: JamiResources.round_folder_24dp_svg
|
2020-09-08 12:59:34 -04:00
|
|
|
itemWidth: root.itemWidth
|
2021-08-26 14:57:24 -04:00
|
|
|
|
2020-09-08 12:59:34 -04:00
|
|
|
onClick: caCert_Dialog.open()
|
|
|
|
}
|
|
|
|
|
|
|
|
SettingMaterialButton {
|
|
|
|
id: btnUserCert
|
2021-08-26 14:57:24 -04:00
|
|
|
|
2020-09-08 12:59:34 -04:00
|
|
|
Layout.fillWidth: true
|
2020-09-16 17:08:21 -04:00
|
|
|
Layout.minimumHeight: JamiTheme.preferredFieldHeight
|
2020-09-08 12:59:34 -04:00
|
|
|
|
2021-08-26 14:57:24 -04:00
|
|
|
enabled: CurrentAccount.enable_TLS
|
|
|
|
textField: UtilsAdapter.toFileInfoName(CurrentAccount.certificateFile_TLS)
|
2020-09-11 17:30:46 -04:00
|
|
|
titleField: JamiStrings.userCertificate
|
2021-07-19 23:52:58 -04:00
|
|
|
source: JamiResources.round_folder_24dp_svg
|
2020-09-08 12:59:34 -04:00
|
|
|
itemWidth: root.itemWidth
|
2021-08-26 14:57:24 -04:00
|
|
|
|
2020-09-08 12:59:34 -04:00
|
|
|
onClick: userCert_Dialog.open()
|
|
|
|
}
|
|
|
|
|
|
|
|
SettingMaterialButton {
|
|
|
|
id: btnPrivateKey
|
2021-08-26 14:57:24 -04:00
|
|
|
|
2020-09-08 12:59:34 -04:00
|
|
|
Layout.fillWidth: true
|
2020-09-16 17:08:21 -04:00
|
|
|
Layout.minimumHeight: JamiTheme.preferredFieldHeight
|
2020-09-08 12:59:34 -04:00
|
|
|
|
2021-08-26 14:57:24 -04:00
|
|
|
enabled: CurrentAccount.enable_TLS
|
|
|
|
textField: UtilsAdapter.toFileInfoName(CurrentAccount.privateKeyFile_TLS)
|
2020-09-11 17:30:46 -04:00
|
|
|
titleField: JamiStrings.privateKey
|
2021-07-19 23:52:58 -04:00
|
|
|
source: JamiResources.round_folder_24dp_svg
|
2020-09-08 12:59:34 -04:00
|
|
|
itemWidth: root.itemWidth
|
2021-08-26 14:57:24 -04:00
|
|
|
|
2020-09-08 12:59:34 -04:00
|
|
|
onClick: privateKey_Dialog.open()
|
|
|
|
}
|
|
|
|
|
|
|
|
SettingsMaterialLineEdit {
|
|
|
|
id: lineEditCertPassword
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: JamiTheme.preferredFieldHeight
|
2021-08-26 14:57:24 -04:00
|
|
|
|
2020-09-08 12:59:34 -04:00
|
|
|
itemWidth: root.itemWidth
|
2020-09-11 17:30:46 -04:00
|
|
|
titleField: JamiStrings.privateKeyPassword
|
2021-08-26 14:57:24 -04:00
|
|
|
|
|
|
|
textField: CurrentAccount.password_TLS
|
|
|
|
|
|
|
|
onEditFinished: CurrentAccount.password_TLS = textField
|
2020-09-08 12:59:34 -04:00
|
|
|
}
|
|
|
|
}
|
2020-09-16 17:08:21 -04:00
|
|
|
}
|