SettingsForm.qml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. // import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
  2. import QtQuick 1.1
  3. import "../js/core.js" as Core
  4. import "../parts/"
  5. KPage {
  6. id: settingsDialog
  7. property alias name: userName.text;
  8. property alias image: selectImage.source
  9. property alias description: txtDescription.text
  10. property bool firstExecution: false
  11. Rectangle{
  12. anchors.fill: parent
  13. color: "#e1ecef"
  14. }
  15. anchors.fill:parent
  16. Flickable{
  17. id: flick
  18. width: parent.width; height: parent.height-titlebar.height
  19. contentWidth: parent.width;
  20. contentHeight: 700
  21. anchors.top: titlebar.bottom
  22. Column {
  23. id: grid1
  24. spacing: 20
  25. anchors{
  26. top:parent.top
  27. left: parent.left
  28. right: parent.right
  29. margins: 10
  30. }
  31. KLabel{text:qsTr("Your image"); height: 40;color: "#8f00FF" }
  32. Image {
  33. id: selectImage
  34. width: 128
  35. height: 128
  36. source: "qrc:/violet/face"
  37. MouseArea{
  38. anchors.fill: parent;
  39. //onClicked: pageStack.push(Qt.resolvedUrl("ImageSelectionDialog.qml"))
  40. onClicked: imageSelection.visible= true
  41. }
  42. }
  43. KLabel{id:name; text:qsTr("Name"); height: 40;color: "#8f00FF" }
  44. KTextInput{
  45. id:userName;
  46. width: parent.width
  47. }
  48. KLabel{id:description; text:qsTr("Something about your karma"); height: 40;color:"#8f00FF" }
  49. KTextArea{
  50. id:txtDescription;
  51. text: qsTr("I'm a karmic person\nLorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus dictum arcu vitae velit lobortis iaculis. Nam quis lorem sit amet turpis tincidunt malesuada. Sed vitae pulvinar sapien. Ut sem ligula, interdum at pulvinar faucibus, consectetur in ligula. Vestibulum nunc orci, iaculis nec euismod ac, fringilla ac lorem. Proin ac turpis leo, nec placerat diam. Nam non enim orci. Cras vitae accumsan odio. Aenean diam est, rutrum vel tincidunt in, tincidunt non lacus. Pellentesque risus sapien, sagittis et rutrum ut, feugiat id neque. Pellentesque sed leo sed ante condimentum congue. Vivamus accumsan laoreet arcu non consectetur. Phasellus non felis eget elit porta elementum. Vivamus viverra, leo quis egestas egestas, elit neque ultricies lectus, et faucibus enim nisi in orci. ")
  52. width: parent.width
  53. //wrapMode: TextEdit.WordWrap
  54. }
  55. }
  56. }
  57. //Page layout is divided in 3
  58. TitleBar{
  59. id: titlebar
  60. }
  61. KToolBar{
  62. KButton{
  63. text:qsTr("Cancel")
  64. onClicked: pageStack.pop()
  65. }
  66. KButton{
  67. text:qsTr("Ok")
  68. onClicked: {
  69. var item = Core.defaultUserItem();
  70. item.name = userName.text;
  71. item.image = image;
  72. item.description = txtDescription.text
  73. item.id=1
  74. Core.updateUser(item);
  75. if (firstExecution)
  76. pageStack.push(Qt.resolvedUrl("PersonPage.qml"))
  77. else
  78. pageStack.pop()
  79. }
  80. }
  81. }
  82. //Keys.onPressed:{ console.log("KEY Code es " + event.key);if (event.key == Qt.Key_Up) console.log('--------------------ShowDetails'); }
  83. ImageSelectionDialog{
  84. id: imageSelection
  85. visible:false
  86. }
  87. }