UNPKG

2.01 kBPlain TextView Raw
1/*
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20*/
21
22import QtQuick 2.0
23import Ubuntu.Components.Popups 0.1
24import Ubuntu.Components 0.1
25
26Dialog {
27 id: dialogue
28 property string button1Text
29 property string button2Text
30 property string button3Text
31 property bool promptVisible
32 property string defaultPromptText
33
34 TextField {
35 id: prompt
36 text: defaultPromptText
37 visible: promptVisible
38 focus: true
39 }
40 Button {
41 text: button1Text
42 color: "orange"
43 onClicked: {
44 root.exec("Notification", "notificationDialogButtonPressed", [1, prompt.text, promptVisible]);
45 PopupUtils.close(dialogue)
46 }
47 }
48 Button {
49 text: button2Text
50 visible: button2Text.length > 0
51 color: "orange"
52 onClicked: {
53 root.exec("Notification", "notificationDialogButtonPressed", [2, prompt.text, promptVisible]);
54 PopupUtils.close(dialogue)
55 }
56 }
57 Button {
58 text: button3Text
59 visible: button3Text.length > 0
60 onClicked: {
61 root.exec("Notification", "notificationDialogButtonPressed", [3, prompt.text, promptVisible]);
62 PopupUtils.close(dialogue)
63 }
64 }
65}