Changeset View
Changeset View
Standalone View
Standalone View
src/kcm/package/contents/ui/RemoveAccountDialog.qml
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright 2020 Dan Leinir Turthra Jensen <admin@leinir.dk> | ||||
3 | * | ||||
4 | * This program is free software; you can redistribute it and/or modify | ||||
5 | * it under the terms of the GNU Library General Public License as | ||||
6 | * published by the Free Software Foundation; either version 2 or | ||||
7 | * (at your option) any later version. | ||||
8 | * | ||||
9 | * This program is distributed in the hope that it will be useful, | ||||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
12 | * GNU Library General Public License for more details | ||||
13 | * | ||||
14 | * You should have received a copy of the GNU Library General Public | ||||
15 | * License along with this program; if not, write to the | ||||
16 | * Free Software Foundation, Inc., | ||||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||||
18 | */ | ||||
19 | | ||||
20 | import QtQuick 2.12 | ||||
21 | import QtQuick.Layouts 1.12 | ||||
22 | | ||||
23 | import org.kde.kirigami 2.7 as Kirigami | ||||
24 | | ||||
25 | import org.kde.kaccounts 1.2 as KAccounts | ||||
26 | | ||||
27 | MessageBoxSheet { | ||||
28 | id: component | ||||
29 | property int accountId | ||||
30 | property string displayName | ||||
31 | property string providerName | ||||
32 | signal accountRemoved() | ||||
33 | title: i18nc("The title for a dialog which lets you remove an account", "Remove Account?") | ||||
34 | text: { | ||||
35 | if (displayName.length > 0 && providerName.length > 0) { | ||||
36 | 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\"?", providerName, displayName) | ||||
37 | } else if (displayName.length > 0) { | ||||
38 | 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\"?", displayName) | ||||
39 | } else { | ||||
40 | 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?", providerName) | ||||
41 | } | ||||
42 | } | ||||
43 | actions: [ | ||||
44 | Kirigami.Action { | ||||
45 | text: i18nc("The label for a button which will cause the removal of a specified account", "Remove Account") | ||||
46 | onTriggered: { | ||||
47 | var job = accountRemovalJob.createObject(component, { "accountId": component.accountId }); | ||||
48 | job.start(); | ||||
49 | } | ||||
50 | Component { | ||||
51 | id: accountRemovalJob | ||||
52 | KAccounts.RemoveAccountJob { | ||||
53 | onFinished: component.accountRemoved() | ||||
54 | } | ||||
55 | } | ||||
56 | } | ||||
57 | ] | ||||
58 | } |