diff options
Diffstat (limited to 'settings/accounts')
| -rw-r--r-- | settings/accounts/accounts.pro | 6 | ||||
| -rw-r--r-- | settings/accounts/providers/mastodon.provider | 3 | ||||
| -rw-r--r-- | settings/accounts/services/mastodon-microblog.service | 5 | ||||
| -rw-r--r-- | settings/accounts/services/mastodon-notifications.service | 32 | ||||
| -rw-r--r-- | settings/accounts/services/mastodon-sharing.service | 3 | ||||
| -rw-r--r-- | settings/accounts/ui/MastodonSettingsDisplay.qml | 35 | ||||
| -rw-r--r-- | settings/accounts/ui/mastodon-settings.qml | 4 | ||||
| -rw-r--r-- | settings/accounts/ui/mastodon-update.qml | 7 | ||||
| -rw-r--r-- | settings/accounts/ui/mastodon.qml | 9 |
9 files changed, 87 insertions, 17 deletions
diff --git a/settings/accounts/accounts.pro b/settings/accounts/accounts.pro index d451438..37982a3 100644 --- a/settings/accounts/accounts.pro +++ b/settings/accounts/accounts.pro @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2013 - 2026 Jolla Ltd. +# +# SPDX-License-Identifier: BSD-3-Clause + TEMPLATE = aux TS_FILE = $$OUT_PWD/settings-accounts-mastodon.ts @@ -28,6 +32,7 @@ PRE_TARGETDEPS += ts engineering_english OTHER_FILES += \ $$PWD/providers/mastodon.provider \ $$PWD/services/mastodon-microblog.service \ + $$PWD/services/mastodon-notifications.service \ $$PWD/services/mastodon-sharing.service \ $$PWD/ui/MastodonSettingsDisplay.qml \ $$PWD/ui/mastodon.qml \ @@ -39,6 +44,7 @@ provider.path = /usr/share/accounts/providers/ services.files += \ $$PWD/services/mastodon-microblog.service \ + $$PWD/services/mastodon-notifications.service \ $$PWD/services/mastodon-sharing.service services.path = /usr/share/accounts/services/ diff --git a/settings/accounts/providers/mastodon.provider b/settings/accounts/providers/mastodon.provider index c02de41..422c231 100644 --- a/settings/accounts/providers/mastodon.provider +++ b/settings/accounts/providers/mastodon.provider @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Copyright (C) 2013-2026 Jolla Ltd. --> +<!-- SPDX-FileCopyrightText: 2013 - 2026 Jolla Ltd. --> +<!-- SPDX-License-Identifier: BSD-3-Clause --> <!DOCTYPE provider> <provider version="1.0" id="mastodon"> <translations>/usr/share/translations/settings-accounts-mastodon</translations> diff --git a/settings/accounts/services/mastodon-microblog.service b/settings/accounts/services/mastodon-microblog.service index 6b975f7..527f70f 100644 --- a/settings/accounts/services/mastodon-microblog.service +++ b/settings/accounts/services/mastodon-microblog.service @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!-- Copyright (C) 2013-2026 Jolla Ltd. --> +<!-- SPDX-FileCopyrightText: 2013 - 2026 Jolla Ltd. --> +<!-- SPDX-License-Identifier: BSD-3-Clause --> <service id="mastodon-microblog"> <type>microblogging</type> <translations>/usr/share/translations/settings-accounts-mastodon</translations> @@ -8,7 +9,7 @@ <provider>mastodon</provider> <template> - <setting name="sync_profile_templates" type="as">["mastodon.Posts", "mastodon.Notifications"]</setting> + <setting name="sync_profile_templates" type="as">["mastodon.Posts"]</setting> <group name="auth"> <setting name="method">oauth2</setting> <setting name="mechanism">web_server</setting> diff --git a/settings/accounts/services/mastodon-notifications.service b/settings/accounts/services/mastodon-notifications.service new file mode 100644 index 0000000..f5471c9 --- /dev/null +++ b/settings/accounts/services/mastodon-notifications.service @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- SPDX-FileCopyrightText: 2013 - 2026 Jolla Ltd. --> +<!-- SPDX-License-Identifier: BSD-3-Clause --> +<service id="mastodon-notifications"> + <type>microblogging</type> + <translations>/usr/share/translations/settings-accounts-mastodon</translations> + <name>Notifications</name> + <icon>image://theme/icon-l-mastodon</icon> + <provider>mastodon</provider> + + <template> + <setting name="sync_profile_templates" type="as">["mastodon.Notifications"]</setting> + <group name="auth"> + <setting name="method">oauth2</setting> + <setting name="mechanism">web_server</setting> + <group name="oauth2"> + <group name="web_server"> + <setting name="Host">mastodon.social</setting> + <setting name="AllowedSchemes" type="as">["https"]</setting> + <setting name="AuthPath">oauth/authorize</setting> + <setting name="TokenPath">oauth/token</setting> + <setting name="ResponseType">code</setting> + <setting name="Scope" type="as">["read","write"]</setting> + <setting name="RedirectUri">http://ipv4.jolla.com/online/status.html</setting> + </group> + </group> + </group> + <group name="api"> + <setting name="Host">https://mastodon.social</setting> + </group> + </template> +</service> diff --git a/settings/accounts/services/mastodon-sharing.service b/settings/accounts/services/mastodon-sharing.service index 4048b56..fdf342a 100644 --- a/settings/accounts/services/mastodon-sharing.service +++ b/settings/accounts/services/mastodon-sharing.service @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> -<!-- Copyright (C) 2013-2026 Jolla Ltd. --> +<!-- SPDX-FileCopyrightText: 2013 - 2026 Jolla Ltd. --> +<!-- SPDX-License-Identifier: BSD-3-Clause --> <service id="mastodon-sharing"> <type>sharing</type> <translations>/usr/share/translations/settings-accounts-mastodon</translations> diff --git a/settings/accounts/ui/MastodonSettingsDisplay.qml b/settings/accounts/ui/MastodonSettingsDisplay.qml index 1ee276e..13ac06c 100644 --- a/settings/accounts/ui/MastodonSettingsDisplay.qml +++ b/settings/accounts/ui/MastodonSettingsDisplay.qml @@ -1,17 +1,21 @@ /* - * Copyright (C) 2013-2026 Jolla Ltd. + * SPDX-FileCopyrightText: 2013 - 2026 Jolla Ltd. + * + * SPDX-License-Identifier: BSD-3-Clause */ import QtQuick 2.0 import Sailfish.Silica 1.0 import Sailfish.Accounts 1.0 import com.jolla.settings.accounts 1.0 +import com.jolla.settings.accounts.mastodon 1.0 import org.nemomobile.configuration 1.0 StandardAccountSettingsDisplay { id: root settingsModified: true + property bool postsServiceEnabled: false function refreshDescriptionEditor() { var description = root.account.configurationValues("")["description"] @@ -37,7 +41,8 @@ StandardAccountSettingsDisplay { var providerDisplayName = root.accountProvider && root.accountProvider.displayName ? root.accountProvider.displayName.toString().trim() : "" - return providerDisplayName.length > 0 ? providerDisplayName : "Mastodon" + //% "Mastodon" + return providerDisplayName.length > 0 ? providerDisplayName : qsTrId("settings-accounts-mastodon-la-provider_name") } onAboutToSaveAccount: { @@ -106,12 +111,25 @@ StandardAccountSettingsDisplay { id: syncServicesRepeater TextSwitch { checked: model.enabled - text: model.displayName + text: model.serviceName === "mastodon-microblog" + //% "Posts" + ? qsTrId("settings-accounts-mastodon-la-service_posts") + : (model.serviceName === "mastodon-notifications" + //% "Notifications" + ? qsTrId("settings-accounts-mastodon-la-service_notifications") + : model.displayName) description: model.serviceName === "mastodon-microblog" - ? "Show Mastodon posts in the Events view." - : "" + //% "Show Mastodon posts in the Events view." + ? qsTrId("settings-accounts-mastodon-la-service_posts_description") + : (model.serviceName === "mastodon-notifications" + //% "Show Mastodon notifications." + ? qsTrId("settings-accounts-mastodon-la-service_notifications_description") + : "") visible: text.length > 0 onCheckedChanged: { + if (model.serviceName === "mastodon-microblog") { + root.postsServiceEnabled = checked + } if (checked) { root.account.enableWithService(model.serviceName) } else { @@ -124,8 +142,11 @@ StandardAccountSettingsDisplay { TextSwitch { id: eventsSyncSwitch - text: "Sync Mastodon feed automatically" - description: "Fetch new posts periodically when browsing Events Mastodon feed." + //% "Sync Mastodon feed automatically" + text: qsTrId("settings-accounts-mastodon-la-auto_sync_feed") + //% "Fetch new posts periodically when browsing Events Mastodon feed." + description: qsTrId("settings-accounts-mastodon-la-auto_sync_feed_description") + enabled: root.postsServiceEnabled onCheckedChanged: { autoSyncConf.value = checked diff --git a/settings/accounts/ui/mastodon-settings.qml b/settings/accounts/ui/mastodon-settings.qml index c66cbb7..0538e44 100644 --- a/settings/accounts/ui/mastodon-settings.qml +++ b/settings/accounts/ui/mastodon-settings.qml @@ -1,5 +1,7 @@ /* - * Copyright (C) 2013-2026 Jolla Ltd. + * SPDX-FileCopyrightText: 2013 - 2026 Jolla Ltd. + * + * SPDX-License-Identifier: BSD-3-Clause */ import QtQuick 2.0 diff --git a/settings/accounts/ui/mastodon-update.qml b/settings/accounts/ui/mastodon-update.qml index 98dba8c..2485a83 100644 --- a/settings/accounts/ui/mastodon-update.qml +++ b/settings/accounts/ui/mastodon-update.qml @@ -1,5 +1,7 @@ /* - * Copyright (C) 2013-2026 Jolla Ltd. + * SPDX-FileCopyrightText: 2013 - 2026 Jolla Ltd. + * + * SPDX-License-Identifier: BSD-3-Clause */ import QtQuick 2.0 @@ -175,7 +177,8 @@ AccountCredentialsAgent { var clientId = _valueFromServiceConfig(config, "auth/oauth2/web_server/ClientId") var clientSecret = _valueFromServiceConfig(config, "auth/oauth2/web_server/ClientSecret") if (clientId.length === 0 || clientSecret.length === 0) { - credentialsUpdateError("Missing Mastodon OAuth client credentials") + //% "Missing Mastodon OAuth client credentials" + credentialsUpdateError(qsTrId("settings-accounts-mastodon-la-missing_client_credentials")) return } diff --git a/settings/accounts/ui/mastodon.qml b/settings/accounts/ui/mastodon.qml index e7cf255..a4bd512 100644 --- a/settings/accounts/ui/mastodon.qml +++ b/settings/accounts/ui/mastodon.qml @@ -1,5 +1,7 @@ /* - * Copyright (C) 2013-2026 Jolla Ltd. + * SPDX-FileCopyrightText: 2013 - 2026 Jolla Ltd. + * + * SPDX-License-Identifier: BSD-3-Clause */ import QtQuick 2.0 @@ -366,12 +368,13 @@ AccountCreationAgent { function configure() { hasConfigured = true - var services = ["mastodon-microblog", "mastodon-sharing"] + var services = ["mastodon-microblog", "mastodon-notifications", "mastodon-sharing"] var providerDisplayName = root.accountProvider && root.accountProvider.displayName ? root.accountProvider.displayName.toString().trim() : "" if (providerDisplayName.length === 0) { - providerDisplayName = "Mastodon" + //% "Mastodon" + providerDisplayName = qsTrId("settings-accounts-mastodon-la-provider_name") } newAccount.displayName = providerDisplayName |
