Merge lp:~ahayzen/ubuntu-system-settings/printers-use-header-sections into lp:~jonas-drange/ubuntu-system-settings/printers

Proposed by Andrew Hayzen
Status: Merged
Approved by: Jonas G. Drange
Approved revision: 1778
Merged at revision: 1777
Proposed branch: lp:~ahayzen/ubuntu-system-settings/printers-use-header-sections
Merge into: lp:~jonas-drange/ubuntu-system-settings/printers
Diff against target: 156 lines (+56/-46)
3 files modified
plugins/printing/PageComponent.qml (+5/-1)
plugins/printing/Printer.qml (+45/-45)
src/qml/MainWindow.qml (+6/-0)
To merge this branch: bzr merge lp:~ahayzen/ubuntu-system-settings/printers-use-header-sections
Reviewer Review Type Date Requested Status
Jonas G. Drange Approve
Review via email: mp+320679@code.launchpad.net

Commit message

* Change subPageSelector to be header sections
* Disable automatic height of the standard and search headers
* Fix Printers list and Describe Printer not being scrollable

Description of the change

* Change subPageSelector to be header sections
* Disable automatic height of the standard and search headers
* Fix Printers list and Describe Printer not being scrollable

To post a comment you must log in.
1777. By Andrew Hayzen

* Fix scrolling not functioning on the printer list page

1778. By Andrew Hayzen

* Fix for AddPrinterDetails.qml not scrolling

Revision history for this message
Jonas G. Drange (jonas-drange) wrote :

LGTM! Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/printing/AddPrinterDetails.qml'
2=== modified file 'plugins/printing/PageComponent.qml'
3--- plugins/printing/PageComponent.qml 2017-03-21 14:53:48 +0000
4+++ plugins/printing/PageComponent.qml 2017-03-22 17:35:37 +0000
5@@ -84,10 +84,14 @@
6 Flickable {
7 id: printerList
8 anchors.fill: parent
9+ contentHeight: contentItem.childrenRect.height
10 clip: true
11
12 Column {
13- anchors.fill: parent
14+ anchors {
15+ left: parent.left
16+ right: parent.right
17+ }
18
19 ListView {
20 id: allPrintersList
21
22=== modified file 'plugins/printing/Printer.qml'
23--- plugins/printing/Printer.qml 2017-03-06 16:12:37 +0000
24+++ plugins/printing/Printer.qml 2017-03-22 17:35:37 +0000
25@@ -28,6 +28,33 @@
26 header: PageHeader {
27 title: printer.name
28 flickable: printerFlickable
29+ extension: Loader {
30+ active: printer.isLoaded
31+ anchors {
32+ bottom: parent.bottom
33+ left: parent.left
34+ leftMargin: units.gu(2)
35+ right: parent.right
36+ rightMargin: units.gu(2)
37+ }
38+ sourceComponent: Sections {
39+ model: [
40+ i18n.tr("Printer status"),
41+ i18n.tr("General settings"),
42+ i18n.tr("Policies"),
43+ /* i18n.tr("Allowed users"), */
44+ /* i18n.tr("Installable options"), */
45+ i18n.tr("Copies and pages"),
46+ ]
47+
48+ Component.onCompleted: {
49+ // If we're asked for specific category, show it immediately.
50+ if (pluginOptions && pluginOptions["category"]) {
51+ categoryToSelectorIndex(pluginOptions["category"]);
52+ }
53+ }
54+ }
55+ }
56 }
57
58 function categoryToSelectorIndex(category) {
59@@ -84,55 +111,28 @@
60 right: parent.right
61 }
62
63- OptionSelector {
64- id: subPageSelector
65- anchors {
66- left: parent.left
67- leftMargin: units.gu(2)
68- }
69- width: units.gu(30)
70- model: [
71- i18n.tr("Printer status"),
72- i18n.tr("General settings"),
73- i18n.tr("Policies"),
74- /* i18n.tr("Allowed users"), */
75- /* i18n.tr("Installable options"), */
76- i18n.tr("Copies and pages"),
77- ]
78- onSelectedIndexChanged: {
79- var uri = printerSubPageLoader.defaultUri;
80- switch (selectedIndex) {
81- case 1:
82- uri = Qt.resolvedUrl("GeneralSettings.qml");
83- break;
84- case 2:
85- uri = Qt.resolvedUrl("Policies.qml");
86- break;
87- case 3:
88- uri = Qt.resolvedUrl("CopiesAndPages.qml");
89- break;
90- }
91- printerSubPageLoader.setSource(uri);
92- }
93- }
94-
95 Loader {
96 id: printerSubPageLoader
97 anchors { left: parent.left; right: parent.right }
98- property string defaultUri: Qt.resolvedUrl("Status.qml")
99-
100- Component.onCompleted: {
101- // If we're asked for specific category, show it immediately.
102- var category = pluginOptions ? pluginOptions['category'] : null;
103- var index = 0;
104- if (pluginOptions && category) {
105- index = categoryToSelectorIndex(category);
106- }
107-
108- if (index == 0) {
109- printerSubPageLoader.setSource(defaultUri);
110+ source: {
111+ if (printerPage.header.extension.item) {
112+ switch (printerPage.header.extension.item.selectedIndex) {
113+ case 1:
114+ Qt.resolvedUrl("GeneralSettings.qml");
115+ break;
116+ case 2:
117+ Qt.resolvedUrl("Policies.qml");
118+ break;
119+ case 3:
120+ Qt.resolvedUrl("CopiesAndPages.qml");
121+ break;
122+ case 0:
123+ default:
124+ Qt.resolvedUrl("Status.qml");
125+ break;
126+ }
127 } else {
128- subPageSelector.selectedIndex = index;
129+ null
130 }
131 }
132 }
133
134=== modified file 'src/qml/MainWindow.qml'
135--- src/qml/MainWindow.qml 2016-12-14 13:37:49 +0000
136+++ src/qml/MainWindow.qml 2017-03-22 17:35:37 +0000
137@@ -167,6 +167,9 @@
138 PageHeader {
139 id: standardHeader
140 objectName: "standardHeader"
141+ // turn off automatic height
142+ // so when in APL the height doesn't change
143+ automaticHeight: false
144 visible: mainPage.header === standardHeader
145 title: i18n.tr("System Settings")
146 flickable: mainFlickable
147@@ -186,6 +189,9 @@
148 PageHeader {
149 id: searchHeader
150 objectName: "searchHeader"
151+ // turn off automatic height
152+ // so when in APL the height doesn't change
153+ automaticHeight: false
154 visible: mainPage.header === searchHeader
155 flickable: mainFlickable
156 contents: TextField {

Subscribers

People subscribed via source and target branches

to all changes: