DiscoveryPage.qml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. import QtQuick 1.1
  2. MyPage {
  3. id: discoveryPage
  4. Flickable {
  5. id: flickArea
  6. anchors.top: parent.top; anchors.topMargin: 5
  7. anchors.bottom: toolBar.top; anchors.bottomMargin: 5
  8. anchors.left: parent.left; anchors.leftMargin: 10
  9. anchors.right: parent.right; anchors.rightMargin: 10
  10. contentHeight: contentPage.height
  11. contentWidth: contentPage.width
  12. flickableDirection: Flickable.VerticalFlick
  13. Column {
  14. id: contentPage
  15. width: discoveryPage.width - flickArea.anchors.rightMargin - flickArea.anchors.leftMargin
  16. spacing: 10
  17. Item {
  18. id: spacer1
  19. height: 30
  20. width: discoveryPage.width
  21. }
  22. Row {
  23. spacing: 20
  24. anchors.horizontalCenter: parent.horizontalCenter
  25. Image {
  26. id: imgAddContact
  27. anchors.verticalCenter: parent.verticalCenter
  28. source: "qrc:/qml/images/muc.png"
  29. }
  30. Text {
  31. id: txtAddContact
  32. anchors.verticalCenter: parent.verticalCenter
  33. text: qsTr("Multi-user chat:")
  34. font.pixelSize: 32
  35. }
  36. }
  37. Item {
  38. id: spacer11
  39. height: 20
  40. width: discoveryPage.width
  41. }
  42. Text {
  43. id: txtJid
  44. anchors.horizontalCenter: parent.horizontalCenter
  45. text: qsTr("Room:")
  46. font.pixelSize: 28
  47. }
  48. Text {
  49. id: txtJidExample
  50. anchors.horizontalCenter: parent.horizontalCenter
  51. text: qsTr("Example: room@conference.server.com")
  52. color: "gray"
  53. font.pixelSize: 18
  54. font.italic: true
  55. }
  56. MyTextInput2 {
  57. id: tiJid
  58. anchors.horizontalCenter: parent.horizontalCenter
  59. height: 50
  60. width: parent.width
  61. Component.onCompleted: {
  62. if( main.invRoomJid != "" ) {
  63. tiJid.text = main.invRoomJid
  64. }
  65. }
  66. }
  67. Item {
  68. height: 10
  69. width: discoveryPage.width
  70. }
  71. Text {
  72. id: txtNickname
  73. anchors.horizontalCenter: parent.horizontalCenter
  74. text: qsTr("Nickname:")
  75. font.pixelSize: 28
  76. }
  77. MyTextInput2 {
  78. id: tiNickname
  79. anchors.horizontalCenter: parent.horizontalCenter
  80. height: 50
  81. width: parent.width
  82. font.pixelSize: 28
  83. Component.onCompleted: {
  84. if( main.invMyNickName != "" ) {
  85. tiNickname.text = main.invMyNickName
  86. }
  87. }
  88. }
  89. Item {
  90. id: spacer3
  91. height: 10
  92. width: discoveryPage.width
  93. }
  94. Text {
  95. id: txtPassword
  96. anchors.horizontalCenter: parent.horizontalCenter
  97. text: qsTr("Passowrd:")
  98. font.pixelSize: 28
  99. }
  100. MyTextInput2 {
  101. id: tiPassword
  102. anchors.horizontalCenter: parent.horizontalCenter
  103. height: 50
  104. width: parent.width
  105. font.pixelSize: 28
  106. }
  107. Item {
  108. height: 10
  109. width: discoveryPage.width
  110. }
  111. MyCheckBox {
  112. id: cbAddToRoster
  113. text: qsTr("bookmark")
  114. }
  115. Item {
  116. height: 10
  117. width: discoveryPage.width
  118. }
  119. Item {
  120. id: spacer6
  121. height: 5
  122. width: discoveryPage.width
  123. }
  124. }
  125. }
  126. /******************************************/
  127. ToolBar {
  128. id: toolBar
  129. ToolButton {
  130. id: toolBarButtonRoster
  131. icon: "qrc:/qml/images/bar_options.png"
  132. anchors.left: parent.left
  133. anchors.leftMargin: (0.5*(parent.width/4) - 0.5*toolBarButtonRoster.width)
  134. onClicked: {
  135. discoveryPage.closePage( "qrc:/qml/RosterPage.qml" )
  136. }
  137. pauseAnim: 500
  138. }
  139. ToolButton {
  140. id: toolBarButtonOptions
  141. icon: "qrc:/qml/images/bar_ok.png"
  142. anchors.left: parent.left
  143. anchors.leftMargin: (3.5*(parent.width/4) - 0.5*toolBarButtonOptions.width)
  144. onClicked: {
  145. if ( (tiNickname.text != "") && (tiJid.text != "") )
  146. {
  147. muc.nickName = tiNickname.text
  148. if ( tiPassword.text != "" ) {
  149. muc.password = tiPassword.text
  150. }
  151. xmppClient.addMucRoster( tiJid.text, muc.subjectRoom, cbAddToRoster.checked ) //add muc to roster
  152. muc.jidRoom = tiJid.text //enter to muc
  153. discoveryPage.closePage( "qrc:/qml/RosterPage.qml" )
  154. //xmppClient.chatJid = main.invRoomJid
  155. main.invRoomJid = ""
  156. main.invIniterJid = ""
  157. }
  158. }
  159. pauseAnim: 600
  160. }
  161. }
  162. }