diff options
| author | Andrew Branson <andrew.branson@jolla.com> | 2026-02-10 10:41:02 +0100 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@jolla.com> | 2026-02-10 17:09:39 +0100 |
| commit | 4351f4627ba9e71775438dd26c9acddd002c7e11 (patch) | |
| tree | 3c72c980c5c81507109087bda67052b7ec8216b6 /settings/accounts/ui/MastodonSettingsDisplay.qml | |
Initial commit
Diffstat (limited to 'settings/accounts/ui/MastodonSettingsDisplay.qml')
| -rw-r--r-- | settings/accounts/ui/MastodonSettingsDisplay.qml | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/settings/accounts/ui/MastodonSettingsDisplay.qml b/settings/accounts/ui/MastodonSettingsDisplay.qml new file mode 100644 index 0000000..be79e3a --- /dev/null +++ b/settings/accounts/ui/MastodonSettingsDisplay.qml @@ -0,0 +1,92 @@ +import QtQuick 2.0 +import Sailfish.Silica 1.0 +import Sailfish.Accounts 1.0 +import com.jolla.settings.accounts 1.0 +import org.nemomobile.configuration 1.0 + +StandardAccountSettingsDisplay { + id: root + + settingsModified: true + + onAboutToSaveAccount: { + settingsLoader.updateAllSyncProfiles() + + if (eventsSyncSwitch.checked !== root.account.configurationValues("")["FeedViewAutoSync"]) { + root.account.setConfigurationValue("", "FeedViewAutoSync", eventsSyncSwitch.checked) + } + } + + StandardAccountSettingsLoader { + id: settingsLoader + account: root.account + accountProvider: root.accountProvider + accountManager: root.accountManager + autoEnableServices: root.autoEnableAccount + + onSettingsLoaded: { + syncServicesRepeater.model = syncServices + otherServicesDisplay.serviceModel = otherServices + + var autoSync = root.account.configurationValues("")["FeedViewAutoSync"] + var isNewAccount = root.autoEnableAccount + eventsSyncSwitch.checked = (isNewAccount || autoSync === true) + } + } + + Column { + id: syncServicesDisplay + width: parent.width + + SectionHeader { + //: Options for data to be downloaded from a remote server + //% "Download" + text: qsTrId("settings-accounts-la-download_options") + } + + Repeater { + id: syncServicesRepeater + TextSwitch { + checked: model.enabled + text: model.displayName + visible: text.length > 0 + onCheckedChanged: { + if (checked) { + root.account.enableWithService(model.serviceName) + } else { + root.account.disableWithService(model.serviceName) + } + } + } + } + + TextSwitch { + id: eventsSyncSwitch + + text: "Sync Mastodon feed automatically" + description: "Fetch new posts periodically when browsing Events Mastodon feed." + + onCheckedChanged: { + autoSyncConf.value = checked + } + } + } + + ConfigurationValue { + id: autoSyncConf + key: "/desktop/lipstick-jolla-home/events/auto_sync_feeds/" + root.account.identifier + } + + AccountServiceSettingsDisplay { + id: otherServicesDisplay + enabled: root.accountEnabled + + onUpdateServiceEnabledStatus: { + if (enabled) { + root.account.enableWithService(serviceName) + } else { + root.account.disableWithService(serviceName) + } + } + } +} |
