ContactsView.qml 2.9 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
    property alias list : _contactsList
13
    property alias listView : _listView
Camilo higuita's avatar
Camilo higuita committed
14

15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
    //    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
30
    footBar.implicitHeight: toolBarHeight * 1.5
31 32

    footBar.leftContent: [
Camilo higuita's avatar
Camilo higuita committed
33
        Maui.ToolButton
34 35 36 37
        {
            iconName: "list-add-user"
            onClicked: _newContactDialog.open()
            text: qsTr("New")
Camilo higuita's avatar
Camilo higuita committed
38
            display: ToolButton.TextUnderIcon
39 40 41 42 43
        }
    ]

    footBar.rightContent: [

Camilo higuita's avatar
Camilo higuita committed
44
        Maui.ToolButton
45 46 47
        {
            iconName: "view-sort"
            text: qsTr("Sort")
Camilo higuita's avatar
Camilo higuita committed
48
            display: ToolButton.TextUnderIcon
49
        }
Camilo higuita's avatar
Camilo higuita committed
50 51
    ]

52 53 54 55 56 57 58 59
    footBar.middleContent: Maui.TextField
    {
        id: _searchField
        width: footBar.middleLayout.width * 0.7
        //        height: rowHeight
        placeholderText: qsTr("Search contacts... ")
    }

60 61 62 63 64 65 66 67 68 69 70
    BaseModel
    {
        id: _contactsModel
        list: _contactsList
    }

    ContactsList
    {
        id: _contactsList
    }

Camilo higuita's avatar
Camilo higuita committed
71 72 73 74 75 76
    content: ListView
    {
        id: _listView
        anchors.fill: parent
        spacing: space.big

77 78 79 80
        section.property: "n"
        section.criteria: ViewSection.FirstCharacter
        section.labelPositioning: ViewSection.InlineLabels
        section.delegate: Maui.LabelDelegate
Camilo higuita's avatar
Camilo higuita committed
81
        {
82 83 84
            label: section
            isSection: true
            boldLabel: true
85 86 87
            //            colorScheme.backgroundColor: "#333"
            //            colorScheme.textColor: "#fafafa"
            //            width: iconSize
88

89 90 91 92
            //            background: Rectangle
            //            {
            //                color:  colorScheme.backgroundColor
            //                radius: radiusV
93

94
            //            }
95

Camilo higuita's avatar
Camilo higuita committed
96 97 98

        }

99
        model: _contactsModel
Camilo higuita's avatar
Camilo higuita committed
100 101 102 103 104 105 106 107 108 109 110
        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
111 112 113
                onClicked:
                {
                    _listView.currentIndex = index
Camilo higuita's avatar
Camilo higuita committed
114
                    _contactDialog.show(list.get(index))
Camilo higuita's avatar
Camilo higuita committed
115
                }
Camilo higuita's avatar
Camilo higuita committed
116 117 118 119
            }
        }
    }
}