ContactsView.qml 3.19 KB
Newer Older
Camilo higuita's avatar
Camilo higuita committed
1 2 3
import QtQuick 2.9
import QtQuick.Controls 2.3
import org.kde.mauikit 1.0 as Maui
4
import UnionModels 1.0
Camilo higuita's avatar
Camilo higuita committed
5 6 7 8 9 10 11

Maui.Page
{
    id: control

    colorScheme.accentColor: "#615f7d"

Camilo higuita's avatar
Camilo higuita committed
12 13
    property alias list : _contactsList

14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
    //    floatingBar: true
    //    footBarMargins: space.huge
    //    footBarAligment: Qt.AlignRight
    //    footBar.middleContent: Maui.ToolButton
    //    {
    //        iconName: "list-add-user"
    //        iconColor: "white"
    //        onClicked: _contactDialog.open()
    //    }

    //    footBar.colorScheme.backgroundColor: control.colorScheme.accentColor
    //    footBar.colorScheme.borderColor: Qt.darker(control.colorScheme.accentColor, 1.4)
    headBar.visible: false
    footBar.drawBorder: false
    footBar.floating: false
Camilo higuita's avatar
Camilo higuita committed
29
    footBar.implicitHeight: toolBarHeight * 1.5
30 31

    footBar.leftContent: [
Camilo higuita's avatar
Camilo higuita committed
32
        Maui.ToolButton
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
        {
            iconName: "list-add-user"
            onClicked: _newContactDialog.open()
            //        height: _searchField.height
            //        width: height
            text: qsTr("New")
            //        display: ToolButton.TextUnderIcon


            //                background: Rectangle
            //                {
            //                    color: "#615f7d"
            //                    radius: radiusV
            //                    border.color: Qt.darker("#615f7d", 1.3)
            //                }
        }
    ]

    footBar.rightContent: [

Camilo higuita's avatar
Camilo higuita committed
53
        Maui.ToolButton
54 55 56 57
        {
            iconName: "view-sort"
            text: qsTr("Sort")
        }
Camilo higuita's avatar
Camilo higuita committed
58 59
    ]

60 61 62 63 64 65 66 67
    footBar.middleContent: Maui.TextField
    {
        id: _searchField
        width: footBar.middleLayout.width * 0.7
        //        height: rowHeight
        placeholderText: qsTr("Search contacts... ")
    }

68 69 70 71 72 73 74 75 76 77 78
    BaseModel
    {
        id: _contactsModel
        list: _contactsList
    }

    ContactsList
    {
        id: _contactsList
    }

Camilo higuita's avatar
Camilo higuita committed
79 80 81 82 83 84
    content: ListView
    {
        id: _listView
        anchors.fill: parent
        spacing: space.big

85 86 87 88
        section.property: "n"
        section.criteria: ViewSection.FirstCharacter
        section.labelPositioning: ViewSection.InlineLabels
        section.delegate: Maui.LabelDelegate
Camilo higuita's avatar
Camilo higuita committed
89
        {
90 91 92
            label: section
            isSection: true
            boldLabel: true
93 94 95
            //            colorScheme.backgroundColor: "#333"
            //            colorScheme.textColor: "#fafafa"
            //            width: iconSize
96

97 98 99 100
            //            background: Rectangle
            //            {
            //                color:  colorScheme.backgroundColor
            //                radius: radiusV
101

102
            //            }
103

Camilo higuita's avatar
Camilo higuita committed
104 105 106

        }

107
        model: _contactsModel
Camilo higuita's avatar
Camilo higuita committed
108 109 110 111 112 113 114 115 116 117 118
        delegate: ContactDelegate
        {
            id: _delegate

            height: unit * 80
            width: isWide ? control.width * 0.8 : control.width * 0.95
            anchors.horizontalCenter: parent.horizontalCenter

            Connections
            {
                target: _delegate
Camilo higuita's avatar
Camilo higuita committed
119 120 121
                onClicked:
                {
                    _listView.currentIndex = index
Camilo higuita's avatar
Camilo higuita committed
122
                    _contactDialog.show(list.get(index))
Camilo higuita's avatar
Camilo higuita committed
123
                }
Camilo higuita's avatar
Camilo higuita committed
124 125 126 127
            }
        }
    }
}