summaryrefslogtreecommitdiff
path: root/settings/accounts/ui/MastodonSettingsDisplay.qml
diff options
context:
space:
mode:
Diffstat (limited to 'settings/accounts/ui/MastodonSettingsDisplay.qml')
-rw-r--r--settings/accounts/ui/MastodonSettingsDisplay.qml92
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)
+ }
+ }
+ }
+}