File: Services.qml

package info (click to toggle)
kaccounts-providers 4%3A25.04.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,028 kB
  • sloc: cpp: 672; sh: 9; makefile: 3
file content (60 lines) | stat: -rw-r--r-- 1,520 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
 *  SPDX-FileCopyrightText: 2020 Nicolas Fella <nicolas.fella@gmx.de>
 *  SPDX-FileCopyrightText: 2019 Rituka Patwal <ritukapatwal21@gmail.com>
 *  SPDX-FileCopyrightText: 2015 Martin Klapetek <mklapetek@kde.org>
 *
 *  SPDX-License-Identifier: LGPL-2.0-or-later
 */

import QtQuick 2.2
import org.kde.kirigami as Kirigami
import org.kde.kirigami.delegates as KD
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.5

Kirigami.ScrollablePage {
    id: root
    title: i18n("Services")

    property var disabledServices: []

    ListView {
        model: helper.availableServices

        clip: true

        delegate: KD.CheckSubtitleDelegate {
            width: ListView.view.width

            text: modelData.name
            subtitle: modelData.description

            highlighted: pressed || down

            onToggled: {
                if (checked) {
                    const idx = root.disabledServices.indexOf(modelData.id);
                    if (idx > -1) {
                        root.disabledServices.splice(idx, 1);
                    }
                } else {
                    root.disabledServices.push(modelData.id);
                }
            }
        }
    }

    footer: ToolBar {
         RowLayout {
            anchors.fill: parent

            Button {
                text: i18n("Finish")
                Layout.alignment: Qt.AlignRight
                onClicked: {
                    helper.finish(root.disabledServices)
                }
            }
         }
    }
}