mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-01 21:35:42 +02:00
generalsettings: add file transfer settings
+ Auto accept files from trusted sources (default: true) + Auto accept files from untrusted sources (default: false) + Size limit (default: 20Mb) Change-Id: I0e1068e3996786b23ba9a7797d02b7f8bb0f89d1 GitLab: #160
This commit is contained in:
parent
1e7c712a10
commit
417a0fe042
10 changed files with 160 additions and 0 deletions
1
qml.qrc
1
qml.qrc
|
@ -33,6 +33,7 @@
|
|||
<file>src/commoncomponents/SpinningAnimation.qml</file>
|
||||
<file>src/settingsview/SettingsView.qml</file>
|
||||
<file>src/settingsview/components/ChatviewSettings.qml</file>
|
||||
<file>src/settingsview/components/FileTransferSettings.qml</file>
|
||||
<file>src/settingsview/components/SettingsMenu.qml</file>
|
||||
<file>src/settingsview/components/SettingsHeader.qml</file>
|
||||
<file>src/settingsview/components/SystemSettings.qml</file>
|
||||
|
|
|
@ -36,6 +36,9 @@ const QString defaultDownloadPath = QStandardPaths::writableLocation(
|
|||
X(DownloadPath, defaultDownloadPath) \
|
||||
X(EnableNotifications, true) \
|
||||
X(EnableTypingIndicator, true) \
|
||||
X(AllowFromUntrusted, false) \
|
||||
X(AcceptTransferBelow, 20) \
|
||||
X(AutoAcceptFiles, true) \
|
||||
X(DisplayHyperlinkPreviews, true) \
|
||||
X(EnableDarkTheme, false) \
|
||||
X(AutoUpdate, true) \
|
||||
|
|
|
@ -321,6 +321,13 @@ Item {
|
|||
property string enableTypingIndicator: qsTr("Enable typing indicators")
|
||||
property string displayHyperlinkPreviews: qsTr("Display hyperlink previews in the chatview")
|
||||
|
||||
// File transfer settings
|
||||
property string fileTransfer: qsTr("File transfer")
|
||||
property string allowFromUntrusted: qsTr("Allow incoming files from unknown contacts")
|
||||
property string autoAcceptFiles: qsTr("Automatically accept incoming files")
|
||||
property string acceptTransferBelow: qsTr("Accept transfer limit")
|
||||
property string acceptTransferTooltip: qsTr("in MB, 0 = unlimited")
|
||||
|
||||
// Updates
|
||||
property string betaInstall: qsTr("Install beta version")
|
||||
property string checkForUpdates: qsTr("Check for updates now")
|
||||
|
|
|
@ -263,7 +263,15 @@ MainApplication::init()
|
|||
}
|
||||
|
||||
auto downloadPath = settingsManager_->getValue(Settings::Key::DownloadPath);
|
||||
auto allowTransferFromUntrusted = settingsManager_->getValue(Settings::Key::AllowFromUntrusted)
|
||||
.toBool();
|
||||
auto allowTransferFromTrusted = settingsManager_->getValue(Settings::Key::AutoAcceptFiles)
|
||||
.toBool();
|
||||
auto acceptTransferBelow = settingsManager_->getValue(Settings::Key::AcceptTransferBelow).toInt();
|
||||
lrcInstance_->accountModel().downloadDirectory = downloadPath.toString() + "/";
|
||||
lrcInstance_->accountModel().autoTransferFromUntrusted = allowTransferFromUntrusted;
|
||||
lrcInstance_->accountModel().autoTransferFromTrusted = allowTransferFromTrusted;
|
||||
lrcInstance_->accountModel().autoTransferSizeThreshold = acceptTransferBelow;
|
||||
|
||||
initQmlLayer();
|
||||
initSystray();
|
||||
|
|
|
@ -897,6 +897,27 @@ SettingsAdapter::registrationExpirationTimeSpinBoxValueChanged(int value)
|
|||
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->get_currentAccountId(), confProps);
|
||||
}
|
||||
|
||||
void
|
||||
SettingsAdapter::autoAcceptFiles(bool value)
|
||||
{
|
||||
lrcInstance_->accountModel().autoTransferFromTrusted = value;
|
||||
setAppValue(Settings::Key::AutoAcceptFiles, value);
|
||||
}
|
||||
|
||||
void
|
||||
SettingsAdapter::allowFromUntrusted(bool value)
|
||||
{
|
||||
lrcInstance_->accountModel().autoTransferFromUntrusted = value;
|
||||
setAppValue(Settings::Key::AllowFromUntrusted, value);
|
||||
}
|
||||
|
||||
void
|
||||
SettingsAdapter::acceptTransferBelow(int value)
|
||||
{
|
||||
lrcInstance_->accountModel().autoTransferSizeThreshold = value;
|
||||
setAppValue(Settings::Key::AcceptTransferBelow, value);
|
||||
}
|
||||
|
||||
void
|
||||
SettingsAdapter::networkInterfaceSpinBoxValueChanged(int value)
|
||||
{
|
||||
|
|
|
@ -202,6 +202,10 @@ public:
|
|||
Q_INVOKABLE void videoRTPMinPortSpinBoxEditFinished(int value);
|
||||
Q_INVOKABLE void videoRTPMaxPortSpinBoxEditFinished(int value);
|
||||
|
||||
Q_INVOKABLE void autoAcceptFiles(bool value);
|
||||
Q_INVOKABLE void allowFromUntrusted(bool value);
|
||||
Q_INVOKABLE void acceptTransferBelow(int value);
|
||||
|
||||
Q_INVOKABLE void tlsProtocolComboBoxIndexChanged(const int& index);
|
||||
|
||||
Q_INVOKABLE void setDeviceName(QString text);
|
||||
|
|
|
@ -61,6 +61,7 @@ Rectangle {
|
|||
pageIdCurrentAccountSettings.updateAccountInfoDisplayed()
|
||||
break
|
||||
case SettingsView.General:
|
||||
generalSettings.updateValues()
|
||||
AccountAdapter.stopPreviewing()
|
||||
selectedMenu = sel
|
||||
break
|
||||
|
|
94
src/settingsview/components/FileTransferSettings.qml
Normal file
94
src/settingsview/components/FileTransferSettings.qml
Normal file
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
* Copyright (C) 2021 by Savoir-faire Linux
|
||||
* Author: Sébastien Blin <sebastien.blin@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/>.
|
||||
*/
|
||||
|
||||
import QtQuick 2.14
|
||||
import QtQuick.Controls 2.14
|
||||
import QtQuick.Layouts 1.14
|
||||
|
||||
import net.jami.Adapters 1.0
|
||||
import net.jami.Enums 1.0
|
||||
import net.jami.Constants 1.0
|
||||
|
||||
ColumnLayout {
|
||||
id:root
|
||||
|
||||
property int itemWidth
|
||||
|
||||
function updateValues() {
|
||||
acceptTransferBelowSpinBox.setValue(SettingsAdapter.getAppValue(Settings.AcceptTransferBelow))
|
||||
allowFromUntrustedCheckbox.checked = SettingsAdapter.getAppValue(Settings.AllowFromUntrusted)
|
||||
autoAcceptFilesCheckbox.checked = SettingsAdapter.getAppValue(Settings.AutoAcceptFiles)
|
||||
}
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
|
||||
text: JamiStrings.fileTransfer
|
||||
font.pointSize: JamiTheme.headerFontSize
|
||||
font.kerning: true
|
||||
color: JamiTheme.textColor
|
||||
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
|
||||
ToggleSwitch {
|
||||
id: allowFromUntrustedCheckbox
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: JamiTheme.preferredMarginSize
|
||||
|
||||
checked: SettingsAdapter.getAppValue(Settings.AllowFromUntrusted)
|
||||
|
||||
labelText: JamiStrings.allowFromUntrusted
|
||||
fontPointSize: JamiTheme.settingsFontSize
|
||||
|
||||
tooltipText: JamiStrings.allowFromUntrusted
|
||||
|
||||
onSwitchToggled: SettingsAdapter.allowFromUntrusted(checked)
|
||||
}
|
||||
|
||||
ToggleSwitch {
|
||||
id: autoAcceptFilesCheckbox
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: JamiTheme.preferredMarginSize
|
||||
|
||||
checked: SettingsAdapter.getAppValue(Settings.AutoAcceptFiles)
|
||||
|
||||
labelText: JamiStrings.autoAcceptFiles
|
||||
fontPointSize: JamiTheme.settingsFontSize
|
||||
|
||||
tooltipText: JamiStrings.autoAcceptFiles
|
||||
|
||||
onSwitchToggled: SettingsAdapter.autoAcceptFiles(checked)
|
||||
}
|
||||
|
||||
SettingSpinBox {
|
||||
id: acceptTransferBelowSpinBox
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: JamiTheme.preferredMarginSize
|
||||
|
||||
title: JamiStrings.acceptTransferBelow
|
||||
tooltipText: JamiStrings.acceptTransferTooltip
|
||||
itemWidth: root.itemWidth
|
||||
bottomValue: 0
|
||||
topValue: 99999999
|
||||
step: 1
|
||||
|
||||
onNewValue: SettingsAdapter.acceptTransferBelow(valueField)
|
||||
}
|
||||
}
|
|
@ -39,6 +39,10 @@ Rectangle {
|
|||
|
||||
color: JamiTheme.secondaryBackgroundColor
|
||||
|
||||
function updateValues() {
|
||||
fileTransferSettings.updateValues()
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: generalSettingsColumnLayout
|
||||
|
||||
|
@ -66,6 +70,17 @@ Rectangle {
|
|||
itemWidth: preferredColumnWidth
|
||||
}
|
||||
|
||||
// file transfer setting panel
|
||||
FileTransferSettings {
|
||||
id: fileTransferSettings
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: JamiTheme.preferredMarginSize
|
||||
Layout.leftMargin: JamiTheme.preferredMarginSize
|
||||
Layout.rightMargin: JamiTheme.preferredMarginSize
|
||||
|
||||
itemWidth: preferredColumnWidth
|
||||
}
|
||||
|
||||
// call recording setting panel
|
||||
RecordingSettings {
|
||||
Layout.fillWidth: true
|
||||
|
|
|
@ -39,6 +39,7 @@ RowLayout {
|
|||
property int topValue
|
||||
property int step
|
||||
property int valueField
|
||||
property string tooltipText: ""
|
||||
|
||||
signal newValue
|
||||
|
||||
|
@ -87,5 +88,10 @@ RowLayout {
|
|||
border.color: enabled? root.borderColor : "transparent"
|
||||
color: JamiTheme.editBackgroundColor
|
||||
}
|
||||
|
||||
hoverEnabled: true
|
||||
ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval
|
||||
ToolTip.visible: hovered && (root.tooltipText.length > 0)
|
||||
ToolTip.text: root.tooltipText
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue