diff --git a/src/kcm/package/contents/ui/AccountDetails.qml b/src/kcm/package/contents/ui/AccountDetails.qml index 826318a..28ea84d 100644 --- a/src/kcm/package/contents/ui/AccountDetails.qml +++ b/src/kcm/package/contents/ui/AccountDetails.qml @@ -1,139 +1,141 @@ /* * Copyright 2019 Nicolas Fella * Copyright 2020 Dan Leinir Turthra Jensen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import QtQuick 2.7 -import QtQuick.Layouts 1.11 -import QtQuick.Controls 2.0 as Controls +import QtQuick 2.12 +import QtQuick.Controls 2.12 as Controls +import QtQuick.Layouts 1.12 + import org.kde.kirigami 2.4 as Kirigami -import org.kde.kaccounts 1.2 as KAccounts import org.kde.kcm 1.2 +import org.kde.kaccounts 1.2 as KAccounts + SimpleKCM { id: component; title: i18n("Account Details") property alias model: servicesList.model RemoveAccountDialog { id: accountRemover parent: component accountId: servicesList.model.accountId displayName: servicesList.model.accountDisplayName providerName: servicesList.model.accountProviderName onAccountRemoved: kcm.pop() } RenameAccountDialog { id: accountRenamer parent: component accountId: servicesList.model.accountId currentDisplayName: servicesList.model.accountDisplayName } Component { id: serviceToggleJob KAccounts.AccountServiceToggleJob { } } header: RowLayout { Layout.fillWidth: true Layout.margins: Kirigami.Units.smallSpacing spacing: Kirigami.Units.smallSpacing Kirigami.Icon { source: model.accountIconName Layout.preferredWidth: Kirigami.Units.iconSizes.large Layout.preferredHeight: Kirigami.Units.iconSizes.large } Controls.Label { Layout.fillWidth: true text: { if (model.accountDisplayName.length > 0 && model.accountProviderName.length > 0) { return i18n("%1 (%2)", model.accountDisplayName, model.accountProviderName) } else if (model.accountDisplayName.length > 0) { return model.accountDisplayName } else { return i18n("%1 account", model.accountProviderName) } } } Controls.ToolButton { icon.name: "edit-entry" display: Controls.AbstractButton.IconOnly Layout.preferredHeight: Kirigami.Units.iconSizes.large Layout.preferredWidth: Kirigami.Units.iconSizes.large onClicked: accountRenamer.open(); Controls.ToolTip { visible: parent.hovered && !parent.pressed text: i18nc("Button which spawns a dialog allowing the user to change the displayed account's human-readable name", "Change Account Display Name") delay: Kirigami.Units.toolTipDelay timeout: 5000 y: parent.height } } } footer: RowLayout { Controls.Button { Layout.alignment: Qt.AlignRight text: i18n("Remove This Account") icon.name: "edit-delete-remove" onClicked: accountRemover.open(); } } Kirigami.FormLayout { Layout.fillWidth: true Layout.margins: Kirigami.Units.largeSpacing Controls.Label { visible: servicesList.count === 0 Layout.fillWidth: true height: component.height / 3 enabled: false verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter wrapMode: Text.Wrap text: i18nc("A text shown when an account has no configurable services", "There are no configurable services available for this account. You can still change its display name by clicking the edit icon above.") } Kirigami.Separator { visible: servicesList.count > 0 Kirigami.FormData.label: i18nc("Heading for a list of services available with this account", "Use This Account For") Kirigami.FormData.isSection: true } Repeater { id: servicesList delegate: Controls.CheckBox { id: serviceCheck Kirigami.FormData.label: model.description checked: model.enabled text: model.displayName Binding { target: serviceCheck property: "checked" value: model.enabled } onClicked: { var job = serviceToggleJob.createObject(component, { "accountId": servicesList.model.accountId, "serviceId": model.name, "serviceEnabled": !model.enabled }) job.start() } } } } } diff --git a/src/kcm/package/contents/ui/Accounts.qml b/src/kcm/package/contents/ui/Accounts.qml index a67bd4d..f97e5ff 100644 --- a/src/kcm/package/contents/ui/Accounts.qml +++ b/src/kcm/package/contents/ui/Accounts.qml @@ -1,104 +1,102 @@ /* * Copyright 2015 Martin Klapetek * Copyright 2020 Dan Leinir Turthra Jensen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - - -import QtQuick 2.7 -import QtQuick.Layouts 1.11 -import QtQuick.Controls 2.0 as Controls +import QtQuick 2.12 +import QtQuick.Controls 2.12 as Controls +import QtQuick.Layouts 1.12 import org.kde.kirigami 2.7 as Kirigami +import org.kde.kcm 1.2 import org.kde.kaccounts 1.2 as KAccounts -import org.kde.kcm 1.2 ScrollViewKCM { id: kaccountsRoot // Existing accounts view: ListView { model: KAccounts.AccountsModel { } delegate: Kirigami.SwipeListItem { id: accountDelegate width: ListView.view.width contentItem: RowLayout { implicitWidth: accountDelegate.ListView.view.width implicitHeight: Kirigami.Units.iconSizes.large + Kirigami.Units.smallSpacing * 2 spacing: Kirigami.Units.smallSpacing Kirigami.Icon { source: model.iconName Layout.preferredWidth: Kirigami.Units.iconSizes.large Layout.preferredHeight: Kirigami.Units.iconSizes.large } Controls.Label { Layout.fillWidth: true text: { if (model.displayName.length > 0 && model.providerName.length > 0) { return i18n("%1 (%2)", model.displayName, model.providerName) } else if (model.displayName.length > 0) { return model.displayName } else { return i18n("%1 account", model.providerName) } } } } actions: [ Kirigami.Action { text: i18nc("Tooltip for an action which will offer the user to remove the mentioned account", "Remove %1", accountDelegate.contentItem.text) iconName: "edit-delete-remove" onTriggered: { accountRemover.accountId = model.id; accountRemover.displayName = model.displayName; accountRemover.providerName = model.providerName; accountRemover.open(); } } ] onClicked: kcm.push("AccountDetails.qml", {model: model.services}) } Controls.Label { visible: view.count === 0 anchors.fill: parent clip: true enabled: false horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter wrapMode: Text.Wrap text: i18nc("A text shown when a user has not yet added any accounts", "You have not added any accounts yet.\n\nClick on \"Add New Account...\" below to do so.") } } RemoveAccountDialog { id: accountRemover parent: kaccountsRoot } footer: RowLayout { Controls.Button { Layout.alignment: Qt.AlignRight text: i18n("Add New Account...") icon.name: "contact-new" onClicked: kcm.push("AvailableAccounts.qml") } } } diff --git a/src/kcm/package/contents/ui/AvailableAccounts.qml b/src/kcm/package/contents/ui/AvailableAccounts.qml index ac1671a..1079c62 100644 --- a/src/kcm/package/contents/ui/AvailableAccounts.qml +++ b/src/kcm/package/contents/ui/AvailableAccounts.qml @@ -1,91 +1,93 @@ /* * Copyright 2019 Nicolas Fella * Copyright 2020 Dan Leinir Turthra Jensen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import QtQuick 2.7 -import QtQuick.Layouts 1.11 -import QtQuick.Controls 2.0 as Controls +import QtQuick 2.12 +import QtQuick.Controls 2.12 as Controls +import QtQuick.Layouts 1.12 + import org.kde.kirigami 2.4 as Kirigami -import org.kde.kaccounts 1.2 as KAccounts import org.kde.kcm 1.2 +import org.kde.kaccounts 1.2 as KAccounts + ScrollViewKCM { id: root title: i18n("Add New Account") view: ListView { model: KAccounts.ProvidersModel {} delegate: Kirigami.AbstractListItem { id: accountDelegate width: ListView.view.width enabled: model.supportsMultipleAccounts === true || model.accountsCount === 0 contentItem: RowLayout { implicitWidth: accountDelegate.ListView.view.width implicitHeight: Kirigami.Units.iconSizes.large + Kirigami.Units.smallSpacing * 2 spacing: Kirigami.Units.smallSpacing Kirigami.Icon { source: model.iconName Layout.preferredWidth: Kirigami.Units.iconSizes.large Layout.preferredHeight: Kirigami.Units.iconSizes.large Item { visible: model.accountsCount > 0 anchors { bottom: parent.bottom right: parent.right } height: parent.height / 3 width: height Rectangle { anchors.fill: parent radius: height / 2 color: Kirigami.Theme.highlightColor border { width: 1 color: Kirigami.Theme.highlightedTextColor } } Controls.Label { anchors.fill: parent horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter color: Kirigami.Theme.highlightedTextColor text: model.accountsCount } } } Controls.Label { Layout.fillWidth: true text: model.displayName + "\n" + model.description; } } onClicked: { var job = jobComponent.createObject(root, { "providerName": model.name }) job.start() } } } Component { id: jobComponent KAccounts.CreateAccountJob { onFinished: kcm.pop() } } } diff --git a/src/kcm/package/contents/ui/MessageBoxSheet.qml b/src/kcm/package/contents/ui/MessageBoxSheet.qml index 2190e7a..e2d646c 100644 --- a/src/kcm/package/contents/ui/MessageBoxSheet.qml +++ b/src/kcm/package/contents/ui/MessageBoxSheet.qml @@ -1,58 +1,58 @@ /* * Copyright 2020 Dan Leinir Turthra Jensen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import QtQuick 2.7 -import QtQuick.Controls 2.11 as QtControls -import QtQuick.Layouts 1.11 as QtLayouts +import QtQuick 2.12 +import QtQuick.Controls 2.12 as QtControls +import QtQuick.Layouts 1.12 as QtLayouts import org.kde.kirigami 2.7 as Kirigami Kirigami.OverlaySheet { id: component property alias title: headerLabel.text property alias text: messageLabel.text property list actions showCloseButton: true header: Kirigami.Heading { id: headerLabel QtLayouts.Layout.fillWidth: true elide: Text.ElideRight } contentItem: QtControls.Label { id: messageLabel QtLayouts.Layout.preferredWidth: Kirigami.Units.gridUnit * 10 QtLayouts.Layout.margins: Kirigami.Units.largeSpacing wrapMode: Text.Wrap } footer: QtLayouts.RowLayout { Item { QtLayouts.Layout.fillWidth: true } Repeater { model: component.actions; QtControls.Button { action: modelData Connections { target: action onTriggered: component.close() } } } } } diff --git a/src/kcm/package/contents/ui/RemoveAccountDialog.qml b/src/kcm/package/contents/ui/RemoveAccountDialog.qml index 5599396..078367a 100644 --- a/src/kcm/package/contents/ui/RemoveAccountDialog.qml +++ b/src/kcm/package/contents/ui/RemoveAccountDialog.qml @@ -1,58 +1,58 @@ /* * Copyright 2020 Dan Leinir Turthra Jensen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import QtQuick 2.7 -import QtQuick.Layouts 1.11 +import QtQuick 2.12 +import QtQuick.Layouts 1.12 import org.kde.kirigami 2.7 as Kirigami import org.kde.kaccounts 1.2 as KAccounts MessageBoxSheet { id: component property int accountId property string displayName property string providerName signal accountRemoved() title: i18nc("The title for a dialog which lets you remove an account", "Remove Account?") text: { if (component.displayName.length > 0 && component.providerName.length > 0) { return i18nc("The text for a dialog which lets you remove an account when both provider name and account name are available", "Are you sure you wish to remove the \"%1\" account \"%2\"?", component.providerName, component.displayName) } else if (component.displayName.length > 0) { return i18nc("The text for a dialog which lets you remove an account when only the account name is available", "Are you sure you wish to remove the account \"%1\"?", component.displayName) } else { return i18nc("The text for a dialog which lets you remove an account when only the provider name is available", "Are you sure you wish to remove this \"%1\" account?", component.providerName) } } actions: [ Kirigami.Action { text: i18nc("The label for a button which will cause the removal of a specified account", "Remove Account") onTriggered: { var job = accountRemovalJob.createObject(component, { "accountId": component.accountId }); job.start(); } Component { id: accountRemovalJob KAccounts.RemoveAccountJob { onFinished: component.accountRemoved() } } } ] } diff --git a/src/kcm/package/contents/ui/RenameAccountDialog.qml b/src/kcm/package/contents/ui/RenameAccountDialog.qml index 3c7890d..07fb31b 100644 --- a/src/kcm/package/contents/ui/RenameAccountDialog.qml +++ b/src/kcm/package/contents/ui/RenameAccountDialog.qml @@ -1,63 +1,63 @@ /* * Copyright 2020 Dan Leinir Turthra Jensen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import QtQuick 2.7 -import QtQuick.Layouts 1.11 -import QtQuick.Controls 2.0 as Controls +import QtQuick 2.12 +import QtQuick.Controls 2.12 as Controls +import QtQuick.Layouts 1.12 import org.kde.kirigami 2.7 as Kirigami import org.kde.kaccounts 1.2 as KAccounts MessageBoxSheet { id: component title: i18nc("The title for a dialog which lets you set the human-readable name of an account", "Rename Account") property int accountId property string currentDisplayName signal accountRenamed() onSheetOpenChanged: { if (sheetOpen === true) { newAccountDisplayName.text = component.currentDisplayName; } } contentItem: Kirigami.FormLayout { Layout.preferredWidth: Kirigami.Units.gridUnit * 10 Layout.margins: Kirigami.Units.largeSpacing Controls.TextField { id: newAccountDisplayName Kirigami.FormData.label: i18nc("Label for the text field used to enter a new human-readable name for an account", "Enter the new name of the account") } } actions: [ Kirigami.Action { enabled: newAccountDisplayName.text.length > 0 && newAccountDisplayName.text !== component.currentDisplayName text: i18nc("Text of a button which will cause the human-readable name of an account to be set to a text specified by the user", "Set Account Name") onTriggered: { var job = accountDisplayNameJob.createObject(component, { "accountId": component.accountId, "displayName": newAccountDisplayName.text }) job.start(); } Component { id: accountDisplayNameJob KAccounts.ChangeAccountDisplayNameJob { onFinished: component.accountRenamed() } } } ] }