ActivitiesView.qml 2.98 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*   vim:set foldenable foldmethod=marker:
 *
 *   Copyright (C) 2015 Ivan Cukic <ivan.cukic@kde.org>
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License version 2,
 *   or (at your option) any later version, as published by the Free
 *   Software Foundation
 *
 *   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 General Public License for more details
 *
 *   You should have received a copy of the GNU 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.
 */

21
22
23
import QtQuick 2.5
import QtQuick.Controls 2.5 as QQC2
import QtQuick.Layouts 1.0
24
25
26

import org.kde.activities 0.1 as Activities
import org.kde.activities.settings 0.1
27
import org.kde.kirigami 2.5 as Kirigami
28

29
ColumnLayout {
30
31
    id: root

32
33
34
35
    QQC2.ScrollView {
        Layout.fillHeight: true
        Layout.fillWidth: true
        Component.onCompleted: background.visible = true;
36
37

        ListView {
38
            id: activitiesList
39
40
41
42
43

            model: Activities.ActivityModel {
                id: kactivities
            }

44
45
            delegate: Kirigami.SwipeListItem {
                hoverEnabled: true
46

47
48
                contentItem: RowLayout {
                    id: row
49

50
                    Kirigami.Icon {
51
                        id: icon
52
53
54
                        height: Kirigami.Units.iconSizes.medium
                        width: height
                        source: model.icon
55
56
                        sourceSize.width: model.icon.width
                        sourceSize.height: model.icon.height
57
58
                    }

59
60
                    QQC2.Label {
                        Layout.fillWidth: true
61
62
63
64
                        text: model.name
                    }
                }

65
66
67
                actions: [
                    Kirigami.Action {
                        icon.name: "configure"
Pino Toscano's avatar
Pino Toscano committed
68
                        tooltip: i18nc("@info:tooltip", "Configure %1 activity", model.name)
69
70
71
72
73
74
                        onTriggered: ActivitySettings.configureActivity(model.id);
                    },
                    Kirigami.Action {
                        visible: ActivitySettings.newActivityAuthorized
                        enabled:  activitiesList.count > 1
                        icon.name: "edit-delete"
Pino Toscano's avatar
Pino Toscano committed
75
                        tooltip: i18nc("@info:tooltip", "Delete %1 activity", model.name)
76
                        onTriggered: ActivitySettings.deleteActivity(model.id);
77
                    }
78
                ]
79
80
81
            }
        }
    }
82
83
84
85
86
87
88
89

    QQC2.Button {
        id: buttonCreateActivity
        visible: ActivitySettings.newActivityAuthorized
        text: i18nd("kcm_activities5", "Create New...")
        icon.name: "list-add"
        onClicked: ActivitySettings.newActivity();
    }
90
}