Warning, /plasma/libplasma/examples/applets/testcomponents/contents/ui/DialogsPage.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 SPDX-FileCopyrightText: 2013 Sebastian Kügler <sebas@kde.org>
0003
0004 SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006
0007 import QtQuick
0008 import QtQuick.Window
0009
0010 import org.kde.plasma.core as PlasmaCore
0011 import org.kde.plasma.components as PlasmaComponents
0012 import org.kde.kquickcontrolsaddons as KQuickControlsAddons
0013 import org.kde.kirigami as Kirigami
0014
0015 // DialogsPage
0016
0017 PlasmaComponents.Page {
0018 id: dialogsPage
0019 anchors {
0020 fill: parent
0021 margins: _s
0022 }
0023 Column {
0024 spacing: _s/2
0025 anchors.fill: parent
0026 Kirigami.Heading {
0027 width: parent.width
0028 level: 1
0029 text: "Dialogs"
0030 }
0031 Row {
0032 height: _h
0033 spacing: _s
0034 PlasmaComponents.Button {
0035 id: radio
0036 checkable: true
0037 iconSource: "dialog-ok"
0038 text: "Window"
0039 }
0040 Window {
0041 title: radio.text
0042 id: qWindow
0043 visible: radio.checked
0044 width: childrenRect.width
0045 height: childrenRect.height
0046 color: Qt.rgba(0,0,0,0)
0047 DialogContent {
0048 id: dContent
0049 onCloseMe: {
0050 qWindow.visible = false
0051 }
0052 }
0053 }
0054
0055 PlasmaComponents.Label {
0056 text: qWindow.visible ? "shown" : "hidden"
0057 }
0058 }
0059 Row {
0060 height: _h
0061 spacing: _s
0062 PlasmaComponents.Button {
0063 text: "Core.Dialog"
0064 iconSource: "dialog-ok-apply"
0065 checkable: true
0066 //onCheckedChanged: pcDialog.visible = checked
0067 onCheckedChanged: pcDialog.visible = checked
0068 }
0069 PlasmaComponents.Label {
0070 text: pcDialog.visible ? "shown" : "hidden"
0071 }
0072
0073 PlasmaCore.Dialog {
0074 id: pcDialog
0075 //windowFlags: Qt.Popup
0076 visualParent: dialogsPage
0077 //mainItem: dContent2
0078 color: Qt.rgba(0,0,0,0)
0079
0080 mainItem: DialogContent {
0081 id: dContent2
0082 onCloseMe: pcDialog.visible = false
0083 }
0084 }
0085 }
0086 Row {
0087 height: _h
0088 spacing: _s
0089 PlasmaComponents.Button {
0090 text: "Dialog"
0091 iconSource: "dialog-ok-apply"
0092 checkable: true
0093 onCheckedChanged: {
0094 if (checked) {
0095 pcompDialog.open();
0096 } else {
0097 pcompDialog.close();
0098 }
0099 }
0100 }
0101 PlasmaComponents.Label {
0102 text: pcompDialog.visible ? "shown" : "hidden"
0103 }
0104
0105 PlasmaComponents.Dialog {
0106 id: pcompDialog
0107 //windowFlags: Qt.Popup
0108 visualParent: root
0109 content: DialogContent {
0110 id: dContent3
0111 onCloseMe: pcompDialog.close()
0112 }
0113 buttons: PlasmaComponents.ButtonRow {
0114 PlasmaComponents.Button {
0115 text: "Close";
0116 onClicked: {
0117 print("Closing...");
0118 pcompDialog.close()
0119 }
0120 }
0121 PlasmaComponents.Button {
0122 text: "Accept";
0123 onClicked: {
0124 print("Accepting...");
0125 pcompDialog.accept();
0126 pcompDialog.close();
0127 }
0128 }
0129 }
0130 }
0131 }
0132 Row {
0133 height: _h
0134 spacing: _s
0135 PlasmaComponents.Button {
0136 text: "QueryDialog"
0137 iconSource: "dialog-ok-apply"
0138 checkable: true
0139 onCheckedChanged: {
0140 if (checked) {
0141 queryDialog.open();
0142 } else {
0143 queryDialog.close();
0144 }
0145 }
0146 }
0147 PlasmaComponents.Label {
0148 text: queryDialog.visible ? "shown" : "hidden"
0149 }
0150
0151 PlasmaComponents.QueryDialog {
0152 id: queryDialog
0153 //windowFlags: Qt.Popup
0154 visualParent: root
0155 titleText: "Fruit Inquiry"
0156 message: "Would you rather have apples or oranges?"
0157 acceptButtonText: "Apples"
0158 rejectButtonText: "Oranges"
0159 onButtonClicked: {
0160 print("hey");
0161 queryDialog.close();
0162 }
0163 }
0164 }
0165 PlasmaComponents.ButtonRow {
0166 id: buttonRow
0167 spacing: _s/2
0168 PlasmaComponents.Button {
0169 width: _h
0170 text: "Top"
0171 onClicked: {
0172 locationDialog.location = PlasmaCore.Types.TopEdge;
0173 locationDialog.visible = !locationDialog.visible
0174 }
0175 }
0176 PlasmaComponents.Button {
0177 text: "Bottom"
0178 width: _h
0179 onClicked: {
0180 locationDialog.location = PlasmaCore.Types.BottomEdge;
0181 locationDialog.visible = !locationDialog.visible
0182 }
0183 }
0184 PlasmaComponents.Button {
0185 text: "Left"
0186 width: _h
0187 onClicked: {
0188 locationDialog.location = PlasmaCore.Types.LeftEdge;
0189 locationDialog.visible = !locationDialog.visible
0190 }
0191 }
0192 PlasmaComponents.Button {
0193 text: "Right"
0194 width: _h
0195 onClicked: {
0196 locationDialog.location = PlasmaCore.Types.RightEdge;
0197 locationDialog.visible = !locationDialog.visible
0198 }
0199 }
0200 PlasmaComponents.Button {
0201 text: "Desktop"
0202 width: _h
0203 onClicked: {
0204 locationDialog.location = PlasmaCore.Types.Desktop;
0205 locationDialog.visible = !locationDialog.visible
0206 }
0207 }
0208 PlasmaComponents.Button {
0209 text: "Floating"
0210 width: _h
0211 onClicked: {
0212 locationDialog.location = PlasmaCore.Types.Floating;
0213 locationDialog.visible = !locationDialog.visible
0214 }
0215 }
0216 PlasmaComponents.Button {
0217 text: "FullScreen"
0218 width: _h
0219 onClicked: {
0220 locationDialog.location = PlasmaCore.Types.FullScreen;
0221 locationDialog.visible = !locationDialog.visible
0222 }
0223 }
0224 }
0225 PlasmaCore.Dialog {
0226 id: locationDialog
0227 visualParent: buttonRow
0228 mainItem: DialogContent {
0229 id: dContent4
0230 onCloseMe: locationDialog.visible = false
0231 }
0232 }
0233 }
0234 }
0235