LogsView.qml 2.57 KB
Newer Older
Camilo higuita's avatar
Camilo higuita committed
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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
import QtQuick 2.9
import QtQuick.Controls 2.3
import org.kde.mauikit 1.0 as Maui
import UnionModels 1.0

import "../contacts"

Maui.Page
{
    id: control
    headBarExit: false
    headBar.visible: false

    colorScheme.accentColor: "#615f7d"
    colorScheme.backgroundColor: backgroundColor
    colorScheme.textColor: textColor

    BaseModel
    {
        id: _contactsModel
        list: _callLogsModel
    }

    CallLogs
    {
        id: _callLogsModel
    }

      ListView
    {
        anchors.fill: parent
        spacing: space.big
        clip: true

        section.property: "date"
        section.criteria: ViewSection.FullString
        section.labelPositioning: ViewSection.InlineLabels
        section.delegate: Maui.LabelDelegate
        {
            label: Maui.FM.formatDate(section, "MM/dd/yyyy", "dd-MM-yyyy HH:mm")
            isSection: true
            boldLabel: true
            //            colorScheme.backgroundColor: "#333"
            //            colorScheme.textColor: "#fafafa"
            //            width: iconSize

            //            background: Rectangle
            //            {
            //                color:  colorScheme.backgroundColor
            //                radius: radiusV

            //            }


        }

        model: _contactsModel
        delegate: ContactDelegate
        {
            id: _delegate

            label1.text: model.n + " / " + model.tel
            label2.text: model.date
            label3.text: model.type

            height: unit * 60
            width: isWide ? control.width * 0.8 : control.width * 0.95
            anchors.horizontalCenter: parent.horizontalCenter
            showMenuIcon: false

            quickButtons: Maui.ToolButton
            {
                iconName: switch (model.type)
                          {
                          case "INCOMING" : return "go-bottom";
                          case "OUTGOING" : return "go-top";
                          case "MISSED" : return "dialog-close";

                          }
            }

            Connections
            {
                target: _delegate
                onClicked:
                {
                    view.currentIndex = index
                    _contactDialog.show(list.get(index))
                }
                onFavClicked:
                {
                    var item = _contactsList.get(index)
                    item["fav"] = item.fav == "1" ? "0" : "1"
                    _contactsList.update(item, index)
                }
            }
        }

        ScrollBar.vertical: ScrollBar {}
    }


}