123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330 |
- import QtQuick 1.1
- import meegim 1.0
- MyPage {
- id: vCardPage
- property string bareJid: ""
- property string nextPage: "qrc:/qml/RosterPage.qml"
- property bool readOnly: true
- property alias vCardPhoto: avatar.source
- property alias vCardNickName: tiNickname.text
- property alias vCardName: tiName.text
- property alias vCardMiddleName: tiMiddlename.text
- property alias vCardLastName: tiLastname.text
- property alias vCardFullName: tiFullName.text
- property alias vCardEmail: tiEmail.text
- property alias vCardBirthday: tiBirthday.text
- property alias vCardUrl: tiUrl.text
- Component.onCompleted: {
- showCurtain( true )
- if( main.requestMyVCard == true ) {
- console.log("QML::VCargPage: 1.Request vCard for: " + xmppClient.myBareJid )
- xmppClient.requestVCard( xmppClient.myBareJid )
- textCurtain.text = xmppClient.myBareJid
- toolBarButtonOptions.visible = true
- main.requestMyVCard = false
- } else {
- console.log("QML::VCargPage: 2.Request vCard for: " + xmppClient.chatJid )
- xmppClient.requestVCard( xmppClient.chatJid )
- textCurtain.text = xmppClient.chatJid
- toolBarButtonOptions.visible = false
- }
- clearForm()
- }
- Connections {
- target: xmppVCard
- onVCardChanged: {
- //console.log( "QML: VCardPage: onVCardChanged: " + xmppVCard.nickname )
- if( xmppVCard.photo != "" ) {
- vCardPhoto = xmppVCard.photo
- }
- vCardNickName = xmppVCard.nickname
- vCardName = xmppVCard.name
- vCardMiddleName = xmppVCard.middlename
- vCardLastName = xmppVCard.lastname
- vCardFullName = xmppVCard.fullname
- vCardEmail = xmppVCard.email
- vCardBirthday = xmppVCard.birthday
- vCardUrl = xmppVCard.url
- bareJid = xmppVCard.jid
- showCurtain( false )
- }
- }
- function showCurtain( isShow ) {
- if( isShow ) {
- curtain.opacity = 0.85
- } else {
- curtain.opacity = 0
- }
- }
- Rectangle {
- id: curtain
- z: 10
- anchors.top: parent.top
- anchors.bottom: toolBar.top
- anchors.left: parent.left
- anchors.right: parent.right
- color: "black"
- opacity: 0
- Behavior on opacity { NumberAnimation { duration: 400 } }
- }
- Column {
- z: curtain.z + 1
- anchors.centerIn: parent
- width: parent.width
- spacing: 5
- Image {
- id: imgVCardRequest
- source: "qrc:/qml/images/vcard.png"
- anchors.horizontalCenter: parent.horizontalCenter
- visible: curtain.opacity != 0 ? true : false
- opacity: curtain.opacity
- }
- Text {
- font.pixelSize: 26
- anchors.horizontalCenter: parent.horizontalCenter
- text: qsTr("Request vCard for")
- color: "white"
- visible: curtain.opacity != 0 ? true : false
- opacity: curtain.opacity
- }
- Text {
- id: textCurtain
- anchors.horizontalCenter: parent.horizontalCenter
- font.pixelSize: 26
- color: "white"
- visible: curtain.opacity != 0 ? true : false
- opacity: curtain.opacity
- }
- }
- function clearForm()
- {
- vCardPhoto = "qrc:/qml/images/avatar.png"
- vCardNickName = ""
- vCardName = ""
- vCardMiddleName = ""
- vCardLastName = ""
- vCardFullName = ""
- vCardEmail = ""
- vCardBirthday = ""
- vCardUrl = ""
- bareJid = ""
- }
- Flickable {
- id: flickArea
- anchors.top: parent.top; anchors.topMargin: 12
- anchors.bottom: toolBar.top; anchors.bottomMargin: 12
- anchors.left: parent.left; anchors.leftMargin: 20
- anchors.right: parent.right; anchors.rightMargin: 20
- contentHeight: columnContent.height
- contentWidth: columnContent.width
- flickableDirection: Flickable.VerticalFlick
- Column {
- id: columnContent
- width: vCardPage.width - flickArea.anchors.rightMargin - flickArea.anchors.leftMargin
- spacing: 10
- Row {
- id: rowAvatarAndJid
- height: avatar.height
- width: columnContent.width
- spacing: 15
- Image {
- id: avatar
- smooth: true
- height: 80
- width: height
- source: "qrc:/qml/images/avatar.png"
- anchors.verticalCenter: parent.verticalCenter
- }
- Text {
- id: txtJid
- text: bareJid
- anchors.verticalCenter: parent.verticalCenter
- font.pixelSize: 28
- }
- }
- Text {
- id: txtNickname
- anchors.horizontalCenter: parent.horizontalCenter
- text: qsTr("Nickname:")
- font.pixelSize: 28
- }
- MyTextInput {
- id: tiNickname
- anchors.horizontalCenter: parent.horizontalCenter
- height: 50
- width: parent.width
- readOnly: vCardPage.readOnly
- __readonlyIsGray: false
- }
- Item { height: 10; width: vCardPage.width }
- Text {
- id: txtName
- anchors.horizontalCenter: parent.horizontalCenter
- text: qsTr("Name:")
- font.pixelSize: 28
- }
- MyTextInput {
- id: tiName
- anchors.horizontalCenter: parent.horizontalCenter
- height: 50
- width: parent.width
- readOnly: vCardPage.readOnly
- __readonlyIsGray: false
- }
- Item { height: 10; width: vCardPage.width }
- Text {
- id: txtLastname
- anchors.horizontalCenter: parent.horizontalCenter
- text: qsTr("Last name:")
- font.pixelSize: 28
- }
- MyTextInput {
- id: tiLastname
- anchors.horizontalCenter: parent.horizontalCenter
- height: 50
- width: parent.width
- readOnly: vCardPage.readOnly
- __readonlyIsGray: false
- }
- Item { height: 10; width: vCardPage.width }
- Text {
- id: txtMiddlename
- anchors.horizontalCenter: parent.horizontalCenter
- text: qsTr("Middle name:")
- font.pixelSize: 28
- }
- MyTextInput {
- id: tiMiddlename
- anchors.horizontalCenter: parent.horizontalCenter
- height: 50
- width: parent.width
- readOnly: vCardPage.readOnly
- __readonlyIsGray: false
- }
- Item { height: 10; width: vCardPage.width }
- Text {
- id: txtFullName
- anchors.horizontalCenter: parent.horizontalCenter
- text: qsTr("Full name:")
- font.pixelSize: 28
- }
- MyTextInput {
- id: tiFullName
- anchors.horizontalCenter: parent.horizontalCenter
- height: 50
- width: parent.width
- readOnly: vCardPage.readOnly
- __readonlyIsGray: false
- }
- Item { height: 10; width: vCardPage.width }
- Text {
- id: txtEmail
- anchors.horizontalCenter: parent.horizontalCenter
- text: qsTr("E-mail:")
- font.pixelSize: 28
- }
- MyTextInput {
- id: tiEmail
- anchors.horizontalCenter: parent.horizontalCenter
- height: 50
- width: parent.width
- readOnly: vCardPage.readOnly
- __readonlyIsGray: false
- }
- Item { height: 10; width: vCardPage.width }
- Text {
- id: txtBirthday
- anchors.horizontalCenter: parent.horizontalCenter
- text: qsTr("Birthday:")
- font.pixelSize: 28
- }
- MyTextInput {
- id: tiBirthday
- anchors.horizontalCenter: parent.horizontalCenter
- height: 50
- width: parent.width
- readOnly: vCardPage.readOnly
- __readonlyIsGray: false
- }
- Item { height: 10; width: vCardPage.width }
- Text {
- id: txtUrl
- anchors.horizontalCenter: parent.horizontalCenter
- text: qsTr("Url:")
- font.pixelSize: 28
- }
- MyTextInput {
- id: tiUrl
- anchors.horizontalCenter: parent.horizontalCenter
- height: 50
- width: parent.width
- readOnly: vCardPage.readOnly
- __readonlyIsGray: false
- }
- Item { height: 10; width: vCardPage.width }
- } // Column
- }
- ToolBar {
- id: toolBar
- ToolButton {
- id: toolBarButtonDialog
- icon: "qrc:/qml/images/bar_roster.png"
- anchors.left: parent.left
- anchors.leftMargin: 30
- onClicked: {
- vCardPage.closePage( vCardPage.nextPage )
- }
- pauseAnim: 500
- }/*
- ToolButton {
- id: toolBarButtonOptions
- icon: "qrc:/qml/images/bar_ok.png"
- anchors.left: parent.left
- anchors.leftMargin: (3.5*(parent.width/4) - 0.5*toolBarButtonOptions.width)
- onClicked: {
- //TODO: Отправка vCard на сервер
- //xmppClient.setMyVCard()
- var objVCard = Qt.createQmlObject("import QtQuick 1.1; import meegim 1.0; XmppVCard {}", parent, "VCardPage.qml: XmppVCard" )
- objVCard.name = "xyxyxy"
- console.log(objVCard.name)
- }
- pauseAnim: 600
- visible: false
- }*/
- }
- }
|