diff options
| author | Andrew Branson <andrew.branson@jolla.com> | 2026-02-10 21:14:11 +0100 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@jolla.com> | 2026-02-10 22:09:19 +0100 |
| commit | da91be4961962536c7ff021ec97674996a1cb8d0 (patch) | |
| tree | 04fef71468c3ba3611701eed57e163172aefc453 /settings | |
| parent | 0b9869b23af94f1935839568d62fa7b849f9e5d0 (diff) | |
translation
Diffstat (limited to 'settings')
| -rw-r--r-- | settings/accounts/ui/MastodonSettingsDisplay.qml | 7 | ||||
| -rw-r--r-- | settings/accounts/ui/mastodon-settings.qml | 16 | ||||
| -rw-r--r-- | settings/accounts/ui/mastodon.qml | 52 |
3 files changed, 62 insertions, 13 deletions
diff --git a/settings/accounts/ui/MastodonSettingsDisplay.qml b/settings/accounts/ui/MastodonSettingsDisplay.qml index be79e3a..a9e2c5a 100644 --- a/settings/accounts/ui/MastodonSettingsDisplay.qml +++ b/settings/accounts/ui/MastodonSettingsDisplay.qml @@ -28,6 +28,13 @@ StandardAccountSettingsDisplay { syncServicesRepeater.model = syncServices otherServicesDisplay.serviceModel = otherServices + var credentialsUserName = root.account.defaultCredentialsUserName + ? root.account.defaultCredentialsUserName.toString().trim() + : "" + if (credentialsUserName.length > 0 && root.account.displayName !== credentialsUserName) { + root.account.displayName = credentialsUserName + } + var autoSync = root.account.configurationValues("")["FeedViewAutoSync"] var isNewAccount = root.autoEnableAccount eventsSyncSwitch.checked = (isNewAccount || autoSync === true) diff --git a/settings/accounts/ui/mastodon-settings.qml b/settings/accounts/ui/mastodon-settings.qml index ae79ce4..630f51d 100644 --- a/settings/accounts/ui/mastodon-settings.qml +++ b/settings/accounts/ui/mastodon-settings.qml @@ -6,6 +6,21 @@ import com.jolla.settings.accounts 1.0 AccountSettingsAgent { id: root + property string accountSubtitle: { + var credentialsUserName = account.defaultCredentialsUserName + ? account.defaultCredentialsUserName.toString().trim() + : "" + if (credentialsUserName.length > 0) { + return credentialsUserName + } + return account.displayName + } + + Account { + id: account + identifier: root.accountId + } + initialPage: Page { onPageContainerChanged: { if (pageContainer == null && !credentialsUpdater.running) { @@ -46,6 +61,7 @@ AccountSettingsAgent { PageHeader { id: header title: root.accountsHeaderText + description: root.accountSubtitle } MastodonSettingsDisplay { diff --git a/settings/accounts/ui/mastodon.qml b/settings/accounts/ui/mastodon.qml index a789459..736e82e 100644 --- a/settings/accounts/ui/mastodon.qml +++ b/settings/accounts/ui/mastodon.qml @@ -76,7 +76,8 @@ AccountCreationAgent { } if (xhr.status < 200 || xhr.status >= 300) { - _showRegistrationError("Failed to register Mastodon app for " + apiHost, busyPage) + //% "Failed to register Mastodon app for %1" + _showRegistrationError(qsTrId("settings-accounts-mastodon-la-register_app_failed").arg(apiHost), busyPage) return } @@ -84,12 +85,14 @@ AccountCreationAgent { try { response = JSON.parse(xhr.responseText) } catch (err) { - _showRegistrationError("Invalid Mastodon app registration response", busyPage) + //% "Invalid Mastodon app registration response" + _showRegistrationError(qsTrId("settings-accounts-mastodon-la-invalid_app_registration_response"), busyPage) return } if (!response.client_id || !response.client_secret) { - _showRegistrationError("Mastodon app registration did not return credentials", busyPage) + //% "Mastodon app registration did not return credentials" + _showRegistrationError(qsTrId("settings-accounts-mastodon-la-app_registration_missing_credentials"), busyPage) return } @@ -102,7 +105,8 @@ AccountCreationAgent { } var postData = [] - postData.push("client_name=" + encodeURIComponent("Sailfish Mastodon")) + //% "Sailfish Mastodon" + postData.push("client_name=" + encodeURIComponent(qsTrId("settings-accounts-mastodon-la-client_name"))) postData.push("redirect_uris=" + encodeURIComponent(callbackUri)) postData.push("scopes=" + encodeURIComponent("read write")) postData.push("website=" + encodeURIComponent("https://sailfishos.org")) @@ -126,7 +130,8 @@ AccountCreationAgent { _goToSettings(accountId) }) _accountSetup.error.connect(function() { - accountCreationError("Failed to finish Mastodon account setup") + //% "Failed to finish Mastodon account setup" + accountCreationError(qsTrId("settings-accounts-mastodon-la-account_setup_failed")) }) } @@ -154,7 +159,7 @@ AccountCreationAgent { DialogHeader { id: header //% "Sign in" - acceptText: qsTrId("settings_accounts-common-bt-sign_in") + acceptText: qsTrId("settings-accounts-common-bt-sign_in") } Column { @@ -163,19 +168,34 @@ AccountCreationAgent { spacing: Theme.paddingLarge width: parent.width - Label { + Row { x: Theme.horizontalPageMargin width: parent.width - x * 2 - wrapMode: Text.Wrap - color: Theme.highlightColor - text: "Enter your Mastodon server, then sign in." + spacing: Theme.paddingMedium + + Icon { + id: promptIcon + width: Theme.iconSizeMedium + height: Theme.iconSizeMedium + source: "image://theme/icon-l-mastodon" + } + + //: Prompt shown in account setup before OAuth sign-in. + Label { + width: parent.width - promptIcon.width - parent.spacing + wrapMode: Text.Wrap + color: Theme.highlightColor + //% "Enter your Mastodon server, then sign in." + text: qsTrId("settings-accounts-mastodon-la-enter_server_then_sign_in") + } } TextField { id: instanceField x: Theme.horizontalPageMargin width: parent.width - x * 2 - label: "Server" + //% "Server" + label: qsTrId("settings-accounts-mastodon-la-server") placeholderText: "mastodon.social" inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhUrlCharactersOnly EnterKey.iconSource: "image://theme/icon-m-enter-next" @@ -191,7 +211,8 @@ AccountCreationAgent { Component { id: busyComponent AccountBusyPage { - busyDescription: "Preparing Mastodon sign-in..." + //% "Preparing Mastodon sign-in..." + busyDescription: qsTrId("settings-accounts-mastodon-la-preparing_sign_in") onStatusChanged: { if (status === PageStatus.Active && root._pendingApiHost.length > 0) { root._registerClientApplication(root._pendingApiHost, this) @@ -264,8 +285,13 @@ AccountCreationAgent { hasConfigured = true var services = ["mastodon-microblog", "mastodon-sharing"] + var credentialsUserName = newAccount.defaultCredentialsUserName + ? newAccount.defaultCredentialsUserName.toString().trim() + : "" var providerDisplayName = root._displayName(apiHost) - if (providerDisplayName.length > 0) { + if (credentialsUserName.length > 0) { + newAccount.displayName = credentialsUserName + } else if (providerDisplayName.length > 0) { newAccount.displayName = providerDisplayName } |
