Merge lp:~bhdouglass/rockwork/js-dialogs into lp:rockwork

Proposed by Brian Douglass
Status: Merged
Merged at revision: 124
Proposed branch: lp:~bhdouglass/rockwork/js-dialogs
Merge into: lp:rockwork
Diff against target: 161 lines (+103/-0)
8 files modified
rockwork/AppSettingsPage.qml (+6/-0)
rockwork/js-dialogs/AlertDialog.qml (+11/-0)
rockwork/js-dialogs/BaseDialog.qml (+14/-0)
rockwork/js-dialogs/BeforeUnloadDialog.qml (+16/-0)
rockwork/js-dialogs/ConfirmDialog.qml (+16/-0)
rockwork/js-dialogs/PromptDialog.qml (+30/-0)
rockwork/js-dialogs/README.md (+5/-0)
rockwork/rockwork.qrc (+5/-0)
To merge this branch: bzr merge lp:~bhdouglass/rockwork/js-dialogs
Reviewer Review Type Date Requested Status
Michael Zanetti Pending
Review via email: mp+296625@code.launchpad.net

Description of the change

Added javascript dialogs for the app settings webview

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'rockwork/AppSettingsPage.qml'
2--- rockwork/AppSettingsPage.qml 2016-02-23 05:28:51 +0000
3+++ rockwork/AppSettingsPage.qml 2016-06-07 03:49:11 +0000
4@@ -2,6 +2,7 @@
5 import Ubuntu.Web 0.2
6 import Ubuntu.Components 1.3
7 import com.canonical.Oxide 1.0 as Oxide
8+import "js-dialogs" as Dialogs
9
10 Page {
11 id: settings
12@@ -33,6 +34,11 @@
13 preferences.appCacheEnabled: true
14 preferences.javascriptCanAccessClipboard: true
15
16+ alertDialog: Dialogs.AlertDialog {}
17+ confirmDialog: Dialogs.ConfirmDialog {}
18+ promptDialog: Dialogs.PromptDialog {}
19+ beforeUnloadDialog: Dialogs.BeforeUnloadDialog {}
20+
21 function navigationRequestedDelegate(request) {
22 var url = request.url.toString();
23 if (url.substring(0, 16) == 'pebblejs://close') {
24
25=== added directory 'rockwork/js-dialogs'
26=== added file 'rockwork/js-dialogs/AlertDialog.qml'
27--- rockwork/js-dialogs/AlertDialog.qml 1970-01-01 00:00:00 +0000
28+++ rockwork/js-dialogs/AlertDialog.qml 2016-06-07 03:49:11 +0000
29@@ -0,0 +1,11 @@
30+import QtQuick 2.4
31+import Ubuntu.Components 1.3
32+
33+BaseDialog {
34+ title: i18n.tr("App Settings Alert")
35+
36+ Button {
37+ text: i18n.tr("OK")
38+ onClicked: model.accept()
39+ }
40+}
41
42=== added file 'rockwork/js-dialogs/BaseDialog.qml'
43--- rockwork/js-dialogs/BaseDialog.qml 1970-01-01 00:00:00 +0000
44+++ rockwork/js-dialogs/BaseDialog.qml 2016-06-07 03:49:11 +0000
45@@ -0,0 +1,14 @@
46+import QtQuick 2.4
47+import Ubuntu.Components 1.3
48+import Ubuntu.Components.Popups 1.3 as Popups
49+
50+Popups.Dialog {
51+ text: model.message
52+
53+ // Set the parent at construction time, instead of letting show()
54+ // set it later on, which for some reason results in the size of
55+ // the dialog not being updated.
56+ parent: QuickUtils.rootItem(this)
57+
58+ Component.onCompleted: show()
59+}
60
61=== added file 'rockwork/js-dialogs/BeforeUnloadDialog.qml'
62--- rockwork/js-dialogs/BeforeUnloadDialog.qml 1970-01-01 00:00:00 +0000
63+++ rockwork/js-dialogs/BeforeUnloadDialog.qml 2016-06-07 03:49:11 +0000
64@@ -0,0 +1,16 @@
65+import QtQuick 2.4
66+import Ubuntu.Components 1.3
67+
68+BaseDialog {
69+ title: i18n.tr("App Settings Confirm Navigation")
70+
71+ Button {
72+ text: i18n.tr("Leave")
73+ onClicked: model.accept()
74+ }
75+
76+ Button {
77+ text: i18n.tr("Stay")
78+ onClicked: model.reject()
79+ }
80+}
81
82=== added file 'rockwork/js-dialogs/ConfirmDialog.qml'
83--- rockwork/js-dialogs/ConfirmDialog.qml 1970-01-01 00:00:00 +0000
84+++ rockwork/js-dialogs/ConfirmDialog.qml 2016-06-07 03:49:11 +0000
85@@ -0,0 +1,16 @@
86+import QtQuick 2.4
87+import Ubuntu.Components 1.3
88+
89+BaseDialog {
90+ title: i18n.tr("App Settings Confirmation")
91+
92+ Button {
93+ text: i18n.tr("OK")
94+ onClicked: model.accept()
95+ }
96+
97+ Button {
98+ text: i18n.tr("Cancel")
99+ onClicked: model.reject()
100+ }
101+}
102
103=== added file 'rockwork/js-dialogs/PromptDialog.qml'
104--- rockwork/js-dialogs/PromptDialog.qml 1970-01-01 00:00:00 +0000
105+++ rockwork/js-dialogs/PromptDialog.qml 2016-06-07 03:49:11 +0000
106@@ -0,0 +1,30 @@
107+import QtQuick 2.4
108+import Ubuntu.Components 1.3
109+
110+BaseDialog {
111+ title: i18n.tr("App Settings Prompt")
112+
113+ TextField {
114+ id: input
115+ text: model.defaultValue
116+ onAccepted: model.accept(input.text)
117+ }
118+
119+ Button {
120+ text: i18n.tr("OK")
121+ color: "green"
122+ onClicked: model.accept(input.text)
123+ }
124+
125+ Button {
126+ text: i18n.tr("Cancel")
127+ color: UbuntuColors.coolGrey
128+ onClicked: model.reject()
129+ }
130+
131+ Binding {
132+ target: model
133+ property: "currentValue"
134+ value: input.text
135+ }
136+}
137
138=== added file 'rockwork/js-dialogs/README.md'
139--- rockwork/js-dialogs/README.md 1970-01-01 00:00:00 +0000
140+++ rockwork/js-dialogs/README.md 2016-06-07 03:49:11 +0000
141@@ -0,0 +1,5 @@
142+# JavaScript Dialogs
143+
144+These are the JavaScript for the app settings page, these are based on the
145+dialogs found in the [webbrowser-app project](https://launchpad.net/webbrowser-app)
146+(licensed under the GPL v3).
147
148=== modified file 'rockwork/rockwork.qrc'
149--- rockwork/rockwork.qrc 2016-03-24 16:07:19 +0000
150+++ rockwork/rockwork.qrc 2016-06-07 03:49:11 +0000
151@@ -45,5 +45,10 @@
152 <file>SettingsPage.qml</file>
153 <file>ImportPackagePage.qml</file>
154 <file>SendLogsDialog.qml</file>
155+ <file>js-dialogs/BaseDialog.qml</file>
156+ <file>js-dialogs/AlertDialog.qml</file>
157+ <file>js-dialogs/BeforeUnloadDialog.qml</file>
158+ <file>js-dialogs/ConfirmDialog.qml</file>
159+ <file>js-dialogs/PromptDialog.qml</file>
160 </qresource>
161 </RCC>

Subscribers

People subscribed via source and target branches