18 import QtQuick.Layouts 1.11 as QtLayouts
29 property int questionType
30 anchors.centerIn: QtControls.Overlay.overlay
34 switch (questionType) {
35 case NewStuffCore.Question.SelectFromListQuestion:
36 case NewStuffCore.Question.InputTextQuestion:
37 case NewStuffCore.Question.PasswordQuestion:
38 case NewStuffCore.Question.ContinueCancelQuestion:
40 return QtControls.Dialog.Ok | QtControls.Dialog.Cancel;
42 case NewStuffCore.Question.YesNoQuestion:
43 return QtControls.Dialog.Yes | QtControls.Dialog.No;
51 target: NewStuff.QuickQuestionListener
53 dialog.questionType = NewStuffCore.Question.SelectFromListQuestion;
55 questionLabel.text = question;
56 for (var i = 0; i < list.
length; i++) {
57 listView.model.append({ text: list[i] });
59 listView.currentIndex = 0;
60 listView.visible =
true;
63 onAskContinueCancelQuestion: {
64 dialog.questionType = NewStuffCore.Question.ContinueCancelQuestion;
66 questionLabel.text = question;
69 onAskTextInputQuestion: {
70 dialog.questionType = NewStuffCore.Question.InputTextQuestion;
72 questionLabel.text = question;
73 textInput.visible =
true;
76 onAskPasswordQuestion: {
77 dialog.questionType = NewStuffCore.Question.PasswordQuestion;
79 questionLabel.text = question;
80 textInput.echoMode = QtControls.TextInput.PasswordEchoOnEdit;
81 textInput.visible =
true;
85 dialog.questionType = NewStuffCore.Question.YesNoQuestion;
87 questionLabel.text = question;
92 target: applicationWindow()
97 if (dialog.opened ===
true) {
102 function passResponse(responseIsContinue) {
104 switch(dialog.questionType) {
105 case NewStuffCore.Question.SelectFromListQuestion:
106 input = listView.currentItem.text;
107 listView.model.clear();
108 listView.visible =
false;
110 case NewStuffCore.Question.InputTextQuestion:
111 input = textInput.text;
113 textInput.visible =
false;
115 case NewStuffCore.Question.PasswordQuestion:
116 input = textInput.text;
118 textInput.visible =
false;
119 textInput.echoMode = QtControls.TextInput.Normal;
121 case NewStuffCore.Question.ContinueCancelQuestion:
122 case NewStuffCore.Question.YesNoQuestion:
127 NewStuff.QuickQuestionListener.passResponse(responseIsContinue, input);
130 QtLayouts.ColumnLayout {
132 property int maxWidth: applicationWindow().width - (dialog.leftPadding + dialog.leftMargin + dialog.rightMargin + dialog.rightPadding)
135 QtLayouts.Layout.maximumWidth: parent.maxWidth
141 QtLayouts.Layout.maximumWidth: parent.maxWidth
142 QtLayouts.Layout.fillWidth:
true 143 QtLayouts.Layout.minimumHeight:
Kirigami.Units.gridUnit * 6
146 reserveSpaceForIcon:
false 150 QtControls.TextField {
153 QtLayouts.Layout.maximumWidth: parent.maxWidth
154 QtLayouts.Layout.fillWidth:
true
A dialog which has a NewStuff.Page at the base.