Detail.qml 3.17 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/*
 *   Copyright 2018 Fabian Riethmayer
 *
 *   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.2
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.2
import org.kde.kirigami 2.4 as Kirigami
import QtGraphicalEffects 1.0
24
import org.kde.people 1.0 as KPeople
25 26 27 28 29 30

import "lib" as HIG


Flickable  {
    id: root
31
    property string personUri;
32 33
    signal editClicked()

Jonah Brüchert's avatar
Jonah Brüchert committed
34

35 36 37 38 39
    KPeople.PersonData {
        id: personData
        personUri: root.personUri
    }

40 41 42 43 44 45
    HIG.Header {
        id: header
        content.anchors.leftMargin: root.width > 400 ? 100 : Kirigami.Units.largeSpacing
        content.anchors.topMargin: Kirigami.Units.largeSpacing
        content.anchors.bottomMargin: Kirigami.Units.largeSpacing
        //status: root.contentY == 0 ? 1 : Math.min(1, Math.max(2 / 11, 1 - root.contentY / Kirigami.Units.gridUnit))
Jonah Brüchert's avatar
Jonah Brüchert committed
46
        source: personData.person.photo
47 48 49 50 51 52

        stripContent: Row {
            anchors.fill: parent
            spacing: (header.width - 3 * Kirigami.Units.iconSizes.medium) / 4
            anchors.leftMargin: spacing

53
            /*Kirigami.Icon {
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
                source: "favorite"
                width: Kirigami.Units.iconSizes.smallMedium
                height: width
                anchors.verticalCenter: parent.verticalCenter
            }
            Kirigami.Icon {
                source: "document-share"
                width: Kirigami.Units.iconSizes.smallMedium
                height: width
                anchors.verticalCenter: parent.verticalCenter
            }
            Kirigami.Icon {
                source: "document-edit"
                width: Kirigami.Units.iconSizes.smallMedium
                height: width
                anchors.verticalCenter: parent.verticalCenter
                MouseArea {
                    onClicked: root.editClicked()
                    anchors.fill: parent
                }
74
            }*/
75 76 77
        }

        Kirigami.Heading {
Jonah Brüchert's avatar
Jonah Brüchert committed
78
            text: personData.person.name
79 80 81 82 83
            color: "#fcfcfc"
            level: 1
        }
    }

84 85 86 87 88 89
    KPeople.PersonActions {
        id: personActions
        personUri: root.personUri
    }

    ListView {
90
        id: actionsListView
91 92
        anchors.top: header.bottom
        width: parent.width
93 94 95 96 97 98
        model: personActions
        delegate: Kirigami.BasicListItem {
            text: model.display
            icon: model.iconName
            onClicked: personActions.triggerAction(model.action)
            Component.onCompleted: console.log(model.actionType)
99 100 101
        }
    }
}