123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- import QtQuick 1.1
- DialogLiquid {
- id: dlgSubscribes
- height: parent.height*0.5
- property string selectedBareJidSubscribe: ""
- function addBareJid( bareJid )
- {
- if( bareJid != "" ) {
- modelListBareJids.append( { bareJid : bareJid } )
- }
- }
- ListModel {
- id: modelListBareJids
- //ListElement { bareJid: "bareJid1@server1.com" } //as example
- }
- Component {
- id: componentWrapper
- Rectangle {
- id: wrapper
- width: listViewJids.width
- height: 70
- border.color: "gray"
- Text {
- id: txtItem
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: parent.left
- anchors.leftMargin: 20
- text: bareJid
- font.pixelSize: 28
- }
- MouseArea {
- id: mouseAreaItem;
- anchors.fill: parent
- onClicked: {
- wrapper.ListView.view.currentIndex = index
- selectedBareJidSubscribe = bareJid
- }
- }
- Component.onCompleted: {
- if( index == 0 ) {
- selectedBareJidSubscribe = bareJid
- //console.log("*** selected: " + selectedBareJidSubscribe)
- }
- }
- states: State {
- name: "Current"
- when: wrapper.ListView.isCurrentItem
- PropertyChanges { target: wrapper; color: "lightblue" }
- }
- }
- }
- Rectangle {
- id: headerDlg
- anchors.top: parent.top
- anchors.left: parent.left
- width: parent.width
- height: 70
- gradient: Gradient {
- GradientStop { position: 0; color: "#919191" }
- GradientStop { position: 1; color: "#666666" }
- }
- Text {
- anchors.centerIn: parent
- font.pixelSize: 22
- color: "white"
- text: qsTr("Authorization requests")
- }
- }
- property int __marg1 : 3
- ListView {
- id: listViewJids
- anchors.top: headerDlg.bottom
- anchors.topMargin: __marg1
- anchors.left: parent.left
- anchors.leftMargin: __marg1
- anchors.bottom: rowOfButtons.top
- anchors.bottomMargin: __marg1
- width: parent.width - __marg1*2
- model: modelListBareJids
- delegate: componentWrapper
- clip: true
- }
- Item {
- id:rowOfButtons
- width: parent.width - 2*__marg1
- height: 80
- anchors.left: parent.left
- anchors.leftMargin: __marg1
- anchors.bottom: parent.bottom
- anchors.bottomMargin: __marg1
- Button {
- id: buttonAccept
- text: qsTr("Accept")
- height: 70
- width: parent.width/2 - 10
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: parent.left
- anchors.leftMargin: 4
- onClicked: {
- var res = xmppClient.acceptSubscribtion( selectedBareJidSubscribe )
- if( res ) {
- for( var j=0; j<modelListBareJids.count; j++ ) {
- var jid = modelListBareJids.get(j).bareJid
- if( jid == selectedBareJidSubscribe ) {
- modelListBareJids.remove(j);
- break;
- }
- }
- } //if(res)
- }
- }
- Button {
- id: buttonReject
- text: qsTr("Reject")
- height: 70
- width: parent.width/2 - 10
- anchors.verticalCenter: parent.verticalCenter
- anchors.right: parent.right
- anchors.rightMargin: 4
- onClicked: {
- var res = xmppClient.rejectSubscribtion( selectedBareJidSubscribe )
- if( res ) {
- for( var j=0; j<modelListBareJids.count; j++ ) {
- var jid = modelListBareJids.get(j).bareJid
- if( jid == selectedBareJidSubscribe ) {
- modelListBareJids.remove(j);
- break;
- }
- }
- } //if(res)
- }
- }
- }
- }
|