AccountAddPage.qml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. import QtQuick 1.1
  2. MyPage {
  3. id: accAddPage
  4. onStateChanged: {
  5. if(state == "visible") {
  6. tiJid.text = main.accJid
  7. tiPass.text = main.accPass
  8. tiHost.text = main.accHost
  9. tiPort.text = main.accPort
  10. tiResource.text = main.accResource
  11. checkBoxDefault.setCheck( main.accDefault )
  12. checkBoxHostPort.setCheck( main.accManualHostPort )
  13. }
  14. }
  15. Flickable {
  16. id: flickArea
  17. anchors.top: parent.top; anchors.topMargin: 5
  18. anchors.bottom: toolBar.top; anchors.bottomMargin: 5
  19. anchors.left: parent.left; anchors.leftMargin: 10
  20. anchors.right: parent.right; anchors.rightMargin: 10
  21. contentHeight: contentPage.height
  22. contentWidth: contentPage.width
  23. flickableDirection: Flickable.VerticalFlick
  24. Column {
  25. id: contentPage
  26. width: accAddPage.width - flickArea.anchors.rightMargin - flickArea.anchors.leftMargin
  27. spacing: 10
  28. Item {
  29. id: spacer1
  30. height: 20
  31. width: accAddPage.width
  32. }
  33. Button {
  34. id: buttonTypeAcc
  35. anchors.horizontalCenter: parent.horizontalCenter
  36. height: 80
  37. width: parent.width
  38. text: "XMPP"
  39. onClicked: {
  40. }
  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: accAddPage.width
  66. }
  67. Text {
  68. id: txtPass
  69. anchors.horizontalCenter: parent.horizontalCenter
  70. text: qsTr("Password:")
  71. font.pixelSize: 28
  72. }
  73. MyTextInput {
  74. id: tiPass
  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: accAddPage.width
  84. }
  85. MyCheckBox {
  86. id: checkBoxDefault
  87. text: qsTr("Use default")
  88. }
  89. Item {
  90. height: 10
  91. width: accAddPage.width
  92. }
  93. Text {
  94. id: txtResource
  95. anchors.horizontalCenter: parent.horizontalCenter
  96. text: qsTr("Resource:")
  97. font.pixelSize: 28
  98. }
  99. MyTextInput {
  100. id: tiResource
  101. anchors.horizontalCenter: parent.horizontalCenter
  102. height: 50
  103. width: parent.width
  104. font.pixelSize: 28
  105. }
  106. Item {
  107. id: spacer4
  108. height: 10
  109. width: accAddPage.width
  110. }
  111. MyCheckBox {
  112. id: checkBoxHostPort
  113. text: qsTr("Manually specify server host/port")
  114. font.pixelSize: 22
  115. }
  116. /*Item {
  117. id: spacer4x
  118. height: 5
  119. width: accAddPage.width
  120. }*/
  121. Text {
  122. id: txtHost
  123. anchors.horizontalCenter: parent.horizontalCenter
  124. font.pixelSize: 28
  125. text: qsTr("Server:")
  126. color: checkBoxHostPort.checked ? "black" : "gray"
  127. }
  128. MyTextInput {
  129. id: tiHost
  130. anchors.horizontalCenter: parent.horizontalCenter
  131. height: 50
  132. width: parent.width
  133. readOnly: !checkBoxHostPort.checked
  134. }
  135. Item {
  136. id: spacer5
  137. height: 10
  138. width: accAddPage.width
  139. }
  140. Text {
  141. id: txtPort
  142. anchors.horizontalCenter: parent.horizontalCenter
  143. font.pixelSize: 28
  144. text: qsTr("Port:")
  145. color: checkBoxHostPort.checked ? "black" : "gray"
  146. }
  147. MyTextInput {
  148. id: tiPort
  149. anchors.horizontalCenter: parent.horizontalCenter
  150. height: 50
  151. width: parent.width
  152. readOnly: !checkBoxHostPort.checked
  153. }
  154. Item {
  155. id: spacer6
  156. height: 5
  157. width: accAddPage.width
  158. }
  159. }
  160. }
  161. /******************************************/
  162. ToolBar {
  163. id: toolBar
  164. ToolButton {
  165. id: toolBarButtonRoster
  166. icon: "qrc:/qml/images/bar_options.png"
  167. anchors.left: parent.left
  168. anchors.leftMargin: (0.5*(parent.width/4) - 0.5*toolBarButtonRoster.width)
  169. onClicked: {
  170. accAddPage.closePage( "qrc:/qml/AccountsPage.qml" )
  171. }
  172. pauseAnim: 500
  173. }
  174. ToolButton {
  175. id: toolBarButtonOptions
  176. icon: "qrc:/qml/images/bar_ok.png"
  177. anchors.left: parent.left
  178. anchors.leftMargin: (3.5*(parent.width/4) - 0.5*toolBarButtonOptions.width)
  179. onClicked: {
  180. var jid = tiJid.text
  181. var pass = tiPass.text
  182. var isDflt = checkBoxDefault.checked == true ? true : false
  183. if( (jid=="") || (pass=="") ) {
  184. return
  185. }
  186. var host = tiHost.text
  187. var port = tiPort.text
  188. var resource = tiResource.text
  189. var isHostPortManually = checkBoxHostPort.checked == true ? true : false
  190. settings.setAccount( jid, pass, isDflt, resource, host, port, isHostPortManually )
  191. settings.initListOfAccounts()
  192. accAddPage.closePage( "qrc:/qml/AccountsPage.qml" )
  193. }
  194. pauseAnim: 600
  195. }
  196. }
  197. }