forked from lubuwest/Friendiqa
Version 0.002 with working Favorite Combobox
This commit is contained in:
parent
42de63fe63
commit
571c9046d0
42 changed files with 1948 additions and 814 deletions
126
v0.002/Develop/source-android/qml/PermissionDialog.qml
Normal file
126
v0.002/Develop/source-android/qml/PermissionDialog.qml
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
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<groupModel.count;i++)
|
||||
{if (groupModel.get(i).groupstatus=="positive"){
|
||||
group_allow.append(groupModel.get(i).groupname)
|
||||
}
|
||||
}
|
||||
print("groups"+JSON.stringify(group_allow))
|
||||
permissionDialog.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted:{
|
||||
print("permissiondialog completed");
|
||||
Helperjs.readData(db,"contacts",login.username,function(contacts){
|
||||
for (var name in contacts){
|
||||
print("contact: "+JSON.stringify(contacts[name]));
|
||||
contactModel.append({"contact":contacts[name]})
|
||||
}},"isFriend",1);
|
||||
|
||||
Helperjs.readData(db,"groups",login.username,function(owngroups){
|
||||
for (var number in owngroups){
|
||||
groupModel.append({"group":owngroup[number]})
|
||||
}});
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue