Commit 1d82b30b authored by Dan Leinir Turthra Jensen's avatar Dan Leinir Turthra Jensen 🌈
Browse files

A bit of work on the Account config page

parent 1199fb89
......@@ -32,6 +32,47 @@ SimpleKCM {
property alias model: servicesList.model
MessageBoxSheet {
id: accountRemovalDlg
parent: component
property int accountId
property string displayName
property string providerName
title: i18nc("The title for a dialog which lets you remove an account", "Remove Account?")
text: {
if (accountRemovalDlg.displayName.length > 0 && accountRemovalDlg.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\"?", accountRemovalDlg.providerName, accountRemovalDlg.displayName)
} else if (accountRemovalDlg.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\"?", accountRemovalDlg.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?", accountRemovalDlg.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(kaccountsRoot, { "accountId": accountRemovalDlg.accountId });
job.start();
}
}
]
}
Component {
id: jobComponent
KAccounts.AccountServiceToggle { }
}
Component {
id: accountRemovalJob
KAccounts.RemoveAccount {
onFinished: {
kcm.pop();
}
}
}
header: RowLayout {
Layout.fillWidth: true
Layout.margins: Kirigami.Units.smallSpacing
......@@ -54,7 +95,22 @@ SimpleKCM {
}
}
}
contentItem: Kirigami.FormLayout {
footer: RowLayout {
Controls.Button {
Layout.alignment: Qt.AlignRight
text: i18n("Remove This Account")
icon.name: "edit-delete-remove"
onClicked: {
accountRemovalDlg.accountId = servicesList.model.accountId;
accountRemovalDlg.displayName = servicesList.model.accountDisplayName;
accountRemovalDlg.providerName = servicesList.model.accountProviderName;
accountRemovalDlg.open();
}
}
}
Kirigami.FormLayout {
Layout.fillWidth: true
Item {
visible: servicesList.count === 0
......@@ -92,55 +148,4 @@ SimpleKCM {
}
}
}
footer: RowLayout {
Controls.Button {
Layout.alignment: Qt.AlignRight
text: i18n("Remove This Account")
icon.name: "edit-delete-remove"
onClicked: {
accountRemovalDlg.accountId = servicesList.model.accountId;
accountRemovalDlg.displayName = servicesList.model.accountDisplayName;
accountRemovalDlg.providerName = servicesList.model.accountProviderName;
accountRemovalDlg.open();
}
}
}
Component {
id: jobComponent
KAccounts.AccountServiceToggle { }
}
MessageBoxSheet {
id: accountRemovalDlg
parent: component
property int accountId
property string displayName
property string providerName
title: i18nc("The title for a dialog which lets you remove an account", "Remove Account?")
text: {
if (accountRemovalDlg.displayName.length > 0 && accountRemovalDlg.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\"?", accountRemovalDlg.providerName, accountRemovalDlg.displayName)
} else if (accountRemovalDlg.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\"?", accountRemovalDlg.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?", accountRemovalDlg.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(kaccountsRoot, { "accountId": accountRemovalDlg.accountId });
job.start();
}
}
]
}
Component {
id: accountRemovalJob
KAccounts.RemoveAccount {
onFinished: {
kcm.pop();
}
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment