123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228 |
- import QtQuick 1.1
- MyPage {
- id: accAddPage
- onStateChanged: {
- if(state == "visible") {
- tiJid.text = main.accJid
- tiPass.text = main.accPass
- tiHost.text = main.accHost
- tiPort.text = main.accPort
- tiResource.text = main.accResource
- checkBoxDefault.setCheck( main.accDefault )
- checkBoxHostPort.setCheck( main.accManualHostPort )
- }
- }
- Flickable {
- id: flickArea
- anchors.top: parent.top; anchors.topMargin: 5
- anchors.bottom: toolBar.top; anchors.bottomMargin: 5
- anchors.left: parent.left; anchors.leftMargin: 10
- anchors.right: parent.right; anchors.rightMargin: 10
- contentHeight: contentPage.height
- contentWidth: contentPage.width
- flickableDirection: Flickable.VerticalFlick
- Column {
- id: contentPage
- width: accAddPage.width - flickArea.anchors.rightMargin - flickArea.anchors.leftMargin
- spacing: 10
- Item {
- id: spacer1
- height: 20
- width: accAddPage.width
- }
- Button {
- id: buttonTypeAcc
- anchors.horizontalCenter: parent.horizontalCenter
- height: 80
- width: parent.width
- text: "XMPP"
- onClicked: {
- }
- }
- Text {
- id: txtJid
- anchors.horizontalCenter: parent.horizontalCenter
- text: qsTr("Jid:")
- font.pixelSize: 28
- }
- Text {
- id: txtJidExample
- anchors.horizontalCenter: parent.horizontalCenter
- text: qsTr("Example: login@server.com")
- color: "gray"
- font.pixelSize: 18
- font.italic: true
- }
- MyTextInput {
- id: tiJid
- anchors.horizontalCenter: parent.horizontalCenter
- height: 50
- width: parent.width
- }
- Item {
- id: spacer2
- height: 10
- width: accAddPage.width
- }
- Text {
- id: txtPass
- anchors.horizontalCenter: parent.horizontalCenter
- text: qsTr("Password:")
- font.pixelSize: 28
- }
- MyTextInput {
- id: tiPass
- anchors.horizontalCenter: parent.horizontalCenter
- height: 50
- width: parent.width
- font.pixelSize: 28
- }
- Item {
- id: spacer3
- height: 10
- width: accAddPage.width
- }
- MyCheckBox {
- id: checkBoxDefault
- text: qsTr("Use default")
- }
- Item {
- height: 10
- width: accAddPage.width
- }
- Text {
- id: txtResource
- anchors.horizontalCenter: parent.horizontalCenter
- text: qsTr("Resource:")
- font.pixelSize: 28
- }
- MyTextInput {
- id: tiResource
- anchors.horizontalCenter: parent.horizontalCenter
- height: 50
- width: parent.width
- font.pixelSize: 28
- }
- Item {
- id: spacer4
- height: 10
- width: accAddPage.width
- }
- MyCheckBox {
- id: checkBoxHostPort
- text: qsTr("Manually specify server host/port")
- font.pixelSize: 22
- }
- /*Item {
- id: spacer4x
- height: 5
- width: accAddPage.width
- }*/
- Text {
- id: txtHost
- anchors.horizontalCenter: parent.horizontalCenter
- font.pixelSize: 28
- text: qsTr("Server:")
- color: checkBoxHostPort.checked ? "black" : "gray"
- }
- MyTextInput {
- id: tiHost
- anchors.horizontalCenter: parent.horizontalCenter
- height: 50
- width: parent.width
- readOnly: !checkBoxHostPort.checked
- }
- Item {
- id: spacer5
- height: 10
- width: accAddPage.width
- }
- Text {
- id: txtPort
- anchors.horizontalCenter: parent.horizontalCenter
- font.pixelSize: 28
- text: qsTr("Port:")
- color: checkBoxHostPort.checked ? "black" : "gray"
- }
- MyTextInput {
- id: tiPort
- anchors.horizontalCenter: parent.horizontalCenter
- height: 50
- width: parent.width
- readOnly: !checkBoxHostPort.checked
- }
- Item {
- id: spacer6
- height: 5
- width: accAddPage.width
- }
- }
- }
- /******************************************/
- ToolBar {
- id: toolBar
- ToolButton {
- id: toolBarButtonRoster
- icon: "qrc:/qml/images/bar_options.png"
- anchors.left: parent.left
- anchors.leftMargin: (0.5*(parent.width/4) - 0.5*toolBarButtonRoster.width)
- onClicked: {
- accAddPage.closePage( "qrc:/qml/AccountsPage.qml" )
- }
- 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: {
- var jid = tiJid.text
- var pass = tiPass.text
- var isDflt = checkBoxDefault.checked == true ? true : false
- if( (jid=="") || (pass=="") ) {
- return
- }
- var host = tiHost.text
- var port = tiPort.text
- var resource = tiResource.text
- var isHostPortManually = checkBoxHostPort.checked == true ? true : false
- settings.setAccount( jid, pass, isDflt, resource, host, port, isHostPortManually )
- settings.initListOfAccounts()
- accAddPage.closePage( "qrc:/qml/AccountsPage.qml" )
- }
- pauseAnim: 600
- }
- }
- }
|