summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2013-12-16 15:22:14 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-03 17:02:18 +0100
commitba9ba084124403bd8930e29d8afcea9d64b6c0b6 (patch)
treee8c3a10eeaef753cf3c65673556bbd7f663933aa /src
parentc34ce66f7b3dc7cb46d14181d46e438536a4d5f2 (diff)
downloadqtquickcontrols-ba9ba084124403bd8930e29d8afcea9d64b6c0b6.tar.gz
move QtQuick.Dialogs from qtdeclarative to qtquickcontrols
This will enable using Controls in the QML dialog implementations. For now, Controls are used only as drop-in replacements for the Button, Checkbox, and TextField which were custom implementations in the qtdeclarative module before. Change-Id: Ic79e9e8e5715a72ce51f4c724bfdfd33653300f2 Reviewed-by: Liang Qi <liang.qi@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/dialogs/DefaultColorDialog.qml363
-rw-r--r--src/dialogs/DefaultFileDialog.qml395
-rw-r--r--src/dialogs/DefaultFontDialog.qml484
-rw-r--r--src/dialogs/DefaultMessageDialog.qml316
-rw-r--r--src/dialogs/Private/Private.pro17
-rw-r--r--src/dialogs/Private/dialogsprivateplugin.cpp66
-rw-r--r--src/dialogs/Private/qmldir3
-rw-r--r--src/dialogs/Private/qquickfontlistmodel.cpp290
-rw-r--r--src/dialogs/Private/qquickfontlistmodel_p.h125
-rw-r--r--src/dialogs/Private/qquickwritingsystemlistmodel.cpp176
-rw-r--r--src/dialogs/Private/qquickwritingsystemlistmodel_p.h100
-rw-r--r--src/dialogs/WidgetColorDialog.qml44
-rw-r--r--src/dialogs/WidgetFileDialog.qml44
-rw-r--r--src/dialogs/WidgetFontDialog.qml44
-rw-r--r--src/dialogs/WidgetMessageDialog.qml44
-rw-r--r--src/dialogs/dialogs.pro93
-rw-r--r--src/dialogs/doc/images/critical.pngbin0 -> 253 bytes
-rw-r--r--src/dialogs/doc/images/information.pngbin0 -> 254 bytes
-rw-r--r--src/dialogs/doc/images/question.pngbin0 -> 257 bytes
-rw-r--r--src/dialogs/doc/images/replacefile.pngbin0 -> 4304 bytes
-rw-r--r--src/dialogs/doc/images/warning.pngbin0 -> 224 bytes
-rw-r--r--src/dialogs/doc/qtquickdialogs.qdocconf41
-rw-r--r--src/dialogs/doc/src/qtquickdialogs-examples.qdoc36
-rw-r--r--src/dialogs/doc/src/qtquickdialogs-index.qdoc58
-rw-r--r--src/dialogs/images/checkers.pngbin0 -> 149 bytes
-rw-r--r--src/dialogs/images/checkmark.pngbin0 -> 809 bytes
-rw-r--r--src/dialogs/images/copy.pngbin0 -> 1338 bytes
-rw-r--r--src/dialogs/images/critical.pngbin0 -> 253 bytes
-rw-r--r--src/dialogs/images/crosshairs.pngbin0 -> 876 bytes
-rw-r--r--src/dialogs/images/folder.pngbin0 -> 1841 bytes
-rw-r--r--src/dialogs/images/information.pngbin0 -> 254 bytes
-rw-r--r--src/dialogs/images/question.pngbin0 -> 257 bytes
-rw-r--r--src/dialogs/images/slider_handle.pngbin0 -> 1551 bytes
-rw-r--r--src/dialogs/images/sunken_frame.pngbin0 -> 623 bytes
-rw-r--r--src/dialogs/images/up.pngbin0 -> 662 bytes
-rw-r--r--src/dialogs/images/warning.pngbin0 -> 224 bytes
-rw-r--r--src/dialogs/images/window_border.pngbin0 -> 588 bytes
-rw-r--r--src/dialogs/plugin.cpp216
-rw-r--r--src/dialogs/plugins.qmltypes654
-rw-r--r--src/dialogs/qml/ColorSlider.qml138
-rw-r--r--src/dialogs/qml/DefaultWindowDecoration.qml71
-rw-r--r--src/dialogs/qml/qmldir1
-rw-r--r--src/dialogs/qmldir4
-rw-r--r--src/dialogs/qquickabstractcolordialog.cpp129
-rw-r--r--src/dialogs/qquickabstractcolordialog_p.h113
-rw-r--r--src/dialogs/qquickabstractdialog.cpp335
-rw-r--r--src/dialogs/qquickabstractdialog_p.h145
-rw-r--r--src/dialogs/qquickabstractfiledialog.cpp239
-rw-r--r--src/dialogs/qquickabstractfiledialog_p.h129
-rw-r--r--src/dialogs/qquickabstractfontdialog.cpp150
-rw-r--r--src/dialogs/qquickabstractfontdialog_p.h113
-rw-r--r--src/dialogs/qquickabstractmessagedialog.cpp179
-rw-r--r--src/dialogs/qquickabstractmessagedialog_p.h165
-rw-r--r--src/dialogs/qquickcolordialog.cpp119
-rw-r--r--src/dialogs/qquickcolordialog_p.h80
-rw-r--r--src/dialogs/qquickdialogassets_p.h65
-rw-r--r--src/dialogs/qquickfiledialog.cpp172
-rw-r--r--src/dialogs/qquickfiledialog_p.h93
-rw-r--r--src/dialogs/qquickfontdialog.cpp120
-rw-r--r--src/dialogs/qquickfontdialog_p.h80
-rw-r--r--src/dialogs/qquickmessagedialog.cpp181
-rw-r--r--src/dialogs/qquickmessagedialog_p.h86
-rw-r--r--src/dialogs/qquickplatformcolordialog.cpp254
-rw-r--r--src/dialogs/qquickplatformcolordialog_p.h78
-rw-r--r--src/dialogs/qquickplatformfiledialog.cpp314
-rw-r--r--src/dialogs/qquickplatformfiledialog_p.h78
-rw-r--r--src/dialogs/qquickplatformfontdialog.cpp252
-rw-r--r--src/dialogs/qquickplatformfontdialog_p.h78
-rw-r--r--src/dialogs/qquickplatformmessagedialog.cpp398
-rw-r--r--src/dialogs/qquickplatformmessagedialog_p.h78
-rw-r--r--src/src.pro5
-rw-r--r--src/widgets/plugins.qmltypes302
-rw-r--r--src/widgets/qmessageboxhelper_p.h107
-rw-r--r--src/widgets/qmldir4
-rw-r--r--src/widgets/qquickqcolordialog.cpp175
-rw-r--r--src/widgets/qquickqcolordialog_p.h78
-rw-r--r--src/widgets/qquickqfiledialog.cpp211
-rw-r--r--src/widgets/qquickqfiledialog_p.h107
-rw-r--r--src/widgets/qquickqfontdialog.cpp178
-rw-r--r--src/widgets/qquickqfontdialog_p.h78
-rw-r--r--src/widgets/qquickqmessagebox.cpp144
-rw-r--r--src/widgets/qquickqmessagebox_p.h77
-rw-r--r--src/widgets/widgets.pro32
-rw-r--r--src/widgets/widgetsplugin.cpp89
84 files changed, 9633 insertions, 0 deletions
diff --git a/src/dialogs/DefaultColorDialog.qml b/src/dialogs/DefaultColorDialog.qml
new file mode 100644
index 00000000..98003b05
--- /dev/null
+++ b/src/dialogs/DefaultColorDialog.qml
@@ -0,0 +1,363 @@
+/*****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+*****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Dialogs 1.0
+import QtQuick.Window 2.1
+import "qml"
+
+AbstractColorDialog {
+ id: root
+ property bool __valueSet: true // guard to prevent binding loops
+ function __setControlsFromColor() {
+ __valueSet = false
+ hueSlider.value = root.currentHue
+ saturationSlider.value = root.currentSaturation
+ lightnessSlider.value = root.currentLightness
+ alphaSlider.value = root.currentAlpha
+ crosshairs.x = root.currentLightness * paletteMap.width
+ crosshairs.y = (1.0 - root.currentSaturation) * paletteMap.height
+ __valueSet = true
+ }
+ onCurrentColorChanged: __setControlsFromColor()
+ onSelectionAccepted: root.color = root.currentColor
+
+ Rectangle {
+ id: content
+ property int maxSize: 0.9 * Math.min(Screen.desktopAvailableWidth, Screen.desktopAvailableHeight)
+ implicitHeight: Math.min(maxSize, Screen.pixelDensity * (usePaletteMap ? 100 : 50))
+ implicitWidth: usePaletteMap ? implicitHeight - bottomMinHeight : implicitHeight * 1.5
+ color: palette.window
+ focus: root.visible
+ property real bottomMinHeight: sliders.height + buttonRow.height + outerSpacing * 3
+ property real spacing: 8
+ property real outerSpacing: 12
+ property bool usePaletteMap: true
+
+ Keys.onPressed: {
+ event.accepted = true
+ switch (event.key) {
+ case Qt.Key_Return:
+ case Qt.Key_Select:
+ accept()
+ break
+ case Qt.Key_Escape:
+ case Qt.Key_Back:
+ reject()
+ break
+ case Qt.Key_C:
+ if (event.modifiers & Qt.ControlModifier)
+ colorField.copyAll()
+ break
+ case Qt.Key_V:
+ if (event.modifiers & Qt.ControlModifier) {
+ colorField.paste()
+ root.currentColor = colorField.text
+ }
+ break
+ default:
+ // do nothing
+ event.accepted = false
+ break
+ }
+ }
+
+ // set the preferred width based on height, to avoid "letterboxing" the paletteMap
+ onHeightChanged: implicitHeight = Math.max((usePaletteMap ? 480 : bottomMinHeight), height)
+
+ SystemPalette { id: palette }
+
+ Item {
+ id: paletteFrame
+ visible: content.usePaletteMap
+ anchors {
+ top: parent.top
+ left: parent.left
+ right: parent.right
+ margins: content.outerSpacing
+ }
+ height: Math.min(content.height - content.bottomMinHeight, content.width - content.outerSpacing * 2)
+
+ Image {
+ id: paletteMap
+ x: (parent.width - width) / 2
+ width: height
+ onWidthChanged: root.__setControlsFromColor()
+ height: parent.height
+ source: "images/checkers.png"
+ fillMode: Image.Tile
+
+ // note we smoothscale the shader from a smaller version to improve performance
+ ShaderEffect {
+ id: map
+ width: 64
+ height: 64
+ opacity: alphaSlider.value
+ scale: paletteMap.width / width;
+ layer.enabled: true
+ layer.smooth: true
+ anchors.centerIn: parent
+ property real hue: hueSlider.value
+
+ fragmentShader: "
+ varying mediump vec2 qt_TexCoord0;
+ uniform highp float qt_Opacity;
+ uniform highp float hue;
+
+ highp float hueToIntensity(highp float v1, highp float v2, highp float h) {
+ h = fract(h);
+ if (h < 1.0 / 6.0)
+ return v1 + (v2 - v1) * 6.0 * h;
+ else if (h < 1.0 / 2.0)
+ return v2;
+ else if (h < 2.0 / 3.0)
+ return v1 + (v2 - v1) * 6.0 * (2.0 / 3.0 - h);
+
+ return v1;
+ }
+
+ highp vec3 HSLtoRGB(highp vec3 color) {
+ highp float h = color.x;
+ highp float l = color.z;
+ highp float s = color.y;
+
+ if (s < 1.0 / 256.0)
+ return vec3(l, l, l);
+
+ highp float v1;
+ highp float v2;
+ if (l < 0.5)
+ v2 = l * (1.0 + s);
+ else
+ v2 = (l + s) - (s * l);
+
+ v1 = 2.0 * l - v2;
+
+ highp float d = 1.0 / 3.0;
+ highp float r = hueToIntensity(v1, v2, h + d);
+ highp float g = hueToIntensity(v1, v2, h);
+ highp float b = hueToIntensity(v1, v2, h - d);
+ return vec3(r, g, b);
+ }
+
+ void main() {
+ lowp vec4 c = vec4(1.0);
+ c.rgb = HSLtoRGB(vec3(hue, 1.0 - qt_TexCoord0.t, qt_TexCoord0.s));
+ gl_FragColor = c * qt_Opacity;
+ }
+ "
+ }
+
+ MouseArea {
+ id: mapMouseArea
+ anchors.fill: parent
+ onPositionChanged: {
+ if (pressed && containsMouse) {
+ var xx = Math.max(0, Math.min(mouse.x, parent.width))
+ var yy = Math.max(0, Math.min(mouse.y, parent.height))
+ saturationSlider.value = 1.0 - yy / parent.height
+ lightnessSlider.value = xx / parent.width
+ // TODO if we constrain the movement here, can avoid the containsMouse test
+ crosshairs.x = mouse.x - crosshairs.radius
+ crosshairs.y = mouse.y - crosshairs.radius
+ }
+ }
+ onPressed: positionChanged(mouse)
+ }
+
+ Image {
+ id: crosshairs
+ property int radius: width / 2 // truncated to int
+ source: "images/crosshairs.png"
+ }
+
+ BorderImage {
+ anchors.fill: parent
+ anchors.margins: -1
+ anchors.leftMargin: -2
+ source: "images/sunken_frame.png"
+ border.left: 8
+ border.right: 8
+ border.top: 8
+ border.bottom: 8
+ }
+ }
+ }
+
+ Column {
+ id: sliders
+ anchors {
+ top: paletteFrame.bottom
+ left: parent.left
+ right: parent.right
+ margins: content.outerSpacing
+ }
+ spacing: content.spacing
+
+ ColorSlider {
+ id: hueSlider
+ value: 0.5
+ onValueChanged: if (__valueSet) root.currentColor = Qt.hsla(hueSlider.value, saturationSlider.value, lightnessSlider.value, alphaSlider.value)
+ text: qsTr("Hue")
+ trackDelegate: Rectangle {
+ rotation: -90
+ transformOrigin: Item.TopLeft
+ gradient: Gradient {
+ GradientStop {position: 0.000; color: Qt.rgba(1, 0, 0, 1)}
+ GradientStop {position: 0.167; color: Qt.rgba(1, 1, 0, 1)}
+ GradientStop {position: 0.333; color: Qt.rgba(0, 1, 0, 1)}
+ GradientStop {position: 0.500; color: Qt.rgba(0, 1, 1, 1)}
+ GradientStop {position: 0.667; color: Qt.rgba(0, 0, 1, 1)}
+ GradientStop {position: 0.833; color: Qt.rgba(1, 0, 1, 1)}
+ GradientStop {position: 1.000; color: Qt.rgba(1, 0, 0, 1)}
+ }
+ }
+ }
+
+ ColorSlider {
+ id: saturationSlider
+ visible: !content.usePaletteMap
+ value: 0.5
+ onValueChanged: if (__valueSet) root.currentColor = Qt.hsla(hueSlider.value, saturationSlider.value, lightnessSlider.value, alphaSlider.value)
+ text: qsTr("Saturation")
+ trackDelegate: Rectangle {
+ rotation: -90
+ transformOrigin: Item.TopLeft
+ gradient: Gradient {
+ GradientStop { position: 0; color: Qt.hsla(hueSlider.value, 0.0, lightnessSlider.value, 1.0) }
+ GradientStop { position: 1; color: Qt.hsla(hueSlider.value, 1.0, lightnessSlider.value, 1.0) }
+ }
+ }
+ }
+
+ ColorSlider {
+ id: lightnessSlider
+ visible: !content.usePaletteMap
+ value: 0.5
+ onValueChanged: if (__valueSet) root.currentColor = Qt.hsla(hueSlider.value, saturationSlider.value, lightnessSlider.value, alphaSlider.value)
+ text: qsTr("Luminosity")
+ trackDelegate: Rectangle {
+ rotation: -90
+ transformOrigin: Item.TopLeft
+ gradient: Gradient {
+ GradientStop { position: 0; color: "black" }
+ GradientStop { position: 0.5; color: Qt.hsla(hueSlider.value, saturationSlider.value, 0.5, 1.0) }
+ GradientStop { position: 1; color: "white" }
+ }
+ }
+ }
+
+ ColorSlider {
+ id: alphaSlider
+ minimum: 0.0
+ maximum: 1.0
+ value: 1.0
+ onValueChanged: if (__valueSet) root.currentColor = Qt.hsla(hueSlider.value, saturationSlider.value, lightnessSlider.value, alphaSlider.value)
+ text: qsTr("Alpha")
+ visible: root.showAlphaChannel
+ trackDelegate: Item {
+ rotation: -90
+ transformOrigin: Item.TopLeft
+ Image {
+ anchors {fill: parent}
+ source: "images/checkers.png"
+ fillMode: Image.TileVertically
+ }
+ Rectangle {
+ anchors.fill: parent
+ gradient: Gradient {
+ GradientStop { position: 0; color: "transparent" }
+ GradientStop { position: 1; color: Qt.hsla(hueSlider.value,
+ saturationSlider.value,
+ lightnessSlider.value, 1.0) }
+ } }
+ }
+ }
+ }
+
+ Item {
+ id: buttonRow
+ height: Math.max(buttonsOnly.height, copyIcon.height)
+ width: parent.width
+ anchors {
+ left: parent.left
+ right: parent.right
+ bottom: content.bottom
+ margins: content.outerSpacing
+ }
+ Row {
+ spacing: content.spacing
+ height: parent.height
+ TextField {
+ id: colorField
+ text: root.currentColor.toString()
+ anchors.verticalCenter: parent.verticalCenter
+ onAccepted: root.currentColor = text
+ Component.onCompleted: width = implicitWidth + 10
+ }
+ Image {
+ id: copyIcon
+ anchors.verticalCenter: parent.verticalCenter
+ source: "images/copy.png"
+ MouseArea {
+ anchors.fill: parent
+ onClicked: colorField.copyAll()
+ }
+ }
+ }
+ Row {
+ id: buttonsOnly
+ spacing: content.spacing
+ anchors.right: parent.right
+ Button {
+ id: cancelButton
+ text: "Cancel"
+ onClicked: root.reject()
+ }
+ Button {
+ id: okButton
+ text: "OK"
+ onClicked: root.accept()
+ }
+ }
+ }
+ }
+}
diff --git a/src/dialogs/DefaultFileDialog.qml b/src/dialogs/DefaultFileDialog.qml
new file mode 100644
index 00000000..9967fce6
--- /dev/null
+++ b/src/dialogs/DefaultFileDialog.qml
@@ -0,0 +1,395 @@
+/*****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+*****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Dialogs 1.0
+import QtQuick.Window 2.1
+import Qt.labs.folderlistmodel 2.0
+import "qml"
+
+AbstractFileDialog {
+ id: root
+ onVisibleChanged: {
+ if (visible) {
+ __selectedIndices = []
+ __lastClickedIdx = -1
+ currentPathField.visible = false
+ }
+ }
+ onFolderChanged: view.model.folder = folder
+
+ property real __textX: titleBar.height
+ property SystemPalette __palette
+ property var __selectedIndices: []
+ property int __lastClickedIdx: -1
+
+ function __dirDown(path) {
+ view.model.folder = path
+ __lastClickedIdx = -1
+ __selectedIndices = []
+ }
+ function __dirUp() {
+ view.model.folder = view.model.parentFolder
+ __lastClickedIdx = -1
+ __selectedIndices = []
+ }
+ function __up(extend) {
+ if (view.currentIndex > 0)
+ --view.currentIndex
+ else
+ view.currentIndex = 0
+ if (extend) {
+ if (__selectedIndices.indexOf(view.currentIndex) < 0) {
+ var selCopy = __selectedIndices
+ selCopy.push(view.currentIndex)
+ __selectedIndices = selCopy
+ }
+ } else
+ __selectedIndices = [view.currentIndex]
+ }
+ function __down(extend) {
+ if (view.currentIndex < view.model.count - 1)
+ ++view.currentIndex
+ else
+ view.currentIndex = view.model.count - 1
+ if (extend) {
+ if (__selectedIndices.indexOf(view.currentIndex) < 0) {
+ var selCopy = __selectedIndices
+ selCopy.push(view.currentIndex)
+ __selectedIndices = selCopy
+ }
+ } else
+ __selectedIndices = [view.currentIndex]
+ }
+ function __acceptSelection() {
+ clearSelection()
+ if (selectFolder && __selectedIndices.length == 0)
+ addSelection(folder)
+ else if (__selectedIndices.length > 0) {
+ __selectedIndices.map(function(idx) {
+ if (view.model.isFolder(idx)) {
+ if (selectFolder)
+ addSelection(view.model.get(idx, "fileURL"))
+ } else {
+ if (!selectFolder)
+ addSelection(view.model.get(idx, "fileURL"))
+ }
+ })
+ } else {
+ addSelection(pathToUrl(currentPathField.text))
+ }
+ accept()
+ }
+
+ Rectangle {
+ id: content
+ property int maxSize: Math.min(Screen.desktopAvailableWidth, Screen.desktopAvailableHeight)
+ // TODO: QTBUG-29817 geometry from AbstractFileDialog
+ implicitWidth: Math.min(maxSize, Screen.pixelDensity * 100)
+ implicitHeight: Math.min(maxSize, Screen.pixelDensity * 80)
+ color: __palette.window
+ focus: root.visible && !currentPathField.visible
+ property real spacing: 6
+ property real outerSpacing: 12
+ SystemPalette { id: __palette }
+
+ Component {
+ id: folderDelegate
+ Rectangle {
+ id: wrapper
+ function launch() {
+ if (view.model.isFolder(index)) {
+ __dirDown(filePath)
+ } else {
+ root.__acceptSelection()
+ }
+ }
+ width: content.width
+ height: nameText.implicitHeight * 1.5
+ color: "transparent"
+ Rectangle {
+ id: itemHighlight
+ visible: root.__selectedIndices.indexOf(index) >= 0
+ anchors.fill: parent
+ color: __palette.highlight
+ }
+ Image {
+ id: icon
+ source: "images/folder.png"
+ height: wrapper.height - y * 2; width: height
+ x: (root.__textX - width) / 2
+ y: 2
+ visible: view.model.isFolder(index)
+ }
+ Text {
+ id: nameText
+ anchors.fill: parent; verticalAlignment: Text.AlignVCenter
+ text: fileName
+ anchors.leftMargin: root.__textX
+ color: itemHighlight.visible ? __palette.highlightedText : __palette.windowText
+ elide: Text.ElideRight
+ }
+ MouseArea {
+ id: mouseRegion
+ anchors.fill: parent
+ onDoubleClicked: {
+ __selectedIndices = [index]
+ root.__lastClickedIdx = index
+ launch()
+ }
+ onClicked: {
+ view.currentIndex = index
+ if (mouse.modifiers & Qt.ControlModifier && root.selectMultiple) {
+ // modifying the contents of __selectedIndices doesn't notify,
+ // so we have to re-assign the variable
+ var selCopy = __selectedIndices
+ var existingIdx = selCopy.indexOf(index)
+ if (existingIdx >= 0)
+ selCopy.splice(existingIdx, 1)
+ else
+ selCopy.push(index)
+ __selectedIndices = selCopy
+ } else if (mouse.modifiers & Qt.ShiftModifier && root.selectMultiple) {
+ if (root.__lastClickedIdx >= 0) {
+ var sel = []
+ if (index > __lastClickedIdx) {
+ for (var i = root.__lastClickedIdx; i <= index; i++)
+ sel.push(i)
+ } else {
+ for (var i = root.__lastClickedIdx; i >= index; i--)
+ sel.push(i)
+ }
+ __selectedIndices = sel
+ }
+ } else {
+ __selectedIndices = [index]
+ root.__lastClickedIdx = index
+ }
+ }
+ }
+ }
+ }
+
+ Keys.onPressed: {
+ event.accepted = true
+ switch (event.key) {
+ case Qt.Key_Up:
+ root.__up(event.modifiers & Qt.ShiftModifier && root.selectMultiple)
+ break
+ case Qt.Key_Down:
+ root.__down(event.modifiers & Qt.ShiftModifier && root.selectMultiple)
+ break
+ case Qt.Key_Left:
+ root.__dirUp()
+ break
+ case Qt.Key_Return:
+ case Qt.Key_Select:
+ case Qt.Key_Right:
+ if (view.currentItem)
+ view.currentItem.launch()
+ else
+ root.__acceptSelection()
+ break
+ case Qt.Key_Back:
+ case Qt.Key_Escape:
+ reject()
+ break
+ case Qt.Key_C:
+ if (event.modifiers & Qt.ControlModifier)
+ currentPathField.copyAll()
+ break
+ case Qt.Key_V:
+ if (event.modifiers & Qt.ControlModifier) {
+ currentPathField.visible = true
+ currentPathField.paste()
+ }
+ break
+ default:
+ // do nothing
+ event.accepted = false
+ break
+ }
+ }
+
+ ListView {
+ id: view
+ anchors.top: titleBar.bottom
+ anchors.bottom: bottomBar.top
+ clip: true
+ x: 0
+ width: parent.width
+ model: FolderListModel {
+ onFolderChanged: {
+ root.folder = folder
+ currentPathField.text = root.urlToPath(view.model.folder)
+ }
+ }
+ delegate: folderDelegate
+ highlight: Rectangle {
+ color: "transparent"
+ border.color: Qt.darker(__palette.window, 1.3)
+ }
+ highlightMoveDuration: 0
+ highlightMoveVelocity: -1
+ }
+
+ MouseArea {
+ anchors.fill: view
+ enabled: currentPathField.visible
+ onClicked: currentPathField.visible = false
+ }
+
+
+ Item {
+ id: titleBar
+ width: parent.width
+ height: currentPathField.height * 1.5
+ Rectangle {
+ anchors.fill: parent
+ color: Qt.darker(__palette.window, 1.1)
+ border.color: Qt.darker(__palette.window, 1.3)
+ }
+ Rectangle {
+ id: upButton
+ width: root.__textX
+ height: titleBar.height
+ color: "transparent"
+
+ Image {
+ id: upButtonImage
+ anchors.centerIn: parent; source: "images/up.png"
+ }
+ MouseArea { id: upRegion; anchors.centerIn: parent
+ width: 56
+ height: parent.height
+ onClicked: if (view.model.parentFolder !== "") __dirUp()
+ }
+ states: [
+ State {
+ name: "pressed"
+ when: upRegion.pressed
+ PropertyChanges { target: upButton; color: __palette.highlight }
+ }
+ ]
+ }
+ Text {
+ id: currentPathText
+ anchors.left: parent.left; anchors.right: parent.right; anchors.verticalCenter: parent.verticalCenter
+ anchors.leftMargin: __textX; anchors.rightMargin: content.spacing
+ text: root.urlToPath(view.model.folder)
+ color: __palette.text
+ elide: Text.ElideLeft; horizontalAlignment: Text.AlignRight; verticalAlignment: Text.AlignVCenter
+ MouseArea {
+ anchors.fill: parent
+ onClicked: currentPathField.visible = true
+ }
+ }
+ TextField {
+ id: currentPathField
+ anchors.left: parent.left; anchors.right: parent.right; anchors.verticalCenter: parent.verticalCenter
+ anchors.leftMargin: __textX; anchors.rightMargin: content.spacing
+ visible: false
+ focus: visible
+ onAccepted: {
+ root.clearSelection()
+ if (root.addSelection(root.pathToUrl(text)))
+ root.accept()
+ else
+ view.model.folder = root.pathFolder(text)
+ }
+ Keys.onPressed: {
+ event.accepted = true
+ switch (event.key) {
+ case Qt.Key_Down:
+ currentPathField.visible = false
+ break
+ case Qt.Key_Back:
+ case Qt.Key_Escape:
+ reject()
+ break
+ }
+ }
+ }
+ }
+ Rectangle {
+ id: bottomBar
+ width: parent.width
+ height: buttonRow.height + buttonRow.spacing * 2
+ anchors.bottom: parent.bottom
+ color: Qt.darker(__palette.window, 1.1)
+ border.color: Qt.darker(__palette.window, 1.3)
+
+ Row {
+ id: buttonRow
+ anchors.right: parent.right
+ anchors.rightMargin: spacing
+ anchors.verticalCenter: parent.verticalCenter
+ spacing: content.spacing
+ TextField {
+ id: filterField
+ text: root.selectedNameFilter
+ visible: !selectFolder
+ width: bottomBar.width - cancelButton.width - okButton.width - parent.spacing * 5
+ anchors.verticalCenter: parent.verticalCenter
+ onAccepted: {
+ root.selectNameFilter(text)
+ view.model.nameFilters = text
+ }
+ }
+ Button {
+ id: cancelButton
+ text: "Cancel"
+ onClicked: root.reject()
+ }
+ Button {
+ id: okButton
+ text: "OK"
+ onClicked: {
+ if (view.model.isFolder(view.currentIndex) && !selectFolder)
+ __dirDown(view.model.get(view.currentIndex, "filePath"))
+ else
+ root.__acceptSelection()
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/dialogs/DefaultFontDialog.qml b/src/dialogs/DefaultFontDialog.qml
new file mode 100644
index 00000000..b2e4764d
--- /dev/null
+++ b/src/dialogs/DefaultFontDialog.qml
@@ -0,0 +1,484 @@
+/*****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+*****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Dialogs 1.1
+import QtQuick.Dialogs.Private 1.1
+import QtQuick.Window 2.1
+import "qml"
+
+AbstractFontDialog {
+ id: root
+
+ property alias font: content.externalFont
+
+ Rectangle {
+ id: content
+ implicitWidth: Math.min(Screen.desktopAvailableWidth, implicitHeight * 1.2)
+ implicitHeight: Math.min(Screen.desktopAvailableHeight, settingsBottom.implicitHeight * 3)
+ color: palette.window
+ focus: root.visible
+ property real spacing: 6
+ property real outerSpacing: 12
+ property real listMargins: 4
+ property real delegateHeightMultiplier: 1.5
+ property real extraWidth: width > 400 ? width - 400 : 0
+ property real extraHeight: height > initialHeight ? height - initialHeight : 0
+ property real initialHeight: -1
+ onHeightChanged: if (visible && initialHeight < 0) initialHeight = height
+
+ property color borderColor: Qt.darker(palette.button, 1.5)
+
+ property font font: Qt.font({ family: "Helvetica", pointSize: 24, weight: Font.Normal })
+ property font externalFont
+ property string writingSystem
+ property string writingSystemSample
+ property var pointSizes
+
+ onFontChanged: externalFont = font
+
+ onExternalFontChanged: {
+ if (content.font != content.externalFont) {
+ font = externalFont
+ wsListView.reset()
+ fontListView.reset()
+ weightListView.reset()
+ }
+ }
+
+ Keys.onPressed: {
+ event.accepted = true
+ switch (event.key) {
+ case Qt.Key_Return:
+ case Qt.Key_Select:
+ root.font = content.font
+ root.accept()
+ break
+ case Qt.Key_Escape:
+ case Qt.Key_Back:
+ reject()
+ break
+ default:
+ // do nothing
+ event.accepted = false
+ break
+ }
+ }
+
+ SystemPalette { id: palette }
+
+ Column {
+ id: contentColumn
+ anchors.fill: parent
+ anchors.margins: content.outerSpacing
+ spacing: content.outerSpacing
+
+ Grid {
+ id: settingsTop
+ columns: 3
+ spacing: content.spacing
+ width: parent.width
+ height: parent.height - buttonRow.height - settingsBottom.height - parent.spacing * 2
+ property real columnHeight: height - writingSystemLabel.height - spacing
+
+ Text { id: writingSystemLabel; text: qsTr("Writing System"); font.bold: true }
+ Text { id: fontNameLabel; text: qsTr("Font"); font.bold: true }
+ Text { id: sizeLabel; text: qsTr("Size"); font.bold: true }
+ Rectangle {
+ id: wsColumn
+ radius: 3
+ color: palette.window
+ border.color: content.borderColor
+ implicitWidth: Math.max(writingSystemLabel.implicitWidth, 100) + content.extraWidth / 5
+ height: parent.columnHeight
+ clip: true
+ ListView {
+ id: wsListView
+ anchors.fill: parent
+ anchors.margins: content.listMargins
+ anchors.topMargin: 2
+ highlightMoveDuration: 0
+ onHeightChanged: positionViewAtIndex(currentIndex, ListView.Contain)
+ function reset() {
+ if (wsModel.count > 0) {
+ content.writingSystem = wsModel.get(0).name;
+ fontModel.writingSystem = content.writingSystem;
+ content.writingSystemSample = wsModel.get(0).sample;
+ }
+ }
+
+ model: WritingSystemListModel {
+ id: wsModel
+ Component.onCompleted: wsListView.reset()
+ }
+ highlight: Rectangle {
+ color: palette.highlight
+ x: 2 - wsListView.anchors.margins
+ width: wsListView.parent.width - 4
+ }
+ delegate: Item {
+ width: parent.width
+ height: wsText.height * content.delegateHeightMultiplier
+ Text {
+ id: wsText
+ text: name
+ width: parent.width
+ elide: Text.ElideRight
+ color: index === wsListView.currentIndex ? palette.highlightedText : palette.windowText
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ wsListView.currentIndex = index;
+ content.writingSystem = wsModel.get(wsListView.currentIndex).name;
+ fontModel.writingSystem = content.writingSystem;
+ content.writingSystemSample = wsModel.get(wsListView.currentIndex).sample;
+ }
+ }
+ }
+ }
+ }
+ Rectangle {
+ radius: 3
+ color: palette.window
+ border.color: content.borderColor
+ implicitWidth: Math.max(fontNameLabel.implicitWidth, parent.width - wsColumn.implicitWidth - pointSizesColumn.implicitWidth - parent.spacing * 2)
+ height: parent.columnHeight
+ clip: true
+ ListView {
+ id: fontListView
+ anchors.fill: parent
+ anchors.margins: content.listMargins
+ anchors.topMargin: 2
+ highlightMoveDuration: 0
+ onHeightChanged: positionViewAtIndex(currentIndex, ListView.Contain)
+ function reset() {
+ fontModel.findIndex()
+ content.pointSizes = fontModel.pointSizes()
+ fontModel.findPointSizesIndex()
+ }
+
+ model: FontListModel {
+ id: fontModel
+ scalableFonts: root.scalableFonts
+ nonScalableFonts: root.nonScalableFonts
+ monospacedFonts: root.monospacedFonts
+ proportionalFonts: root.proportionalFonts
+ Component.onCompleted: fontListView.reset()
+ onModelReset: { findIndex(); }
+ function findIndex() {
+ if (fontModel.count <= 0)
+ return
+
+ if (content.font.family == "") {
+ content.font.family = fontModel.get(0).family
+ fontListView.currentIndex = 0
+ } else {
+ var find = false
+ for (var i = 0; i < fontModel.count; ++i) {
+ if (content.font.family == fontModel.get(i).family) {
+ find = true
+ fontListView.currentIndex = i
+ break
+ }
+ }
+ if (find == false) {
+ content.font.family = fontModel.get(0).family
+ fontListView.currentIndex = 0
+ }
+ }
+ }
+ function findPointSizesIndex() {
+ if (content.pointSizes.length <= 0)
+ return
+
+ var find = false
+ for (var i = 0; i < content.pointSizes.length; ++i) {
+ if (content.font.pointSize == content.pointSizes[i]) {
+ find = true
+ pointSizesListView.currentIndex = i
+ break
+ }
+ }
+ if (find == false) {
+ content.font.pointSize = content.pointSizes[0]
+ pointSizesListView.currentIndex = 0
+ }
+ }
+ }
+ highlight: Rectangle {
+ color: palette.highlight
+ x: 2 - fontListView.anchors.margins
+ width: fontListView.parent.width - 4
+ }
+ delegate: Item {
+ width: parent.width
+ height: fontText.height * content.delegateHeightMultiplier
+ Text {
+ id: fontText
+ text: family
+ width: parent.width
+ elide: Text.ElideRight
+ color: index === fontListView.currentIndex ? palette.highlightedText : palette.windowText
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ fontListView.currentIndex = index
+ content.font.family = fontModel.get(fontListView.currentIndex).family
+ }
+ }
+ }
+ }
+ }
+ Rectangle {
+ id: pointSizesColumn
+ radius: 3
+ color: palette.window
+ border.color: content.borderColor
+ implicitWidth:sizeLabel.implicitWidth * 2
+ height: parent.columnHeight
+ clip: true
+ ListView {
+ id: pointSizesListView
+ anchors.fill: parent
+ anchors.margins: content.listMargins
+ anchors.topMargin: 2
+ highlightMoveDuration: 0
+ onHeightChanged: positionViewAtIndex(currentIndex, ListView.Contain)
+ model: content.pointSizes
+ highlight: Rectangle {
+ color: palette.highlight
+ x: 2 - pointSizesListView.anchors.margins
+ width: pointSizesListView.parent.width - 4
+ }
+ delegate: Item {
+ width: parent.width
+ height: pointSizesText.height * content.delegateHeightMultiplier
+ Text {
+ id: pointSizesText
+ text: content.pointSizes[index]
+ width: parent.width
+ elide: Text.ElideRight
+ color: index === pointSizesListView.currentIndex ? palette.highlightedText : palette.windowText
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ pointSizesListView.currentIndex = index
+ content.font.pointSize = content.pointSizes[pointSizesListView.currentIndex]
+ }
+ }
+ }
+ }
+ }
+ }
+
+ Grid {
+ id: settingsBottom
+ columns: 3
+ spacing: content.spacing
+ width: parent.width
+ height: initialHeight + content.extraHeight / 4
+ property real initialHeight
+ property real secondRowHeight: height - weightLabel.height - spacing
+ Component.onCompleted: initialHeight = implicitHeight
+
+ Text { id: weightLabel; text: qsTr("Weight"); font.bold: true }
+ Text { id: optionsLabel; text: qsTr("Style"); font.bold: true }
+ Text { id: sampleLabel; text: qsTr("Sample"); font.bold: true }
+ Rectangle {
+ id: weightColumn
+ radius: 3
+ color: palette.window
+ border.color: content.borderColor
+ implicitWidth: optionsColumn.implicitWidth
+ implicitHeight: optionsColumn.implicitHeight
+ height: parent.secondRowHeight
+ clip: true
+ ListView {
+ id: weightListView
+ anchors.fill: parent
+ anchors.margins: content.listMargins
+ anchors.topMargin: 2
+ highlightMoveDuration: 0
+ onHeightChanged: positionViewAtIndex(currentIndex, ListView.Contain)
+ function reset() {
+ weightModel.findIndex()
+ }
+
+ model: ListModel {
+ id: weightModel
+ ListElement {
+ name: "Light"
+ weight: Font.Light
+ }
+ ListElement {
+ name: "Normal"
+ weight: Font.Normal
+ }
+ ListElement {
+ name: "DemiBold"
+ weight: Font.DemiBold
+ }
+ ListElement {
+ name: "Bold"
+ weight: Font.Bold
+ }
+ ListElement {
+ name: "Black"
+ weight: Font.Black
+ }
+ Component.onCompleted: weightListView.reset()
+ function findIndex() {
+ var find = false
+ for (var i = 0; i < weightModel.count; ++i) {
+ if (content.font.weight == weightModel.get(i).weight) {
+ find = true
+ weightListView.currentIndex = i
+ break
+ }
+ }
+ if (find == false) {
+ content.font.weight = weightModel.get(1).family
+ fontListView.currentIndex = 1
+ }
+ }
+ }
+ highlight: Rectangle {
+ color: palette.highlight
+ x: 2 - weightListView.anchors.margins
+ width: weightListView.parent.width - 4
+ }
+ delegate: Item {
+ width: parent.width
+ height: weightText.height * content.delegateHeightMultiplier
+ Text {
+ id: weightText
+ text: name
+ width: parent.width
+ elide: Text.ElideRight
+ color: index === weightListView.currentIndex ? palette.highlightedText : palette.windowText
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ weightListView.currentIndex = index
+ content.font.weight = weightModel.get(weightListView.currentIndex).weight
+ }
+ }
+ }
+ }
+ }
+ Column {
+ id: optionsColumn
+ spacing: 4
+ CheckBox {
+ id: italicCheckBox
+ text: qsTr("Italic")
+ checked: content.font.italic
+ onClicked: { content.font.italic = italicCheckBox.checked }
+ }
+ CheckBox {
+ id: underlineCheckBox
+ text: qsTr("Underline")
+ checked: content.font.underline
+ onClicked: { content.font.underline = underlineCheckBox.checked }
+ }
+ CheckBox {
+ id: overlineCheckBox
+ text: qsTr("Overline")
+ checked: content.font.overline
+ onClicked: { content.font.overline = overlineCheckBox.checked }
+ }
+ CheckBox {
+ id: strikeoutCheckBox
+ text: qsTr("Strikeout")
+ checked: content.font.strikeout
+ onClicked: { content.font.strikeout = strikeoutCheckBox.checked }
+ }
+ }
+ Rectangle {
+ clip: true
+ implicitWidth: sample.implicitWidth + parent.spacing
+ implicitHeight: optionsColumn.implicitHeight
+ width: parent.width - weightColumn.width - optionsColumn.width - parent.spacing * 2
+ height: parent.secondRowHeight
+ color: palette.window
+ border.color: content.borderColor
+ Text {
+ id: sample
+ anchors.centerIn: parent
+ font: content.font
+ text: content.writingSystemSample
+ }
+ }
+ }
+
+ Item {
+ id: buttonRow
+ height: buttonsOnly.height
+ width: parent.width
+ Row {
+ id: buttonsOnly
+ spacing: content.spacing
+ anchors.right: parent.right
+ Button {
+ text: qsTr("Cancel")
+ onClicked: root.reject()
+ }
+ Button {
+ text: qsTr("OK")
+ onClicked: {
+ root.font = content.font
+ root.accept()
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
diff --git a/src/dialogs/DefaultMessageDialog.qml b/src/dialogs/DefaultMessageDialog.qml
new file mode 100644
index 00000000..36ec507f
--- /dev/null
+++ b/src/dialogs/DefaultMessageDialog.qml
@@ -0,0 +1,316 @@
+/*****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+*****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.1
+import QtQuick.Dialogs 1.1
+import QtQuick.Window 2.1
+import "qml"
+
+AbstractMessageDialog {
+ id: root
+
+ Rectangle {
+ id: content
+ property real spacing: 6
+ property real outerSpacing: 12
+ property real buttonsRowImplicitWidth: Screen.pixelDensity * 50
+ implicitHeight: contentColumn.implicitHeight + outerSpacing * 2
+ onImplicitHeightChanged: root.height = implicitHeight
+ implicitWidth: Math.min(Screen.desktopAvailableWidth * 0.9, Math.max(
+ mainText.implicitWidth, buttonsRowImplicitWidth) + outerSpacing * 2);
+ onImplicitWidthChanged: root.width = implicitWidth
+ color: palette.window
+ focus: root.visible
+ Keys.onPressed: {
+ event.accepted = true
+ if (event.modifiers === Qt.ControlModifier)
+ switch (event.key) {
+ case Qt.Key_A:
+ detailedText.selectAll()
+ break
+ case Qt.Key_C:
+ detailedText.copy()
+ break
+ } else switch (event.key) {
+ case Qt.Key_Escape:
+ case Qt.Key_Back:
+ reject()
+ break
+ case Qt.Key_Enter:
+ case Qt.Key_Return:
+ accept()
+ break
+ }
+ }
+
+ Column {
+ id: contentColumn
+ spacing: content.spacing
+ anchors {
+ top: parent.top
+ left: parent.left
+ right: parent.right
+ margins: content.outerSpacing
+ }
+
+ SystemPalette { id: palette }
+
+ Item {
+ width: parent.width
+ height: Math.max(icon.height, mainText.height + informativeText.height + content.spacing)
+ Image {
+ id: icon
+ source: root.standardIconSource
+ }
+
+ Text {
+ id: mainText
+ anchors {
+ left: icon.right
+ leftMargin: content.spacing
+ right: parent.right
+ }
+ text: root.text
+ font.weight: Font.Bold
+ wrapMode: Text.WordWrap
+ }
+
+ Text {
+ id: informativeText
+ anchors {
+ left: icon.right
+ right: parent.right
+ top: mainText.bottom
+ leftMargin: content.spacing
+ topMargin: content.spacing
+ }
+ text: root.informativeText
+ wrapMode: Text.WordWrap
+ }
+ }
+
+
+ Flow {
+ id: buttons
+ spacing: content.spacing
+ layoutDirection: Qt.RightToLeft
+ width: parent.width + content.outerSpacing
+ x: -content.outerSpacing
+ Button {
+ id: okButton
+ text: "OK"
+ onClicked: root.click(StandardButton.Ok)
+ visible: root.standardButtons & StandardButton.Ok
+ }
+ Button {
+ id: openButton
+ text: "Open"
+ onClicked: root.click(StandardButton.Open)
+ visible: root.standardButtons & StandardButton.Open
+ }
+ Button {
+ id: saveButton
+ text: "Save"
+ onClicked: root.click(StandardButton.Save)
+ visible: root.standardButtons & StandardButton.Save
+ }
+ Button {
+ id: saveAllButton
+ text: "Save All"
+ onClicked: root.click(StandardButton.SaveAll)
+ visible: root.standardButtons & StandardButton.SaveAll
+ }
+ Button {
+ id: retryButton
+ text: "Retry"
+ onClicked: root.click(StandardButton.Retry)
+ visible: root.standardButtons & StandardButton.Retry
+ }
+ Button {
+ id: ignoreButton
+ text: "Ignore"
+ onClicked: root.click(StandardButton.Ignore)
+ visible: root.standardButtons & StandardButton.Ignore
+ }
+ Button {
+ id: applyButton
+ text: "Apply"
+ onClicked: root.click(StandardButton.Apply)
+ visible: root.standardButtons & StandardButton.Apply
+ }
+ Button {
+ id: yesButton
+ text: "Yes"
+ onClicked: root.click(StandardButton.Yes)
+ visible: root.standardButtons & StandardButton.Yes
+ }
+ Button {
+ id: yesAllButton
+ text: "Yes to All"
+ onClicked: root.click(StandardButton.YesToAll)
+ visible: root.standardButtons & StandardButton.YesToAll
+ }
+ Button {
+ id: noButton
+ text: "No"
+ onClicked: root.click(StandardButton.No)
+ visible: root.standardButtons & StandardButton.No
+ }
+ Button {
+ id: noAllButton
+ text: "No to All"
+ onClicked: root.click(StandardButton.NoToAll)
+ visible: root.standardButtons & StandardButton.NoToAll
+ }
+ Button {
+ id: discardButton
+ text: "Discard"
+ onClicked: root.click(StandardButton.Discard)
+ visible: root.standardButtons & StandardButton.Discard
+ }
+ Button {
+ id: resetButton
+ text: "Reset"
+ onClicked: root.click(StandardButton.Reset)
+ visible: root.standardButtons & StandardButton.Reset
+ }
+ Button {
+ id: restoreDefaultsButton
+ text: "Restore Defaults"
+ onClicked: root.click(StandardButton.RestoreDefaults)
+ visible: root.standardButtons & StandardButton.RestoreDefaults
+ }
+ Button {
+ id: cancelButton
+ text: "Cancel"
+ onClicked: root.click(StandardButton.Cancel)
+ visible: root.standardButtons & StandardButton.Cancel
+ }
+ Button {
+ id: abortButton
+ text: "Abort"
+ onClicked: root.click(StandardButton.Abort)
+ visible: root.standardButtons & StandardButton.Abort
+ }
+ Button {
+ id: closeButton
+ text: "Close"
+ onClicked: root.click(StandardButton.Close)
+ visible: root.standardButtons & StandardButton.Close
+ }
+ Button {
+ id: moreButton
+ text: "Show Details..."
+ onClicked: content.state = (content.state === "" ? "expanded" : "")
+ visible: root.detailedText.length > 0
+ }
+ Button {
+ id: helpButton
+ text: "Help"
+ onClicked: root.click(StandardButton.Help)
+ visible: root.standardButtons & StandardButton.Help
+ }
+ onVisibleChildrenChanged: calculateImplicitWidth()
+ }
+ }
+
+ Item {
+ id: details
+ width: parent.width
+ implicitHeight: detailedText.implicitHeight + content.spacing
+ height: 0
+ clip: true
+
+ anchors {
+ left: parent.left
+ right: parent.right
+ top: contentColumn.bottom
+ topMargin: content.spacing
+ leftMargin: content.outerSpacing
+ rightMargin: content.outerSpacing
+ }
+
+ Flickable {
+ id: flickable
+ contentHeight: detailedText.height
+ anchors.fill: parent
+ anchors.topMargin: content.spacing
+ anchors.bottomMargin: content.outerSpacing
+ TextEdit {
+ id: detailedText
+ text: root.detailedText
+ width: details.width
+ wrapMode: Text.WordWrap
+ readOnly: true
+ selectByMouse: true
+ }
+ }
+ }
+
+ states: [
+ State {
+ name: "expanded"
+ PropertyChanges {
+ target: details
+ height: content.height - contentColumn.height - content.spacing - content.outerSpacing
+ }
+ PropertyChanges {
+ target: content
+ implicitHeight: contentColumn.implicitHeight + content.spacing * 2 +
+ detailedText.implicitHeight + content.outerSpacing * 2
+ }
+ PropertyChanges {
+ target: moreButton
+ text: "Hide Details"
+ }
+ }
+ ]
+ }
+ function calculateImplicitWidth() {
+ if (buttons.visibleChildren.length < 2)
+ return;
+ var calcWidth = 0;
+ for (var i = 0; i < buttons.visibleChildren.length; ++i)
+ calcWidth += Math.max(100, buttons.visibleChildren[i].implicitWidth) + content.spacing
+ content.buttonsRowImplicitWidth = content.outerSpacing + calcWidth
+ }
+ Component.onCompleted: calculateImplicitWidth()
+}
diff --git a/src/dialogs/Private/Private.pro b/src/dialogs/Private/Private.pro
new file mode 100644
index 00000000..7f04617e
--- /dev/null
+++ b/src/dialogs/Private/Private.pro
@@ -0,0 +1,17 @@
+CXX_MODULE = qml
+TARGET = dialogsprivateplugin
+TARGETPATH = QtQuick/Dialogs/Private
+IMPORT_VERSION = 1.1
+
+SOURCES += \
+ qquickfontlistmodel.cpp \
+ qquickwritingsystemlistmodel.cpp \
+ dialogsprivateplugin.cpp
+
+HEADERS += \
+ qquickfontlistmodel_p.h \
+ qquickwritingsystemlistmodel_p.h
+
+QT += gui-private core-private qml-private
+
+load(qml_plugin)
diff --git a/src/dialogs/Private/dialogsprivateplugin.cpp b/src/dialogs/Private/dialogsprivateplugin.cpp
new file mode 100644
index 00000000..f920df30
--- /dev/null
+++ b/src/dialogs/Private/dialogsprivateplugin.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
+#include "qquickwritingsystemlistmodel_p.h"
+#include "qquickfontlistmodel_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QtQuick2DialogsPrivatePlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
+
+public:
+ virtual void registerTypes(const char *uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQuick.Dialogs.Private"));
+
+ qmlRegisterType<QQuickWritingSystemListModel>(uri, 1, 1, "WritingSystemListModel");
+ qmlRegisterType<QQuickFontListModel>(uri, 1, 1, "FontListModel");
+ }
+};
+
+QT_END_NAMESPACE
+
+#include "dialogsprivateplugin.moc"
diff --git a/src/dialogs/Private/qmldir b/src/dialogs/Private/qmldir
new file mode 100644
index 00000000..e1847155
--- /dev/null
+++ b/src/dialogs/Private/qmldir
@@ -0,0 +1,3 @@
+module QtQuick.Dialogs.Private
+plugin dialogsprivateplugin
+typeinfo plugins.qmltypes
diff --git a/src/dialogs/Private/qquickfontlistmodel.cpp b/src/dialogs/Private/qquickfontlistmodel.cpp
new file mode 100644
index 00000000..96d1824e
--- /dev/null
+++ b/src/dialogs/Private/qquickfontlistmodel.cpp
@@ -0,0 +1,290 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickfontlistmodel_p.h"
+#include <QtGui/qfontdatabase.h>
+#include <QtQml/qqmlcontext.h>
+#include <private/qqmlengine_p.h>
+#include <private/qv8engine_p.h>
+#include <private/qv4value_p.h>
+#include <private/qv4engine_p.h>
+#include <private/qv4object_p.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace QV4;
+
+class QQuickFontListModelPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickFontListModel)
+
+public:
+ QQuickFontListModelPrivate(QQuickFontListModel *q)
+ : q_ptr(q), ws(QFontDatabase::Any)
+ , options(QSharedPointer<QFontDialogOptions>(new QFontDialogOptions()))
+ {}
+
+ QQuickFontListModel *q_ptr;
+ QFontDatabase db;
+ QFontDatabase::WritingSystem ws;
+ QSharedPointer<QFontDialogOptions> options;
+ QStringList families;
+ QHash<int, QByteArray> roleNames;
+ ~QQuickFontListModelPrivate() {}
+ void init();
+};
+
+
+void QQuickFontListModelPrivate::init()
+{
+ Q_Q(QQuickFontListModel);
+
+ families = db.families();
+
+ emit q->rowCountChanged();
+ emit q->writingSystemChanged();
+}
+
+QQuickFontListModel::QQuickFontListModel(QObject *parent)
+ : QAbstractListModel(parent), d_ptr(new QQuickFontListModelPrivate(this))
+{
+ Q_D(QQuickFontListModel);
+ d->roleNames[FontFamilyRole] = "family";
+ d->init();
+}
+
+QQuickFontListModel::~QQuickFontListModel()
+{
+}
+
+QVariant QQuickFontListModel::data(const QModelIndex &index, int role) const
+{
+ Q_D(const QQuickFontListModel);
+ QVariant rv;
+
+ if (index.row() >= d->families.size())
+ return rv;
+
+ switch (role)
+ {
+ case FontFamilyRole:
+ rv = d->families.at(index.row());
+ break;
+ default:
+ break;
+ }
+ return rv;
+}
+
+QHash<int, QByteArray> QQuickFontListModel::roleNames() const
+{
+ Q_D(const QQuickFontListModel);
+ return d->roleNames;
+}
+
+int QQuickFontListModel::rowCount(const QModelIndex &parent) const
+{
+ Q_D(const QQuickFontListModel);
+ Q_UNUSED(parent);
+ return d->families.size();
+}
+
+QModelIndex QQuickFontListModel::index(int row, int , const QModelIndex &) const
+{
+ return createIndex(row, 0);
+}
+
+QString QQuickFontListModel::writingSystem() const
+{
+ Q_D(const QQuickFontListModel);
+ return QFontDatabase::writingSystemName(d->ws);
+}
+
+void QQuickFontListModel::setWritingSystem(const QString &wSystem)
+{
+ Q_D(QQuickFontListModel);
+
+ if (wSystem == writingSystem())
+ return;
+
+ QList<QFontDatabase::WritingSystem> wss;
+ wss << QFontDatabase::Any;
+ wss << d->db.writingSystems();
+ QFontDatabase::WritingSystem ws;
+ foreach (ws, wss) {
+ if (wSystem == QFontDatabase::writingSystemName(ws)) {
+ d->ws = ws;
+ updateFamilies();
+ return;
+ }
+ }
+}
+
+void QQuickFontListModel::updateFamilies()
+{
+ Q_D(QQuickFontListModel);
+
+ beginResetModel();
+ const QFontDialogOptions::FontDialogOptions scalableMask = (QFontDialogOptions::FontDialogOptions)(QFontDialogOptions::ScalableFonts | QFontDialogOptions::NonScalableFonts);
+ const QFontDialogOptions::FontDialogOptions spacingMask = (QFontDialogOptions::FontDialogOptions)(QFontDialogOptions::ProportionalFonts | QFontDialogOptions::MonospacedFonts);
+ const QFontDialogOptions::FontDialogOptions options = d->options->options();
+
+ d->families.clear();
+ foreach (const QString &family, d->db.families(d->ws)) {
+ if ((options & scalableMask) && (options & scalableMask) != scalableMask) {
+ if (bool(options & QFontDialogOptions::ScalableFonts) != d->db.isSmoothlyScalable(family))
+ continue;
+ }
+ if ((options & spacingMask) && (options & spacingMask) != spacingMask) {
+ if (bool(options & QFontDialogOptions::MonospacedFonts) != d->db.isFixedPitch(family))
+ continue;
+ }
+ d->families << family;
+ }
+ endResetModel();
+}
+
+bool QQuickFontListModel::scalableFonts() const
+{
+ Q_D(const QQuickFontListModel);
+ return d->options->testOption(QFontDialogOptions::ScalableFonts);
+}
+
+bool QQuickFontListModel::nonScalableFonts() const
+{
+ Q_D(const QQuickFontListModel);
+ return d->options->testOption(QFontDialogOptions::NonScalableFonts);
+}
+
+bool QQuickFontListModel::monospacedFonts() const
+{
+ Q_D(const QQuickFontListModel);
+ return d->options->testOption(QFontDialogOptions::MonospacedFonts);
+}
+
+bool QQuickFontListModel::proportionalFonts() const
+{
+ Q_D(const QQuickFontListModel);
+ return d->options->testOption(QFontDialogOptions::ProportionalFonts);
+}
+
+QQmlV4Handle QQuickFontListModel::get(int idx) const
+{
+ Q_D(const QQuickFontListModel);
+
+ if (idx < 0 || idx >= count())
+ return QQmlV4Handle(Encode::undefined());
+
+ QQmlEngine *engine = qmlContext(this)->engine();
+ QV8Engine *v8engine = QQmlEnginePrivate::getV8Engine(engine);
+ ExecutionEngine *v4engine = QV8Engine::getV4(v8engine);
+ Scope scope(v4engine);
+ ScopedObject o(scope, v4engine->newObject());
+ ScopedString s(scope);
+ for (int ii = 0; ii < d->roleNames.keys().count(); ++ii) {
+ Property *p = o->insertMember((s = v4engine->newIdentifier(d->roleNames[Qt::UserRole + ii + 1])), PropertyAttributes());
+ p->value = v8engine->fromVariant(data(index(idx, 0), Qt::UserRole + ii + 1));
+ }
+
+ return QQmlV4Handle(o);
+}
+
+QQmlV4Handle QQuickFontListModel::pointSizes()
+{
+ QQmlEngine *engine = qmlContext(this)->engine();
+ QV8Engine *v8engine = QQmlEnginePrivate::getV8Engine(engine);
+ ExecutionEngine *v4engine = QV8Engine::getV4(v8engine);
+ Scope scope(v4engine);
+
+ QList<int> pss = QFontDatabase::standardSizes();
+ int size = pss.size();
+
+ Scoped<QV4::ArrayObject> a(scope, v4engine->newArrayObject());
+ a->arrayReserve(size);
+ a->arrayDataLen = size;
+ for (int i = 0; i < size; ++i)
+ a->arrayData[i].value = Primitive::fromInt32(pss.at(i));
+ a->setArrayLengthUnchecked(size);
+
+ return QQmlV4Handle(ScopedValue(scope, a.asReturnedValue()));
+}
+
+void QQuickFontListModel::classBegin()
+{
+}
+
+void QQuickFontListModel::componentComplete()
+{
+}
+
+void QQuickFontListModel::setScalableFonts(bool arg)
+{
+ Q_D(QQuickFontListModel);
+ d->options->setOption(QFontDialogOptions::ScalableFonts, arg);
+ updateFamilies();
+ emit scalableFontsChanged();
+}
+
+void QQuickFontListModel::setNonScalableFonts(bool arg)
+{
+ Q_D(QQuickFontListModel);
+ d->options->setOption(QFontDialogOptions::NonScalableFonts, arg);
+ updateFamilies();
+ emit nonScalableFontsChanged();
+}
+
+void QQuickFontListModel::setMonospacedFonts(bool arg)
+{
+ Q_D(QQuickFontListModel);
+ d->options->setOption(QFontDialogOptions::MonospacedFonts, arg);
+ updateFamilies();
+ emit monospacedFontsChanged();
+}
+
+void QQuickFontListModel::setProportionalFonts(bool arg)
+{
+ Q_D(QQuickFontListModel);
+ d->options->setOption(QFontDialogOptions::ProportionalFonts, arg);
+ updateFamilies();
+ emit proportionalFontsChanged();
+}
+
+QT_END_NAMESPACE
diff --git a/src/dialogs/Private/qquickfontlistmodel_p.h b/src/dialogs/Private/qquickfontlistmodel_p.h
new file mode 100644
index 00000000..3e2e7f71
--- /dev/null
+++ b/src/dialogs/Private/qquickfontlistmodel_p.h
@@ -0,0 +1,125 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKFONTLISTMODEL_P_H
+#define QQUICKFONTLISTMODEL_P_H
+
+#include <QtCore/qstringlist.h>
+#include <QtCore/qabstractitemmodel.h>
+#include <QtGui/qpa/qplatformdialoghelper.h>
+#include <QtQml/qqmlparserstatus.h>
+#include <private/qv8engine_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QModelIndex;
+
+class QQuickFontListModelPrivate;
+
+class QQuickFontListModel : public QAbstractListModel, public QQmlParserStatus
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlParserStatus)
+ Q_PROPERTY(QString writingSystem READ writingSystem WRITE setWritingSystem NOTIFY writingSystemChanged)
+
+ Q_PROPERTY(bool scalableFonts READ scalableFonts WRITE setScalableFonts NOTIFY scalableFontsChanged)
+ Q_PROPERTY(bool nonScalableFonts READ nonScalableFonts WRITE setNonScalableFonts NOTIFY nonScalableFontsChanged)
+ Q_PROPERTY(bool monospacedFonts READ monospacedFonts WRITE setMonospacedFonts NOTIFY monospacedFontsChanged)
+ Q_PROPERTY(bool proportionalFonts READ proportionalFonts WRITE setProportionalFonts NOTIFY proportionalFontsChanged)
+
+ Q_PROPERTY(int count READ count NOTIFY rowCountChanged)
+
+public:
+ QQuickFontListModel(QObject *parent = 0);
+ ~QQuickFontListModel();
+
+ enum Roles {
+ FontFamilyRole = Qt::UserRole + 1
+ };
+
+ virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
+ virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ virtual QHash<int, QByteArray> roleNames() const;
+
+ int count() const { return rowCount(QModelIndex()); }
+
+ QString writingSystem() const;
+ void setWritingSystem(const QString& writingSystem);
+
+ bool scalableFonts() const;
+ bool nonScalableFonts() const;
+ bool monospacedFonts() const;
+ bool proportionalFonts() const;
+
+ Q_INVOKABLE QQmlV4Handle get(int index) const;
+ Q_INVOKABLE QQmlV4Handle pointSizes();
+
+ virtual void classBegin();
+ virtual void componentComplete();
+
+public Q_SLOTS:
+ void setScalableFonts(bool arg);
+ void setNonScalableFonts(bool arg);
+ void setMonospacedFonts(bool arg);
+ void setProportionalFonts(bool arg);
+
+Q_SIGNALS:
+ void scalableFontsChanged();
+ void nonScalableFontsChanged();
+ void monospacedFontsChanged();
+ void proportionalFontsChanged();
+ void writingSystemChanged();
+ void rowCountChanged() const;
+
+protected:
+ void updateFamilies();
+
+private:
+ Q_DISABLE_COPY(QQuickFontListModel)
+ Q_DECLARE_PRIVATE(QQuickFontListModel)
+ QScopedPointer<QQuickFontListModelPrivate> d_ptr;
+
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKFONTLISTMODEL_P_H
diff --git a/src/dialogs/Private/qquickwritingsystemlistmodel.cpp b/src/dialogs/Private/qquickwritingsystemlistmodel.cpp
new file mode 100644
index 00000000..f2b4ff8b
--- /dev/null
+++ b/src/dialogs/Private/qquickwritingsystemlistmodel.cpp
@@ -0,0 +1,176 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickwritingsystemlistmodel_p.h"
+#include <QtGui/qfontdatabase.h>
+#include <QtQml/qqmlcontext.h>
+#include <private/qqmlengine_p.h>
+#include <private/qv8engine_p.h>
+#include <private/qv4value_p.h>
+#include <private/qv4engine_p.h>
+#include <private/qv4object_p.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace QV4;
+
+class QQuickWritingSystemListModelPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickWritingSystemListModel)
+
+public:
+ QQuickWritingSystemListModelPrivate(QQuickWritingSystemListModel *q)
+ : q_ptr(q)
+ {}
+
+ QQuickWritingSystemListModel *q_ptr;
+ QList<QFontDatabase::WritingSystem> wss;
+ QHash<int, QByteArray> roleNames;
+ ~QQuickWritingSystemListModelPrivate() {}
+ void init();
+};
+
+
+void QQuickWritingSystemListModelPrivate::init()
+{
+ Q_Q(QQuickWritingSystemListModel);
+ wss << QFontDatabase::Any;
+ QFontDatabase db;
+ wss << db.writingSystems();
+
+ emit q->rowCountChanged();
+ emit q->writingSystemsChanged();
+}
+
+QQuickWritingSystemListModel::QQuickWritingSystemListModel(QObject *parent)
+ : QAbstractListModel(parent), d_ptr(new QQuickWritingSystemListModelPrivate(this))
+{
+ Q_D(QQuickWritingSystemListModel);
+ d->roleNames[WritingSystemNameRole] = "name";
+ d->roleNames[WritingSystemSampleRole] = "sample";
+ d->init();
+}
+
+QQuickWritingSystemListModel::~QQuickWritingSystemListModel()
+{
+}
+
+QVariant QQuickWritingSystemListModel::data(const QModelIndex &index, int role) const
+{
+ Q_D(const QQuickWritingSystemListModel);
+ QVariant rv;
+
+ if (index.row() >= d->wss.size())
+ return rv;
+
+ switch (role)
+ {
+ case WritingSystemNameRole:
+ rv = QFontDatabase::writingSystemName(d->wss.at(index.row()));
+ break;
+ case WritingSystemSampleRole:
+ rv = QFontDatabase::writingSystemSample(d->wss.at(index.row()));
+ break;
+ default:
+ break;
+ }
+ return rv;
+}
+
+QHash<int, QByteArray> QQuickWritingSystemListModel::roleNames() const
+{
+ Q_D(const QQuickWritingSystemListModel);
+ return d->roleNames;
+}
+
+int QQuickWritingSystemListModel::rowCount(const QModelIndex &parent) const
+{
+ Q_D(const QQuickWritingSystemListModel);
+ Q_UNUSED(parent);
+ return d->wss.size();
+}
+
+QModelIndex QQuickWritingSystemListModel::index(int row, int , const QModelIndex &) const
+{
+ return createIndex(row, 0);
+}
+
+QStringList QQuickWritingSystemListModel::writingSystems() const
+{
+ Q_D(const QQuickWritingSystemListModel);
+ QStringList result;
+ QFontDatabase::WritingSystem ws;
+ foreach (ws, d->wss)
+ result.append(QFontDatabase::writingSystemName(ws));
+
+ return result;
+}
+
+QQmlV4Handle QQuickWritingSystemListModel::get(int idx) const
+{
+ Q_D(const QQuickWritingSystemListModel);
+
+ if (idx < 0 || idx >= count())
+ return QQmlV4Handle(Encode::undefined());
+
+ QQmlEngine *engine = qmlContext(this)->engine();
+ QV8Engine *v8engine = QQmlEnginePrivate::getV8Engine(engine);
+ ExecutionEngine *v4engine = QV8Engine::getV4(v8engine);
+ Scope scope(v4engine);
+ ScopedObject o(scope, v4engine->newObject());
+ ScopedString s(scope);
+ for (int ii = 0; ii < d->roleNames.keys().count(); ++ii) {
+ Property *p = o->insertMember((s = v4engine->newIdentifier(d->roleNames[Qt::UserRole + ii + 1])), PropertyAttributes());
+ p->value = v8engine->fromVariant(data(index(idx, 0), Qt::UserRole + ii + 1));
+ }
+
+ return QQmlV4Handle(o);
+}
+
+void QQuickWritingSystemListModel::classBegin()
+{
+}
+
+void QQuickWritingSystemListModel::componentComplete()
+{
+}
+
+QT_END_NAMESPACE
diff --git a/src/dialogs/Private/qquickwritingsystemlistmodel_p.h b/src/dialogs/Private/qquickwritingsystemlistmodel_p.h
new file mode 100644
index 00000000..31058bbf
--- /dev/null
+++ b/src/dialogs/Private/qquickwritingsystemlistmodel_p.h
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKWRITINGSYSTEMLISTMODEL_P_H
+#define QQUICKWRITINGSYSTEMLISTMODEL_P_H
+
+#include <QtCore/qstringlist.h>
+#include <QtCore/qabstractitemmodel.h>
+#include <QtQml/qqmlparserstatus.h>
+#include <private/qv8engine_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QModelIndex;
+
+class QQuickWritingSystemListModelPrivate;
+
+class QQuickWritingSystemListModel : public QAbstractListModel, public QQmlParserStatus
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlParserStatus)
+ Q_PROPERTY(QStringList writingSystems READ writingSystems NOTIFY writingSystemsChanged)
+
+ Q_PROPERTY(int count READ count NOTIFY rowCountChanged)
+
+public:
+ QQuickWritingSystemListModel(QObject *parent = 0);
+ ~QQuickWritingSystemListModel();
+
+ enum Roles {
+ WritingSystemNameRole = Qt::UserRole + 1,
+ WritingSystemSampleRole = Qt::UserRole + 2
+ };
+
+ virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
+ virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ virtual QHash<int, QByteArray> roleNames() const;
+
+ int count() const { return rowCount(QModelIndex()); }
+
+ QStringList writingSystems() const;
+
+ Q_INVOKABLE QQmlV4Handle get(int index) const;
+
+ virtual void classBegin();
+ virtual void componentComplete();
+
+Q_SIGNALS:
+ void writingSystemsChanged();
+ void rowCountChanged() const;
+
+private:
+ Q_DISABLE_COPY(QQuickWritingSystemListModel)
+ Q_DECLARE_PRIVATE(QQuickWritingSystemListModel)
+ QScopedPointer<QQuickWritingSystemListModelPrivate> d_ptr;
+
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKWRITINGSYSTEMLISTMODEL_P_H
diff --git a/src/dialogs/WidgetColorDialog.qml b/src/dialogs/WidgetColorDialog.qml
new file mode 100644
index 00000000..ed7c7ab7
--- /dev/null
+++ b/src/dialogs/WidgetColorDialog.qml
@@ -0,0 +1,44 @@
+/*****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+*****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.PrivateWidgets 1.0
+
+QtColorDialog { }
diff --git a/src/dialogs/WidgetFileDialog.qml b/src/dialogs/WidgetFileDialog.qml
new file mode 100644
index 00000000..c8f59d20
--- /dev/null
+++ b/src/dialogs/WidgetFileDialog.qml
@@ -0,0 +1,44 @@
+/*****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+*****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.PrivateWidgets 1.0
+
+QtFileDialog { }
diff --git a/src/dialogs/WidgetFontDialog.qml b/src/dialogs/WidgetFontDialog.qml
new file mode 100644
index 00000000..69f98b28
--- /dev/null
+++ b/src/dialogs/WidgetFontDialog.qml
@@ -0,0 +1,44 @@
+/*****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+*****************************************************************************/
+
+import QtQuick 2.2
+import QtQuick.PrivateWidgets 1.1
+
+QtFontDialog { }
diff --git a/src/dialogs/WidgetMessageDialog.qml b/src/dialogs/WidgetMessageDialog.qml
new file mode 100644
index 00000000..8bc3eccf
--- /dev/null
+++ b/src/dialogs/WidgetMessageDialog.qml
@@ -0,0 +1,44 @@
+/*****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+*****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.PrivateWidgets 1.1
+
+QtMessageDialog { }
diff --git a/src/dialogs/dialogs.pro b/src/dialogs/dialogs.pro
new file mode 100644
index 00000000..f263c003
--- /dev/null
+++ b/src/dialogs/dialogs.pro
@@ -0,0 +1,93 @@
+CXX_MODULE = qml
+TARGET = dialogplugin
+TARGETPATH = QtQuick/Dialogs
+IMPORT_VERSION = 1.1
+
+QMAKE_DOCS = $$PWD/doc/qtquickdialogs.qdocconf
+
+SOURCES += \
+ qquickabstractmessagedialog.cpp \
+ qquickplatformmessagedialog.cpp \
+ qquickmessagedialog.cpp \
+ qquickabstractfiledialog.cpp \
+ qquickplatformfiledialog.cpp \
+ qquickfiledialog.cpp \
+ qquickabstractcolordialog.cpp \
+ qquickplatformcolordialog.cpp \
+ qquickcolordialog.cpp \
+ qquickabstractfontdialog.cpp \
+ qquickplatformfontdialog.cpp \
+ qquickfontdialog.cpp \
+ qquickabstractdialog.cpp \
+ plugin.cpp
+
+HEADERS += \
+ qquickabstractmessagedialog_p.h \
+ qquickplatformmessagedialog_p.h \
+ qquickmessagedialog_p.h \
+ qquickdialogassets_p.h \
+ qquickabstractfiledialog_p.h \
+ qquickplatformfiledialog_p.h \
+ qquickfiledialog_p.h \
+ qquickabstractcolordialog_p.h \
+ qquickplatformcolordialog_p.h \
+ qquickcolordialog_p.h \
+ qquickabstractfontdialog_p.h \
+ qquickplatformfontdialog_p.h \
+ qquickfontdialog_p.h \
+ qquickabstractdialog_p.h
+
+DIALOGS_QML_FILES += \
+ DefaultMessageDialog.qml \
+ WidgetMessageDialog.qml \
+ DefaultFileDialog.qml \
+ WidgetFileDialog.qml \
+ DefaultColorDialog.qml \
+ WidgetColorDialog.qml \
+ DefaultFontDialog.qml \
+ WidgetFontDialog.qml \
+ qml/ColorSlider.qml \
+ qml/DefaultWindowDecoration.qml \
+ qml/qmldir \
+ images/critical.png \
+ images/information.png \
+ images/question.png \
+ images/warning.png \
+ images/checkers.png \
+ images/checkmark.png \
+ images/copy.png \
+ images/crosshairs.png \
+ images/slider_handle.png \
+ images/sunken_frame.png \
+ images/window_border.png \
+ images/folder.png \
+ images/up.png
+
+QT += quick-private gui gui-private core core-private qml
+
+# Create the resource file
+GENERATED_RESOURCE_FILE = $$OUT_PWD/dialogs.qrc
+
+RESOURCE_CONTENT = \
+ "<RCC>" \
+ "<qresource prefix=\"/QtQuick/Dialogs\">"
+
+for(resourcefile, DIALOGS_QML_FILES) {
+ resourcefileabsolutepath = $$absolute_path($$resourcefile)
+ relativepath_in = $$relative_path($$resourcefileabsolutepath, $$_PRO_FILE_PWD_)
+ relativepath_out = $$relative_path($$resourcefileabsolutepath, $$OUT_PWD)
+ RESOURCE_CONTENT += "<file alias=\"$$relativepath_in\">$$relativepath_out</file>"
+}
+
+RESOURCE_CONTENT += \
+ "</qresource>" \
+ "</RCC>"
+
+write_file($$GENERATED_RESOURCE_FILE, RESOURCE_CONTENT)|error("Aborting.")
+
+RESOURCES += $$GENERATED_RESOURCE_FILE
+
+# In case of a debug build, deploy the QML files too
+CONFIG(debug, debug|release): QML_FILES += $$DIALOGS_QML_FILES
+
+load(qml_plugin)
diff --git a/src/dialogs/doc/images/critical.png b/src/dialogs/doc/images/critical.png
new file mode 100644
index 00000000..dc9c5aeb
--- /dev/null
+++ b/src/dialogs/doc/images/critical.png
Binary files differ
diff --git a/src/dialogs/doc/images/information.png b/src/dialogs/doc/images/information.png
new file mode 100644
index 00000000..0a2eb87d
--- /dev/null
+++ b/src/dialogs/doc/images/information.png
Binary files differ
diff --git a/src/dialogs/doc/images/question.png b/src/dialogs/doc/images/question.png
new file mode 100644
index 00000000..2dd92fd7
--- /dev/null
+++ b/src/dialogs/doc/images/question.png
Binary files differ
diff --git a/src/dialogs/doc/images/replacefile.png b/src/dialogs/doc/images/replacefile.png
new file mode 100644
index 00000000..d1479fa9
--- /dev/null
+++ b/src/dialogs/doc/images/replacefile.png
Binary files differ
diff --git a/src/dialogs/doc/images/warning.png b/src/dialogs/doc/images/warning.png
new file mode 100644
index 00000000..cba78f6b
--- /dev/null
+++ b/src/dialogs/doc/images/warning.png
Binary files differ
diff --git a/src/dialogs/doc/qtquickdialogs.qdocconf b/src/dialogs/doc/qtquickdialogs.qdocconf
new file mode 100644
index 00000000..47f6d41e
--- /dev/null
+++ b/src/dialogs/doc/qtquickdialogs.qdocconf
@@ -0,0 +1,41 @@
+include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
+
+project = QtQuickDialogs
+description = Qt Quick Dialogs Reference Documentation
+url = http://qt-project.org/doc/qt-$QT_VER
+version = $QT_VERSION
+
+qhp.projects = QtQuickDialogs
+
+qhp.QtQuickDialogs.file = qtquickdialogs.qhp
+qhp.QtQuickDialogs.namespace = org.qt-project.qtquickdialogs.$QT_VERSION_TAG
+qhp.QtQuickDialogs.virtualFolder = qtquickdialogs
+qhp.QtQuickDialogs.indexTitle = Qt Quick Dialogs
+qhp.QtQuickDialogs.indexRoot =
+
+qhp.QtQuickDialogs.filterAttributes = qtquickdialogs $QT_VERSION qtrefdoc
+qhp.QtQuickDialogs.customFilters.Qt.name = QtQuickDialogs $QT_VERSION
+qhp.QtQuickDialogs.customFilters.Qt.filterAttributes = qtquickdialogs $QT_VERSION
+
+qhp.QtQuickDialogs.subprojects = qtquickdialogsqmltypes
+qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.title = QML Types
+qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.indexTitle = Qt Quick Dialogs QML Types
+qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.selectors = fake:qmlclass
+qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.sortPages = true
+
+depends = qtqml qtquick qtgui qtwidgets qtdoc
+
+exampledirs += ../../../examples/quick/dialogs
+
+examplesinstallpath = quick/dialogs
+
+headerdirs += ..
+
+sourcedirs += ..
+
+imagedirs += images
+
+excludedirs += ../qml
+
+navigation.landingpage = "Qt Quick Dialogs"
+navigation.qmltypespage = "Qt Quick Dialogs QML Types"
diff --git a/src/dialogs/doc/src/qtquickdialogs-examples.qdoc b/src/dialogs/doc/src/qtquickdialogs-examples.qdoc
new file mode 100644
index 00000000..ee277f48
--- /dev/null
+++ b/src/dialogs/doc/src/qtquickdialogs-examples.qdoc
@@ -0,0 +1,36 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \group qtquickdialog_examples
+ \ingroup qtquickexamples
+ \title Qt Quick Examples - Dialogs
+ \brief A Collection of examples for \l{Qt Quick Dialogs}, written in QML.
+
+ These examples show how to use the \l{Qt Quick Dialogs}.
+*/
+
diff --git a/src/dialogs/doc/src/qtquickdialogs-index.qdoc b/src/dialogs/doc/src/qtquickdialogs-index.qdoc
new file mode 100644
index 00000000..5a1223b0
--- /dev/null
+++ b/src/dialogs/doc/src/qtquickdialogs-index.qdoc
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \group dialogs
+ \title Dialogs
+*/
+
+/*!
+ \page qtquickdialogs-index.html
+ \title Qt Quick Dialogs
+
+ \brief Qt Quick Dialogs submodule
+
+ The module is new in Qt 5.1.
+
+ \section1 Dialogs
+
+ \annotatedlist dialogs
+
+ \section1 Related information
+
+ \section2 Examples
+ \list
+ \li \l{Qt Quick Examples - Dialogs}{Dialogs Examples}
+ \endlist
+
+ \section2 Reference
+ \list
+ \li \l{Qt Quick Dialogs QML Types}{QML Types}
+ \endlist
+
+*/
+
diff --git a/src/dialogs/images/checkers.png b/src/dialogs/images/checkers.png
new file mode 100644
index 00000000..458d33de
--- /dev/null
+++ b/src/dialogs/images/checkers.png
Binary files differ
diff --git a/src/dialogs/images/checkmark.png b/src/dialogs/images/checkmark.png
new file mode 100644
index 00000000..821aafcc
--- /dev/null
+++ b/src/dialogs/images/checkmark.png
Binary files differ
diff --git a/src/dialogs/images/copy.png b/src/dialogs/images/copy.png
new file mode 100644
index 00000000..2aeb2828
--- /dev/null
+++ b/src/dialogs/images/copy.png
Binary files differ
diff --git a/src/dialogs/images/critical.png b/src/dialogs/images/critical.png
new file mode 100644
index 00000000..dc9c5aeb
--- /dev/null
+++ b/src/dialogs/images/critical.png
Binary files differ
diff --git a/src/dialogs/images/crosshairs.png b/src/dialogs/images/crosshairs.png
new file mode 100644
index 00000000..9a61946e
--- /dev/null
+++ b/src/dialogs/images/crosshairs.png
Binary files differ
diff --git a/src/dialogs/images/folder.png b/src/dialogs/images/folder.png
new file mode 100644
index 00000000..e53e2ad4
--- /dev/null
+++ b/src/dialogs/images/folder.png
Binary files differ
diff --git a/src/dialogs/images/information.png b/src/dialogs/images/information.png
new file mode 100644
index 00000000..0a2eb87d
--- /dev/null
+++ b/src/dialogs/images/information.png
Binary files differ
diff --git a/src/dialogs/images/question.png b/src/dialogs/images/question.png
new file mode 100644
index 00000000..2dd92fd7
--- /dev/null
+++ b/src/dialogs/images/question.png
Binary files differ
diff --git a/src/dialogs/images/slider_handle.png b/src/dialogs/images/slider_handle.png
new file mode 100644
index 00000000..e3b96543
--- /dev/null
+++ b/src/dialogs/images/slider_handle.png
Binary files differ
diff --git a/src/dialogs/images/sunken_frame.png b/src/dialogs/images/sunken_frame.png
new file mode 100644
index 00000000..178c3092
--- /dev/null
+++ b/src/dialogs/images/sunken_frame.png
Binary files differ
diff --git a/src/dialogs/images/up.png b/src/dialogs/images/up.png
new file mode 100644
index 00000000..b05f8025
--- /dev/null
+++ b/src/dialogs/images/up.png
Binary files differ
diff --git a/src/dialogs/images/warning.png b/src/dialogs/images/warning.png
new file mode 100644
index 00000000..cba78f6b
--- /dev/null
+++ b/src/dialogs/images/warning.png
Binary files differ
diff --git a/src/dialogs/images/window_border.png b/src/dialogs/images/window_border.png
new file mode 100644
index 00000000..431af854
--- /dev/null
+++ b/src/dialogs/images/window_border.png
Binary files differ
diff --git a/src/dialogs/plugin.cpp b/src/dialogs/plugin.cpp
new file mode 100644
index 00000000..4e4c641e
--- /dev/null
+++ b/src/dialogs/plugin.cpp
@@ -0,0 +1,216 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtQml/qqml.h>
+#include <QtQml/qqmlextensionplugin.h>
+#include "qquickmessagedialog_p.h"
+#include "qquickabstractmessagedialog_p.h"
+#include "qquickdialogassets_p.h"
+#include "qquickplatformmessagedialog_p.h"
+#include "qquickfiledialog_p.h"
+#include "qquickabstractfiledialog_p.h"
+#include "qquickplatformfiledialog_p.h"
+#include "qquickcolordialog_p.h"
+#include "qquickabstractcolordialog_p.h"
+#include "qquickplatformcolordialog_p.h"
+#include "qquickfontdialog_p.h"
+#include "qquickabstractfontdialog_p.h"
+#include "qquickplatformfontdialog_p.h"
+#include <private/qguiapplication_p.h>
+#include <qpa/qplatformintegration.h>
+
+//#define PURE_QML_ONLY
+//#define DEBUG_REGISTRATION
+
+static void initResources()
+{
+ Q_INIT_RESOURCE(dialogs);
+}
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmlmodule QtQuick.Dialogs 1.1
+ \title Qt Quick Dialogs QML Types
+ \ingroup qmlmodules
+ \brief Provides QML types for standard file, color picker and message dialogs
+
+ This QML module contains types for creating and interacting with system dialogs.
+
+ To use the types in this module, import the module with the following line:
+
+ \code
+ import QtQuick.Dialogs 1.1
+ \endcode
+*/
+
+class QtQuick2DialogsPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
+
+public:
+ QtQuick2DialogsPlugin() : QQmlExtensionPlugin(), m_useResources(true) { }
+
+ virtual void initializeEngine(QQmlEngine *engine, const char * uri) {
+#ifdef DEBUG_REGISTRATION
+ qDebug() << Q_FUNC_INFO << uri << m_decorationComponentUrl;
+#else
+ Q_UNUSED(uri)
+#endif
+ QQuickAbstractDialog::m_decorationComponent =
+ new QQmlComponent(engine, m_decorationComponentUrl, QQmlComponent::Asynchronous);
+ }
+
+ virtual void registerTypes(const char *uri) {
+ initResources();
+
+#ifdef DEBUG_REGISTRATION
+ qDebug() << Q_FUNC_INFO << uri;
+#endif
+ Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQuick.Dialogs"));
+ bool hasTopLevelWindows = QGuiApplicationPrivate::platformIntegration()->
+ hasCapability(QPlatformIntegration::MultipleWindows);
+ QDir qmlDir(baseUrl().toLocalFile());
+ QDir widgetsDir(baseUrl().toLocalFile());
+ widgetsDir.cd("../PrivateWidgets");
+
+ // If at least one file was actually installed, then use installed qml files instead of resources.
+ // This makes debugging and incremental development easier, whereas the "normal" installation
+ // uses resources to save space and cut down on the number of files to deploy.
+ if (qmlDir.exists(QString("DefaultFileDialog.qml")))
+ m_useResources = false;
+ m_decorationComponentUrl = m_useResources ?
+ QUrl("qrc:/QtQuick/Dialogs/qml/DefaultWindowDecoration.qml") :
+ QUrl::fromLocalFile(qmlDir.filePath(QString("qml/DefaultWindowDecoration.qml")));
+
+ // Prefer the QPA dialog helpers if the platform supports them.
+ // Else if there is a QWidget-based implementation, check whether it's
+ // possible to instantiate it from Qt Quick.
+ // Otherwise fall back to a pure-QML implementation.
+
+ // MessageDialog
+ qmlRegisterUncreatableType<QQuickStandardButton>(uri, 1, 1, "StandardButton",
+ QLatin1String("Do not create objects of type StandardButton"));
+ qmlRegisterUncreatableType<QQuickStandardIcon>(uri, 1, 1, "StandardIcon",
+ QLatin1String("Do not create objects of type StandardIcon"));
+#ifndef PURE_QML_ONLY
+ if (QGuiApplicationPrivate::platformTheme()->usePlatformNativeDialog(QPlatformTheme::MessageDialog))
+ qmlRegisterType<QQuickPlatformMessageDialog>(uri, 1, 0, "MessageDialog");
+ else
+#endif
+ registerWidgetOrQmlImplementation<QQuickMessageDialog>(widgetsDir, qmlDir, "MessageDialog", uri, hasTopLevelWindows, 1, 1);
+
+ // FileDialog
+#ifndef PURE_QML_ONLY
+ if (QGuiApplicationPrivate::platformTheme()->usePlatformNativeDialog(QPlatformTheme::FileDialog))
+ qmlRegisterType<QQuickPlatformFileDialog>(uri, 1, 0, "FileDialog");
+ else
+#endif
+ registerWidgetOrQmlImplementation<QQuickFileDialog>(widgetsDir, qmlDir, "FileDialog", uri, hasTopLevelWindows, 1, 0);
+
+ // ColorDialog
+#ifndef PURE_QML_ONLY
+ if (QGuiApplicationPrivate::platformTheme()->usePlatformNativeDialog(QPlatformTheme::ColorDialog))
+ qmlRegisterType<QQuickPlatformColorDialog>(uri, 1, 0, "ColorDialog");
+ else
+#endif
+ registerWidgetOrQmlImplementation<QQuickColorDialog>(widgetsDir, qmlDir, "ColorDialog", uri, hasTopLevelWindows, 1, 0);
+
+ // FontDialog
+#ifndef PURE_QML_ONLY
+ if (QGuiApplicationPrivate::platformTheme()->usePlatformNativeDialog(QPlatformTheme::FontDialog))
+ qmlRegisterType<QQuickPlatformFontDialog>(uri, 1, 1, "FontDialog");
+ else
+#endif
+ registerWidgetOrQmlImplementation<QQuickFontDialog>(widgetsDir, qmlDir, "FontDialog", uri, hasTopLevelWindows, 1, 1);
+ }
+
+protected:
+ template <class WrapperType>
+ void registerWidgetOrQmlImplementation(QDir widgetsDir, QDir qmlDir,
+ const char *qmlName, const char *uri, bool hasTopLevelWindows, int versionMajor, int versionMinor) {
+ // qDebug() << "QtQuick2DialogsPlugin::registerWidgetOrQmlImplementation" << uri << qmlName << ": QML in" << qmlDir.absolutePath()
+ // << "using resources?" << m_useResources << "; widgets in" << widgetsDir.absolutePath();
+#ifdef DEBUG_REGISTRATION
+ qDebug() << Q_FUNC_INFO << qmlDir << qmlName << uri;
+#endif
+ bool needQmlImplementation = true;
+
+#ifdef PURE_QML_ONLY
+ Q_UNUSED(widgetsDir)
+ Q_UNUSED(hasTopLevelWindows)
+#else
+ // If there is a qmldir and we have a QApplication instance (as opposed to a
+ // widget-free QGuiApplication), assume that the widget-based dialog will work.
+ if (hasTopLevelWindows && widgetsDir.exists("qmldir") &&
+ !qstrcmp(QCoreApplication::instance()->metaObject()->className(), "QApplication")) {
+ QUrl dialogQmlPath = m_useResources ?
+ QUrl(QString("qrc:/QtQuick/Dialogs/Widget%1.qml").arg(qmlName)) :
+ QUrl::fromLocalFile(qmlDir.filePath(QString("Widget%1.qml").arg(qmlName)));
+ if (qmlRegisterType(dialogQmlPath, uri, versionMajor, versionMinor, qmlName) >= 0) {
+ needQmlImplementation = false;
+#ifdef DEBUG_REGISTRATION
+ qDebug() << " registering" << qmlName << " as " << dialogQmlPath << "success?" << !needQmlImplementation;
+#endif
+ }
+ }
+#endif
+ if (needQmlImplementation) {
+ QByteArray abstractTypeName = QByteArray("Abstract") + qmlName;
+ qmlRegisterType<WrapperType>(uri, versionMajor, versionMinor, abstractTypeName); // implementation wrapper
+ QUrl dialogQmlPath = m_useResources ?
+ QUrl(QString("qrc:/QtQuick/Dialogs/Default%1.qml").arg(qmlName)) :
+ QUrl::fromLocalFile(qmlDir.filePath(QString("Default%1.qml").arg(qmlName)));
+#ifdef DEBUG_REGISTRATION
+ qDebug() << " registering" << qmlName << " as " << dialogQmlPath << "success?" <<
+#endif
+ qmlRegisterType(dialogQmlPath, uri, versionMajor, versionMinor, qmlName);
+ }
+ }
+
+ QUrl m_decorationComponentUrl;
+ bool m_useResources;
+};
+
+QT_END_NAMESPACE
+
+#include "plugin.moc"
diff --git a/src/dialogs/plugins.qmltypes b/src/dialogs/plugins.qmltypes
new file mode 100644
index 00000000..d5db4b93
--- /dev/null
+++ b/src/dialogs/plugins.qmltypes
@@ -0,0 +1,654 @@
+import QtQuick.tooling 1.1
+
+// This file describes the plugin-supplied types contained in the library.
+// It is used for QML tooling purposes only.
+//
+// This file was auto-generated by:
+// 'qmlplugindump -nonrelocatable -omit-prefix=__ QtQuick.Dialogs 1.1'
+
+Module {
+ Component {
+ name: "QQuickAbstractColorDialog"
+ prototype: "QQuickAbstractDialog"
+ Property { name: "showAlphaChannel"; type: "bool" }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "currentColor"; type: "QColor" }
+ Property { name: "currentHue"; type: "double"; isReadonly: true }
+ Property { name: "currentSaturation"; type: "double"; isReadonly: true }
+ Property { name: "currentLightness"; type: "double"; isReadonly: true }
+ Property { name: "currentAlpha"; type: "double"; isReadonly: true }
+ Signal { name: "selectionAccepted" }
+ Method {
+ name: "setVisible"
+ Parameter { name: "v"; type: "bool" }
+ }
+ Method {
+ name: "setModality"
+ Parameter { name: "m"; type: "Qt::WindowModality" }
+ }
+ Method {
+ name: "setTitle"
+ Parameter { name: "t"; type: "string" }
+ }
+ Method {
+ name: "setColor"
+ Parameter { name: "arg"; type: "QColor" }
+ }
+ Method {
+ name: "setCurrentColor"
+ Parameter { name: "currentColor"; type: "QColor" }
+ }
+ Method {
+ name: "setShowAlphaChannel"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ }
+ Component {
+ name: "QQuickAbstractDialog"
+ prototype: "QObject"
+ Property { name: "visible"; type: "bool" }
+ Property { name: "modality"; type: "Qt::WindowModality" }
+ Property { name: "title"; type: "string" }
+ Property { name: "isWindow"; type: "bool"; isReadonly: true }
+ Property { name: "x"; type: "int" }
+ Property { name: "y"; type: "int" }
+ Property { name: "width"; type: "int" }
+ Property { name: "height"; type: "int" }
+ Signal { name: "visibilityChanged" }
+ Signal { name: "geometryChanged" }
+ Signal { name: "accepted" }
+ Signal { name: "rejected" }
+ Method { name: "open" }
+ Method { name: "close" }
+ Method {
+ name: "setX"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setY"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setWidth"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setHeight"
+ Parameter { name: "arg"; type: "int" }
+ }
+ }
+ Component {
+ name: "QQuickAbstractFileDialog"
+ prototype: "QQuickAbstractDialog"
+ Property { name: "selectExisting"; type: "bool" }
+ Property { name: "selectMultiple"; type: "bool" }
+ Property { name: "selectFolder"; type: "bool" }
+ Property { name: "folder"; type: "QUrl" }
+ Property { name: "nameFilters"; type: "QStringList" }
+ Property { name: "selectedNameFilter"; type: "string" }
+ Property { name: "fileUrl"; type: "QUrl"; isReadonly: true }
+ Property { name: "fileUrls"; type: "QList<QUrl>"; isReadonly: true }
+ Signal { name: "filterSelected" }
+ Signal { name: "fileModeChanged" }
+ Signal { name: "selectionAccepted" }
+ Method {
+ name: "setVisible"
+ Parameter { name: "v"; type: "bool" }
+ }
+ Method {
+ name: "setTitle"
+ Parameter { name: "t"; type: "string" }
+ }
+ Method {
+ name: "setSelectExisting"
+ Parameter { name: "s"; type: "bool" }
+ }
+ Method {
+ name: "setSelectMultiple"
+ Parameter { name: "s"; type: "bool" }
+ }
+ Method {
+ name: "setSelectFolder"
+ Parameter { name: "s"; type: "bool" }
+ }
+ Method {
+ name: "setFolder"
+ Parameter { name: "f"; type: "QUrl" }
+ }
+ Method {
+ name: "setNameFilters"
+ Parameter { name: "f"; type: "QStringList" }
+ }
+ Method {
+ name: "selectNameFilter"
+ Parameter { name: "f"; type: "string" }
+ }
+ }
+ Component {
+ name: "QQuickAbstractFontDialog"
+ prototype: "QQuickAbstractDialog"
+ Property { name: "scalableFonts"; type: "bool" }
+ Property { name: "nonScalableFonts"; type: "bool" }
+ Property { name: "monospacedFonts"; type: "bool" }
+ Property { name: "proportionalFonts"; type: "bool" }
+ Property { name: "font"; type: "QFont" }
+ Signal { name: "selectionAccepted" }
+ Method {
+ name: "setVisible"
+ Parameter { name: "v"; type: "bool" }
+ }
+ Method {
+ name: "setModality"
+ Parameter { name: "m"; type: "Qt::WindowModality" }
+ }
+ Method {
+ name: "setTitle"
+ Parameter { name: "t"; type: "string" }
+ }
+ Method {
+ name: "setFont"
+ Parameter { name: "arg"; type: "QFont" }
+ }
+ Method {
+ name: "setScalableFonts"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Method {
+ name: "setNonScalableFonts"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Method {
+ name: "setMonospacedFonts"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Method {
+ name: "setProportionalFonts"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ }
+ Component {
+ name: "QQuickAbstractMessageDialog"
+ prototype: "QQuickAbstractDialog"
+ Enum {
+ name: "Icon"
+ values: {
+ "NoIcon": 0,
+ "Information": 1,
+ "Warning": 2,
+ "Critical": 3,
+ "Question": 4
+ }
+ }
+ Enum {
+ name: "StandardButton"
+ values: {
+ "NoButton": 0,
+ "Ok": 1024,
+ "Save": 2048,
+ "SaveAll": 4096,
+ "Open": 8192,
+ "Yes": 16384,
+ "YesToAll": 32768,
+ "No": 65536,
+ "NoToAll": 131072,
+ "Abort": 262144,
+ "Retry": 524288,
+ "Ignore": 1048576,
+ "Close": 2097152,
+ "Cancel": 4194304,
+ "Discard": 8388608,
+ "Help": 16777216,
+ "Apply": 33554432,
+ "Reset": 67108864,
+ "RestoreDefaults": 134217728
+ }
+ }
+ Enum {
+ name: "StandardButtons"
+ values: {
+ "NoButton": 0,
+ "Ok": 1024,
+ "Save": 2048,
+ "SaveAll": 4096,
+ "Open": 8192,
+ "Yes": 16384,
+ "YesToAll": 32768,
+ "No": 65536,
+ "NoToAll": 131072,
+ "Abort": 262144,
+ "Retry": 524288,
+ "Ignore": 1048576,
+ "Close": 2097152,
+ "Cancel": 4194304,
+ "Discard": 8388608,
+ "Help": 16777216,
+ "Apply": 33554432,
+ "Reset": 67108864,
+ "RestoreDefaults": 134217728
+ }
+ }
+ Property { name: "text"; type: "string" }
+ Property { name: "informativeText"; type: "string" }
+ Property { name: "detailedText"; type: "string" }
+ Property { name: "icon"; type: "Icon" }
+ Property { name: "standardIconSource"; type: "QUrl"; isReadonly: true }
+ Property { name: "standardButtons"; type: "StandardButtons" }
+ Property { name: "clickedButton"; type: "StandardButton"; isReadonly: true }
+ Signal { name: "buttonClicked" }
+ Signal { name: "discard" }
+ Signal { name: "help" }
+ Signal { name: "yes" }
+ Signal { name: "no" }
+ Signal { name: "apply" }
+ Signal { name: "reset" }
+ Method {
+ name: "setVisible"
+ Parameter { name: "v"; type: "bool" }
+ }
+ Method {
+ name: "setTitle"
+ Parameter { name: "arg"; type: "string" }
+ }
+ Method {
+ name: "setText"
+ Parameter { name: "arg"; type: "string" }
+ }
+ Method {
+ name: "setInformativeText"
+ Parameter { name: "arg"; type: "string" }
+ }
+ Method {
+ name: "setDetailedText"
+ Parameter { name: "arg"; type: "string" }
+ }
+ Method {
+ name: "setIcon"
+ Parameter { name: "icon"; type: "Icon" }
+ }
+ Method {
+ name: "setStandardButtons"
+ Parameter { name: "buttons"; type: "StandardButtons" }
+ }
+ Method {
+ name: "click"
+ Parameter { name: "button"; type: "QMessageDialogOptions::StandardButton" }
+ Parameter { type: "QMessageDialogOptions::ButtonRole" }
+ }
+ Method {
+ name: "click"
+ Parameter { name: "button"; type: "QQuickAbstractMessageDialog::StandardButton" }
+ }
+ }
+ Component {
+ name: "QQuickColorDialog"
+ defaultProperty: "implementation"
+ prototype: "QQuickAbstractColorDialog"
+ exports: ["QtQuick.Dialogs/AbstractColorDialog 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "implementation"; type: "QObject"; isPointer: true }
+ }
+ Component {
+ name: "QQuickFileDialog"
+ defaultProperty: "implementation"
+ prototype: "QQuickAbstractFileDialog"
+ exports: ["QtQuick.Dialogs/AbstractFileDialog 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "implementation"; type: "QObject"; isPointer: true }
+ Method { name: "clearSelection" }
+ Method {
+ name: "addSelection"
+ type: "bool"
+ Parameter { name: "path"; type: "QUrl" }
+ }
+ }
+ Component {
+ name: "QQuickFontDialog"
+ defaultProperty: "implementation"
+ prototype: "QQuickAbstractFontDialog"
+ exports: ["QtQuick.Dialogs/AbstractFontDialog 1.1"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "implementation"; type: "QObject"; isPointer: true }
+ }
+ Component {
+ name: "QQuickMessageDialog"
+ defaultProperty: "implementation"
+ prototype: "QQuickAbstractMessageDialog"
+ exports: ["QtQuick.Dialogs/AbstractMessageDialog 1.1"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "implementation"; type: "QObject"; isPointer: true }
+ }
+ Component {
+ name: "QQuickStandardButton"
+ exports: ["QtQuick.Dialogs/StandardButton 1.1"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickStandardIcon"
+ exports: ["QtQuick.Dialogs/StandardIcon 1.1"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ prototype: "QObject"
+ name: "QtQuick.Dialogs/ColorDialog"
+ exports: ["QtQuick.Dialogs/ColorDialog 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "implementation"
+ Property { name: "showAlphaChannel"; type: "bool" }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "currentColor"; type: "QColor" }
+ Property { name: "currentHue"; type: "double"; isReadonly: true }
+ Property { name: "currentSaturation"; type: "double"; isReadonly: true }
+ Property { name: "currentLightness"; type: "double"; isReadonly: true }
+ Property { name: "currentAlpha"; type: "double"; isReadonly: true }
+ Signal { name: "selectionAccepted" }
+ Method {
+ name: "setVisible"
+ Parameter { name: "v"; type: "bool" }
+ }
+ Method {
+ name: "setModality"
+ Parameter { name: "m"; type: "Qt::WindowModality" }
+ }
+ Method {
+ name: "setTitle"
+ Parameter { name: "t"; type: "string" }
+ }
+ Method {
+ name: "setColor"
+ Parameter { name: "arg"; type: "QColor" }
+ }
+ Method {
+ name: "setCurrentColor"
+ Parameter { name: "currentColor"; type: "QColor" }
+ }
+ Method {
+ name: "setShowAlphaChannel"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "modality"; type: "Qt::WindowModality" }
+ Property { name: "title"; type: "string" }
+ Property { name: "isWindow"; type: "bool"; isReadonly: true }
+ Property { name: "x"; type: "int" }
+ Property { name: "y"; type: "int" }
+ Property { name: "width"; type: "int" }
+ Property { name: "height"; type: "int" }
+ Signal { name: "visibilityChanged" }
+ Signal { name: "geometryChanged" }
+ Signal { name: "accepted" }
+ Signal { name: "rejected" }
+ Method { name: "open" }
+ Method { name: "close" }
+ Method {
+ name: "setX"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setY"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setWidth"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setHeight"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Property { name: "implementation"; type: "QObject"; isPointer: true }
+ }
+ Component {
+ prototype: "QObject"
+ name: "QtQuick.Dialogs/FileDialog"
+ exports: ["QtQuick.Dialogs/FileDialog 1.0"]
+ exportMetaObjectRevisions: [0]
+ defaultProperty: "implementation"
+ Property { name: "visible"; type: "bool" }
+ Property { name: "modality"; type: "Qt::WindowModality" }
+ Property { name: "title"; type: "string" }
+ Property { name: "isWindow"; type: "bool"; isReadonly: true }
+ Property { name: "x"; type: "int" }
+ Property { name: "y"; type: "int" }
+ Property { name: "width"; type: "int" }
+ Property { name: "height"; type: "int" }
+ Signal { name: "visibilityChanged" }
+ Signal { name: "geometryChanged" }
+ Signal { name: "accepted" }
+ Signal { name: "rejected" }
+ Method { name: "open" }
+ Method { name: "close" }
+ Method {
+ name: "setX"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setY"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setWidth"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setHeight"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Property { name: "selectExisting"; type: "bool" }
+ Property { name: "selectMultiple"; type: "bool" }
+ Property { name: "selectFolder"; type: "bool" }
+ Property { name: "folder"; type: "QUrl" }
+ Property { name: "nameFilters"; type: "QStringList" }
+ Property { name: "selectedNameFilter"; type: "string" }
+ Property { name: "fileUrl"; type: "QUrl"; isReadonly: true }
+ Property { name: "fileUrls"; type: "QList<QUrl>"; isReadonly: true }
+ Signal { name: "filterSelected" }
+ Signal { name: "fileModeChanged" }
+ Signal { name: "selectionAccepted" }
+ Method {
+ name: "setVisible"
+ Parameter { name: "v"; type: "bool" }
+ }
+ Method {
+ name: "setTitle"
+ Parameter { name: "t"; type: "string" }
+ }
+ Method {
+ name: "setSelectExisting"
+ Parameter { name: "s"; type: "bool" }
+ }
+ Method {
+ name: "setSelectMultiple"
+ Parameter { name: "s"; type: "bool" }
+ }
+ Method {
+ name: "setSelectFolder"
+ Parameter { name: "s"; type: "bool" }
+ }
+ Method {
+ name: "setFolder"
+ Parameter { name: "f"; type: "QUrl" }
+ }
+ Method {
+ name: "setNameFilters"
+ Parameter { name: "f"; type: "QStringList" }
+ }
+ Method {
+ name: "selectNameFilter"
+ Parameter { name: "f"; type: "string" }
+ }
+ Property { name: "implementation"; type: "QObject"; isPointer: true }
+ Method { name: "clearSelection" }
+ Method {
+ name: "addSelection"
+ type: "bool"
+ Parameter { name: "path"; type: "QUrl" }
+ }
+ }
+ Component {
+ prototype: "QObject"
+ name: "QtQuick.Dialogs/FontDialog"
+ exports: ["QtQuick.Dialogs/FontDialog 1.1"]
+ exportMetaObjectRevisions: [1]
+ defaultProperty: "implementation"
+ Property { name: "font"; type: "QFont" }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "modality"; type: "Qt::WindowModality" }
+ Property { name: "title"; type: "string" }
+ Property { name: "isWindow"; type: "bool"; isReadonly: true }
+ Property { name: "x"; type: "int" }
+ Property { name: "y"; type: "int" }
+ Property { name: "width"; type: "int" }
+ Property { name: "height"; type: "int" }
+ Signal { name: "visibilityChanged" }
+ Signal { name: "geometryChanged" }
+ Signal { name: "accepted" }
+ Signal { name: "rejected" }
+ Method { name: "open" }
+ Method { name: "close" }
+ Method {
+ name: "setX"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setY"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setWidth"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setHeight"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Property { name: "scalableFonts"; type: "bool" }
+ Property { name: "nonScalableFonts"; type: "bool" }
+ Property { name: "monospacedFonts"; type: "bool" }
+ Property { name: "proportionalFonts"; type: "bool" }
+ Property { name: "font"; type: "QFont" }
+ Signal { name: "selectionAccepted" }
+ Method {
+ name: "setVisible"
+ Parameter { name: "v"; type: "bool" }
+ }
+ Method {
+ name: "setModality"
+ Parameter { name: "m"; type: "Qt::WindowModality" }
+ }
+ Method {
+ name: "setTitle"
+ Parameter { name: "t"; type: "string" }
+ }
+ Method {
+ name: "setFont"
+ Parameter { name: "arg"; type: "QFont" }
+ }
+ Method {
+ name: "setScalableFonts"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Method {
+ name: "setNonScalableFonts"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Method {
+ name: "setMonospacedFonts"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Method {
+ name: "setProportionalFonts"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Property { name: "implementation"; type: "QObject"; isPointer: true }
+ }
+ Component {
+ prototype: "QObject"
+ name: "QtQuick.Dialogs/MessageDialog"
+ exports: ["QtQuick.Dialogs/MessageDialog 1.1"]
+ exportMetaObjectRevisions: [1]
+ defaultProperty: "implementation"
+ Method { name: "calculateImplicitWidth"; type: "QVariant" }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "modality"; type: "Qt::WindowModality" }
+ Property { name: "title"; type: "string" }
+ Property { name: "isWindow"; type: "bool"; isReadonly: true }
+ Property { name: "x"; type: "int" }
+ Property { name: "y"; type: "int" }
+ Property { name: "width"; type: "int" }
+ Property { name: "height"; type: "int" }
+ Signal { name: "visibilityChanged" }
+ Signal { name: "geometryChanged" }
+ Signal { name: "accepted" }
+ Signal { name: "rejected" }
+ Method { name: "open" }
+ Method { name: "close" }
+ Method {
+ name: "setX"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setY"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setWidth"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setHeight"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Property { name: "text"; type: "string" }
+ Property { name: "informativeText"; type: "string" }
+ Property { name: "detailedText"; type: "string" }
+ Property { name: "icon"; type: "Icon" }
+ Property { name: "standardIconSource"; type: "QUrl"; isReadonly: true }
+ Property { name: "standardButtons"; type: "StandardButtons" }
+ Property { name: "clickedButton"; type: "StandardButton"; isReadonly: true }
+ Signal { name: "buttonClicked" }
+ Signal { name: "discard" }
+ Signal { name: "help" }
+ Signal { name: "yes" }
+ Signal { name: "no" }
+ Signal { name: "apply" }
+ Signal { name: "reset" }
+ Method {
+ name: "setVisible"
+ Parameter { name: "v"; type: "bool" }
+ }
+ Method {
+ name: "setTitle"
+ Parameter { name: "arg"; type: "string" }
+ }
+ Method {
+ name: "setText"
+ Parameter { name: "arg"; type: "string" }
+ }
+ Method {
+ name: "setInformativeText"
+ Parameter { name: "arg"; type: "string" }
+ }
+ Method {
+ name: "setDetailedText"
+ Parameter { name: "arg"; type: "string" }
+ }
+ Method {
+ name: "setIcon"
+ Parameter { name: "icon"; type: "Icon" }
+ }
+ Method {
+ name: "setStandardButtons"
+ Parameter { name: "buttons"; type: "StandardButtons" }
+ }
+ Method {
+ name: "click"
+ Parameter { name: "button"; type: "QMessageDialogOptions::StandardButton" }
+ Parameter { type: "QMessageDialogOptions::ButtonRole" }
+ }
+ Method {
+ name: "click"
+ Parameter { name: "button"; type: "QQuickAbstractMessageDialog::StandardButton" }
+ }
+ Property { name: "implementation"; type: "QObject"; isPointer: true }
+ }
+}
diff --git a/src/dialogs/qml/ColorSlider.qml b/src/dialogs/qml/ColorSlider.qml
new file mode 100644
index 00000000..8fc97173
--- /dev/null
+++ b/src/dialogs/qml/ColorSlider.qml
@@ -0,0 +1,138 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Graphical Effects module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+
+Item {
+ id: colorSlider
+
+ property real value: 1
+ property real maximum: 1
+ property real minimum: 0
+ property string text: ""
+ property bool pressed: mouseArea.pressed
+ property bool integer: false
+ property Component trackDelegate
+ property string handleSource: "../images/slider_handle.png"
+
+ width: parent.width
+ height: handle.height + textText.implicitHeight
+
+ function updatePos() {
+ if (maximum > minimum) {
+ var pos = (track.width - 10) * (value - minimum) / (maximum - minimum) + 5;
+ return Math.min(Math.max(pos, 5), track.width - 5) - 10;
+ } else {
+ return 5;
+ }
+ }
+
+ SystemPalette { id: palette }
+
+ Column {
+ id: column
+ width: parent.width
+ spacing: 12
+ Text {
+ id: textText
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: colorSlider.text
+ anchors.left: parent.left
+ color: palette.windowText
+ }
+
+ Item {
+ id: track
+ height: 8
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ Loader {
+ sourceComponent: trackDelegate
+ width: parent.height
+ height: parent.width
+ y: width
+ }
+
+ BorderImage {
+ source: "../images/sunken_frame.png"
+ border.left: 8
+ border.right: 8
+ border.top:8
+ border.bottom: 8
+ anchors.fill: track
+ anchors.margins: -1
+ anchors.topMargin: -2
+ anchors.leftMargin: -2
+ }
+
+ Image {
+ id: handle
+ anchors.verticalCenter: parent.verticalCenter
+ smooth: true
+ source: "../images/slider_handle.png"
+ x: updatePos() - 8
+ z: 1
+ }
+
+ MouseArea {
+ id: mouseArea
+ anchors {left: parent.left; right: parent.right; verticalCenter: parent.verticalCenter}
+ height: handle.height
+ width: handle.width
+ preventStealing: true
+
+ onPressed: {
+ var handleX = Math.max(0, Math.min(mouseX, mouseArea.width))
+ var realValue = (maximum - minimum) * handleX / mouseArea.width + minimum;
+ value = colorSlider.integer ? Math.round(realValue) : realValue;
+ }
+
+ onPositionChanged: {
+ if (pressed) {
+ var handleX = Math.max(0, Math.min(mouseX, mouseArea.width))
+ var realValue = (maximum - minimum) * handleX / mouseArea.width + minimum;
+ value = colorSlider.integer ? Math.round(realValue) : realValue;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/dialogs/qml/DefaultWindowDecoration.qml b/src/dialogs/qml/DefaultWindowDecoration.qml
new file mode 100644
index 00000000..ec930101
--- /dev/null
+++ b/src/dialogs/qml/DefaultWindowDecoration.qml
@@ -0,0 +1,71 @@
+/*****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+*****************************************************************************/
+
+import QtQuick 2.1
+
+Rectangle {
+ color: "#80000000"
+ anchors.fill: parent
+ z: 1000000
+ property alias content: borderImage.content
+ property bool dismissOnOuterClick: true
+ signal dismissed
+ MouseArea {
+ anchors.fill: parent
+ enabled: dismissOnOuterClick
+ onClicked: dismissed()
+ BorderImage {
+ id: borderImage
+ property Item content
+
+ MouseArea { anchors.fill: parent }
+
+ width: content ? content.width + 15 : 0
+ height: content ? content.height + 15 : 0
+ onWidthChanged: content.x = 5
+ onHeightChanged: content.y = 5
+ border { left: 10; top: 10; right: 10; bottom: 10 }
+ clip: true
+ source: "../images/window_border.png"
+ anchors.centerIn: parent
+ onContentChanged: if (content) content.parent = borderImage
+ }
+ }
+}
diff --git a/src/dialogs/qml/qmldir b/src/dialogs/qml/qmldir
new file mode 100644
index 00000000..c2bf3e58
--- /dev/null
+++ b/src/dialogs/qml/qmldir
@@ -0,0 +1 @@
+ColorSlider 1.0 ColorSlider.qml
diff --git a/src/dialogs/qmldir b/src/dialogs/qmldir
new file mode 100644
index 00000000..b4ae1a05
--- /dev/null
+++ b/src/dialogs/qmldir
@@ -0,0 +1,4 @@
+module QtQuick.Dialogs
+plugin dialogplugin
+classname QtQuick2DialogsPlugin
+typeinfo plugins.qmltypes
diff --git a/src/dialogs/qquickabstractcolordialog.cpp b/src/dialogs/qquickabstractcolordialog.cpp
new file mode 100644
index 00000000..abac997c
--- /dev/null
+++ b/src/dialogs/qquickabstractcolordialog.cpp
@@ -0,0 +1,129 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstractcolordialog_p.h"
+#include "qquickitem.h"
+
+#include <private/qguiapplication_p.h>
+#include <QWindow>
+#include <QQuickWindow>
+
+QT_BEGIN_NAMESPACE
+
+QQuickAbstractColorDialog::QQuickAbstractColorDialog(QObject *parent)
+ : QQuickAbstractDialog(parent)
+ , m_dlgHelper(0)
+ , m_options(QSharedPointer<QColorDialogOptions>(new QColorDialogOptions()))
+{
+ // On the Mac, modality doesn't work unless you call exec(). But this is a reasonable default anyway.
+ m_modality = Qt::NonModal;
+ connect(this, SIGNAL(accepted()), this, SIGNAL(selectionAccepted()));
+}
+
+QQuickAbstractColorDialog::~QQuickAbstractColorDialog()
+{
+}
+
+void QQuickAbstractColorDialog::setVisible(bool v)
+{
+ if (helper() && v) {
+ m_dlgHelper->setOptions(m_options);
+ // Due to the fact that QColorDialogOptions doesn't have currentColor...
+ m_dlgHelper->setCurrentColor(m_color);
+ }
+ QQuickAbstractDialog::setVisible(v);
+}
+
+void QQuickAbstractColorDialog::setModality(Qt::WindowModality m)
+{
+#ifdef Q_OS_MAC
+ // On the Mac, modality doesn't work unless you call exec()
+ m_modality = Qt::NonModal;
+ emit modalityChanged();
+ return;
+#endif
+ QQuickAbstractDialog::setModality(m);
+}
+
+QString QQuickAbstractColorDialog::title() const
+{
+ return m_options->windowTitle();
+}
+
+bool QQuickAbstractColorDialog::showAlphaChannel() const
+{
+ return m_options->testOption(QColorDialogOptions::ShowAlphaChannel);
+}
+
+void QQuickAbstractColorDialog::setTitle(const QString &t)
+{
+ if (m_options->windowTitle() == t) return;
+ m_options->setWindowTitle(t);
+ emit titleChanged();
+}
+
+void QQuickAbstractColorDialog::setColor(QColor arg)
+{
+ if (m_dlgHelper)
+ m_dlgHelper->setCurrentColor(arg);
+ // m_options->setCustomColor or setStandardColor don't make sense here
+ if (m_color != arg) {
+ m_color = arg;
+ emit colorChanged();
+ }
+ setCurrentColor(arg);
+}
+
+void QQuickAbstractColorDialog::setCurrentColor(QColor currentColor)
+{
+ if (m_currentColor != currentColor) {
+ m_currentColor = currentColor;
+ emit currentColorChanged();
+ }
+}
+
+void QQuickAbstractColorDialog::setShowAlphaChannel(bool arg)
+{
+ m_options->setOption(QColorDialogOptions::ShowAlphaChannel, arg);
+ emit showAlphaChannelChanged();
+}
+
+QT_END_NAMESPACE
diff --git a/src/dialogs/qquickabstractcolordialog_p.h b/src/dialogs/qquickabstractcolordialog_p.h
new file mode 100644
index 00000000..ad2c7ce1
--- /dev/null
+++ b/src/dialogs/qquickabstractcolordialog_p.h
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTCOLORDIALOG_P_H
+#define QQUICKABSTRACTCOLORDIALOG_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQml>
+#include <QQuickView>
+#include <QtGui/qpa/qplatformdialoghelper.h>
+#include <qpa/qplatformtheme.h>
+#include "qquickabstractdialog_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractColorDialog : public QQuickAbstractDialog
+{
+ Q_OBJECT
+ Q_PROPERTY(bool showAlphaChannel READ showAlphaChannel WRITE setShowAlphaChannel NOTIFY showAlphaChannelChanged)
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
+ Q_PROPERTY(QColor currentColor READ currentColor WRITE setCurrentColor NOTIFY currentColorChanged)
+ Q_PROPERTY(qreal currentHue READ currentHue NOTIFY currentColorChanged)
+ Q_PROPERTY(qreal currentSaturation READ currentSaturation NOTIFY currentColorChanged)
+ Q_PROPERTY(qreal currentLightness READ currentLightness NOTIFY currentColorChanged)
+ Q_PROPERTY(qreal currentAlpha READ currentAlpha NOTIFY currentColorChanged)
+
+public:
+ QQuickAbstractColorDialog(QObject *parent = 0);
+ virtual ~QQuickAbstractColorDialog();
+
+ virtual QString title() const;
+ bool showAlphaChannel() const;
+ QColor color() const { return m_color; }
+ QColor currentColor() const { return m_currentColor; }
+ qreal currentHue() const { return m_currentColor.hslHueF(); }
+ qreal currentSaturation() const { return m_currentColor.hslSaturationF(); }
+ qreal currentLightness() const { return m_currentColor.lightnessF(); }
+ qreal currentAlpha() const { return m_currentColor.alphaF(); }
+
+public Q_SLOTS:
+ void setVisible(bool v);
+ void setModality(Qt::WindowModality m);
+ void setTitle(const QString &t);
+ void setColor(QColor arg);
+ void setCurrentColor(QColor currentColor);
+ void setShowAlphaChannel(bool arg);
+
+Q_SIGNALS:
+ void showAlphaChannelChanged();
+ void colorChanged();
+ void currentColorChanged();
+ void selectionAccepted();
+
+protected:
+ QPlatformColorDialogHelper *m_dlgHelper;
+ QSharedPointer<QColorDialogOptions> m_options;
+ QColor m_color;
+ QColor m_currentColor;
+
+ Q_DISABLE_COPY(QQuickAbstractColorDialog)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTCOLORDIALOG_P_H
diff --git a/src/dialogs/qquickabstractdialog.cpp b/src/dialogs/qquickabstractdialog.cpp
new file mode 100644
index 00000000..633e5b72
--- /dev/null
+++ b/src/dialogs/qquickabstractdialog.cpp
@@ -0,0 +1,335 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstractdialog_p.h"
+#include "qquickitem.h"
+
+#include <private/qguiapplication_p.h>
+#include <QWindow>
+#include <QQmlComponent>
+#include <QQuickWindow>
+#include <qpa/qplatformintegration.h>
+
+QT_BEGIN_NAMESPACE
+
+QQmlComponent *QQuickAbstractDialog::m_decorationComponent(0);
+
+QQuickAbstractDialog::QQuickAbstractDialog(QObject *parent)
+ : QObject(parent)
+ , m_parentWindow(0)
+ , m_visible(false)
+ , m_modality(Qt::WindowModal)
+ , m_qmlImplementation(0)
+ , m_dialogWindow(0)
+ , m_contentItem(0)
+ , m_windowDecoration(0)
+ , m_hasNativeWindows(QGuiApplicationPrivate::platformIntegration()->
+ hasCapability(QPlatformIntegration::MultipleWindows))
+ , m_hasAspiredPosition(false)
+{
+}
+
+QQuickAbstractDialog::~QQuickAbstractDialog()
+{
+}
+
+void QQuickAbstractDialog::setVisible(bool v)
+{
+ if (m_visible == v) return;
+ m_visible = v;
+ if (helper()) {
+ if (v) {
+ Qt::WindowFlags flags = Qt::Dialog;
+ if (!title().isEmpty())
+ flags |= Qt::WindowTitleHint;
+ m_visible = helper()->show(flags, m_modality, parentWindow());
+ } else {
+ helper()->hide();
+ }
+ } else {
+ // For a pure QML implementation, there is no helper.
+ // But m_implementation is probably either an Item or a Window at this point.
+ if (!m_dialogWindow) {
+ m_dialogWindow = qobject_cast<QWindow *>(m_qmlImplementation);
+ if (!m_dialogWindow) {
+ m_contentItem = qobject_cast<QQuickItem *>(m_qmlImplementation);
+ if (m_contentItem) {
+ if (m_hasNativeWindows)
+ m_dialogWindow = m_contentItem->window();
+ // An Item-based dialog implementation doesn't come with a window, so
+ // we have to instantiate one iff the platform allows it.
+ if (!m_dialogWindow && m_hasNativeWindows) {
+ QQuickWindow *win = new QQuickWindow;
+ ((QObject *)win)->setParent(this); // memory management only
+ m_dialogWindow = win;
+ m_contentItem->setParentItem(win->contentItem());
+ m_dialogWindow->setMinimumSize(QSize(m_contentItem->implicitWidth(), m_contentItem->implicitHeight()));
+ connect(win, SIGNAL(widthChanged(int)), this, SLOT(windowGeometryChanged()));
+ connect(win, SIGNAL(heightChanged(int)), this, SLOT(windowGeometryChanged()));
+ }
+
+ QQuickItem *parentItem = qobject_cast<QQuickItem *>(parent());
+
+ // If the platform does not support multiple windows, but the dialog is
+ // implemented as an Item, then try to decorate it as a fake window and make it visible.
+ if (parentItem && !m_dialogWindow && !m_windowDecoration) {
+ if (m_decorationComponent) {
+ if (m_decorationComponent->isLoading())
+ connect(m_decorationComponent, SIGNAL(statusChanged(QQmlComponent::Status)),
+ this, SLOT(decorationLoaded()));
+ else
+ decorationLoaded();
+ }
+ // Window decoration wasn't possible, so just reparent it into the scene
+ else {
+ m_contentItem->setParentItem(parentItem);
+ m_contentItem->setZ(10000);
+ }
+ }
+ }
+ }
+ if (m_dialogWindow) {
+ // "grow up" to the size and position expected to achieve
+ if (!m_sizeAspiration.isNull()) {
+ if (m_hasAspiredPosition)
+ m_dialogWindow->setGeometry(m_sizeAspiration);
+ else {
+ if (m_sizeAspiration.width() > 0)
+ m_dialogWindow->setWidth(m_sizeAspiration.width());
+ if (m_sizeAspiration.height() > 0)
+ m_dialogWindow->setHeight(m_sizeAspiration.height());
+ }
+ }
+ connect(m_dialogWindow, SIGNAL(visibleChanged(bool)), this, SLOT(visibleChanged(bool)));
+ connect(m_dialogWindow, SIGNAL(xChanged(int)), this, SLOT(setX(int)));
+ connect(m_dialogWindow, SIGNAL(yChanged(int)), this, SLOT(setY(int)));
+ connect(m_dialogWindow, SIGNAL(widthChanged(int)), this, SLOT(setWidth(int)));
+ connect(m_dialogWindow, SIGNAL(heightChanged(int)), this, SLOT(setHeight(int)));
+ }
+ }
+ if (m_windowDecoration) {
+ m_windowDecoration->setVisible(v);
+ } else if (m_dialogWindow) {
+ if (v) {
+ m_dialogWindow->setTransientParent(parentWindow());
+ m_dialogWindow->setTitle(title());
+ m_dialogWindow->setModality(m_modality);
+ }
+ m_dialogWindow->setVisible(v);
+ }
+ }
+
+ emit visibilityChanged();
+}
+
+void QQuickAbstractDialog::decorationLoaded()
+{
+ bool ok = false;
+ QQuickItem *parentItem = qobject_cast<QQuickItem *>(parent());
+ while (parentItem->parentItem() && !parentItem->parentItem()->inherits("QQuickRootItem"))
+ parentItem = parentItem->parentItem();
+ if (m_decorationComponent->isError()) {
+ qWarning() << m_decorationComponent->errors();
+ } else {
+ QObject *decoration = m_decorationComponent->create();
+ m_windowDecoration = qobject_cast<QQuickItem *>(decoration);
+ if (m_windowDecoration) {
+ m_windowDecoration->setParentItem(parentItem);
+ // Give the window decoration its content to manage
+ QVariant contentVariant;
+ contentVariant.setValue<QQuickItem*>(m_contentItem);
+ m_windowDecoration->setProperty("content", contentVariant);
+ connect(m_windowDecoration, SIGNAL(dismissed()), this, SLOT(reject()));
+ ok = true;
+ } else {
+ qWarning() << m_decorationComponent->url() <<
+ "cannot be used as a window decoration because it's not an Item";
+ delete m_windowDecoration;
+ delete m_decorationComponent;
+ m_decorationComponent = 0;
+ }
+ }
+ // Window decoration wasn't possible, so just reparent it into the scene
+ if (!ok) {
+ m_contentItem->setParentItem(parentItem);
+ m_contentItem->setZ(10000);
+ }
+}
+
+void QQuickAbstractDialog::setModality(Qt::WindowModality m)
+{
+ if (m_modality == m) return;
+ m_modality = m;
+ emit modalityChanged();
+}
+
+void QQuickAbstractDialog::accept()
+{
+ setVisible(false);
+ emit accepted();
+}
+
+void QQuickAbstractDialog::reject()
+{
+ setVisible(false);
+ emit rejected();
+}
+
+void QQuickAbstractDialog::visibleChanged(bool v)
+{
+ m_visible = v;
+ emit visibilityChanged();
+}
+
+void QQuickAbstractDialog::windowGeometryChanged()
+{
+ QQuickItem *content = qobject_cast<QQuickItem*>(m_qmlImplementation);
+ if (m_dialogWindow && content) {
+ content->setWidth(m_dialogWindow->width());
+ content->setHeight(m_dialogWindow->height());
+ }
+}
+
+QQuickWindow *QQuickAbstractDialog::parentWindow()
+{
+ QQuickItem *parentItem = qobject_cast<QQuickItem *>(parent());
+ if (parentItem)
+ m_parentWindow = parentItem->window();
+ return m_parentWindow;
+}
+
+void QQuickAbstractDialog::setQmlImplementation(QObject *obj)
+{
+ m_qmlImplementation = obj;
+ if (m_dialogWindow) {
+ disconnect(this, SLOT(visibleChanged(bool)));
+ // Can't necessarily delete because m_dialogWindow might have been provided by the QML.
+ m_dialogWindow = 0;
+ }
+}
+
+int QQuickAbstractDialog::x() const
+{
+ if (m_dialogWindow)
+ return m_dialogWindow->x();
+ return m_sizeAspiration.x();
+}
+
+int QQuickAbstractDialog::y() const
+{
+ if (m_dialogWindow)
+ return m_dialogWindow->y();
+ return m_sizeAspiration.y();
+}
+
+int QQuickAbstractDialog::width() const
+{
+ if (m_dialogWindow)
+ return m_dialogWindow->width();
+ return m_sizeAspiration.width();
+}
+
+int QQuickAbstractDialog::height() const
+{
+ if (m_dialogWindow)
+ return m_dialogWindow->height();
+ return m_sizeAspiration.height();
+}
+
+void QQuickAbstractDialog::setX(int arg)
+{
+ m_hasAspiredPosition = true;
+ m_sizeAspiration.setX(arg);
+ if (helper()) {
+ // TODO
+ } else if (m_dialogWindow) {
+ if (sender() != m_dialogWindow)
+ m_dialogWindow->setX(arg);
+ } else if (m_contentItem) {
+ m_contentItem->setX(arg);
+ }
+ emit geometryChanged();
+}
+
+void QQuickAbstractDialog::setY(int arg)
+{
+ m_hasAspiredPosition = true;
+ m_sizeAspiration.setY(arg);
+ if (helper()) {
+ // TODO
+ } else if (m_dialogWindow) {
+ if (sender() != m_dialogWindow)
+ m_dialogWindow->setY(arg);
+ } else if (m_contentItem) {
+ m_contentItem->setY(arg);
+ }
+ emit geometryChanged();
+}
+
+void QQuickAbstractDialog::setWidth(int arg)
+{
+ m_sizeAspiration.setWidth(arg);
+ if (helper()) {
+ // TODO
+ } else if (m_dialogWindow) {
+ if (sender() != m_dialogWindow)
+ m_dialogWindow->setWidth(arg);
+ } else if (m_contentItem) {
+ m_contentItem->setWidth(arg);
+ }
+ emit geometryChanged();
+}
+
+void QQuickAbstractDialog::setHeight(int arg)
+{
+ m_sizeAspiration.setHeight(arg);
+ if (helper()) {
+ // TODO
+ } else if (m_dialogWindow) {
+ if (sender() != m_dialogWindow)
+ m_dialogWindow->setHeight(arg);
+ } else if (m_contentItem) {
+ m_contentItem->setHeight(arg);
+ }
+ emit geometryChanged();
+}
+
+QT_END_NAMESPACE
diff --git a/src/dialogs/qquickabstractdialog_p.h b/src/dialogs/qquickabstractdialog_p.h
new file mode 100644
index 00000000..8ffa166c
--- /dev/null
+++ b/src/dialogs/qquickabstractdialog_p.h
@@ -0,0 +1,145 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTDIALOG_P_H
+#define QQUICKABSTRACTDIALOG_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQml>
+#include <QQuickView>
+#include <QtGui/qpa/qplatformdialoghelper.h>
+#include <qpa/qplatformtheme.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractDialog : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibilityChanged)
+ Q_PROPERTY(Qt::WindowModality modality READ modality WRITE setModality NOTIFY modalityChanged)
+ Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
+ Q_PROPERTY(bool isWindow READ isWindow CONSTANT)
+ Q_PROPERTY(int x READ x WRITE setX NOTIFY geometryChanged)
+ Q_PROPERTY(int y READ y WRITE setY NOTIFY geometryChanged)
+ Q_PROPERTY(int width READ width WRITE setWidth NOTIFY geometryChanged)
+ Q_PROPERTY(int height READ height WRITE setHeight NOTIFY geometryChanged)
+
+public:
+ QQuickAbstractDialog(QObject *parent = 0);
+ virtual ~QQuickAbstractDialog();
+
+ bool isVisible() const { return m_visible; }
+ Qt::WindowModality modality() const { return m_modality; }
+ virtual QString title() const = 0;
+ QObject* qmlImplementation() { return m_qmlImplementation; }
+
+ int x() const;
+ int y() const;
+ int width() const;
+ int height() const;
+
+ virtual void setVisible(bool v);
+ virtual void setModality(Qt::WindowModality m);
+ virtual void setTitle(const QString &t) = 0;
+ void setQmlImplementation(QObject* obj);
+ bool isWindow() const { return m_hasNativeWindows; }
+
+public Q_SLOTS:
+ void open() { setVisible(true); }
+ void close() { setVisible(false); }
+ void setX(int arg);
+ void setY(int arg);
+ void setWidth(int arg);
+ void setHeight(int arg);
+
+Q_SIGNALS:
+ void visibilityChanged();
+ void geometryChanged();
+ void modalityChanged();
+ void titleChanged();
+ void accepted();
+ void rejected();
+
+protected Q_SLOTS:
+ void decorationLoaded();
+ virtual void accept();
+ virtual void reject();
+ void visibleChanged(bool v);
+ void windowGeometryChanged();
+
+protected:
+ virtual QPlatformDialogHelper *helper() = 0;
+ QQuickWindow *parentWindow();
+
+protected:
+ QQuickWindow *m_parentWindow;
+ bool m_visible;
+ Qt::WindowModality m_modality;
+
+protected: // variables for pure-QML implementations only
+ QObject *m_qmlImplementation;
+ QWindow *m_dialogWindow;
+ QQuickItem *m_contentItem;
+ QQuickItem *m_windowDecoration;
+ bool m_hasNativeWindows;
+ QRect m_sizeAspiration;
+ bool m_hasAspiredPosition;
+
+ static QQmlComponent *m_decorationComponent;
+
+ friend class QtQuick2DialogsPlugin;
+
+ Q_DISABLE_COPY(QQuickAbstractDialog)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTDIALOG_P_H
diff --git a/src/dialogs/qquickabstractfiledialog.cpp b/src/dialogs/qquickabstractfiledialog.cpp
new file mode 100644
index 00000000..50be9f2c
--- /dev/null
+++ b/src/dialogs/qquickabstractfiledialog.cpp
@@ -0,0 +1,239 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstractfiledialog_p.h"
+#include "qquickitem.h"
+
+#include <private/qguiapplication_p.h>
+#include <QRegularExpression>
+#include <QWindow>
+#include <QQuickWindow>
+
+QT_BEGIN_NAMESPACE
+
+QQuickAbstractFileDialog::QQuickAbstractFileDialog(QObject *parent)
+ : QQuickAbstractDialog(parent)
+ , m_dlgHelper(0)
+ , m_options(QSharedPointer<QFileDialogOptions>(new QFileDialogOptions()))
+ , m_selectExisting(true)
+ , m_selectMultiple(false)
+ , m_selectFolder(false)
+{
+ connect(this, SIGNAL(accepted()), this, SIGNAL(selectionAccepted()));
+}
+
+QQuickAbstractFileDialog::~QQuickAbstractFileDialog()
+{
+}
+
+void QQuickAbstractFileDialog::setVisible(bool v)
+{
+ if (helper() && v) {
+ m_dlgHelper->setOptions(m_options);
+ m_dlgHelper->setFilter();
+ emit filterSelected();
+ }
+ QQuickAbstractDialog::setVisible(v);
+}
+
+QString QQuickAbstractFileDialog::title() const
+{
+ return m_options->windowTitle();
+}
+
+QStringList QQuickAbstractFileDialog::shortcuts() const
+{
+ QStringList ret;
+ ret << QStandardPaths::standardLocations(QStandardPaths::DesktopLocation);
+ ret << QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation);
+ ret << QStandardPaths::standardLocations(QStandardPaths::MusicLocation);
+ ret << QStandardPaths::standardLocations(QStandardPaths::MoviesLocation);
+ ret << QStandardPaths::standardLocations(QStandardPaths::PicturesLocation);
+ ret << QStandardPaths::standardLocations(QStandardPaths::HomeLocation);
+ ret << QStandardPaths::writableLocation(QStandardPaths::TempLocation);
+ ret << QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation);
+
+ QFileInfoList drives = QDir::drives();
+ foreach (QFileInfo fi, drives)
+ ret << fi.absoluteFilePath();
+ return ret;
+}
+
+void QQuickAbstractFileDialog::setTitle(const QString &t)
+{
+ if (m_options->windowTitle() == t) return;
+ m_options->setWindowTitle(t);
+ emit titleChanged();
+}
+
+void QQuickAbstractFileDialog::setSelectExisting(bool selectExisting)
+{
+ if (selectExisting == m_selectExisting) return;
+ m_selectExisting = selectExisting;
+ updateModes();
+}
+
+void QQuickAbstractFileDialog::setSelectMultiple(bool selectMultiple)
+{
+ if (selectMultiple == m_selectMultiple) return;
+ m_selectMultiple = selectMultiple;
+ updateModes();
+}
+
+void QQuickAbstractFileDialog::setSelectFolder(bool selectFolder)
+{
+ if (selectFolder == m_selectFolder) return;
+ m_selectFolder = selectFolder;
+ updateModes();
+}
+
+QUrl QQuickAbstractFileDialog::folder() const
+{
+ if (m_dlgHelper && !m_dlgHelper->directory().isEmpty())
+ return m_dlgHelper->directory();
+ return m_options->initialDirectory();
+}
+
+void QQuickAbstractFileDialog::setFolder(const QUrl &f)
+{
+ if (m_dlgHelper)
+ m_dlgHelper->setDirectory(f);
+ m_options->setInitialDirectory(f);
+ emit folderChanged();
+}
+
+void QQuickAbstractFileDialog::setNameFilters(const QStringList &f)
+{
+ m_options->setNameFilters(f);
+ if (f.isEmpty())
+ selectNameFilter(QString());
+ else if (!f.contains(selectedNameFilter()))
+ selectNameFilter(f.first());
+ emit nameFiltersChanged();
+}
+
+QString QQuickAbstractFileDialog::selectedNameFilter() const
+{
+ QString ret;
+ if (m_dlgHelper)
+ ret = m_dlgHelper->selectedNameFilter();
+ if (ret.isEmpty())
+ return m_options->initiallySelectedNameFilter();
+ return ret;
+}
+
+void QQuickAbstractFileDialog::selectNameFilter(const QString &f)
+{
+ // This should work whether the dialog is currently being shown already, or ahead of time.
+ m_options->setInitiallySelectedNameFilter(f);
+ if (m_dlgHelper)
+ m_dlgHelper->selectNameFilter(f);
+ emit filterSelected();
+}
+
+void QQuickAbstractFileDialog::setSelectedNameFilterIndex(int idx)
+{
+ selectNameFilter(nameFilters().at(idx));
+}
+
+QStringList QQuickAbstractFileDialog::selectedNameFilterExtensions() const
+{
+ QString filterRaw = selectedNameFilter();
+ QStringList ret;
+ if (filterRaw.isEmpty()) {
+ ret << "*";
+ return ret;
+ }
+ QRegularExpression re("(\\*\\.?\\w*)");
+ QRegularExpressionMatchIterator i = re.globalMatch(filterRaw);
+ while (i.hasNext())
+ ret << i.next().captured(1);
+ if (ret.isEmpty())
+ ret << filterRaw;
+ return ret;
+}
+
+int QQuickAbstractFileDialog::selectedNameFilterIndex() const
+{
+ return nameFilters().indexOf(selectedNameFilter());
+}
+
+QUrl QQuickAbstractFileDialog::fileUrl() const
+{
+ QList<QUrl> urls = fileUrls();
+ return (urls.count() == 1) ? urls[0] : QUrl();
+}
+
+QList<QUrl> QQuickAbstractFileDialog::fileUrls() const
+{
+ if (m_dlgHelper)
+ return m_dlgHelper->selectedFiles();
+ return QList<QUrl>();
+}
+
+void QQuickAbstractFileDialog::updateModes()
+{
+ // The 4 possible modes are AnyFile, ExistingFile, Directory, ExistingFiles
+ // Assume AnyFile until we find a reason to the contrary
+ QFileDialogOptions::FileMode mode = QFileDialogOptions::AnyFile;
+
+ if (m_selectFolder) {
+ mode = QFileDialogOptions::Directory;
+ m_options->setOption(QFileDialogOptions::ShowDirsOnly);
+ m_selectMultiple = false;
+ m_selectExisting = true;
+ setNameFilters(QStringList());
+ } else if (m_selectExisting) {
+ mode = m_selectMultiple ?
+ QFileDialogOptions::ExistingFiles : QFileDialogOptions::ExistingFile;
+ m_options->setOption(QFileDialogOptions::ShowDirsOnly, false);
+ } else if (m_selectMultiple) {
+ m_selectExisting = true;
+ }
+ if (!m_selectExisting)
+ m_selectMultiple = false;
+ m_options->setFileMode(mode);
+ m_options->setAcceptMode(m_selectExisting ?
+ QFileDialogOptions::AcceptOpen : QFileDialogOptions::AcceptSave);
+ emit fileModeChanged();
+}
+
+QT_END_NAMESPACE
diff --git a/src/dialogs/qquickabstractfiledialog_p.h b/src/dialogs/qquickabstractfiledialog_p.h
new file mode 100644
index 00000000..d24e557d
--- /dev/null
+++ b/src/dialogs/qquickabstractfiledialog_p.h
@@ -0,0 +1,129 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTFILEDIALOG_P_H
+#define QQUICKABSTRACTFILEDIALOG_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQml>
+#include <QQuickView>
+#include <QtGui/qpa/qplatformdialoghelper.h>
+#include <qpa/qplatformtheme.h>
+#include "qquickabstractdialog_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractFileDialog : public QQuickAbstractDialog
+{
+ Q_OBJECT
+ Q_PROPERTY(bool selectExisting READ selectExisting WRITE setSelectExisting NOTIFY fileModeChanged)
+ Q_PROPERTY(bool selectMultiple READ selectMultiple WRITE setSelectMultiple NOTIFY fileModeChanged)
+ Q_PROPERTY(bool selectFolder READ selectFolder WRITE setSelectFolder NOTIFY fileModeChanged)
+ Q_PROPERTY(QStringList shortcuts READ shortcuts CONSTANT)
+ Q_PROPERTY(QUrl folder READ folder WRITE setFolder NOTIFY folderChanged)
+ Q_PROPERTY(QStringList nameFilters READ nameFilters WRITE setNameFilters NOTIFY nameFiltersChanged)
+ Q_PROPERTY(QString selectedNameFilter READ selectedNameFilter WRITE selectNameFilter NOTIFY filterSelected)
+ Q_PROPERTY(QStringList selectedNameFilterExtensions READ selectedNameFilterExtensions NOTIFY filterSelected)
+ Q_PROPERTY(int selectedNameFilterIndex READ selectedNameFilterIndex WRITE setSelectedNameFilterIndex NOTIFY filterSelected)
+ Q_PROPERTY(QUrl fileUrl READ fileUrl NOTIFY selectionAccepted)
+ Q_PROPERTY(QList<QUrl> fileUrls READ fileUrls NOTIFY selectionAccepted)
+
+public:
+ QQuickAbstractFileDialog(QObject *parent = 0);
+ virtual ~QQuickAbstractFileDialog();
+
+ virtual QString title() const;
+ bool selectExisting() const { return m_selectExisting; }
+ bool selectMultiple() const { return m_selectMultiple; }
+ bool selectFolder() const { return m_selectFolder; }
+ QStringList shortcuts() const;
+ QUrl folder() const;
+ QStringList nameFilters() const { return m_options->nameFilters(); }
+ QString selectedNameFilter() const;
+ QStringList selectedNameFilterExtensions() const;
+ int selectedNameFilterIndex() const;
+ QUrl fileUrl() const;
+ virtual QList<QUrl> fileUrls() const;
+
+public Q_SLOTS:
+ void setVisible(bool v);
+ void setTitle(const QString &t);
+ void setSelectExisting(bool s);
+ void setSelectMultiple(bool s);
+ void setSelectFolder(bool s);
+ void setFolder(const QUrl &f);
+ void setNameFilters(const QStringList &f);
+ void selectNameFilter(const QString &f);
+ void setSelectedNameFilterIndex(int idx);
+
+Q_SIGNALS:
+ void folderChanged();
+ void nameFiltersChanged();
+ void filterSelected();
+ void fileModeChanged();
+ void selectionAccepted();
+
+protected:
+ void updateModes();
+
+protected:
+ QPlatformFileDialogHelper *m_dlgHelper;
+ QSharedPointer<QFileDialogOptions> m_options;
+ bool m_selectExisting;
+ bool m_selectMultiple;
+ bool m_selectFolder;
+
+ Q_DISABLE_COPY(QQuickAbstractFileDialog)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTFILEDIALOG_P_H
diff --git a/src/dialogs/qquickabstractfontdialog.cpp b/src/dialogs/qquickabstractfontdialog.cpp
new file mode 100644
index 00000000..29dd15e8
--- /dev/null
+++ b/src/dialogs/qquickabstractfontdialog.cpp
@@ -0,0 +1,150 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstractfontdialog_p.h"
+#include "qquickitem.h"
+
+#include <private/qguiapplication_p.h>
+#include <QWindow>
+#include <QQuickWindow>
+
+QT_BEGIN_NAMESPACE
+
+QQuickAbstractFontDialog::QQuickAbstractFontDialog(QObject *parent)
+ : QQuickAbstractDialog(parent)
+ , m_dlgHelper(0)
+ , m_options(QSharedPointer<QFontDialogOptions>(new QFontDialogOptions()))
+{
+ // On the Mac, modality doesn't work unless you call exec(). But this is a reasonable default anyway.
+ m_modality = Qt::NonModal;
+ connect(this, SIGNAL(accepted()), this, SIGNAL(selectionAccepted()));
+}
+
+QQuickAbstractFontDialog::~QQuickAbstractFontDialog()
+{
+}
+
+void QQuickAbstractFontDialog::setVisible(bool v)
+{
+ if (helper() && v) {
+ m_dlgHelper->setOptions(m_options);
+ // Due to the fact that QFontDialogOptions doesn't have currentFont...
+ m_dlgHelper->setCurrentFont(m_font);
+ }
+ QQuickAbstractDialog::setVisible(v);
+}
+
+void QQuickAbstractFontDialog::setModality(Qt::WindowModality m)
+{
+#ifdef Q_OS_MAC
+ // On the Mac, modality doesn't work unless you call exec()
+ m_modality = Qt::NonModal;
+ emit modalityChanged();
+ return;
+#endif
+ QQuickAbstractDialog::setModality(m);
+}
+
+QString QQuickAbstractFontDialog::title() const
+{
+ return m_options->windowTitle();
+}
+
+bool QQuickAbstractFontDialog::scalableFonts() const
+{
+ return m_options->testOption(QFontDialogOptions::ScalableFonts);
+}
+
+bool QQuickAbstractFontDialog::nonScalableFonts() const
+{
+ return m_options->testOption(QFontDialogOptions::NonScalableFonts);
+}
+
+bool QQuickAbstractFontDialog::monospacedFonts() const
+{
+ return m_options->testOption(QFontDialogOptions::MonospacedFonts);
+}
+
+bool QQuickAbstractFontDialog::proportionalFonts() const
+{
+ return m_options->testOption(QFontDialogOptions::ProportionalFonts);
+}
+
+void QQuickAbstractFontDialog::setTitle(const QString &t)
+{
+ if (m_options->windowTitle() == t) return;
+ m_options->setWindowTitle(t);
+ emit titleChanged();
+}
+
+void QQuickAbstractFontDialog::setFont(const QFont &arg)
+{
+ if (m_font != arg) {
+ m_font = arg;
+ emit fontChanged();
+ }
+}
+
+void QQuickAbstractFontDialog::setScalableFonts(bool arg)
+{
+ m_options->setOption(QFontDialogOptions::ScalableFonts, arg);
+ emit scalableFontsChanged();
+}
+
+void QQuickAbstractFontDialog::setNonScalableFonts(bool arg)
+{
+ m_options->setOption(QFontDialogOptions::NonScalableFonts, arg);
+ emit nonScalableFontsChanged();
+}
+
+void QQuickAbstractFontDialog::setMonospacedFonts(bool arg)
+{
+ m_options->setOption(QFontDialogOptions::MonospacedFonts, arg);
+ emit monospacedFontsChanged();
+}
+
+void QQuickAbstractFontDialog::setProportionalFonts(bool arg)
+{
+ m_options->setOption(QFontDialogOptions::ProportionalFonts, arg);
+ emit proportionalFontsChanged();
+}
+
+QT_END_NAMESPACE
diff --git a/src/dialogs/qquickabstractfontdialog_p.h b/src/dialogs/qquickabstractfontdialog_p.h
new file mode 100644
index 00000000..858a0d3e
--- /dev/null
+++ b/src/dialogs/qquickabstractfontdialog_p.h
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTFONTDIALOG_P_H
+#define QQUICKABSTRACTFONTDIALOG_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQml>
+#include <QQuickView>
+#include <QtGui/qpa/qplatformdialoghelper.h>
+#include <QtGui/qfont.h>
+#include <qpa/qplatformtheme.h>
+#include "qquickabstractdialog_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractFontDialog : public QQuickAbstractDialog
+{
+ Q_OBJECT
+ Q_PROPERTY(bool scalableFonts READ scalableFonts WRITE setScalableFonts NOTIFY scalableFontsChanged)
+ Q_PROPERTY(bool nonScalableFonts READ nonScalableFonts WRITE setNonScalableFonts NOTIFY nonScalableFontsChanged)
+ Q_PROPERTY(bool monospacedFonts READ monospacedFonts WRITE setMonospacedFonts NOTIFY monospacedFontsChanged)
+ Q_PROPERTY(bool proportionalFonts READ proportionalFonts WRITE setProportionalFonts NOTIFY proportionalFontsChanged)
+ Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged)
+
+public:
+ QQuickAbstractFontDialog(QObject *parent = 0);
+ virtual ~QQuickAbstractFontDialog();
+
+ virtual QString title() const;
+ bool scalableFonts() const;
+ bool nonScalableFonts() const;
+ bool monospacedFonts() const;
+ bool proportionalFonts() const;
+ QFont font() const { return m_font; }
+
+public Q_SLOTS:
+ void setVisible(bool v);
+ void setModality(Qt::WindowModality m);
+ void setTitle(const QString &t);
+ void setFont(const QFont &arg);
+ void setScalableFonts(bool arg);
+ void setNonScalableFonts(bool arg);
+ void setMonospacedFonts(bool arg);
+ void setProportionalFonts(bool arg);
+
+Q_SIGNALS:
+ void scalableFontsChanged();
+ void nonScalableFontsChanged();
+ void monospacedFontsChanged();
+ void proportionalFontsChanged();
+ void fontChanged();
+ void selectionAccepted();
+
+protected:
+ QPlatformFontDialogHelper *m_dlgHelper;
+ QSharedPointer<QFontDialogOptions> m_options;
+ QFont m_font;
+
+ Q_DISABLE_COPY(QQuickAbstractFontDialog)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTFONTDIALOG_P_H
diff --git a/src/dialogs/qquickabstractmessagedialog.cpp b/src/dialogs/qquickabstractmessagedialog.cpp
new file mode 100644
index 00000000..a4446496
--- /dev/null
+++ b/src/dialogs/qquickabstractmessagedialog.cpp
@@ -0,0 +1,179 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstractmessagedialog_p.h"
+#include <QtGui/qpa/qplatformdialoghelper.h>
+
+QT_BEGIN_NAMESPACE
+
+QQuickAbstractMessageDialog::QQuickAbstractMessageDialog(QObject *parent)
+ : QQuickAbstractDialog(parent)
+ , m_dlgHelper(0)
+ , m_options(QSharedPointer<QMessageDialogOptions>(new QMessageDialogOptions()))
+ , m_clickedButton(NoButton)
+{
+}
+
+QQuickAbstractMessageDialog::~QQuickAbstractMessageDialog()
+{
+}
+
+void QQuickAbstractMessageDialog::setVisible(bool v)
+{
+ if (helper() && v)
+ m_dlgHelper->setOptions(m_options);
+ if (v)
+ m_clickedButton = NoButton;
+ QQuickAbstractDialog::setVisible(v);
+}
+
+void QQuickAbstractMessageDialog::setTitle(const QString &arg)
+{
+ if (arg != m_options->windowTitle()) {
+ m_options->setWindowTitle(arg);
+ emit titleChanged();
+ }
+}
+
+void QQuickAbstractMessageDialog::setText(const QString &arg)
+{
+ if (arg != m_options->text()) {
+ m_options->setText(arg);
+ emit textChanged();
+ }
+}
+
+void QQuickAbstractMessageDialog::setInformativeText(const QString &arg)
+{
+ if (arg != m_options->informativeText()) {
+ m_options->setInformativeText(arg);
+ emit informativeTextChanged();
+ }
+}
+
+void QQuickAbstractMessageDialog::setDetailedText(const QString &arg)
+{
+ if (arg != m_options->detailedText()) {
+ m_options->setDetailedText(arg);
+ emit detailedTextChanged();
+ }
+}
+
+void QQuickAbstractMessageDialog::setIcon(QQuickAbstractMessageDialog::Icon icon)
+{
+ if (static_cast<int>(icon) != static_cast<int>(m_options->icon())) {
+ m_options->setIcon(static_cast<QMessageDialogOptions::Icon>(icon));
+ emit iconChanged();
+ }
+}
+
+QUrl QQuickAbstractMessageDialog::standardIconSource()
+{
+ switch (m_options->icon()) {
+ case QMessageDialogOptions::Information:
+ return QUrl("images/information.png");
+ break;
+ case QMessageDialogOptions::Warning:
+ return QUrl("images/warning.png");
+ break;
+ case QMessageDialogOptions::Critical:
+ return QUrl("images/critical.png");
+ break;
+ case QMessageDialogOptions::Question:
+ return QUrl("images/question.png");
+ break;
+ default:
+ return QUrl();
+ break;
+ }
+}
+
+void QQuickAbstractMessageDialog::setStandardButtons(StandardButtons buttons)
+{
+ if (buttons != m_options->standardButtons()) {
+ m_options->setStandardButtons(static_cast<QMessageDialogOptions::StandardButtons>(static_cast<int>(buttons)));
+ emit standardButtonsChanged();
+ }
+}
+
+void QQuickAbstractMessageDialog::click(QMessageDialogOptions::StandardButton button, QMessageDialogOptions::ButtonRole role)
+{
+ setVisible(false);
+ m_clickedButton = static_cast<StandardButton>(button);
+ emit buttonClicked();
+ switch (role) {
+ case QMessageDialogOptions::AcceptRole:
+ emit accept();
+ break;
+ case QMessageDialogOptions::RejectRole:
+ emit reject();
+ break;
+ case QMessageDialogOptions::DestructiveRole:
+ emit discard();
+ break;
+ case QMessageDialogOptions::HelpRole:
+ emit help();
+ break;
+ case QMessageDialogOptions::YesRole:
+ emit yes();
+ break;
+ case QMessageDialogOptions::NoRole:
+ emit no();
+ break;
+ case QMessageDialogOptions::ApplyRole:
+ emit apply();
+ break;
+ case QMessageDialogOptions::ResetRole:
+ emit reset();
+ break;
+ default:
+ qWarning("unhandled MessageDialog button %d with role %d", button, role);
+ }
+}
+
+void QQuickAbstractMessageDialog::click(QQuickAbstractMessageDialog::StandardButton button)
+{
+ click(static_cast<QMessageDialogOptions::StandardButton>(button),
+ static_cast<QMessageDialogOptions::ButtonRole>(
+ QMessageDialogOptions::buttonRole(static_cast<QMessageDialogOptions::StandardButton>(button))));
+}
+
+QT_END_NAMESPACE
diff --git a/src/dialogs/qquickabstractmessagedialog_p.h b/src/dialogs/qquickabstractmessagedialog_p.h
new file mode 100644
index 00000000..f2427bb2
--- /dev/null
+++ b/src/dialogs/qquickabstractmessagedialog_p.h
@@ -0,0 +1,165 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTMESSAGEDIALOG_P_H
+#define QQUICKABSTRACTMESSAGEDIALOG_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQml>
+#include <QQuickView>
+#include <QtGui/qpa/qplatformdialoghelper.h>
+#include <qpa/qplatformtheme.h>
+#include "qquickabstractdialog_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractMessageDialog : public QQuickAbstractDialog
+{
+ Q_OBJECT
+
+ Q_ENUMS(Icon)
+ Q_ENUMS(StandardButton)
+ Q_FLAGS(StandardButtons)
+
+ Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
+ Q_PROPERTY(QString informativeText READ informativeText WRITE setInformativeText NOTIFY informativeTextChanged)
+ Q_PROPERTY(QString detailedText READ detailedText WRITE setDetailedText NOTIFY detailedTextChanged)
+ Q_PROPERTY(Icon icon READ icon WRITE setIcon NOTIFY iconChanged)
+ Q_PROPERTY(QUrl standardIconSource READ standardIconSource NOTIFY iconChanged)
+ Q_PROPERTY(StandardButtons standardButtons READ standardButtons WRITE setStandardButtons NOTIFY standardButtonsChanged)
+ Q_PROPERTY(StandardButton clickedButton READ clickedButton NOTIFY buttonClicked)
+
+public:
+ QQuickAbstractMessageDialog(QObject *parent = 0);
+ virtual ~QQuickAbstractMessageDialog();
+
+ virtual QString title() const { return m_options->windowTitle(); }
+ QString text() const { return m_options->text(); }
+ QString informativeText() const { return m_options->informativeText(); }
+ QString detailedText() const { return m_options->detailedText(); }
+
+ enum Icon {
+ NoIcon = QMessageDialogOptions::NoIcon,
+ Information = QMessageDialogOptions::Information,
+ Warning = QMessageDialogOptions::Warning,
+ Critical = QMessageDialogOptions::Critical,
+ Question = QMessageDialogOptions::Question
+ };
+
+ Icon icon() const { return static_cast<Icon>(m_options->icon()); }
+
+ QUrl standardIconSource();
+
+ enum StandardButton {
+ NoButton = QMessageDialogOptions::NoButton,
+ Ok = QMessageDialogOptions::Ok,
+ Save = QMessageDialogOptions::Save,
+ SaveAll = QMessageDialogOptions::SaveAll,
+ Open = QMessageDialogOptions::Open,
+ Yes = QMessageDialogOptions::Yes,
+ YesToAll = QMessageDialogOptions::YesToAll,
+ No = QMessageDialogOptions::No,
+ NoToAll = QMessageDialogOptions::NoToAll,
+ Abort = QMessageDialogOptions::Abort,
+ Retry = QMessageDialogOptions::Retry,
+ Ignore = QMessageDialogOptions::Ignore,
+ Close = QMessageDialogOptions::Close,
+ Cancel = QMessageDialogOptions::Cancel,
+ Discard = QMessageDialogOptions::Discard,
+ Help = QMessageDialogOptions::Help,
+ Apply = QMessageDialogOptions::Apply,
+ Reset = QMessageDialogOptions::Reset,
+ RestoreDefaults = QMessageDialogOptions::RestoreDefaults
+ };
+ Q_DECLARE_FLAGS(StandardButtons, StandardButton)
+
+ StandardButtons standardButtons() const { return static_cast<StandardButtons>(static_cast<int>(m_options->standardButtons())); }
+
+ StandardButton clickedButton() const { return m_clickedButton; }
+
+public Q_SLOTS:
+ virtual void setVisible(bool v);
+ virtual void setTitle(const QString &arg);
+ void setText(const QString &arg);
+ void setInformativeText(const QString &arg);
+ void setDetailedText(const QString &arg);
+ void setIcon(Icon icon);
+ void setStandardButtons(StandardButtons buttons);
+ void click(QMessageDialogOptions::StandardButton button, QMessageDialogOptions::ButtonRole);
+ void click(QQuickAbstractMessageDialog::StandardButton button);
+
+Q_SIGNALS:
+ void textChanged();
+ void informativeTextChanged();
+ void detailedTextChanged();
+ void iconChanged();
+ void standardButtonsChanged();
+ void buttonClicked();
+ void discard();
+ void help();
+ void yes();
+ void no();
+ void apply();
+ void reset();
+
+protected:
+ QPlatformMessageDialogHelper *m_dlgHelper;
+ QSharedPointer<QMessageDialogOptions> m_options;
+ StandardButton m_clickedButton;
+
+ Q_DISABLE_COPY(QQuickAbstractMessageDialog)
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QQuickAbstractMessageDialog::StandardButtons)
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTMESSAGEDIALOG_P_H
diff --git a/src/dialogs/qquickcolordialog.cpp b/src/dialogs/qquickcolordialog.cpp
new file mode 100644
index 00000000..d0e0e11b
--- /dev/null
+++ b/src/dialogs/qquickcolordialog.cpp
@@ -0,0 +1,119 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickcolordialog_p.h"
+#include <QQuickItem>
+#include <private/qguiapplication_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype AbstractColorDialog
+ \instantiates QQuickColorDialog
+ \inqmlmodule QtQuick.Dialogs 1
+ \ingroup qtquick-visual
+ \brief API wrapper for QML file dialog implementations
+ \since 5.1
+ \internal
+
+ AbstractColorDialog provides only the API for implementing a color dialog.
+ The implementation (e.g. a Window or preferably an Item, in case it is
+ shown on a device that doesn't support multiple windows) can be provided as
+ \l implementation, which is the default property (the only allowed child
+ element).
+*/
+
+/*!
+ \qmlsignal QtQuick::Dialogs::AbstractColorDialog::accepted
+
+ This signal is emitted by \l accept().
+*/
+
+/*!
+ \qmlsignal QtQuick::Dialogs::AbstractColorDialog::rejected
+
+ This signal is emitted by \l reject().
+*/
+
+/*!
+ \class QQuickColorDialog
+ \inmodule QtQuick.Dialogs
+ \internal
+
+ The QQuickColorDialog class is a concrete subclass of
+ \l QQuickAbstractColorDialog, but it is abstract from the QML perspective
+ because it needs to enclose a graphical implementation. It exists in order
+ to provide accessors and helper functions which the QML implementation will
+ need.
+
+ \since 5.1
+*/
+
+/*!
+ Constructs a file dialog wrapper with parent window \a parent.
+*/
+QQuickColorDialog::QQuickColorDialog(QObject *parent)
+ : QQuickAbstractColorDialog(parent)
+{
+}
+
+
+/*!
+ Destroys the file dialog wrapper.
+*/
+QQuickColorDialog::~QQuickColorDialog()
+{
+}
+
+/*!
+ \qmlproperty bool AbstractColorDialog::visible
+
+ This property holds whether the dialog is visible. By default this is false.
+*/
+
+/*!
+ \qmlproperty QObject AbstractColorDialog::implementation
+
+ The QML object which implements the actual file dialog. Should be either a
+ \l Window or an \l Item.
+*/
+
+QT_END_NAMESPACE
diff --git a/src/dialogs/qquickcolordialog_p.h b/src/dialogs/qquickcolordialog_p.h
new file mode 100644
index 00000000..ff6953fc
--- /dev/null
+++ b/src/dialogs/qquickcolordialog_p.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKCOLORDIALOG_P_H
+#define QQUICKCOLORDIALOG_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qquickabstractcolordialog_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QQuickColorDialog : public QQuickAbstractColorDialog
+{
+ Q_OBJECT
+ Q_PROPERTY(QObject* implementation READ qmlImplementation WRITE setQmlImplementation DESIGNABLE false)
+ Q_CLASSINFO("DefaultProperty", "implementation") // AbstractColorDialog in QML can have only one child
+
+public:
+ explicit QQuickColorDialog(QObject *parent = 0);
+ ~QQuickColorDialog();
+
+protected:
+ virtual QPlatformColorDialogHelper *helper() { return 0; }
+
+ Q_DISABLE_COPY(QQuickColorDialog)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickColorDialog *)
+
+#endif // QQUICKCOLORDIALOG_P_H
diff --git a/src/dialogs/qquickdialogassets_p.h b/src/dialogs/qquickdialogassets_p.h
new file mode 100644
index 00000000..406b68a6
--- /dev/null
+++ b/src/dialogs/qquickdialogassets_p.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKDIALOGASSETS_P_H
+#define QQUICKDIALOGASSETS_P_H
+
+#include <private/qtquickglobal_p.h>
+#include <QtGui/qpa/qplatformdialoghelper.h>
+#include "qquickabstractmessagedialog_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QQuickStandardButton
+{
+ Q_GADGET
+ Q_ENUMS(QQuickAbstractMessageDialog::StandardButton)
+};
+
+class QQuickStandardIcon
+{
+ Q_GADGET
+ Q_ENUMS(QQuickAbstractMessageDialog::Icon)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKDIALOGASSETS_P_H
diff --git a/src/dialogs/qquickfiledialog.cpp b/src/dialogs/qquickfiledialog.cpp
new file mode 100644
index 00000000..f408713e
--- /dev/null
+++ b/src/dialogs/qquickfiledialog.cpp
@@ -0,0 +1,172 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickfiledialog_p.h"
+#include <QQuickItem>
+#include <private/qguiapplication_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype AbstractFileDialog
+ \instantiates QQuickFileDialog
+ \inqmlmodule QtQuick.Dialogs 1
+ \ingroup qtquick-visual
+ \brief API wrapper for QML file dialog implementations
+ \since 5.1
+ \internal
+
+ AbstractFileDialog provides only the API for implementing a file dialog.
+ The implementation (e.g. a Window or preferably an Item, in case it is
+ shown on a device that doesn't support multiple windows) can be provided as
+ \l implementation, which is the default property (the only allowed child
+ element).
+*/
+
+/*!
+ \qmlsignal QtQuick::Dialogs::AbstractFileDialog::accepted
+
+ This signal is emitted by \l accept().
+*/
+
+/*!
+ \qmlsignal QtQuick::Dialogs::AbstractFileDialog::rejected
+
+ This signal is emitted by \l reject().
+*/
+
+/*!
+ \class QQuickFileDialog
+ \inmodule QtQuick.Dialogs
+ \internal
+
+ The QQuickFileDialog class is a concrete subclass of
+ \l QQuickAbstractFileDialog, but it is abstract from the QML perspective
+ because it needs to enclose a graphical implementation. It exists in order
+ to provide accessors and helper functions which the QML implementation will
+ need.
+
+ \since 5.1
+*/
+
+/*!
+ Constructs a file dialog wrapper with parent window \a parent.
+*/
+QQuickFileDialog::QQuickFileDialog(QObject *parent)
+ : QQuickAbstractFileDialog(parent)
+{
+}
+
+
+/*!
+ Destroys the file dialog wrapper.
+*/
+QQuickFileDialog::~QQuickFileDialog()
+{
+}
+
+QList<QUrl> QQuickFileDialog::fileUrls() const
+{
+ return m_selections;
+}
+
+/*!
+ \qmlproperty bool AbstractFileDialog::visible
+
+ This property holds whether the dialog is visible. By default this is false.
+*/
+
+/*!
+ \qmlproperty bool AbstractFileDialog::fileUrls
+
+ A list of files to be populated as the user chooses.
+*/
+
+/*!
+ \brief Clears \l fileUrls
+*/
+void QQuickFileDialog::clearSelection()
+{
+ m_selections.clear();
+}
+
+/*!
+ \brief Adds one file to \l fileUrls
+
+ \l path should be given as an absolute file:// path URL.
+ Returns true on success, false if the given path is
+ not valid given the current property settings.
+*/
+bool QQuickFileDialog::addSelection(const QUrl &path)
+{
+ QFileInfo info(path.toLocalFile());
+ if (info.exists() && ((info.isDir() && m_selectFolder) || !info.isDir())) {
+ if (m_selectFolder)
+ m_selections.append(pathFolder(path.toLocalFile()));
+ else
+ m_selections.append(path);
+ return true;
+ }
+ return false;
+}
+
+/*!
+ \brief get a file's directory as a URL
+
+ If \a path points to a directory, just convert it to a URL.
+ If \a path points to a file, convert the file's directory to a URL.
+*/
+QUrl QQuickFileDialog::pathFolder(const QString &path)
+{
+ QFileInfo info(path);
+ if (info.exists() && info.isDir())
+ return QUrl::fromLocalFile(path);
+ return QUrl::fromLocalFile(QFileInfo(path).absolutePath());
+}
+
+/*!
+ \qmlproperty QObject AbstractFileDialog::implementation
+
+ The QML object which implements the actual file dialog. Should be either a
+ \l Window or an \l Item.
+*/
+
+QT_END_NAMESPACE
diff --git a/src/dialogs/qquickfiledialog_p.h b/src/dialogs/qquickfiledialog_p.h
new file mode 100644
index 00000000..880fd137
--- /dev/null
+++ b/src/dialogs/qquickfiledialog_p.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKFILEDIALOG_P_H
+#define QQUICKFILEDIALOG_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qquickabstractfiledialog_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QQuickFileDialog : public QQuickAbstractFileDialog
+{
+ Q_OBJECT
+ Q_PROPERTY(QObject* implementation READ qmlImplementation WRITE setQmlImplementation DESIGNABLE false)
+ Q_CLASSINFO("DefaultProperty", "implementation") // AbstractFileDialog in QML can have only one child
+
+public:
+ explicit QQuickFileDialog(QObject *parent = 0);
+ ~QQuickFileDialog();
+ virtual QList<QUrl> fileUrls() const;
+
+Q_SIGNALS:
+
+public Q_SLOTS:
+ void clearSelection();
+ bool addSelection(const QUrl &path);
+
+protected:
+ virtual QPlatformFileDialogHelper *helper() { return 0; }
+ Q_INVOKABLE QString urlToPath(const QUrl &url) { return url.toLocalFile(); }
+ Q_INVOKABLE QUrl pathToUrl(const QString &path) { return QUrl::fromLocalFile(path); }
+ Q_INVOKABLE QUrl pathFolder(const QString &path);
+
+private:
+ QList<QUrl> m_selections;
+
+ Q_DISABLE_COPY(QQuickFileDialog)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickFileDialog *)
+
+#endif // QQUICKFILEDIALOG_P_H
diff --git a/src/dialogs/qquickfontdialog.cpp b/src/dialogs/qquickfontdialog.cpp
new file mode 100644
index 00000000..2f3c6d83
--- /dev/null
+++ b/src/dialogs/qquickfontdialog.cpp
@@ -0,0 +1,120 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickfontdialog_p.h"
+#include <QQuickItem>
+#include <private/qguiapplication_p.h>
+#include <qpa/qplatformintegration.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype AbstractFontDialog
+ \instantiates QQuickFontDialog
+ \inqmlmodule QtQuick.Dialogs 1
+ \ingroup qtquick-visual
+ \brief API wrapper for QML font dialog implementations
+ \since 5.2
+ \internal
+
+ AbstractFontDialog provides only the API for implementing a font dialog.
+ The implementation (e.g. a Window or preferably an Item, in case it is
+ shown on a device that doesn't support multiple windows) can be provided as
+ \l implementation, which is the default property (the only allowed child
+ element).
+*/
+
+/*!
+ \qmlsignal QtQuick::Dialogs::AbstractFontDialog::accepted
+
+ The \a accepted signal is emitted by \l accept().
+*/
+
+/*!
+ \qmlsignal QtQuick::Dialogs::AbstractFontDialog::rejected
+
+ The \a accepted signal is emitted by \l reject().
+*/
+
+/*!
+ \class QQuickFontDialog
+ \inmodule QtQuick.Dialogs
+ \internal
+
+ The QQuickFontDialog class is a concrete subclass of \l
+ QQuickAbstractFontDialog, but it is abstract from the QML perspective
+ because it needs to enclose a graphical implementation. It exists in order
+ to provide accessors and helper functions which the QML implementation will
+ need.
+
+ \since 5.2
+*/
+
+/*!
+ Constructs a font dialog wrapper with parent window \a parent.
+*/
+QQuickFontDialog::QQuickFontDialog(QObject *parent)
+ : QQuickAbstractFontDialog(parent)
+{
+}
+
+
+/*!
+ Destroys the font dialog wrapper.
+*/
+QQuickFontDialog::~QQuickFontDialog()
+{
+}
+
+/*!
+ \qmlproperty bool AbstractFontDialog::visible
+
+ This property holds whether the dialog is visible. By default this is false.
+*/
+
+/*!
+ \qmlproperty QObject AbstractFontDialog::implementation
+
+ The QML object which implements the actual font dialog. Should be either a
+ \l Window or an \l Item.
+*/
+
+QT_END_NAMESPACE
diff --git a/src/dialogs/qquickfontdialog_p.h b/src/dialogs/qquickfontdialog_p.h
new file mode 100644
index 00000000..a8e2d82e
--- /dev/null
+++ b/src/dialogs/qquickfontdialog_p.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKFONTDIALOG_P_H
+#define QQUICKFONTDIALOG_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qquickabstractfontdialog_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QQuickFontDialog : public QQuickAbstractFontDialog
+{
+ Q_OBJECT
+ Q_PROPERTY(QObject* implementation READ qmlImplementation WRITE setQmlImplementation DESIGNABLE false)
+ Q_CLASSINFO("DefaultProperty", "implementation")
+
+public:
+ explicit QQuickFontDialog(QObject *parent = 0);
+ ~QQuickFontDialog();
+
+protected:
+ virtual QPlatformFontDialogHelper *helper() { return 0; }
+
+ Q_DISABLE_COPY(QQuickFontDialog)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickFontDialog *)
+
+#endif // QQUICKFONTDIALOG_P_H
diff --git a/src/dialogs/qquickmessagedialog.cpp b/src/dialogs/qquickmessagedialog.cpp
new file mode 100644
index 00000000..43b6ca09
--- /dev/null
+++ b/src/dialogs/qquickmessagedialog.cpp
@@ -0,0 +1,181 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickmessagedialog_p.h"
+#include <QQuickItem>
+#include <private/qguiapplication_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype AbstractMessageDialog
+ \instantiates QQuickMessageDialog
+ \inqmlmodule QtQuick.Dialogs 1
+ \ingroup qtquick-visual
+ \brief API wrapper for QML message dialog implementations
+ \since 5.2
+ \internal
+
+ AbstractMessageDialog provides only the API for implementing a message dialog.
+ The implementation (e.g. a Window or preferably an Item, in case it is
+ shown on a device that doesn't support multiple windows) can be provided as
+ \l implementation, which is the default property (the only allowed child
+ element).
+*/
+
+/*!
+ \qmlsignal QtQuick::Dialogs::AbstractMessageDialog::accepted
+
+ This signal is emitted by \l accept().
+*/
+
+/*!
+ \qmlsignal QtQuick::Dialogs::AbstractMessageDialog::rejected
+
+ This signal is emitted by \l reject().
+*/
+
+/*!
+ \class QQuickMessageDialog
+ \inmodule QtQuick.Dialogs
+ \internal
+
+ The QQuickMessageDialog class is a concrete subclass of
+ \l QQuickAbstractMessageDialog, but it is abstract from the QML perspective
+ because it needs to enclose a graphical implementation. It exists in order
+ to provide accessors and helper functions which the QML implementation will
+ need.
+
+ \since 5.2
+*/
+
+/*!
+ Constructs a message dialog wrapper with parent window \a parent.
+*/
+QQuickMessageDialog::QQuickMessageDialog(QObject *parent)
+ : QQuickAbstractMessageDialog(parent)
+{
+ connect(this, SIGNAL(buttonClicked()), this, SLOT(clicked()));
+}
+
+
+/*!
+ Destroys the message dialog wrapper.
+*/
+QQuickMessageDialog::~QQuickMessageDialog()
+{
+}
+
+/*!
+ \qmlproperty bool AbstractMessageDialog::visible
+
+ This property holds whether the dialog is visible. By default this is false.
+*/
+
+/*!
+ \qmlproperty QObject AbstractMessageDialog::implementation
+
+ The QML object which implements the actual message dialog. Should be either a
+ \l Window or an \l Item.
+*/
+
+
+void QQuickMessageDialog::clicked() {
+ switch (m_clickedButton) {
+ // This mapping from buttons to roles is the same as
+ // documented for enum QMessageBox::StandardButton
+ case Ok:
+ case Open:
+ case Save:
+ case SaveAll:
+ case Retry:
+ case Ignore:
+ accept();
+ break;
+ case Cancel:
+ case Close:
+ case Abort:
+ reject();
+ break;
+ case Discard:
+ emit discard();
+ close();
+ break;
+ case Help:
+ emit help();
+ break;
+ case Yes:
+ case YesToAll:
+ emit yes();
+ close();
+ break;
+ case No:
+ case NoToAll:
+ emit no();
+ close();
+ break;
+ case Apply:
+ emit apply();
+ break;
+ case Reset:
+ case RestoreDefaults:
+ emit reset();
+ break;
+ default:
+ qWarning("StandardButton %d has no role", m_clickedButton);
+ }
+}
+
+void QQuickMessageDialog::accept() {
+ // enter key is treated like OK
+ if (m_clickedButton == NoButton)
+ m_clickedButton = Ok;
+ QQuickAbstractMessageDialog::accept();
+}
+
+void QQuickMessageDialog::reject() {
+ // escape key is treated like cancel
+ if (m_clickedButton == NoButton)
+ m_clickedButton = Cancel;
+ QQuickAbstractMessageDialog::reject();
+}
+
+QT_END_NAMESPACE
diff --git a/src/dialogs/qquickmessagedialog_p.h b/src/dialogs/qquickmessagedialog_p.h
new file mode 100644
index 00000000..b21d8cba
--- /dev/null
+++ b/src/dialogs/qquickmessagedialog_p.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKMESSAGEDIALOG_P_H
+#define QQUICKMESSAGEDIALOG_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qquickabstractmessagedialog_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QQuickMessageDialog : public QQuickAbstractMessageDialog
+{
+ Q_OBJECT
+ Q_PROPERTY(QObject* implementation READ qmlImplementation WRITE setQmlImplementation DESIGNABLE false)
+ Q_CLASSINFO("DefaultProperty", "implementation") // AbstractMessageDialog in QML can have only one child
+
+public:
+ explicit QQuickMessageDialog(QObject *parent = 0);
+ ~QQuickMessageDialog();
+
+protected:
+ virtual QPlatformDialogHelper *helper() { return 0; }
+
+protected Q_SLOTS:
+ virtual void accept();
+ virtual void reject();
+ void clicked();
+
+private:
+ Q_DISABLE_COPY(QQuickMessageDialog)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickMessageDialog *)
+
+#endif // QQUICKMESSAGEDIALOG_P_H
diff --git a/src/dialogs/qquickplatformcolordialog.cpp b/src/dialogs/qquickplatformcolordialog.cpp
new file mode 100644
index 00000000..11ddbfe6
--- /dev/null
+++ b/src/dialogs/qquickplatformcolordialog.cpp
@@ -0,0 +1,254 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickplatformcolordialog_p.h"
+#include "qquickitem.h"
+
+#include <private/qguiapplication_p.h>
+#include <QWindow>
+#include <QQuickView>
+#include <QQuickWindow>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype ColorDialog
+ \instantiates QQuickPlatformColorDialog
+ \inqmlmodule QtQuick.Dialogs 1
+ \ingroup dialogs
+ \brief Dialog component for choosing a color.
+ \since 5.1
+
+ ColorDialog allows the user to select a color. The dialog is initially
+ invisible. You need to set the properties as desired first, then set
+ \l visible to true or call \l open().
+
+ Here is a minimal example to open a color dialog and exit after the user
+ chooses a color:
+
+ \qml
+ import QtQuick 2.1
+ import QtQuick.Dialogs 1.0
+
+ ColorDialog {
+ id: colorDialog
+ title: "Please choose a color"
+ onAccepted: {
+ console.log("You chose: " + colorDialog.color)
+ Qt.quit()
+ }
+ onRejected: {
+ console.log("Canceled")
+ Qt.quit()
+ }
+ Component.onCompleted: visible = true
+ }
+ \endqml
+
+ A ColorDialog window is automatically transient for its parent window. So
+ whether you declare the dialog inside an \l Item or inside a \l Window, the
+ dialog will appear centered over the window containing the item, or over
+ the Window that you declared.
+
+ The implementation of ColorDialog will be a platform color dialog if
+ possible. If that isn't possible, then it will try to instantiate a
+ \l QColorDialog. If that also isn't possible, then it will fall back to a QML
+ implementation, DefaultColorDialog.qml. In that case you can customize the
+ appearance by editing this file. DefaultColorDialog.qml contains a Rectangle
+ to hold the dialog's contents, because certain embedded systems do not
+ support multiple top-level windows. When the dialog becomes visible, it
+ will automatically be wrapped in a Window if possible, or simply reparented
+ on top of the main window if there can only be one window.
+*/
+
+/*!
+ \qmlsignal QtQuick::Dialogs::ColorDialog::accepted
+
+ This handler is called when the user has finished using the
+ dialog. You can then inspect the \l color property to get the selection.
+
+ Example:
+
+ \qml
+ ColorDialog {
+ onAccepted: { console.log("Selected color: " + color) }
+ }
+ \endqml
+*/
+
+/*!
+ \qmlsignal QtQuick::Dialogs::ColorDialog::rejected
+
+ This handler is called when the user has dismissed the dialog,
+ either by closing the dialog window or by pressing the Cancel button.
+*/
+
+/*!
+ \class QQuickPlatformColorDialog
+ \inmodule QtQuick.Dialogs
+ \internal
+
+ \brief The QQuickPlatformColorDialog class provides a color dialog
+
+ The dialog is implemented via the QPlatformColorDialogHelper when possible;
+ otherwise it falls back to a QColorDialog or a QML implementation.
+
+ \since 5.1
+*/
+
+/*!
+ Constructs a color dialog with parent window \a parent.
+*/
+QQuickPlatformColorDialog::QQuickPlatformColorDialog(QObject *parent) :
+ QQuickAbstractColorDialog(parent)
+{
+}
+
+/*!
+ Destroys the color dialog.
+*/
+QQuickPlatformColorDialog::~QQuickPlatformColorDialog()
+{
+ if (m_dlgHelper)
+ m_dlgHelper->hide();
+ delete m_dlgHelper;
+}
+
+QPlatformColorDialogHelper *QQuickPlatformColorDialog::helper()
+{
+ QQuickItem *parentItem = qobject_cast<QQuickItem *>(parent());
+ if (parentItem)
+ m_parentWindow = parentItem->window();
+
+ if ( !m_dlgHelper && QGuiApplicationPrivate::platformTheme()->
+ usePlatformNativeDialog(QPlatformTheme::ColorDialog) ) {
+ m_dlgHelper = static_cast<QPlatformColorDialogHelper *>(QGuiApplicationPrivate::platformTheme()
+ ->createPlatformDialogHelper(QPlatformTheme::ColorDialog));
+ if (!m_dlgHelper)
+ return m_dlgHelper;
+ connect(m_dlgHelper, SIGNAL(accept()), this, SLOT(accept()));
+ connect(m_dlgHelper, SIGNAL(reject()), this, SLOT(reject()));
+ connect(m_dlgHelper, SIGNAL(currentColorChanged(QColor)), this, SLOT(setCurrentColor(QColor)));
+ connect(m_dlgHelper, SIGNAL(colorSelected(QColor)), this, SLOT(setColor(QColor)));
+ }
+
+ return m_dlgHelper;
+}
+
+/*!
+ \qmlproperty bool ColorDialog::visible
+
+ This property holds whether the dialog is visible. By default this is
+ false.
+
+ \sa modality
+*/
+
+/*!
+ \qmlproperty Qt::WindowModality ColorDialog::modality
+
+ Whether the dialog should be shown modal with respect to the window
+ containing the dialog's parent Item, modal with respect to the whole
+ application, or non-modal.
+
+ By default it is \l NonModal.
+
+ Modality does not mean that there are any blocking calls to wait for the
+ dialog to be accepted or rejected; it's only that the user will be
+ prevented from interacting with the parent window and/or the application
+ windows at the same time.
+
+ On MacOS the color dialog is only allowed to be non-modal.
+*/
+
+/*!
+ \qmlmethod void ColorDialog::open()
+
+ Shows the dialog to the user. It is equivalent to setting \l visible to
+ true.
+*/
+
+/*!
+ \qmlmethod void ColorDialog::close()
+
+ Closes the dialog.
+*/
+
+/*!
+ \qmlproperty string ColorDialog::title
+
+ The title of the dialog window.
+*/
+
+/*!
+ \qmlproperty bool ColorDialog::showAlphaChannel
+
+ Whether the dialog will provide a means of changing the opacity.
+
+ By default, this property is true. This property must be set to the desired
+ value before opening the dialog. Usually the alpha channel is represented
+ by an additional slider control.
+*/
+
+/*!
+ \qmlproperty color ColorDialog::color
+
+ The color which the user selected.
+
+ \note This color is not always the same as the color held by the
+ currentColor property since the user can choose different colors before
+ finally selecting the one to use.
+
+ \sa currentColor
+*/
+
+/*!
+ \qmlproperty color ColorDialog::currentColor
+
+ The color which the user has currently selected.
+
+ For the color that is set when the dialog is accepted, use the \l color
+ property.
+
+ \sa color
+*/
+
+QT_END_NAMESPACE
diff --git a/src/dialogs/qquickplatformcolordialog_p.h b/src/dialogs/qquickplatformcolordialog_p.h
new file mode 100644
index 00000000..55d301da
--- /dev/null
+++ b/src/dialogs/qquickplatformcolordialog_p.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKPLATFORMCOLORDIALOG_P_H
+#define QQUICKPLATFORMCOLORDIALOG_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qquickabstractcolordialog_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QQuickPlatformColorDialog : public QQuickAbstractColorDialog
+{
+ Q_OBJECT
+
+public:
+ QQuickPlatformColorDialog(QObject *parent = 0);
+ virtual ~QQuickPlatformColorDialog();
+
+protected:
+ QPlatformColorDialogHelper *helper();
+
+ Q_DISABLE_COPY(QQuickPlatformColorDialog)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickPlatformColorDialog *)
+
+#endif // QQUICKPLATFORMCOLORDIALOG_P_H
diff --git a/src/dialogs/qquickplatformfiledialog.cpp b/src/dialogs/qquickplatformfiledialog.cpp
new file mode 100644
index 00000000..066aabe3
--- /dev/null
+++ b/src/dialogs/qquickplatformfiledialog.cpp
@@ -0,0 +1,314 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickplatformfiledialog_p.h"
+#include "qquickitem.h"
+
+#include <private/qguiapplication_p.h>
+#include <QWindow>
+#include <QQuickView>
+#include <QQuickWindow>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype FileDialog
+ \instantiates QQuickPlatformFileDialog
+ \inqmlmodule QtQuick.Dialogs 1
+ \ingroup dialogs
+ \brief Dialog component for choosing files from a local filesystem.
+ \since 5.1
+
+ FileDialog provides a basic file chooser: it allows the user to select
+ existing files and/or directories, or create new filenames. The dialog is
+ initially invisible. You need to set the properties as desired first, then
+ set \l visible to true or call \l open().
+
+ Here is a minimal example to open a file dialog and exit after the user
+ chooses a file:
+
+ \qml
+ import QtQuick 2.1
+ import QtQuick.Dialogs 1.0
+
+ FileDialog {
+ id: fileDialog
+ title: "Please choose a file"
+ onAccepted: {
+ console.log("You chose: " + fileDialog.fileUrls)
+ Qt.quit()
+ }
+ onRejected: {
+ console.log("Canceled")
+ Qt.quit()
+ }
+ Component.onCompleted: visible = true
+ }
+ \endqml
+
+ A FileDialog window is automatically transient for its parent window. So
+ whether you declare the dialog inside an \l Item or inside a \l Window, the
+ dialog will appear centered over the window containing the item, or over
+ the Window that you declared.
+
+ The implementation of FileDialog will be a platform file dialog if
+ possible. If that isn't possible, then it will try to instantiate a
+ \l QFileDialog. If that also isn't possible, then it will fall back to a QML
+ implementation, DefaultFileDialog.qml. In that case you can customize the
+ appearance by editing this file. DefaultFileDialog.qml contains a Rectangle
+ to hold the dialog's contents, because certain embedded systems do not
+ support multiple top-level windows. When the dialog becomes visible, it
+ will automatically be wrapped in a Window if possible, or simply reparented
+ on top of the main window if there can only be one window.
+*/
+
+/*!
+ \qmlsignal QtQuick::Dialogs::FileDialog::accepted
+
+ This handler is called when the user has finished using the
+ dialog. You can then inspect the \l fileUrl or \l fileUrls properties to
+ get the selection.
+
+ Example:
+
+ \qml
+ FileDialog {
+ onAccepted: { console.log("Selected file: " + fileUrl) }
+ }
+ \endqml
+*/
+
+/*!
+ \qmlsignal QtQuick::Dialogs::FileDialog::rejected
+
+ This handler is called when the user has dismissed the dialog,
+ either by closing the dialog window or by pressing the Cancel button.
+*/
+
+/*!
+ \class QQuickPlatformFileDialog
+ \inmodule QtQuick.Dialogs
+ \internal
+
+ \brief The QQuickPlatformFileDialog class provides a file dialog
+
+ The dialog is implemented via the QPlatformFileDialogHelper when possible;
+ otherwise it falls back to a QFileDialog or a QML implementation.
+
+ \since 5.1
+*/
+
+/*!
+ Constructs a file dialog with parent window \a parent.
+*/
+QQuickPlatformFileDialog::QQuickPlatformFileDialog(QObject *parent) :
+ QQuickAbstractFileDialog(parent)
+{
+}
+
+/*!
+ Destroys the file dialog.
+*/
+QQuickPlatformFileDialog::~QQuickPlatformFileDialog()
+{
+ if (m_dlgHelper)
+ m_dlgHelper->hide();
+ delete m_dlgHelper;
+}
+
+QPlatformFileDialogHelper *QQuickPlatformFileDialog::helper()
+{
+ QQuickItem *parentItem = qobject_cast<QQuickItem *>(parent());
+ if (parentItem)
+ m_parentWindow = parentItem->window();
+
+ if ( !m_dlgHelper && QGuiApplicationPrivate::platformTheme()->
+ usePlatformNativeDialog(QPlatformTheme::FileDialog) ) {
+ m_dlgHelper = static_cast<QPlatformFileDialogHelper *>(QGuiApplicationPrivate::platformTheme()
+ ->createPlatformDialogHelper(QPlatformTheme::FileDialog));
+ if (!m_dlgHelper)
+ return m_dlgHelper;
+ connect(m_dlgHelper, SIGNAL(directoryEntered(QUrl)), this, SIGNAL(folderChanged()));
+ connect(m_dlgHelper, SIGNAL(filterSelected(QString)), this, SIGNAL(filterSelected()));
+ connect(m_dlgHelper, SIGNAL(accept()), this, SLOT(accept()));
+ connect(m_dlgHelper, SIGNAL(reject()), this, SLOT(reject()));
+ }
+
+ return m_dlgHelper;
+}
+
+/*!
+ \qmlproperty bool FileDialog::visible
+
+ This property holds whether the dialog is visible. By default this is
+ false.
+
+ \sa modality
+*/
+
+/*!
+ \qmlproperty Qt::WindowModality FileDialog::modality
+
+ Whether the dialog should be shown modal with respect to the window
+ containing the dialog's parent Item, modal with respect to the whole
+ application, or non-modal.
+
+ By default it is \c Qt.WindowModal.
+
+ Modality does not mean that there are any blocking calls to wait for the
+ dialog to be accepted or rejected; it's only that the user will be
+ prevented from interacting with the parent window and/or the application
+ windows at the same time. You probably need to write an onAccepted handler
+ to actually load or save the chosen file.
+*/
+
+/*!
+ \qmlmethod void FileDialog::open()
+
+ Shows the dialog to the user. It is equivalent to setting \l visible to
+ true.
+*/
+
+/*!
+ \qmlmethod void FileDialog::close()
+
+ Closes the dialog.
+*/
+
+/*!
+ \qmlproperty string FileDialog::title
+
+ The title of the dialog window.
+*/
+
+/*!
+ \qmlproperty bool FileDialog::selectExisting
+
+ Whether only existing files or directories can be selected.
+
+ By default, this property is true. This property must be set to the desired
+ value before opening the dialog. Setting this property to false implies
+ that the dialog is for naming a file to which to save something, or naming
+ a folder to be created; therefore \l selectMultiple must be false.
+*/
+
+/*!
+ \qmlproperty bool FileDialog::selectMultiple
+
+ Whether more than one filename can be selected.
+
+ By default, this property is false. This property must be set to the
+ desired value before opening the dialog. Setting this property to true
+ implies that \l selectExisting must be true.
+*/
+
+/*!
+ \qmlproperty bool FileDialog::selectFolder
+
+ Whether the selected item should be a folder.
+
+ By default, this property is false. This property must be set to the
+ desired value before opening the dialog. Setting this property to true
+ implies that \l selectMultiple must be false and \l selectExisting must be
+ true.
+*/
+
+/*!
+ \qmlproperty url FileDialog::folder
+
+ The path to the currently selected folder. Setting this property before
+ invoking open() will cause the file browser to be initially positioned on
+ the specified folder.
+
+ The value of this property is also updated after the dialog is closed.
+
+ By default, this property is false.
+*/
+
+/*!
+ \qmlproperty list<string> FileDialog::nameFilters
+
+ A list of strings to be used as file name filters. Each string can be a
+ space-separated list of filters; filters may include the ? and * wildcards.
+ The list of filters can also be enclosed in parentheses and a textual
+ description of the filter can be provided.
+
+ For example:
+
+ \qml
+ FileDialog {
+ nameFilters: [ "Image files (*.jpg *.png)", "All files (*)" ]
+ }
+ \endqml
+
+ \note Directories are not excluded by filters.
+ \sa selectedNameFilter
+*/
+
+/*!
+ \qmlproperty string FileDialog::selectedNameFilter
+
+ Which of the \l nameFilters is currently selected.
+
+ This property can be set before the dialog is visible, to set the default
+ name filter, and can also be set while the dialog is visible to set the
+ current name filter. It is also updated when the user selects a different
+ filter.
+*/
+
+/*!
+ \qmlproperty url FileDialog::fileUrl
+
+ The path of the file which was selected by the user.
+
+ \note This property is set only if exactly one file was selected. In all
+ other cases, it will be empty.
+
+ \sa fileUrls
+*/
+
+/*!
+ \qmlproperty list<url> FileDialog::fileUrls
+
+ The list of file paths which were selected by the user.
+*/
+
+QT_END_NAMESPACE
diff --git a/src/dialogs/qquickplatformfiledialog_p.h b/src/dialogs/qquickplatformfiledialog_p.h
new file mode 100644
index 00000000..54318362
--- /dev/null
+++ b/src/dialogs/qquickplatformfiledialog_p.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKPLATFORMFILEDIALOG_P_H
+#define QQUICKPLATFORMFILEDIALOG_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qquickabstractfiledialog_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QQuickPlatformFileDialog : public QQuickAbstractFileDialog
+{
+ Q_OBJECT
+
+public:
+ QQuickPlatformFileDialog(QObject *parent = 0);
+ virtual ~QQuickPlatformFileDialog();
+
+protected:
+ QPlatformFileDialogHelper *helper();
+
+ Q_DISABLE_COPY(QQuickPlatformFileDialog)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickPlatformFileDialog *)
+
+#endif // QQUICKPLATFORMFILEDIALOG_P_H
diff --git a/src/dialogs/qquickplatformfontdialog.cpp b/src/dialogs/qquickplatformfontdialog.cpp
new file mode 100644
index 00000000..46ad5eb8
--- /dev/null
+++ b/src/dialogs/qquickplatformfontdialog.cpp
@@ -0,0 +1,252 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickplatformfontdialog_p.h"
+#include "qquickitem.h"
+
+#include <private/qguiapplication_p.h>
+#include <QWindow>
+#include <QQuickView>
+#include <QQuickWindow>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype FontDialog
+ \instantiates QQuickPlatformFontDialog
+ \inqmlmodule QtQuick.Dialogs 1
+ \ingroup qtquick-visual
+ \ingroup dialogs
+ \brief Dialog component for choosing a font.
+ \since 5.2
+
+ FontDialog allows the user to select a font. The dialog is initially
+ invisible. You need to set the properties as desired first, then set
+ \l visible to true or call \l open().
+
+ Here is a minimal example to open a font dialog and exit after the user
+ chooses a font:
+
+ \qml
+ import QtQuick 2.2
+ import QtQuick.Dialogs 1.1
+
+ FontDialog {
+ id: fontDialog
+ title: "Please choose a font"
+ font: Qt.font({ family: "Arial", pointSize: 24, weight: Font.Normal })
+ onAccepted: {
+ console.log("You chose: " + fontDialog.font)
+ Qt.quit()
+ }
+ onRejected: {
+ console.log("Canceled")
+ Qt.quit()
+ }
+ Component.onCompleted: visible = true
+ }
+ \endqml
+
+ A FontDialog window is automatically transient for its parent window. So
+ whether you declare the dialog inside an \l Item or inside a \l Window, the
+ dialog will appear centered over the window containing the item, or over
+ the Window that you declared.
+
+ The implementation of FontDialog will be a platform font dialog if
+ possible. If that isn't possible, then it will try to instantiate a
+ \l QFontDialog. If that also isn't possible, then it will fall back to a QML
+ implementation, DefaultFontDialog.qml. In that case you can customize the
+ appearance by editing this file. DefaultFontDialog.qml contains a Rectangle
+ to hold the dialog's contents, because certain embedded systems do not
+ support multiple top-level windows. When the dialog becomes visible, it
+ will automatically be wrapped in a Window if possible, or simply reparented
+ on top of the main window if there can only be one window.
+*/
+
+/*!
+ \qmlsignal QtQuick::Dialogs::FontDialog::accepted
+
+ The \a accepted signal is emitted when the user has finished using the
+ dialog. You can then inspect the \a font property to get the selection.
+
+ Example:
+
+ \qml
+ FontDialog {
+ onAccepted: { console.log("Selected font: " + font) }
+ }
+ \endqml
+*/
+
+/*!
+ \qmlsignal QtQuick::Dialogs::FontDialog::rejected
+
+ The \a rejected signal is emitted when the user has dismissed the dialog,
+ either by closing the dialog window or by pressing the Cancel button.
+*/
+
+/*!
+ \class QQuickPlatformFontDialog
+ \inmodule QtQuick.Dialogs
+ \internal
+
+ \brief The QQuickPlatformFontDialog class provides a font dialog
+
+ The dialog is implemented via the QQuickPlatformFontDialogHelper when possible;
+ otherwise it falls back to a QFontDialog or a QML implementation.
+
+ \since 5.2
+*/
+
+/*!
+ Constructs a file dialog with parent window \a parent.
+*/
+QQuickPlatformFontDialog::QQuickPlatformFontDialog(QObject *parent) :
+ QQuickAbstractFontDialog(parent)
+{
+}
+
+/*!
+ Destroys the file dialog.
+*/
+QQuickPlatformFontDialog::~QQuickPlatformFontDialog()
+{
+ if (m_dlgHelper)
+ m_dlgHelper->hide();
+ delete m_dlgHelper;
+}
+
+QPlatformFontDialogHelper *QQuickPlatformFontDialog::helper()
+{
+ QQuickItem *parentItem = qobject_cast<QQuickItem *>(parent());
+ if (parentItem)
+ m_parentWindow = parentItem->window();
+
+ if ( !m_dlgHelper && QGuiApplicationPrivate::platformTheme()->
+ usePlatformNativeDialog(QPlatformTheme::FontDialog) ) {
+ m_dlgHelper = static_cast<QPlatformFontDialogHelper *>(QGuiApplicationPrivate::platformTheme()
+ ->createPlatformDialogHelper(QPlatformTheme::FontDialog));
+ if (!m_dlgHelper)
+ return m_dlgHelper;
+ connect(m_dlgHelper, SIGNAL(accept()), this, SLOT(accept()));
+ connect(m_dlgHelper, SIGNAL(reject()), this, SLOT(reject()));
+ connect(m_dlgHelper, SIGNAL(currentFontChanged(const QFont&)), this, SLOT(setFont(const QFont&)));
+ connect(m_dlgHelper, SIGNAL(fontSelected(const QFont&)), this, SLOT(setFont(const QFont&)));
+ }
+
+ return m_dlgHelper;
+}
+
+/*!
+ \qmlproperty bool FontDialog::visible
+
+ This property holds whether the dialog is visible. By default this is
+ false.
+
+ \sa modality
+*/
+
+/*!
+ \qmlproperty Qt::WindowModality FontDialog::modality
+
+ Whether the dialog should be shown modal with respect to the window
+ containing the dialog's parent Item, modal with respect to the whole
+ application, or non-modal.
+
+ By default it is \l WindowModal.
+
+ Modality does not mean that there are any blocking calls to wait for the
+ dialog to be accepted or rejected; it's only that the user will be
+ prevented from interacting with the parent window and/or the application
+ windows at the same time. You probably need to write an onAccepted handler
+ to actually load or save the chosen file.
+*/
+
+/*!
+ \qmlmethod void FontDialog::open()
+
+ Shows the dialog to the user. It is equivalent to setting \l visible to
+ true.
+*/
+
+/*!
+ \qmlmethod void FontDialog::close()
+
+ Closes the dialog.
+*/
+
+/*!
+ \qmlproperty string FontDialog::title
+
+ The title of the dialog window.
+*/
+
+/*!
+ \qmlproperty bool FontDialog::scalableFonts
+
+ Whether the dialog will show scalable fonts or not.
+*/
+
+/*!
+ \qmlproperty bool FontDialog::nonScalableFonts
+
+ Whether the dialog will show non scalable fonts or not.
+*/
+
+/*!
+ \qmlproperty bool FontDialog::monospacedFonts
+
+ Whether the dialog will show monospaced fonts or not.
+*/
+
+/*!
+ \qmlproperty bool FontDialog::proportionalFonts
+
+ Whether the dialog will show proportional fonts or not.
+*/
+
+/*!
+ \qmlproperty font FontDialog::font
+
+ The font which the user selected.
+*/
+
+QT_END_NAMESPACE
diff --git a/src/dialogs/qquickplatformfontdialog_p.h b/src/dialogs/qquickplatformfontdialog_p.h
new file mode 100644
index 00000000..743b24ad
--- /dev/null
+++ b/src/dialogs/qquickplatformfontdialog_p.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKPLATFORMFONTDIALOG_P_H
+#define QQUICKPLATFORMFONTDIALOG_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qquickabstractfontdialog_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QQuickPlatformFontDialog : public QQuickAbstractFontDialog
+{
+ Q_OBJECT
+
+public:
+ QQuickPlatformFontDialog(QObject *parent = 0);
+ virtual ~QQuickPlatformFontDialog();
+
+protected:
+ QPlatformFontDialogHelper *helper();
+
+ Q_DISABLE_COPY(QQuickPlatformFontDialog)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickPlatformFontDialog *)
+
+#endif // QQUICKPLATFORMFONTDIALOG_P_H
diff --git a/src/dialogs/qquickplatformmessagedialog.cpp b/src/dialogs/qquickplatformmessagedialog.cpp
new file mode 100644
index 00000000..65114100
--- /dev/null
+++ b/src/dialogs/qquickplatformmessagedialog.cpp
@@ -0,0 +1,398 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickplatformmessagedialog_p.h"
+#include "qquickitem.h"
+
+#include <private/qguiapplication_p.h>
+#include <QWindow>
+#include <QQuickView>
+#include <QQuickWindow>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype MessageDialog
+ \instantiates QQuickPlatformMessageDialog
+ \inqmlmodule QtQuick.Dialogs 1
+ \ingroup dialogs
+ \brief Dialog component for displaying popup messages.
+ \since 5.2
+
+ The most basic use case for a MessageDialog is a popup alert. It also
+ allows the user to respond in various ways depending on which buttons are
+ enabled. The dialog is initially invisible. You need to set the properties
+ as desired first, then set \l visible to \c true or call \l open().
+
+ Here is a minimal example to show an alert and exit after the user
+ responds:
+
+ \qml
+ import QtQuick 2.2
+ import QtQuick.Dialogs 1.1
+
+ MessageDialog {
+ id: messageDialog
+ title: "May I have your attention please"
+ text: "It's so cool that you are using Qt Quick."
+ onAccepted: {
+ console.log("And of course you could only agree.")
+ Qt.quit()
+ }
+ Component.onCompleted: visible = true
+ }
+ \endqml
+
+ There are several possible handlers depending on which \l standardButtons
+ the dialog has and the \l {QMessageBox::ButtonRole} {ButtonRole} of each.
+ For example, the \l {rejected} {onRejected} handler will be called if the
+ user presses a \gui Cancel, \gui Close or \gui Abort button.
+
+ A MessageDialog window is automatically transient for its parent window. So
+ whether you declare the dialog inside an \l Item or inside a \l Window, the
+ dialog will appear centered over the window containing the item, or over
+ the Window that you declared.
+
+ The implementation of MessageDialog will be a platform message dialog if
+ possible. If that isn't possible, then it will try to instantiate a
+ \l QMessageBox. If that also isn't possible, then it will fall back to a QML
+ implementation, \c DefaultMessageDialog.qml. In that case you can customize
+ the appearance by editing this file. \c DefaultMessageDialog.qml contains a
+ \l Rectangle to hold the dialog's contents, because certain embedded systems
+ do not support multiple top-level windows. When the dialog becomes visible,
+ it will automatically be wrapped in a \l Window if possible, or simply
+ reparented on top of the main window if there can only be one window.
+*/
+
+/*!
+ \qmlsignal MessageDialog::accepted()
+
+ This handler is called when the user has pressed any button which has the
+ \l {QMessageBox::AcceptRole} {AcceptRole}: \gui OK, \gui Open, \gui Save,
+ \gui {Save All}, \gui Retry or \gui Ignore.
+*/
+
+/*!
+ \qmlsignal MessageDialog::rejected()
+
+ This handler is called when the user has dismissed the dialog, by closing
+ the dialog window, by pressing a \gui Cancel, \gui Close or \gui Abort
+ button on the dialog, or by pressing the back button or the escape key.
+*/
+
+/*!
+ \qmlsignal MessageDialog::discard()
+
+ This handler is called when the user has pressed the \gui Discard button.
+*/
+
+/*!
+ \qmlsignal MessageDialog::help()
+
+ This handler is called when the user has pressed the \gui Help button.
+ Depending on platform, the dialog may not be automatically dismissed
+ because the help that your application provides may need to be relevant to
+ the text shown in this dialog in order to assist the user in making a
+ decision. However on other platforms it's not possible to show a dialog and
+ a help window at the same time. If you want to be sure that the dialog will
+ close, you can set \l visible to \c false in your handler.
+*/
+
+/*!
+ \qmlsignal MessageDialog::yes()
+
+ This handler is called when the user has pressed any button which has
+ the \l {QMessageBox::YesRole} {YesRole}: \gui Yes or \gui {Yes to All}.
+*/
+
+/*!
+ \qmlsignal MessageDialog::no()
+
+ This handler is called when the user has pressed any button which has
+ the \l {QMessageBox::NoRole} {NoRole}: \gui No or \gui {No to All}.
+*/
+
+/*!
+ \qmlsignal MessageDialog::apply()
+
+ This handler is called when the user has pressed the \gui Apply button.
+*/
+
+/*!
+ \qmlsignal MessageDialog::reset()
+
+ This handler is called when the user has pressed any button which has
+ the \l {QMessageBox::ResetRole} {ResetRole}: \gui Reset or \gui {Restore Defaults}.
+*/
+
+/*!
+ \class QQuickPlatformMessageDialog
+ \inmodule QtQuick.Dialogs
+ \internal
+
+ \brief The QQuickPlatformMessageDialog class provides a message dialog
+
+ The dialog is implemented via the QPlatformMessageDialogHelper when possible;
+ otherwise it falls back to a QMessageBox or a QML implementation.
+
+ \since 5.2
+*/
+
+/*!
+ Constructs a file dialog with parent window \a parent.
+*/
+QQuickPlatformMessageDialog::QQuickPlatformMessageDialog(QObject *parent) :
+ QQuickAbstractMessageDialog(parent)
+{
+}
+
+/*!
+ Destroys the file dialog.
+*/
+QQuickPlatformMessageDialog::~QQuickPlatformMessageDialog()
+{
+ if (m_dlgHelper)
+ m_dlgHelper->hide();
+ delete m_dlgHelper;
+}
+
+QPlatformMessageDialogHelper *QQuickPlatformMessageDialog::helper()
+{
+ QQuickItem *parentItem = qobject_cast<QQuickItem *>(parent());
+ if (parentItem)
+ m_parentWindow = parentItem->window();
+
+ if ( !m_dlgHelper && QGuiApplicationPrivate::platformTheme()->
+ usePlatformNativeDialog(QPlatformTheme::MessageDialog) ) {
+ m_dlgHelper = static_cast<QPlatformMessageDialogHelper *>(QGuiApplicationPrivate::platformTheme()
+ ->createPlatformDialogHelper(QPlatformTheme::MessageDialog));
+ if (!m_dlgHelper)
+ return m_dlgHelper;
+ // accept() shouldn't be emitted. reject() happens only if the dialog is
+ // dismissed by closing the window rather than by one of its button widgets.
+ connect(m_dlgHelper, SIGNAL(accept()), this, SLOT(accept()));
+ connect(m_dlgHelper, SIGNAL(reject()), this, SLOT(reject()));
+ connect(m_dlgHelper, SIGNAL(clicked(QMessageDialogOptions::StandardButton, QMessageDialogOptions::ButtonRole)),
+ this, SLOT(click(QMessageDialogOptions::StandardButton, QMessageDialogOptions::ButtonRole)));
+ }
+
+ return m_dlgHelper;
+}
+
+/*!
+ \qmlproperty bool MessageDialog::visible
+
+ This property holds whether the dialog is visible. By default this is
+ \c false.
+
+ \sa modality
+*/
+
+/*!
+ \qmlproperty Qt::WindowModality MessageDialog::modality
+
+ Whether the dialog should be shown modal with respect to the window
+ containing the dialog's parent Item, modal with respect to the whole
+ application, or non-modal.
+
+ By default it is \c Qt.WindowModal.
+
+ Modality does not mean that there are any blocking calls to wait for the
+ dialog to be accepted or rejected; it's only that the user will be
+ prevented from interacting with the parent window and/or the application
+ windows until the dialog is dismissed.
+*/
+
+/*!
+ \qmlmethod void MessageDialog::open()
+
+ Shows the dialog to the user. It is equivalent to setting \l visible to
+ \c true.
+*/
+
+/*!
+ \qmlmethod void MessageDialog::close()
+
+ Closes the dialog.
+*/
+
+/*!
+ \qmlproperty string MessageDialog::title
+
+ The title of the dialog window.
+*/
+
+/*!
+ \qmlproperty string MessageDialog::text
+
+ The primary text to be displayed.
+*/
+
+/*!
+ \qmlproperty string MessageDialog::informativeText
+
+ The informative text that provides a fuller description for the message.
+
+ Informative text can be used to supplement the \c text to give more
+ information to the user. Depending on the platform, it may appear in a
+ smaller font below the text, or simply appended to the text.
+
+ \sa {MessageDialog::text}{text}
+*/
+
+/*!
+ \qmlproperty string MessageDialog::detailedText
+
+ The text to be displayed in the details area, which is hidden by default.
+ The user will then be able to press the \gui {Show Details...} button to
+ make it visible.
+
+ \sa {MessageDialog::text}{text}
+*/
+
+/*!
+ \enum QQuickStandardIcon::Icon
+
+ This enum specifies a standard icon to be used on a dialog.
+*/
+
+/*!
+ \qmlproperty QQuickStandardIcon::Icon MessageDialog::icon
+
+ The icon of the message box can be specified with one of these values:
+
+ \table
+ \row
+ \li no icon
+ \li \l StandardIcon.NoIcon
+ \li For an unadorned text alert.
+ \row
+ \li \inlineimage ../images/question.png "Question icon"
+ \li \l StandardIcon.Question
+ \li For asking a question during normal operations.
+ \row
+ \li \image information.png
+ \li \l StandardIcon.Information
+ \li For reporting information about normal operations.
+ \row
+ \li \image warning.png
+ \li \l StandardIcon.Warning
+ \li For reporting non-critical errors.
+ \row
+ \li \image critical.png
+ \li \l StandardIcon.Critical
+ \li For reporting critical errors.
+ \endtable
+
+ The default is \c StandardIcon.NoIcon.
+
+ The enum values are the same as in \l QMessageBox::Icon.
+*/
+
+// TODO after QTBUG-35019 is fixed: fix links to this module's enums
+// rather than linking to those in QMessageBox
+/*!
+ \enum QQuickStandardButton::StandardButton
+
+ This enum specifies a button with a standard label to be used on a dialog.
+*/
+
+/*!
+ \qmlproperty StandardButtons MessageDialog::standardButtons
+
+ The MessageDialog has a row of buttons along the bottom, each of which has
+ a \l {QMessageBox::ButtonRole} {ButtonRole} that determines which signal
+ will be emitted when the button is pressed. You can also find out which
+ specific button was pressed after the fact via the \l clickedButton
+ property. You can control which buttons are available by setting
+ standardButtons to a bitwise-or combination of the following flags:
+
+ \table
+ \row \li StandardButton.Ok \li An \gui OK button defined with the \l {QMessageBox::AcceptRole} {AcceptRole}.
+ \row \li StandardButton.Open \li An \gui Open button defined with the \l {QMessageBox::AcceptRole} {AcceptRole}.
+ \row \li StandardButton.Save \li A \gui Save button defined with the \l {QMessageBox::AcceptRole} {AcceptRole}.
+ \row \li StandardButton.Cancel \li A \gui Cancel button defined with the \l {QMessageBox::RejectRole} {RejectRole}.
+ \row \li StandardButton.Close \li A \gui Close button defined with the \l {QMessageBox::RejectRole} {RejectRole}.
+ \row \li StandardButton.Discard \li A \gui Discard or \gui {Don't Save} button, depending on the platform,
+ defined with the \l {QMessageBox::DestructiveRole} {DestructiveRole}.
+ \row \li StandardButton.Apply \li An \gui Apply button defined with the \l {QMessageBox::ApplyRole} {ApplyRole}.
+ \row \li StandardButton.Reset \li A \gui Reset button defined with the \l {QMessageBox::ResetRole} {ResetRole}.
+ \row \li StandardButton.RestoreDefaults \li A \gui {Restore Defaults} button defined with the \l {QMessageBox::ResetRole} {ResetRole}.
+ \row \li StandardButton.Help \li A \gui Help button defined with the \l {QMessageBox::HelpRole} {HelpRole}.
+ \row \li StandardButton.SaveAll \li A \gui {Save All} button defined with the \l {QMessageBox::AcceptRole} {AcceptRole}.
+ \row \li StandardButton.Yes \li A \gui Yes button defined with the \l {QMessageBox::YesRole} {YesRole}.
+ \row \li StandardButton.YesToAll \li A \gui {Yes to All} button defined with the \l {QMessageBox::YesRole} {YesRole}.
+ \row \li StandardButton.No \li A \gui No button defined with the \l {QMessageBox::NoRole} {NoRole}.
+ \row \li StandardButton.NoToAll \li A \gui {No to All} button defined with the \l {QMessageBox::NoRole} {NoRole}.
+ \row \li StandardButton.Abort \li An \gui Abort button defined with the \l {QMessageBox::RejectRole} {RejectRole}.
+ \row \li StandardButton.Retry \li A \gui Retry button defined with the \l {QMessageBox::AcceptRole} {AcceptRole}.
+ \row \li StandardButton.Ignore \li An \gui Ignore button defined with the \l {QMessageBox::AcceptRole} {AcceptRole}.
+ \endtable
+
+ For example the following dialog will ask a question with 5 possible answers:
+
+ \qml
+ import QtQuick 2.2
+ import QtQuick.Dialogs 1.1
+
+ MessageDialog {
+ title: "Overwrite?"
+ icon: StandardIcon.Question
+ text: "file.txt already exists. Replace?"
+ detailedText: "To replace a file means that its existing contents will be lost. " +
+ "The file that you are copying now will be copied over it instead."
+ standardButtons: StandardButton.Yes | StandardButton.YesToAll |
+ StandardButton.No | StandardButton.NoToAll | StandardButton.Abort
+ Component.onCompleted: visible = true
+ onYes: console.log("copied")
+ onNo: console.log("didn't copy")
+ onRejected: console.log("aborted")
+ }
+ \endqml
+
+ \image replacefile.png
+
+ The default is \c StandardButton.Ok.
+
+ The enum values are the same as in \l QMessageBox::StandardButtons.
+*/
+
+QT_END_NAMESPACE
diff --git a/src/dialogs/qquickplatformmessagedialog_p.h b/src/dialogs/qquickplatformmessagedialog_p.h
new file mode 100644
index 00000000..61f055bb
--- /dev/null
+++ b/src/dialogs/qquickplatformmessagedialog_p.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKPLATFORMMESSAGEDIALOG_P_H
+#define QQUICKPLATFORMMESSAGEDIALOG_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qquickabstractmessagedialog_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QQuickPlatformMessageDialog : public QQuickAbstractMessageDialog
+{
+ Q_OBJECT
+
+public:
+ QQuickPlatformMessageDialog(QObject *parent = 0);
+ virtual ~QQuickPlatformMessageDialog();
+
+protected:
+ QPlatformMessageDialogHelper *helper();
+
+ Q_DISABLE_COPY(QQuickPlatformMessageDialog)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickPlatformMessageDialog *)
+
+#endif // QQUICKPLATFORMMESSAGEDIALOG_P_H
diff --git a/src/src.pro b/src/src.pro
index a440948a..3f7b3801 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -3,3 +3,8 @@ TEMPLATE = subdirs
SUBDIRS += controls
SUBDIRS += layouts
+
+SUBDIRS += dialogs
+SUBDIRS += dialogs/Private
+
+qtHaveModule(quick):qtHaveModule(widgets): SUBDIRS += widgets
diff --git a/src/widgets/plugins.qmltypes b/src/widgets/plugins.qmltypes
new file mode 100644
index 00000000..a67443c5
--- /dev/null
+++ b/src/widgets/plugins.qmltypes
@@ -0,0 +1,302 @@
+import QtQuick.tooling 1.1
+
+// This file describes the plugin-supplied types contained in the library.
+// It is used for QML tooling purposes only.
+//
+// This file was auto-generated by:
+// 'qmlplugindump -nonrelocatable QtQuick.PrivateWidgets 1.1'
+
+Module {
+ Component {
+ name: "QQuickAbstractColorDialog"
+ prototype: "QQuickAbstractDialog"
+ Property { name: "showAlphaChannel"; type: "bool" }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "currentColor"; type: "QColor" }
+ Property { name: "currentHue"; type: "double"; isReadonly: true }
+ Property { name: "currentSaturation"; type: "double"; isReadonly: true }
+ Property { name: "currentLightness"; type: "double"; isReadonly: true }
+ Property { name: "currentAlpha"; type: "double"; isReadonly: true }
+ Signal { name: "selectionAccepted" }
+ Method {
+ name: "setVisible"
+ Parameter { name: "v"; type: "bool" }
+ }
+ Method {
+ name: "setModality"
+ Parameter { name: "m"; type: "Qt::WindowModality" }
+ }
+ Method {
+ name: "setTitle"
+ Parameter { name: "t"; type: "string" }
+ }
+ Method {
+ name: "setColor"
+ Parameter { name: "arg"; type: "QColor" }
+ }
+ Method {
+ name: "setCurrentColor"
+ Parameter { name: "currentColor"; type: "QColor" }
+ }
+ Method {
+ name: "setShowAlphaChannel"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ }
+ Component {
+ name: "QQuickAbstractDialog"
+ prototype: "QObject"
+ Property { name: "visible"; type: "bool" }
+ Property { name: "modality"; type: "Qt::WindowModality" }
+ Property { name: "title"; type: "string" }
+ Property { name: "isWindow"; type: "bool"; isReadonly: true }
+ Property { name: "x"; type: "int" }
+ Property { name: "y"; type: "int" }
+ Property { name: "width"; type: "int" }
+ Property { name: "height"; type: "int" }
+ Signal { name: "visibilityChanged" }
+ Signal { name: "geometryChanged" }
+ Signal { name: "accepted" }
+ Signal { name: "rejected" }
+ Method { name: "open" }
+ Method { name: "close" }
+ Method {
+ name: "setX"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setY"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setWidth"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setHeight"
+ Parameter { name: "arg"; type: "int" }
+ }
+ }
+ Component {
+ name: "QQuickAbstractFileDialog"
+ prototype: "QQuickAbstractDialog"
+ Property { name: "selectExisting"; type: "bool" }
+ Property { name: "selectMultiple"; type: "bool" }
+ Property { name: "selectFolder"; type: "bool" }
+ Property { name: "folder"; type: "QUrl" }
+ Property { name: "nameFilters"; type: "QStringList" }
+ Property { name: "selectedNameFilter"; type: "string" }
+ Property { name: "fileUrl"; type: "QUrl"; isReadonly: true }
+ Property { name: "fileUrls"; type: "QList<QUrl>"; isReadonly: true }
+ Signal { name: "filterSelected" }
+ Signal { name: "fileModeChanged" }
+ Signal { name: "selectionAccepted" }
+ Method {
+ name: "setVisible"
+ Parameter { name: "v"; type: "bool" }
+ }
+ Method {
+ name: "setTitle"
+ Parameter { name: "t"; type: "string" }
+ }
+ Method {
+ name: "setSelectExisting"
+ Parameter { name: "s"; type: "bool" }
+ }
+ Method {
+ name: "setSelectMultiple"
+ Parameter { name: "s"; type: "bool" }
+ }
+ Method {
+ name: "setSelectFolder"
+ Parameter { name: "s"; type: "bool" }
+ }
+ Method {
+ name: "setFolder"
+ Parameter { name: "f"; type: "QUrl" }
+ }
+ Method {
+ name: "setNameFilters"
+ Parameter { name: "f"; type: "QStringList" }
+ }
+ Method {
+ name: "selectNameFilter"
+ Parameter { name: "f"; type: "string" }
+ }
+ }
+ Component {
+ name: "QQuickAbstractFontDialog"
+ prototype: "QQuickAbstractDialog"
+ Property { name: "scalableFonts"; type: "bool" }
+ Property { name: "nonScalableFonts"; type: "bool" }
+ Property { name: "monospacedFonts"; type: "bool" }
+ Property { name: "proportionalFonts"; type: "bool" }
+ Property { name: "font"; type: "QFont" }
+ Signal { name: "selectionAccepted" }
+ Method {
+ name: "setVisible"
+ Parameter { name: "v"; type: "bool" }
+ }
+ Method {
+ name: "setModality"
+ Parameter { name: "m"; type: "Qt::WindowModality" }
+ }
+ Method {
+ name: "setTitle"
+ Parameter { name: "t"; type: "string" }
+ }
+ Method {
+ name: "setFont"
+ Parameter { name: "arg"; type: "QFont" }
+ }
+ Method {
+ name: "setScalableFonts"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Method {
+ name: "setNonScalableFonts"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Method {
+ name: "setMonospacedFonts"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Method {
+ name: "setProportionalFonts"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ }
+ Component {
+ name: "QQuickAbstractMessageDialog"
+ prototype: "QQuickAbstractDialog"
+ exports: ["QtQuick.PrivateWidgets/QtMessageDialog 1.1"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Icon"
+ values: {
+ "NoIcon": 0,
+ "Information": 1,
+ "Warning": 2,
+ "Critical": 3,
+ "Question": 4
+ }
+ }
+ Enum {
+ name: "StandardButton"
+ values: {
+ "NoButton": 0,
+ "Ok": 1024,
+ "Save": 2048,
+ "SaveAll": 4096,
+ "Open": 8192,
+ "Yes": 16384,
+ "YesToAll": 32768,
+ "No": 65536,
+ "NoToAll": 131072,
+ "Abort": 262144,
+ "Retry": 524288,
+ "Ignore": 1048576,
+ "Close": 2097152,
+ "Cancel": 4194304,
+ "Discard": 8388608,
+ "Help": 16777216,
+ "Apply": 33554432,
+ "Reset": 67108864,
+ "RestoreDefaults": 134217728
+ }
+ }
+ Enum {
+ name: "StandardButtons"
+ values: {
+ "NoButton": 0,
+ "Ok": 1024,
+ "Save": 2048,
+ "SaveAll": 4096,
+ "Open": 8192,
+ "Yes": 16384,
+ "YesToAll": 32768,
+ "No": 65536,
+ "NoToAll": 131072,
+ "Abort": 262144,
+ "Retry": 524288,
+ "Ignore": 1048576,
+ "Close": 2097152,
+ "Cancel": 4194304,
+ "Discard": 8388608,
+ "Help": 16777216,
+ "Apply": 33554432,
+ "Reset": 67108864,
+ "RestoreDefaults": 134217728
+ }
+ }
+ Property { name: "text"; type: "string" }
+ Property { name: "informativeText"; type: "string" }
+ Property { name: "detailedText"; type: "string" }
+ Property { name: "icon"; type: "Icon" }
+ Property { name: "standardIconSource"; type: "QUrl"; isReadonly: true }
+ Property { name: "standardButtons"; type: "StandardButtons" }
+ Property { name: "clickedButton"; type: "StandardButton"; isReadonly: true }
+ Signal { name: "buttonClicked" }
+ Signal { name: "discard" }
+ Signal { name: "help" }
+ Signal { name: "yes" }
+ Signal { name: "no" }
+ Signal { name: "apply" }
+ Signal { name: "reset" }
+ Method {
+ name: "setVisible"
+ Parameter { name: "v"; type: "bool" }
+ }
+ Method {
+ name: "setTitle"
+ Parameter { name: "arg"; type: "string" }
+ }
+ Method {
+ name: "setText"
+ Parameter { name: "arg"; type: "string" }
+ }
+ Method {
+ name: "setInformativeText"
+ Parameter { name: "arg"; type: "string" }
+ }
+ Method {
+ name: "setDetailedText"
+ Parameter { name: "arg"; type: "string" }
+ }
+ Method {
+ name: "setIcon"
+ Parameter { name: "icon"; type: "Icon" }
+ }
+ Method {
+ name: "setStandardButtons"
+ Parameter { name: "buttons"; type: "StandardButtons" }
+ }
+ Method {
+ name: "click"
+ Parameter { name: "button"; type: "QMessageDialogOptions::StandardButton" }
+ Parameter { type: "QMessageDialogOptions::ButtonRole" }
+ }
+ Method {
+ name: "click"
+ Parameter { name: "button"; type: "QQuickAbstractMessageDialog::StandardButton" }
+ }
+ }
+ Component {
+ name: "QQuickQColorDialog"
+ prototype: "QQuickAbstractColorDialog"
+ exports: ["QtQuick.PrivateWidgets/QtColorDialog 1.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickQFileDialog"
+ prototype: "QQuickAbstractFileDialog"
+ exports: ["QtQuick.PrivateWidgets/QtFileDialog 1.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickQFontDialog"
+ prototype: "QQuickAbstractFontDialog"
+ exports: ["QtQuick.PrivateWidgets/QtFontDialog 1.1"]
+ exportMetaObjectRevisions: [0]
+ }
+}
diff --git a/src/widgets/qmessageboxhelper_p.h b/src/widgets/qmessageboxhelper_p.h
new file mode 100644
index 00000000..4f1070f9
--- /dev/null
+++ b/src/widgets/qmessageboxhelper_p.h
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QMESSAGEBOXHELPER_P_H
+#define QMESSAGEBOXHELPER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QMessageBox>
+#include "../dialogs/qquickabstractmessagedialog_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QMessageBoxHelper : public QPlatformMessageDialogHelper
+{
+ Q_OBJECT
+public:
+ QMessageBoxHelper() {
+ connect(&m_dialog, SIGNAL(accepted()), this, SIGNAL(accept()));
+ connect(&m_dialog, SIGNAL(rejected()), this, SIGNAL(reject()));
+ connect(&m_dialog, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(buttonClicked(QAbstractButton*)));
+ }
+
+ virtual void exec() { m_dialog.exec(); }
+
+ virtual bool show(Qt::WindowFlags f, Qt::WindowModality m, QWindow *parent) {
+ m_dialog.winId();
+ QWindow *window = m_dialog.windowHandle();
+ Q_ASSERT(window);
+ window->setTransientParent(parent);
+ window->setFlags(f);
+ m_dialog.setWindowModality(m);
+ m_dialog.setWindowTitle(QPlatformMessageDialogHelper::options()->windowTitle());
+ m_dialog.setIcon(static_cast<QMessageBox::Icon>(QPlatformMessageDialogHelper::options()->icon()));
+ if (!QPlatformMessageDialogHelper::options()->text().isNull())
+ m_dialog.setText(QPlatformMessageDialogHelper::options()->text());
+ if (!QPlatformMessageDialogHelper::options()->informativeText().isNull())
+ m_dialog.setInformativeText(QPlatformMessageDialogHelper::options()->informativeText());
+ if (!QPlatformMessageDialogHelper::options()->detailedText().isNull())
+ m_dialog.setDetailedText(QPlatformMessageDialogHelper::options()->detailedText());
+ m_dialog.setStandardButtons(static_cast<QMessageBox::StandardButtons>(static_cast<int>(
+ QPlatformMessageDialogHelper::options()->standardButtons())));
+ m_dialog.show();
+ return m_dialog.isVisible();
+ }
+
+ virtual void hide() { m_dialog.hide(); }
+
+ QMessageBox m_dialog;
+
+public Q_SLOTS:
+ void buttonClicked(QAbstractButton* button) {
+ emit clicked(static_cast<QMessageDialogOptions::StandardButton>(m_dialog.standardButton(button)),
+ static_cast<QMessageDialogOptions::ButtonRole>(m_dialog.buttonRole(button)));
+ }
+};
+
+QT_END_NAMESPACE
+
+#endif // QMESSAGEBOXHELPER_P_H
diff --git a/src/widgets/qmldir b/src/widgets/qmldir
new file mode 100644
index 00000000..da63c98e
--- /dev/null
+++ b/src/widgets/qmldir
@@ -0,0 +1,4 @@
+module QtQuick.PrivateWidgets
+plugin widgetsplugin
+classname QtQuick2PrivateWidgetsPlugin
+typeinfo plugins.qmltypes
diff --git a/src/widgets/qquickqcolordialog.cpp b/src/widgets/qquickqcolordialog.cpp
new file mode 100644
index 00000000..ee27d147
--- /dev/null
+++ b/src/widgets/qquickqcolordialog.cpp
@@ -0,0 +1,175 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickqcolordialog_p.h"
+#include "qquickitem.h"
+
+#include <private/qguiapplication_p.h>
+#include <private/qqmlcontext_p.h>
+#include <QWindow>
+#include <QQuickWindow>
+#include <QColorDialog>
+
+QT_BEGIN_NAMESPACE
+
+class QColorDialogHelper : public QPlatformColorDialogHelper
+{
+public:
+ QColorDialogHelper() :
+ QPlatformColorDialogHelper()
+ {
+ connect(&m_dialog, SIGNAL(currentColorChanged(const QColor&)), this, SIGNAL(currentColorChanged(const QColor&)));
+ connect(&m_dialog, SIGNAL(colorSelected(const QColor&)), this, SIGNAL(colorSelected(const QColor&)));
+ connect(&m_dialog, SIGNAL(accepted()), this, SIGNAL(accept()));
+ connect(&m_dialog, SIGNAL(rejected()), this, SIGNAL(reject()));
+ }
+
+ virtual void setCurrentColor(const QColor &c) { m_dialog.setCurrentColor(c); }
+ virtual QColor currentColor() const { return m_dialog.currentColor(); }
+
+ virtual void exec() { m_dialog.exec(); }
+
+ virtual bool show(Qt::WindowFlags f, Qt::WindowModality m, QWindow *parent) {
+ m_dialog.winId();
+ QWindow *window = m_dialog.windowHandle();
+ Q_ASSERT(window);
+ window->setTransientParent(parent);
+ window->setFlags(f);
+ m_dialog.setWindowModality(m);
+ m_dialog.setWindowTitle(QPlatformColorDialogHelper::options()->windowTitle());
+ m_dialog.setOptions((QColorDialog::ColorDialogOptions)((int)(QPlatformColorDialogHelper::options()->options())));
+ m_dialog.show();
+ return m_dialog.isVisible();
+ }
+
+ virtual void hide() { m_dialog.hide(); }
+
+private:
+ QColorDialog m_dialog;
+};
+
+/*!
+ \qmltype QtColorDialog
+ \instantiates QQuickQColorDialog
+ \inqmlmodule QtQuick.PrivateWidgets 1
+ \ingroup qtquick-visual
+ \brief Dialog component for choosing a color.
+ \since 5.1
+ \internal
+
+ QtColorDialog provides a means to instantiate and manage a QColorDialog.
+ It is not recommended to be used directly; it is an implementation
+ detail of \l ColorDialog in the \l QtQuick.Dialogs module.
+
+ To use this type, you will need to import the module with the following line:
+ \code
+ import QtQuick.PrivateWidgets 1.0
+ \endcode
+*/
+
+/*!
+ \qmlsignal QtQuick::Dialogs::ColorDialog::accepted
+
+ The \a accepted signal is emitted when the user has finished using the
+ dialog. You can then inspect the \a color property to get the selection.
+
+ Example:
+
+ \qml
+ ColorDialog {
+ onAccepted: { console.log("Selected color: " + color) }
+ }
+ \endqml
+*/
+
+/*!
+ \qmlsignal QtQuick::Dialogs::ColorDialog::rejected
+
+ The \a rejected signal is emitted when the user has dismissed the dialog,
+ either by closing the dialog window or by pressing the Cancel button.
+*/
+
+/*!
+ \class QQuickQColorDialog
+ \inmodule QtQuick.PrivateWidgets
+ \internal
+
+ \brief The QQuickQColorDialog class is a wrapper for a QColorDialog.
+
+ \since 5.1
+*/
+
+/*!
+ Constructs a file dialog with parent window \a parent.
+*/
+QQuickQColorDialog::QQuickQColorDialog(QObject *parent)
+ : QQuickAbstractColorDialog(parent)
+{
+}
+
+/*!
+ Destroys the file dialog.
+*/
+QQuickQColorDialog::~QQuickQColorDialog()
+{
+ if (m_dlgHelper)
+ m_dlgHelper->hide();
+ delete m_dlgHelper;
+}
+
+QPlatformColorDialogHelper *QQuickQColorDialog::helper()
+{
+ QQuickItem *parentItem = qobject_cast<QQuickItem *>(parent());
+ if (parentItem)
+ m_parentWindow = parentItem->window();
+
+ if (!m_dlgHelper) {
+ m_dlgHelper = new QColorDialogHelper();
+ connect(m_dlgHelper, SIGNAL(currentColorChanged(const QColor&)), this, SLOT(setCurrentColor(QColor)));
+ connect(m_dlgHelper, SIGNAL(colorSelected(const QColor&)), this, SLOT(setColor(QColor)));
+ connect(m_dlgHelper, SIGNAL(accept()), this, SLOT(accept()));
+ connect(m_dlgHelper, SIGNAL(reject()), this, SLOT(reject()));
+ }
+
+ return m_dlgHelper;
+}
+
+QT_END_NAMESPACE
diff --git a/src/widgets/qquickqcolordialog_p.h b/src/widgets/qquickqcolordialog_p.h
new file mode 100644
index 00000000..3fb04762
--- /dev/null
+++ b/src/widgets/qquickqcolordialog_p.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKQCOLORDIALOG_P_H
+#define QQUICKQCOLORDIALOG_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "../dialogs/qquickabstractcolordialog_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QQuickQColorDialog : public QQuickAbstractColorDialog
+{
+ Q_OBJECT
+
+public:
+ QQuickQColorDialog(QObject *parent = 0);
+ virtual ~QQuickQColorDialog();
+
+protected:
+ QPlatformColorDialogHelper *helper();
+
+ Q_DISABLE_COPY(QQuickQColorDialog)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickQColorDialog *)
+
+#endif // QQUICKQCOLORDIALOG_P_H
diff --git a/src/widgets/qquickqfiledialog.cpp b/src/widgets/qquickqfiledialog.cpp
new file mode 100644
index 00000000..c3991b4f
--- /dev/null
+++ b/src/widgets/qquickqfiledialog.cpp
@@ -0,0 +1,211 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickqfiledialog_p.h"
+#include "qquickitem.h"
+
+#include <private/qguiapplication_p.h>
+#include <private/qqmlcontext_p.h>
+#include <QWindow>
+#include <QQuickWindow>
+#include <QFileDialog>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype QtFileDialog
+ \instantiates QQuickQFileDialog
+ \inqmlmodule QtQuick.PrivateWidgets 1
+ \ingroup qtquick-visual
+ \brief Dialog component for choosing files from a local filesystem.
+ \since 5.1
+ \internal
+
+ QtFileDialog provides a means to instantiate and manage a QFileDialog.
+ It is not recommended to be used directly; it is an implementation
+ detail of \l FileDialog in the \l QtQuick.Dialogs module.
+
+ To use this type, you will need to import the module with the following line:
+ \code
+ import QtQuick.PrivateWidgets 1.0
+ \endcode
+*/
+
+/*!
+ \qmlsignal QtQuick::Dialogs::FileDialog::accepted
+
+ The \a accepted signal is emitted when the user has finished using the
+ dialog. You can then inspect the \a fileUrl or \a fileUrls properties to
+ get the selection.
+
+ Example:
+
+ \qml
+ FileDialog {
+ onAccepted: { console.log("Selected file: " + fileUrl) }
+ }
+ \endqml
+*/
+
+/*!
+ \qmlsignal QtQuick::Dialogs::FileDialog::rejected
+
+ The \a rejected signal is emitted when the user has dismissed the dialog,
+ either by closing the dialog window or by pressing the Cancel button.
+*/
+
+/*!
+ \class QQuickQFileDialog
+ \inmodule QtQuick.PrivateWidgets
+ \internal
+
+ \brief The QQuickQFileDialog class is a wrapper for a QFileDialog.
+
+ \since 5.1
+*/
+
+/*!
+ Constructs a file dialog with parent window \a parent.
+*/
+QQuickQFileDialog::QQuickQFileDialog(QObject *parent)
+ : QQuickAbstractFileDialog(parent)
+{
+}
+
+/*!
+ Destroys the file dialog.
+*/
+QQuickQFileDialog::~QQuickQFileDialog()
+{
+ if (m_dlgHelper)
+ m_dlgHelper->hide();
+ delete m_dlgHelper;
+}
+
+QPlatformFileDialogHelper *QQuickQFileDialog::helper()
+{
+ QQuickItem *parentItem = qobject_cast<QQuickItem *>(parent());
+ if (parentItem)
+ m_parentWindow = parentItem->window();
+
+ if (!m_dlgHelper) {
+ m_dlgHelper = new QFileDialogHelper();
+ connect(m_dlgHelper, SIGNAL(directoryEntered(const QUrl &)), this, SIGNAL(folderChanged()));
+ connect(m_dlgHelper, SIGNAL(filterSelected(const QString &)), this, SIGNAL(filterSelected()));
+ connect(m_dlgHelper, SIGNAL(accept()), this, SLOT(accept()));
+ connect(m_dlgHelper, SIGNAL(reject()), this, SLOT(reject()));
+ }
+
+ return m_dlgHelper;
+}
+
+QFileDialogHelper::QFileDialogHelper() :
+ QPlatformFileDialogHelper()
+{
+ connect(&m_dialog, SIGNAL(currentChanged(const QString&)), this, SLOT(currentChanged(const QString&)));
+ connect(&m_dialog, SIGNAL(directoryEntered(const QString&)), this, SLOT(directoryEntered(const QString&)));
+ connect(&m_dialog, SIGNAL(fileSelected(const QString&)), this, SLOT(fileSelected(const QString&)));
+ connect(&m_dialog, SIGNAL(filesSelected(const QStringList&)), this, SLOT(filesSelected(const QStringList&)));
+ connect(&m_dialog, SIGNAL(filterSelected(const QString&)), this, SIGNAL(filterSelected(const QString&)));
+ connect(&m_dialog, SIGNAL(accepted()), this, SIGNAL(accept()));
+ connect(&m_dialog, SIGNAL(rejected()), this, SIGNAL(reject()));
+}
+
+QList<QUrl> QFileDialogHelper::selectedFiles() const
+{
+ return m_dialog.selectedUrls();
+}
+
+void QFileDialogHelper::setFilter() {
+ m_dialog.setWindowTitle(QPlatformFileDialogHelper::options()->windowTitle());
+ if (QPlatformFileDialogHelper::options()->isLabelExplicitlySet(QFileDialogOptions::LookIn))
+ m_dialog.setLabelText(m_dialog.LookIn, QPlatformFileDialogHelper::options()->labelText(QFileDialogOptions::LookIn));
+ if (QPlatformFileDialogHelper::options()->isLabelExplicitlySet(QFileDialogOptions::FileName))
+ m_dialog.setLabelText(m_dialog.FileName, QPlatformFileDialogHelper::options()->labelText(QFileDialogOptions::FileName));
+ if (QPlatformFileDialogHelper::options()->isLabelExplicitlySet(QFileDialogOptions::FileType))
+ m_dialog.setLabelText(m_dialog.FileType, QPlatformFileDialogHelper::options()->labelText(QFileDialogOptions::FileType));
+ if (QPlatformFileDialogHelper::options()->isLabelExplicitlySet(QFileDialogOptions::Accept))
+ m_dialog.setLabelText(m_dialog.Accept, QPlatformFileDialogHelper::options()->labelText(QFileDialogOptions::Accept));
+ if (QPlatformFileDialogHelper::options()->isLabelExplicitlySet(QFileDialogOptions::Reject))
+ m_dialog.setLabelText(m_dialog.Reject, QPlatformFileDialogHelper::options()->labelText(QFileDialogOptions::Reject));
+ m_dialog.setFilter(QPlatformFileDialogHelper::options()->filter());
+ m_dialog.setNameFilters(QPlatformFileDialogHelper::options()->nameFilters());
+ m_dialog.selectNameFilter(QPlatformFileDialogHelper::options()->initiallySelectedNameFilter());
+ m_dialog.setFileMode(QFileDialog::FileMode(QPlatformFileDialogHelper::options()->fileMode()));
+ m_dialog.setOptions((QFileDialog::Options)((int)(QPlatformFileDialogHelper::options()->options())));
+ m_dialog.setAcceptMode(QFileDialog::AcceptMode(QPlatformFileDialogHelper::options()->acceptMode()));
+}
+
+bool QFileDialogHelper::show(Qt::WindowFlags f, Qt::WindowModality m, QWindow *parent) {
+ m_dialog.winId();
+ QWindow *window = m_dialog.windowHandle();
+ Q_ASSERT(window);
+ window->setTransientParent(parent);
+ window->setFlags(f);
+ m_dialog.setWindowModality(m);
+ m_dialog.show();
+ return m_dialog.isVisible();
+}
+
+void QFileDialogHelper::currentChanged(const QString& path)
+{
+ emit QPlatformFileDialogHelper::currentChanged(QUrl::fromLocalFile(path));
+}
+
+void QFileDialogHelper::directoryEntered(const QString& path)
+{
+ emit QPlatformFileDialogHelper::directoryEntered(QUrl::fromLocalFile(path));
+}
+
+void QFileDialogHelper::fileSelected(const QString& path)
+{
+ emit QPlatformFileDialogHelper::fileSelected(QUrl::fromLocalFile(path));
+}
+
+void QFileDialogHelper::filesSelected(const QStringList& paths)
+{
+ QList<QUrl> pathUrls;
+ foreach (const QString &path, paths)
+ pathUrls << QUrl::fromLocalFile(path);
+ emit QPlatformFileDialogHelper::filesSelected(pathUrls);
+}
+
+QT_END_NAMESPACE
diff --git a/src/widgets/qquickqfiledialog_p.h b/src/widgets/qquickqfiledialog_p.h
new file mode 100644
index 00000000..2bd364eb
--- /dev/null
+++ b/src/widgets/qquickqfiledialog_p.h
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKQFILEDIALOG_P_H
+#define QQUICKQFILEDIALOG_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QFileDialog>
+#include "../dialogs/qquickabstractfiledialog_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QQuickQFileDialog : public QQuickAbstractFileDialog
+{
+ Q_OBJECT
+
+public:
+ QQuickQFileDialog(QObject *parent = 0);
+ virtual ~QQuickQFileDialog();
+
+protected:
+ QPlatformFileDialogHelper *helper();
+
+ Q_DISABLE_COPY(QQuickQFileDialog)
+};
+
+class QFileDialogHelper : public QPlatformFileDialogHelper
+{
+ Q_OBJECT
+public:
+ QFileDialogHelper();
+
+ bool defaultNameFilterDisables() const Q_DECL_OVERRIDE { return true; }
+ void setDirectory(const QUrl &dir) Q_DECL_OVERRIDE { m_dialog.setDirectoryUrl(dir); }
+ QUrl directory() const Q_DECL_OVERRIDE { return m_dialog.directoryUrl(); }
+ void selectFile(const QUrl &f) Q_DECL_OVERRIDE { m_dialog.selectUrl(f); }
+ QList<QUrl> selectedFiles() const Q_DECL_OVERRIDE;
+ void setFilter() Q_DECL_OVERRIDE;
+ void selectNameFilter(const QString &f) Q_DECL_OVERRIDE { m_dialog.selectNameFilter(f); }
+ QString selectedNameFilter() const Q_DECL_OVERRIDE { return m_dialog.selectedNameFilter(); }
+ void exec() Q_DECL_OVERRIDE { m_dialog.exec(); }
+ bool show(Qt::WindowFlags f, Qt::WindowModality m, QWindow *parent) Q_DECL_OVERRIDE;
+ void hide() Q_DECL_OVERRIDE { m_dialog.hide(); }
+
+private Q_SLOTS:
+ void currentChanged(const QString& path);
+ void directoryEntered(const QString& path);
+ void fileSelected(const QString& path);
+ void filesSelected(const QStringList& paths);
+
+private:
+ QFileDialog m_dialog;
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickQFileDialog *)
+
+#endif // QQUICKQFILEDIALOG_P_H
diff --git a/src/widgets/qquickqfontdialog.cpp b/src/widgets/qquickqfontdialog.cpp
new file mode 100644
index 00000000..6d637e1d
--- /dev/null
+++ b/src/widgets/qquickqfontdialog.cpp
@@ -0,0 +1,178 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickqfontdialog_p.h"
+#include "qquickitem.h"
+
+#include <private/qguiapplication_p.h>
+#include <private/qqmlcontext_p.h>
+#include <QWindow>
+#include <QQuickWindow>
+#include <QFontDialog>
+
+QT_BEGIN_NAMESPACE
+
+class QFontDialogHelper : public QPlatformFontDialogHelper
+{
+public:
+ QFontDialogHelper() :
+ QPlatformFontDialogHelper()
+ {
+ connect(&m_dialog, SIGNAL(currentFontChanged(const QFont &)), this, SIGNAL(currentFontChanged(const QFont &)));
+ connect(&m_dialog, SIGNAL(fontSelected(const QFont &)), this, SIGNAL(fontSelected(const QFont &)));
+ connect(&m_dialog, SIGNAL(accepted()), this, SIGNAL(accept()));
+ connect(&m_dialog, SIGNAL(rejected()), this, SIGNAL(reject()));
+ }
+
+ virtual void setCurrentFont(const QFont &font) { m_dialog.setCurrentFont(font); }
+ virtual QFont currentFont() const { return m_dialog.currentFont(); }
+
+ virtual void exec() { m_dialog.exec(); }
+
+ virtual bool show(Qt::WindowFlags f, Qt::WindowModality m, QWindow *parent) {
+ m_dialog.winId();
+ QWindow *window = m_dialog.windowHandle();
+ Q_ASSERT(window);
+ window->setTransientParent(parent);
+ window->setFlags(f);
+ m_dialog.windowHandle()->setTransientParent(parent);
+ m_dialog.windowHandle()->setFlags(f);
+ m_dialog.setWindowModality(m);
+ m_dialog.setWindowTitle(QPlatformFontDialogHelper::options()->windowTitle());
+ m_dialog.setOptions((QFontDialog::FontDialogOptions)((int)(QPlatformFontDialogHelper::options()->options())));
+ m_dialog.show();
+ return m_dialog.isVisible();
+ }
+
+ virtual void hide() { m_dialog.hide(); }
+
+private:
+ QFontDialog m_dialog;
+};
+
+/*!
+ \qmltype QtFontDialog
+ \instantiates QQuickQFontDialog
+ \inqmlmodule QtQuick.PrivateWidgets 1
+ \ingroup qtquick-visual
+ \brief Dialog component for choosing files from a local filesystem.
+ \since 5.2
+ \internal
+
+ QtFontDialog provides a means to instantiate and manage a QFontDialog.
+ It is not recommended to be used directly; it is an implementation
+ detail of \l FontDialog in the \l QtQuick.Dialogs module.
+
+ To use this type, you will need to import the module with the following line:
+ \code
+ import QtQuick.PrivateWidgets 1.1
+ \endcode
+*/
+
+/*!
+ \qmlsignal QtQuick::Dialogs::FontDialog::accepted
+
+ The \a accepted signal is emitted when the user has finished using the
+ dialog. You can then inspect the \a filePath or \a filePaths properties to
+ get the selection.
+
+ Example:
+
+ \qml
+ FontDialog {
+ onAccepted: { console.log("Selected file: " + filePath) }
+ }
+ \endqml
+*/
+
+/*!
+ \qmlsignal QtQuick::Dialogs::FontDialog::rejected
+
+ The \a rejected signal is emitted when the user has dismissed the dialog,
+ either by closing the dialog window or by pressing the Cancel button.
+*/
+
+/*!
+ \class QQuickQFontDialog
+ \inmodule QtQuick.PrivateWidgets
+ \internal
+
+ \brief The QQuickQFontDialog class is a wrapper for a QFontDialog.
+
+ \since 5.2
+*/
+
+/*!
+ Constructs a file dialog with parent window \a parent.
+*/
+QQuickQFontDialog::QQuickQFontDialog(QObject *parent)
+ : QQuickAbstractFontDialog(parent)
+{
+}
+
+/*!
+ Destroys the file dialog.
+*/
+QQuickQFontDialog::~QQuickQFontDialog()
+{
+ if (m_dlgHelper)
+ m_dlgHelper->hide();
+ delete m_dlgHelper;
+}
+
+QPlatformFontDialogHelper *QQuickQFontDialog::helper()
+{
+ QQuickItem *parentItem = qobject_cast<QQuickItem *>(parent());
+ if (parentItem)
+ m_parentWindow = parentItem->window();
+
+ if (!m_dlgHelper) {
+ m_dlgHelper = new QFontDialogHelper();
+ connect(m_dlgHelper, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(setFont(const QFont &)));
+ connect(m_dlgHelper, SIGNAL(fontSelected(const QFont &)), this, SLOT(setFont(const QFont &)));
+ connect(m_dlgHelper, SIGNAL(accept()), this, SLOT(accept()));
+ connect(m_dlgHelper, SIGNAL(reject()), this, SLOT(reject()));
+ }
+
+ return m_dlgHelper;
+}
+
+QT_END_NAMESPACE
diff --git a/src/widgets/qquickqfontdialog_p.h b/src/widgets/qquickqfontdialog_p.h
new file mode 100644
index 00000000..6efd1599
--- /dev/null
+++ b/src/widgets/qquickqfontdialog_p.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQuick.Dialogs module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKQFONTDIALOG_P_H
+#define QQUICKQFONTDIALOG_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "../dialogs/qquickabstractfontdialog_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QQuickQFontDialog : public QQuickAbstractFontDialog
+{
+ Q_OBJECT
+
+public:
+ QQuickQFontDialog(QObject *parent = 0);
+ virtual ~QQuickQFontDialog();
+
+protected:
+ QPlatformFontDialogHelper *helper();
+
+ Q_DISABLE_COPY(QQuickQFontDialog)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickQFontDialog *)
+
+#endif // QQUICKQFONTDIALOG_P_H
diff --git a/src/widgets/qquickqmessagebox.cpp b/src/widgets/qquickqmessagebox.cpp
new file mode 100644
index 00000000..1b92efc5
--- /dev/null
+++ b/src/widgets/qquickqmessagebox.cpp
@@ -0,0 +1,144 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickqmessagebox_p.h"
+#include "qmessageboxhelper_p.h"
+#include "qquickitem.h"
+
+#include <private/qguiapplication_p.h>
+#include <private/qqmlcontext_p.h>
+#include <QWindow>
+#include <QQuickWindow>
+#include <QMessageBox>
+#include <QAbstractButton>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype QtMessageDialog
+ \instantiates QQuickQMessageBox
+ \inqmlmodule QtQuick.PrivateWidgets 1
+ \ingroup qtquick-visual
+ \brief Dialog component for choosing a color.
+ \since 5.2
+ \internal
+
+ QtMessageDialog provides a means to instantiate and manage a QMessageBox.
+ It is not recommended to be used directly; it is an implementation
+ detail of \l MessageDialog in the \l QtQuick.Dialogs module.
+
+ To use this type, you will need to import the module with the following line:
+ \code
+ import QtQuick.PrivateWidgets 1.1
+ \endcode
+*/
+
+/*!
+ \qmlsignal QtQuick::Dialogs::MessageDialog::accepted
+
+ The \a accepted signal is emitted when the user has pressed the OK button
+ on the dialog.
+
+ Example:
+
+ \qml
+ MessageDialog {
+ onAccepted: { console.log("accepted") }
+ }
+ \endqml
+*/
+
+/*!
+ \qmlsignal QtQuick::Dialogs::MessageDialog::rejected
+
+ The \a rejected signal is emitted when the user has dismissed the dialog,
+ either by closing the dialog window or by pressing the Cancel button.
+*/
+
+/*!
+ \class QQuickQMessageBox
+ \inmodule QtQuick.PrivateWidgets
+ \internal
+
+ \brief The QQuickQMessageBox class is a wrapper for a QMessageBox.
+
+ \since 5.2
+*/
+
+/*!
+ Constructs a message dialog with parent window \a parent.
+*/
+QQuickQMessageBox::QQuickQMessageBox(QObject *parent)
+ : QQuickAbstractMessageDialog(parent)
+{
+}
+
+/*!
+ Destroys the message dialog.
+*/
+QQuickQMessageBox::~QQuickQMessageBox()
+{
+ if (m_dlgHelper)
+ m_dlgHelper->hide();
+ delete m_dlgHelper;
+}
+
+QPlatformDialogHelper *QQuickQMessageBox::helper()
+{
+ QQuickItem *parentItem = qobject_cast<QQuickItem *>(parent());
+ if (parentItem)
+ m_parentWindow = parentItem->window();
+
+ if (!QQuickAbstractMessageDialog::m_dlgHelper) {
+ QMessageBoxHelper* helper = new QMessageBoxHelper();
+ QQuickAbstractMessageDialog::m_dlgHelper = helper;
+ // accept() shouldn't be emitted. reject() happens only if the dialog is
+ // dismissed by closing the window rather than by one of its button widgets.
+ connect(helper, SIGNAL(accept()), this, SLOT(accept()));
+ connect(helper, SIGNAL(reject()), this, SLOT(reject()));
+ connect(helper, SIGNAL(clicked(QMessageDialogOptions::StandardButton, QMessageDialogOptions::ButtonRole)),
+ this, SLOT(click(QMessageDialogOptions::StandardButton, QMessageDialogOptions::ButtonRole)));
+ }
+
+ return QQuickAbstractMessageDialog::m_dlgHelper;
+}
+
+QT_END_NAMESPACE
diff --git a/src/widgets/qquickqmessagebox_p.h b/src/widgets/qquickqmessagebox_p.h
new file mode 100644
index 00000000..be91f1d0
--- /dev/null
+++ b/src/widgets/qquickqmessagebox_p.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKQMESSAGEBOX_P_H
+#define QQUICKQMESSAGEBOX_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "../dialogs/qquickabstractmessagedialog_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QQuickQMessageBox : public QQuickAbstractMessageDialog
+{
+public:
+ QQuickQMessageBox(QObject *parent = 0);
+ virtual ~QQuickQMessageBox();
+
+protected:
+ virtual QPlatformDialogHelper *helper();
+
+protected:
+ Q_DISABLE_COPY(QQuickQMessageBox)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickQMessageBox *)
+
+#endif // QQUICKQMESSAGEBOX_P_H
diff --git a/src/widgets/widgets.pro b/src/widgets/widgets.pro
new file mode 100644
index 00000000..53208380
--- /dev/null
+++ b/src/widgets/widgets.pro
@@ -0,0 +1,32 @@
+CXX_MODULE = qml
+TARGET = widgetsplugin
+TARGETPATH = QtQuick/PrivateWidgets
+IMPORT_VERSION = 1.1
+
+SOURCES += \
+ qquickqmessagebox.cpp \
+ ../dialogs/qquickabstractmessagedialog.cpp \
+ qquickqfiledialog.cpp \
+ ../dialogs/qquickabstractfiledialog.cpp \
+ qquickqcolordialog.cpp \
+ ../dialogs/qquickabstractcolordialog.cpp \
+ qquickqfontdialog.cpp \
+ ../dialogs/qquickabstractfontdialog.cpp \
+ ../dialogs/qquickabstractdialog.cpp \
+ widgetsplugin.cpp
+
+HEADERS += \
+ qquickqmessagebox_p.h \
+ qmessageboxhelper_p.h \
+ ../dialogs/qquickabstractmessagedialog_p.h \
+ qquickqfiledialog_p.h \
+ ../dialogs/qquickabstractfiledialog_p.h \
+ qquickqcolordialog_p.h \
+ ../dialogs/qquickabstractcolordialog_p.h \
+ qquickqfontdialog_p.h \
+ ../dialogs/qquickabstractfontdialog_p.h \
+ ../dialogs/qquickabstractdialog_p.h
+
+QT += quick-private gui-private core-private qml-private widgets
+
+load(qml_plugin)
diff --git a/src/widgets/widgetsplugin.cpp b/src/widgets/widgetsplugin.cpp
new file mode 100644
index 00000000..05c3a5e8
--- /dev/null
+++ b/src/widgets/widgetsplugin.cpp
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
+#include "qquickqmessagebox_p.h"
+#include "qquickqfiledialog_p.h"
+#include "qquickqcolordialog_p.h"
+#include "qquickqfontdialog_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmlmodule QtQuick.PrivateWidgets 1
+ \title QWidget QML Types
+ \ingroup qmlmodules
+ \brief Provides QML types for certain QWidgets
+ \internal
+
+ This QML module contains types which should not be depended upon in Qt Quick
+ applications, but are available if the Widgets module is linked. It is
+ recommended to load components from this module conditionally, if at all,
+ and to provide fallback implementations in case they fail to load.
+
+ \code
+ import QtQuick.PrivateWidgets 1.1
+ \endcode
+
+ \since 5.1
+*/
+
+class QtQuick2PrivateWidgetsPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
+
+public:
+ virtual void registerTypes(const char *uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQuick.PrivateWidgets"));
+
+ qmlRegisterType<QQuickQMessageBox>(uri, 1, 1, "QtMessageDialog");
+ qmlRegisterType<QQuickQFileDialog>(uri, 1, 0, "QtFileDialog");
+ qmlRegisterType<QQuickQColorDialog>(uri, 1, 0, "QtColorDialog");
+ qmlRegisterType<QQuickQFontDialog>(uri, 1, 1, "QtFontDialog");
+ }
+};
+
+QT_END_NAMESPACE
+
+#include "widgetsplugin.moc"