2020-09-08 12:59:34 -04:00
|
|
|
/*
|
2023-02-06 01:47:15 -05:00
|
|
|
* Copyright (C) 2020-2023 Savoir-faire Linux Inc.
|
2020-09-08 12:59:34 -04:00
|
|
|
* 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-09-08 10:31:38 -04:00
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Layouts
|
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
|
|
|
|
|
2023-01-06 14:07:33 -05:00
|
|
|
function openFileDialog(title, oldPath, fileType, onAcceptedCb) {
|
|
|
|
var openPath = oldPath === "" ?
|
|
|
|
(UtilsAdapter.getCurrentPath() + "/ringtones/") :
|
|
|
|
(UtilsAdapter.toFileAbsolutepath(oldPath))
|
|
|
|
var dlg = viewCoordinator.presentDialog(
|
|
|
|
appWindow,
|
|
|
|
"commoncomponents/JamiFileDialog.qml",
|
|
|
|
{
|
|
|
|
title: title,
|
|
|
|
fileMode: JamiFileDialog.OpenFile,
|
|
|
|
folder: openPath,
|
|
|
|
nameFilters: [fileType, JamiStrings.allFiles]
|
|
|
|
})
|
|
|
|
dlg.fileAccepted.connect(onAcceptedCb)
|
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
|
|
|
|
2023-01-06 14:07:33 -05:00
|
|
|
onClick: openFileDialog(JamiStrings.selectCACert,
|
|
|
|
CurrentAccount.certificateListFile_TLS,
|
|
|
|
JamiStrings.certificateFile,
|
|
|
|
function (file) {
|
|
|
|
CurrentAccount.certificateListFile_TLS =
|
|
|
|
UtilsAdapter.getAbsPath(file.toString())
|
|
|
|
})
|
2020-09-08 12:59:34 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
2023-01-06 14:07:33 -05:00
|
|
|
onClick: openFileDialog(JamiStrings.selectUserCert,
|
|
|
|
CurrentAccount.certificateFile_TLS,
|
|
|
|
JamiStrings.certificateFile,
|
|
|
|
function (file) {
|
|
|
|
CurrentAccount.certificateFile_TLS =
|
|
|
|
UtilsAdapter.getAbsPath(file.toString())
|
|
|
|
})
|
2020-09-08 12:59:34 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
2023-01-06 14:07:33 -05:00
|
|
|
onClick: openFileDialog(JamiStrings.selectPrivateKey,
|
|
|
|
CurrentAccount.privateKeyFile_TLS,
|
|
|
|
JamiStrings.keyFile,
|
|
|
|
function (file) {
|
|
|
|
CurrentAccount.privateKeyFile_TLS =
|
|
|
|
UtilsAdapter.getAbsPath(file.toString())
|
|
|
|
})
|
2020-09-08 12:59:34 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
}
|