ComboBox.qml 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /****************************************************************************
  2. **
  3. ** Copyright (C) 2012 Róbert Márki
  4. **
  5. ** This file is part of Web Feeds.
  6. **
  7. ** Web Feeds is free software: you can redistribute it and/or modify
  8. ** it under the terms of the GNU General Public License as published by
  9. ** the Free Software Foundation, either version 3 of the License, or
  10. ** (at your option) any later version.
  11. **
  12. ** Web Feeds is distributed in the hope that it will be useful,
  13. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. ** GNU General Public License for more details.
  16. **
  17. ** You should have received a copy of the GNU General Public License
  18. ** along with Web Feeds. If not, see <http://www.gnu.org/licenses/>.
  19. ****************************************************************************/
  20. import QtQuick 1.1
  21. import com.nokia.meego 1.0
  22. import com.nokia.extras 1.1
  23. import "../../../../shared/qml/UIConstants.js" as UIConstants
  24. Item {
  25. id: root
  26. property Dialog dialogItem
  27. property alias labelText: nameLabel.text
  28. property alias text: contentLabel.text
  29. property alias status: selectionDialog.status
  30. property alias model: selectionDialog.model
  31. property alias selectedIndex: selectionDialog.selectedIndex
  32. signal accepted
  33. signal rejected
  34. height: UIConstants.LIST_ITEM_HEIGHT_SMALL
  35. width: parent.width
  36. Connections {
  37. target: selectionDialog
  38. onAccepted: root.accepted();
  39. onRejected: root.rejected();
  40. }
  41. MouseArea {
  42. id: mouseArea
  43. anchors.fill: parent
  44. onClicked: {
  45. selectionDialog.open();
  46. }
  47. }
  48. BorderImage {
  49. id: background
  50. anchors.fill: parent
  51. // Fill page porders
  52. anchors.leftMargin: -UIConstants.MARGIN_XLARGE
  53. anchors.rightMargin: -UIConstants.MARGIN_XLARGE
  54. visible: mouseArea.pressed
  55. source: "image://theme/meegotouch-list-background-pressed-center"
  56. }
  57. Image {
  58. id: tumblerIcon
  59. anchors.right: parent.right
  60. anchors.rightMargin: UIConstants.DEFAULT_MARGIN
  61. anchors.verticalCenter: parent.verticalCenter
  62. source: "image://theme/meegotouch-combobox-indicator" +
  63. (mouseArea.pressed ? "-pressed" : "")
  64. }
  65. Column {
  66. anchors.fill: parent
  67. width: parent.width
  68. Label {
  69. id: nameLabel
  70. font.bold: true
  71. }
  72. Label {
  73. id: contentLabel
  74. text: (root.selectedIndex != -1) ? root.model.get(root.selectedIndex).name : "empty"
  75. }
  76. }
  77. SelectionDialog {
  78. id: selectionDialog
  79. titleText: root.labelText
  80. }
  81. }