AddContactPage.qml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. import QtQuick 1.1
  2. MyPage {
  3. id: addContactPage
  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: addContactPage.width - flickArea.anchors.rightMargin - flickArea.anchors.leftMargin
  16. spacing: 10
  17. Item {
  18. id: spacer1
  19. height: 30
  20. width: addContactPage.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/contact_add.png"
  29. }
  30. Text {
  31. id: txtAddContact
  32. anchors.verticalCenter: parent.verticalCenter
  33. text: qsTr("Adding contact:")
  34. font.pixelSize: 32
  35. }
  36. }
  37. Item {
  38. id: spacer11
  39. height: 20
  40. width: addContactPage.width
  41. }
  42. Text {
  43. id: txtJid
  44. anchors.horizontalCenter: parent.horizontalCenter
  45. text: qsTr("Jid:")
  46. font.pixelSize: 28
  47. }
  48. Text {
  49. id: txtJidExample
  50. anchors.horizontalCenter: parent.horizontalCenter
  51. text: qsTr("Example: login@server.com")
  52. color: "gray"
  53. font.pixelSize: 18
  54. font.italic: true
  55. }
  56. MyTextInput {
  57. id: tiJid
  58. anchors.horizontalCenter: parent.horizontalCenter
  59. height: 50
  60. width: parent.width
  61. }
  62. Item {
  63. id: spacer2
  64. height: 10
  65. width: addContactPage.width
  66. }
  67. Text {
  68. id: txtNickname
  69. anchors.horizontalCenter: parent.horizontalCenter
  70. text: qsTr("Nickname (optional):")
  71. font.pixelSize: 28
  72. }
  73. MyTextInput {
  74. id: tiNickname
  75. anchors.horizontalCenter: parent.horizontalCenter
  76. height: 50
  77. width: parent.width
  78. font.pixelSize: 28
  79. }
  80. Item {
  81. id: spacer3
  82. height: 10
  83. width: addContactPage.width
  84. }
  85. MyCheckBox {
  86. id: checkBoxAuth
  87. text: qsTr("Request authorization")
  88. }
  89. Item {
  90. height: 10
  91. width: addContactPage.width
  92. }
  93. Item {
  94. id: spacer6
  95. height: 5
  96. width: addContactPage.width
  97. }
  98. }
  99. }
  100. /******************************************/
  101. ToolBar {
  102. id: toolBar
  103. ToolButton {
  104. id: toolBarButtonRoster
  105. icon: "qrc:/qml/images/bar_options.png"
  106. anchors.left: parent.left
  107. anchors.leftMargin: (0.5*(parent.width/4) - 0.5*toolBarButtonRoster.width)
  108. onClicked: {
  109. addContactPage.closePage( "qrc:/qml/RosterPage.qml" )
  110. }
  111. pauseAnim: 500
  112. }
  113. ToolButton {
  114. id: toolBarButtonOptions
  115. icon: "qrc:/qml/images/bar_ok.png"
  116. anchors.left: parent.left
  117. anchors.leftMargin: (3.5*(parent.width/4) - 0.5*toolBarButtonOptions.width)
  118. onClicked: {
  119. if( tiJid.text != "" ) {
  120. var sendSubcribe = false
  121. if( checkBoxAuth.checked ) { sendSubcribe = true }
  122. xmppClient.addContact( tiJid.text, tiNickname.text, "", sendSubcribe )
  123. addContactPage.closePage( "qrc:/qml/RosterPage.qml" )
  124. }
  125. }
  126. pauseAnim: 600
  127. }
  128. }
  129. }