import QtQuick 2.0 import QtQuick.Dialogs 1.2 import QtQuick.Controls 1.4 import QtQml.Models 2.1 import "qrc:/js/service.js" as Service import "qrc:/js/helper.js" as Helperjs Rectangle{ id:permissionDialog width: 80*mm height:root.height/3 Text{ x:0.5*mm y:0.5*mm text: "Contacts" } ListView { id: contactView x:0.5*mm y:5.5*mm width: 39*mm height:permissionDialog.height-14*mm clip: true spacing: 0 model: contactModel delegate: contactItem } ListModel{id: contactModel} Component{ id:contactItem Rectangle{ id:contactitemRect width:contactView.width height: 5*mm property string contactstatus:"" color: "light blue" border.color:"grey" Text{ color:"grey" text:contact.screen_name } onContactstatusChanged: { if(contactstatus=="positive"){contactsitemRect.color="green"} else if (contactstatus=="negative"){contactsitemRect.color= "red"} else{contactsitemRect.color= "white"}} MouseArea{ anchors.fill: parent} } } Text{ x:20*mm y:0.5*mm text: "Groups" } ListView { id: groupView x:20*mm y:5.5*mm width: 19*mm height:permissionDialog-8*mm clip: true spacing: 0 model: groupModel delegate: groupItem } ListModel{id: groupModel} Component{ id:groupItem Rectangle{ id:groupitemRect width:groupView.width height: 5*mm property string groupstatus:"" color: "white" border.color:"grey" Text{ color:"grey" text:group.groupname } onGroupstatusChanged: { if(groupstatus=="positive"){groupitemRect.color="green"} else if (groupstatus=="negative"){groupitemRect.color= "red"} else{groupitemRect.color= "white"}} MouseArea{ anchors.fill: parent onClicked:{ if(groupModel.get(index).groupstatus=="neutral"){ groupModel.setProperty(index,"groupstatus","positive")} else if (groupModel.get(index).groupstatus=="positive"){ groupModel.setProperty(index,"groupstatus","negative")} else{groupModel.setProperty(index,"groupstatus","neutral")} }} } } Button{ anchors.horizontalCenter: parent.hoizontalCenter anchors.bottom: parent.bottom anchors.bottomMargin:1 text:qsTr("Done") onClicked:{var group_allow=[]; for (var i=0;i