CommonDialog.qml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /**
  2. * Copyright (c) 2012 Nokia Corporation.
  3. */
  4. import QtQuick 1.1
  5. import com.nokia.meego 1.0
  6. Dialog {
  7. id: genericDialog
  8. property string titleText: ""
  9. property Style platformStyle: SelectionDialogStyle {}
  10. //Deprecated, TODO Remove this on w13
  11. property alias style: genericDialog.platformStyle
  12. //private
  13. property bool __drawFooterLine: false
  14. title: Item {
  15. id: header
  16. height: genericDialog.platformStyle.titleBarHeight
  17. anchors.left: parent.left
  18. anchors.right: parent.right
  19. anchors.top: parent.top
  20. anchors.bottom: parent.bottom
  21. Item {
  22. id: labelField
  23. anchors.fill: parent
  24. Item {
  25. id: labelWrapper
  26. anchors.left: labelField.left
  27. anchors.right: closeButton.left
  28. anchors.bottom: parent.bottom
  29. anchors.bottomMargin: genericDialog.platformStyle.titleBarLineMargin
  30. //anchors.verticalCenter: labelField.verticalCenter
  31. height: titleLabel.height
  32. Label {
  33. id: titleLabel
  34. x: genericDialog.platformStyle.titleBarIndent
  35. width: parent.width - closeButton.width
  36. //anchors.baseline: parent.bottom
  37. font: genericDialog.platformStyle.titleBarFont
  38. color: genericDialog.platformStyle.commonLabelColor
  39. elide: genericDialog.platformStyle.titleElideMode
  40. text: genericDialog.titleText
  41. }
  42. }
  43. Image {
  44. id: closeButton
  45. anchors.bottom: parent.bottom
  46. anchors.bottomMargin: genericDialog.platformStyle.titleBarLineMargin-6
  47. //anchors.verticalCenter: labelField.verticalCenter
  48. anchors.right: labelField.right
  49. opacity: closeButtonArea.pressed ? 0.5 : 1.0
  50. source: "image://theme/icon-m-common-dialog-close"
  51. MouseArea {
  52. id: closeButtonArea
  53. anchors.fill: parent
  54. onClicked: {genericDialog.reject();}
  55. }
  56. }
  57. }
  58. Rectangle {
  59. id: headerLine
  60. anchors.left: parent.left
  61. anchors.right: parent.right
  62. anchors.bottom: header.bottom
  63. height: 1
  64. color: "#4D4D4D"
  65. }
  66. }
  67. content: Item {id: contentField}
  68. buttons: Item {
  69. id: footer
  70. width: parent.width
  71. height: childrenRect.height
  72. //hack to make sure, we're evaluating the correct height
  73. Item {
  74. id: lineWrapper
  75. width: parent.width
  76. height: childrenRect.height
  77. y: 10
  78. Rectangle {
  79. id: footerLine
  80. anchors.left: parent.left
  81. anchors.right: parent.right
  82. anchors.top: parent.top
  83. height: genericDialog.__drawFooterLine ? 1 : 0
  84. color: "#4D4D4D"
  85. }
  86. }
  87. //ugly hack to assure, that we're always evaluating the correct height
  88. Item {id: dummy; anchors.fill: parent}
  89. }
  90. }