download folder setting

This commit is contained in:
Gaelle Braud 2026-02-09 16:38:54 +01:00
parent ffb0bb1d69
commit 06266a49b1
7 changed files with 168 additions and 51 deletions

View file

@ -409,6 +409,11 @@ void SettingsCore::setSelf(QSharedPointer<SettingsCore> me) {
mSettingsModelConnection->invokeToCore([this, enabled]() { setDisplayNotificationContent(enabled); });
});
// Download folder
mSettingsModelConnection->makeConnectToModel(&SettingsModel::downloadFolderChanged, [this](const QString &folder) {
mSettingsModelConnection->invokeToCore([this, folder]() { setDownloadFolder(folder); });
});
// Auto recording
mSettingsModelConnection->makeConnectToModel(
&SettingsModel::automaticallyRecordCallsEnabledChanged, [this](const bool enabled) {
@ -1246,6 +1251,14 @@ QString SettingsCore::getDownloadFolder() const {
return cleanPath;
}
void SettingsCore::setDownloadFolder(QString folder) {
if (mDownloadFolder != folder) {
mDownloadFolder = folder;
emit downloadFolderChanged();
setIsSaved(false);
}
}
void SettingsCore::writeIntoModel(std::shared_ptr<SettingsModel> model) const {
mustBeInLinphoneThread(getClassName() + Q_FUNC_INFO);
// Security

View file

@ -42,6 +42,7 @@ public:
echoCancellationEnabledChanged)
Q_PROPERTY(bool autoDownloadReceivedFiles READ getAutoDownloadReceivedFiles WRITE setAutoDownloadReceivedFiles
NOTIFY autoDownloadReceivedFilesChanged)
Q_PROPERTY(QString downloadFolder READ getDownloadFolder WRITE setDownloadFolder NOTIFY downloadFolderChanged)
Q_PROPERTY(bool displayNotificationContent READ getDisplayNotificationContent WRITE setDisplayNotificationContent
NOTIFY displayNotificationContentChanged)
Q_PROPERTY(
@ -95,17 +96,18 @@ public:
Q_PROPERTY(bool fullLogsEnabled READ getFullLogsEnabled WRITE setFullLogsEnabled NOTIFY fullLogsEnabledChanged)
Q_PROPERTY(bool crashReporterEnabled READ getCrashReporterEnabled WRITE setCrashReporterEnabled NOTIFY
crashReporterEnabledChanged)
Q_PROPERTY(QString logsEmail READ getLogsEmail) Q_PROPERTY(QString logsFolder READ getLogsFolder)
Q_PROPERTY(QString ringtoneName READ getRingtoneFileName NOTIFY ringtoneChanged)
Q_PROPERTY(QString ringtonePath READ getRingtonePath WRITE setRingtone NOTIFY ringtoneChanged)
Q_PROPERTY(QString ringtoneFolder MEMBER mRingtoneFolder NOTIFY ringtoneChanged)
Q_PROPERTY(bool dnd READ dndEnabled WRITE lEnableDnd NOTIFY dndChanged)
Q_PROPERTY(bool isSaved READ isSaved WRITE setIsSaved NOTIFY isSavedChanged)
Q_PROPERTY(QString logsEmail READ getLogsEmail)
Q_PROPERTY(QString logsFolder READ getLogsFolder)
Q_PROPERTY(QString ringtoneName READ getRingtoneFileName NOTIFY ringtoneChanged)
Q_PROPERTY(QString ringtonePath READ getRingtonePath WRITE setRingtone NOTIFY ringtoneChanged)
Q_PROPERTY(QString ringtoneFolder MEMBER mRingtoneFolder NOTIFY ringtoneChanged)
Q_PROPERTY(bool dnd READ dndEnabled WRITE lEnableDnd NOTIFY dndChanged)
Q_PROPERTY(bool isSaved READ isSaved WRITE setIsSaved NOTIFY isSavedChanged)
Q_PROPERTY(bool showAccountDevices READ showAccountDevices WRITE setShowAccountDevices
NOTIFY showAccountDevicesChanged)
Q_PROPERTY(
bool showAccountDevices READ showAccountDevices WRITE setShowAccountDevices NOTIFY showAccountDevicesChanged)
static QSharedPointer<SettingsCore> create();
static QSharedPointer<SettingsCore> create();
SettingsCore(QObject *parent = Q_NULLPTR);
SettingsCore(const SettingsCore &settingsCore);
virtual ~SettingsCore();
@ -153,6 +155,9 @@ public:
}
void setAutoDownloadReceivedFiles(bool enabled);
QString getDownloadFolder() const;
void setDownloadFolder(QString folder);
bool getDisplayNotificationContent() {
return mDisplayNotificationContent;
}
@ -292,7 +297,6 @@ public:
DECLARE_CORE_GETSET(bool, exitOnClose, ExitOnClose)
DECLARE_CORE_GETSET(bool, syncLdapContacts, SyncLdapContacts)
DECLARE_CORE_GETSET(QString, configLocale, ConfigLocale)
DECLARE_CORE_GETSET(QString, downloadFolder, DownloadFolder)
// Read-only
DECLARE_CORE_MEMBER(int, shortcutCount, ShortcutCount)
DECLARE_CORE_MEMBER(QVariantList, shortcuts, Shortcuts)
@ -315,6 +319,7 @@ signals:
void echoCancellationEnabledChanged();
void autoDownloadReceivedFilesChanged();
void downloadFolderChanged();
void displayNotificationContentChanged();
void automaticallyRecordCallsEnabledChanged();
@ -413,6 +418,7 @@ private:
bool mVideoEnabled;
bool mEchoCancellationEnabled;
bool mAutoDownloadReceivedFiles;
QString mDownloadFolder;
bool mDisplayNotificationContent;
bool mAutomaticallyRecordCallsEnabled;

View file

@ -2685,37 +2685,49 @@ Error</extracomment>
<context>
<name>ChatSettingsLayout</name>
<message>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="14"/>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="16"/>
<source>settings_chat_attached_files_title</source>
<extracomment>Attached files</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="21"/>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="23"/>
<source>settings_chat_notifications_title</source>
<extracomment>Notifications</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="32"/>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="48"/>
<source>settings_chat_attached_files_auto_download_title</source>
<extracomment>&quot;Automatic download&quot;</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="34"/>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="50"/>
<source>settings_chat_attached_files_auto_download_subtitle</source>
<extracomment>&quot;Automatically download transferred or received files in conversations&quot;</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="50"/>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="57"/>
<source>settings_chat_download_folder_title</source>
<extracomment>&quot;Dossier de téléchargement des fichiers&quot;</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="64"/>
<source>settings_chat_download_folder_browse_button</source>
<extracomment>Browse folders</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="80"/>
<source>settings_chat_display_notification_content_title</source>
<extracomment>&quot;Display notification content&quot;</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="52"/>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="82"/>
<source>settings_chat_display_notification_content_subtitle</source>
<extracomment>&quot;Display the content of the received message&quot;</extracomment>
<translation type="unfinished"></translation>
@ -3731,13 +3743,13 @@ Error</extracomment>
<context>
<name>DecoratedTextField</name>
<message>
<location filename="../../view/Control/Input/DecoratedTextField.qml" line="57"/>
<location filename="../../view/Control/Input/DecoratedTextField.qml" line="61"/>
<source>textfield_error_message_cannot_be_empty</source>
<extracomment>&quot;ne peut être vide&quot;</extracomment>
<translation>darf nicht leer sein</translation>
</message>
<message>
<location filename="../../view/Control/Input/DecoratedTextField.qml" line="60"/>
<location filename="../../view/Control/Input/DecoratedTextField.qml" line="64"/>
<source>textfield_error_message_unknown_format</source>
<extracomment>&quot;Format non reconnu&quot;</extracomment>
<translation>Unbekanntes Format</translation>
@ -6107,13 +6119,25 @@ Pour les activer dans un projet commercial, merci de nous contacter.</source>
<context>
<name>TextField</name>
<message>
<location filename="../../view/Control/Input/TextField.qml" line="208"/>
<location filename="../../view/Control/Input/TextField.qml" line="213"/>
<source>show_accessible_name</source>
<extracomment>Show %1</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../view/Control/Input/TextField.qml" line="206"/>
<location filename="../../view/Control/Input/TextField.qml" line="232"/>
<source>textfield_custom_button_accessible_name</source>
<extracomment>%1 button on %2</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../view/Control/Input/TextField.qml" line="232"/>
<source></source>
<extracomment>%1 button on %2</extracomment>
<translation>von %1 zu %2 (UTC%3)</translation>
</message>
<message>
<location filename="../../view/Control/Input/TextField.qml" line="211"/>
<source>hide_accessible_name</source>
<extracomment>Hide %1</extracomment>
<translation type="unfinished"></translation>

View file

@ -2670,37 +2670,49 @@ Only your correspondent can decrypt them.</translation>
<context>
<name>ChatSettingsLayout</name>
<message>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="14"/>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="16"/>
<source>settings_chat_attached_files_title</source>
<extracomment>Attached files</extracomment>
<translation>Attached files</translation>
</message>
<message>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="21"/>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="23"/>
<source>settings_chat_notifications_title</source>
<extracomment>Notifications</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="32"/>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="48"/>
<source>settings_chat_attached_files_auto_download_title</source>
<extracomment>&quot;Automatic download&quot;</extracomment>
<translation>Automatic download</translation>
</message>
<message>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="34"/>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="50"/>
<source>settings_chat_attached_files_auto_download_subtitle</source>
<extracomment>&quot;Automatically download transferred or received files in conversations&quot;</extracomment>
<translation>Automatically download transferred or received files in conversations</translation>
</message>
<message>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="50"/>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="57"/>
<source>settings_chat_download_folder_title</source>
<extracomment>&quot;Dossier de téléchargement des fichiers&quot;</extracomment>
<translation>Files download folder</translation>
</message>
<message>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="64"/>
<source>settings_chat_download_folder_browse_button</source>
<extracomment>Browse folders</extracomment>
<translation>Browse folders</translation>
</message>
<message>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="80"/>
<source>settings_chat_display_notification_content_title</source>
<extracomment>&quot;Display notification content&quot;</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="52"/>
<location filename="../../view/Page/Layout/Settings/ChatSettingsLayout.qml" line="82"/>
<source>settings_chat_display_notification_content_subtitle</source>
<extracomment>&quot;Display the content of the received message&quot;</extracomment>
<translation type="unfinished"></translation>
@ -3666,13 +3678,13 @@ Only your correspondent can decrypt them.</translation>
<context>
<name>DecoratedTextField</name>
<message>
<location filename="../../view/Control/Input/DecoratedTextField.qml" line="57"/>
<location filename="../../view/Control/Input/DecoratedTextField.qml" line="61"/>
<source>textfield_error_message_cannot_be_empty</source>
<extracomment>&quot;ne peut être vide&quot;</extracomment>
<translation>can not be empty</translation>
</message>
<message>
<location filename="../../view/Control/Input/DecoratedTextField.qml" line="60"/>
<location filename="../../view/Control/Input/DecoratedTextField.qml" line="64"/>
<source>textfield_error_message_unknown_format</source>
<extracomment>&quot;Format non reconnu&quot;</extracomment>
<translation>Unknown format</translation>
@ -6006,13 +6018,25 @@ To enable them in a commercial project, please contact us.</translation>
<context>
<name>TextField</name>
<message>
<location filename="../../view/Control/Input/TextField.qml" line="208"/>
<location filename="../../view/Control/Input/TextField.qml" line="213"/>
<source>show_accessible_name</source>
<extracomment>Show %1</extracomment>
<translation>Show %1</translation>
</message>
<message>
<location filename="../../view/Control/Input/TextField.qml" line="206"/>
<location filename="../../view/Control/Input/TextField.qml" line="232"/>
<source>textfield_custom_button_accessible_name</source>
<extracomment>%1 button on %2</extracomment>
<translation>%1 button on %2</translation>
</message>
<message>
<location filename="../../view/Control/Input/TextField.qml" line="232"/>
<source></source>
<extracomment>%1 button on %2</extracomment>
<translation>from %1 to %2 (UTC%3)</translation>
</message>
<message>
<location filename="../../view/Control/Input/TextField.qml" line="211"/>
<source>hide_accessible_name</source>
<extracomment>Hide %1</extracomment>
<translation>Hide %1</translation>

View file

@ -15,7 +15,7 @@ FormItemLayout {
property var propertyOwner: new Array
property var propertyOwnerGui
property var title
property var placeHolder
property var placeHolder: ""
property bool useTitleAsPlaceHolder: true
property bool canBeEmpty: true
property bool toValidate: false
@ -30,6 +30,10 @@ FormItemLayout {
property alias hidden: textField.hidden
property alias validator: textField.validator
property alias customButtonIcon: textField.customButtonIcon
property alias customCallback: textField.customCallback
property alias customButtonAccessibleName: textField.customButtonAccessibleName
property var isValid: function(text) {
return true
}

View file

@ -57,6 +57,11 @@ Control.TextField {
property real pixelSize: Typography.p1.pixelSize
property real weight: Typography.p1.weight
// Custom button on the right
property string customButtonIcon
property var customCallback
property string customButtonAccessibleName
// fill propertyName and propertyOwner to check text validity
property string propertyName
property var propertyOwner
@ -208,4 +213,22 @@ Control.TextField {
qsTr("show_accessible_name")
).arg(mainItem.Accessible.name)
}
Button {
id: customButton
KeyNavigation.left: mainItem
z: 1
visible: mainItem.customButtonIcon !== undefined && mainItem.customButtonIcon !== ""
style: ButtonStyle.noBackground
icon.source: mainItem.customButtonIcon
width: visible ? Utils.getSizeWithScreenRatio(20) : 0
height: Utils.getSizeWithScreenRatio(20)
icon.width: width
icon.height: height
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: Utils.getSizeWithScreenRatio(15)
onClicked: mainItem.customCallback()
//: %1 button on %2
Accessible.name: qsTr("textfield_custom_button_accessible_name").arg(mainItem.customButtonAccessibleName).arg(mainItem.Accessible.name)
}
}

View file

@ -1,9 +1,11 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Dialogs
import QtQuick.Controls.Basic as Control
import SettingsCpp
import Linphone
import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils
AbstractSettingsLayout {
id: mainItem
@ -25,22 +27,50 @@ AbstractSettingsLayout {
}
]
onSave: SettingsCpp.save()
onUndo: SettingsCpp.undo()
FolderDialog {
id: folderDialog
currentFolder: SettingsCpp.downloadFolder
options: FolderDialog.DontResolveSymlinks
onAccepted: {
SettingsCpp.downloadFolder = Utils.getSystemPathFromUri(selectedFolder)
}
}
Component {
id: attachedFilesParamComp
SwitchSetting {
//: "Automatic download"
titleText: qsTr("settings_chat_attached_files_auto_download_title")
//: "Automatically download transferred or received files in conversations"
subTitleText: qsTr("settings_chat_attached_files_auto_download_subtitle")
propertyName: "autoDownloadReceivedFiles"
propertyOwner: SettingsCpp
Connections {
target: mainItem
function onSave() {
SettingsCpp.save()
}
ColumnLayout {
spacing: Utils.getSizeWithScreenRatio(20)
SwitchSetting {
//: "Automatic download"
titleText: qsTr("settings_chat_attached_files_auto_download_title")
//: "Automatically download transferred or received files in conversations"
subTitleText: qsTr("settings_chat_attached_files_auto_download_subtitle")
propertyName: "autoDownloadReceivedFiles"
propertyOwner: SettingsCpp
}
DecoratedTextField {
id: downloadFolderTextField
//: "Dossier de téléchargement des fichiers"
title: qsTr("settings_chat_download_folder_title")
propertyName: "downloadFolder"
propertyOwner: SettingsCpp
customButtonIcon: AppIcons.arrowSquareOut
customCallback: function() {folderDialog.open()}
toValidate: true
//: Browse folders
customButtonAccessibleName: qsTr("settings_chat_download_folder_browse_button")
Connections {
target: SettingsCpp
function onDownloadFolderChanged() {
if (downloadFolderTextField.text != downloadFolderTextField.propertyOwner[downloadFolderTextField.propertyName])
downloadFolderTextField.text = downloadFolderTextField.propertyOwner[downloadFolderTextField.propertyName]
}
}
}
}
}
Component {
@ -52,13 +82,6 @@ AbstractSettingsLayout {
subTitleText: qsTr("settings_chat_display_notification_content_subtitle")
propertyName: "displayNotificationContent"
propertyOwner: SettingsCpp
Connections {
target: mainItem
function onSave() {
SettingsCpp.save()
}
}
}
}
}