Changeset View
Changeset View
Standalone View
Standalone View
applet/contents/ui/PopupDialog.qml
Show All 13 Lines | 1 | /* | |||
---|---|---|---|---|---|
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | Lesser General Public License for more details. | 15 | Lesser General Public License for more details. | ||
16 | 16 | | |||
17 | You should have received a copy of the GNU Lesser General Public | 17 | You should have received a copy of the GNU Lesser General Public | ||
18 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | 18 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | import QtQuick 2.2 | 21 | import QtQuick 2.2 | ||
22 | import QtQuick.Layouts 1.2 | ||||
23 | import org.kde.plasma.components 2.0 as PlasmaComponents | ||||
22 | import org.kde.plasma.core 2.0 as PlasmaCore | 24 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
23 | import org.kde.plasma.extras 2.0 as PlasmaExtras | 25 | import org.kde.plasma.extras 2.0 as PlasmaExtras | ||
24 | import org.kde.plasma.networkmanagement 0.2 as PlasmaNM | 26 | import org.kde.plasma.networkmanagement 0.2 as PlasmaNM | ||
25 | 27 | | |||
26 | FocusScope { | 28 | FocusScope { | ||
27 | property var notificationInhibitorLock: undefined | 29 | property var notificationInhibitorLock: undefined | ||
28 | 30 | | |||
29 | PlasmaNM.AvailableDevices { | 31 | PlasmaNM.AvailableDevices { | ||
30 | id: availableDevices | 32 | id: availableDevices | ||
31 | } | 33 | } | ||
32 | 34 | | |||
33 | PlasmaNM.NetworkModel { | 35 | PlasmaNM.NetworkModel { | ||
34 | id: connectionModel | 36 | id: connectionModel | ||
35 | } | 37 | } | ||
36 | 38 | | |||
37 | PlasmaNM.AppletProxyModel { | 39 | PlasmaNM.AppletProxyModel { | ||
38 | id: appletProxyModel | 40 | id: appletProxyModel | ||
39 | 41 | | |||
40 | sourceModel: connectionModel | 42 | sourceModel: connectionModel | ||
41 | } | 43 | } | ||
42 | 44 | | |||
45 | ColumnLayout { | ||||
46 | anchors.fill: parent | ||||
vpilo: This is to solve layouting issues when toggling the search bar. | |||||
47 | | ||||
43 | Toolbar { | 48 | Toolbar { | ||
44 | id: toolbar | 49 | id: toolbar | ||
45 | 50 | Layout.fillWidth: true | |||
46 | anchors { | | |||
47 | left: parent.left | | |||
48 | right: parent.right | | |||
49 | top: parent.top | | |||
50 | } | | |||
51 | } | 51 | } | ||
52 | 52 | | |||
53 | PlasmaExtras.ScrollArea { | 53 | PlasmaExtras.ScrollArea { | ||
54 | id: scrollView | 54 | id: scrollView | ||
55 | 55 | Layout.fillWidth: true | |||
The connection view changes height depending on the presence of a search bar I would expect that to be giving binding loops when you're on the edge. davidedmundson: The connection view changes height depending on the presence of a search bar
The search bar… | |||||
vpilo: How would I test this? | |||||
56 | anchors { | 56 | Layout.fillHeight: true | ||
57 | bottom: parent.bottom | | |||
58 | left: parent.left | | |||
59 | right: parent.right | | |||
60 | top: toolbar.bottom | | |||
61 | } | | |||
62 | 57 | | |||
63 | ListView { | 58 | ListView { | ||
64 | id: connectionView | 59 | id: connectionView | ||
65 | 60 | | |||
66 | property bool availableConnectionsVisible: false | 61 | property bool availableConnectionsVisible: false | ||
67 | property int currentVisibleButtonIndex: -1 | 62 | property int currentVisibleButtonIndex: -1 | ||
68 | 63 | | |||
69 | anchors.fill: parent | 64 | anchors.fill: parent | ||
70 | clip: true | 65 | clip: true | ||
71 | model: appletProxyModel | 66 | model: appletProxyModel | ||
72 | currentIndex: -1 | 67 | currentIndex: -1 | ||
73 | boundsBehavior: Flickable.StopAtBounds | 68 | boundsBehavior: Flickable.StopAtBounds | ||
74 | section.property: showSections ? "Section" : "" | 69 | section.property: showSections ? "Section" : "" | ||
75 | section.delegate: Header { text: section } | 70 | section.delegate: Header { text: section } | ||
76 | delegate: ConnectionItem { } | 71 | delegate: ConnectionItem { } | ||
77 | } | 72 | } | ||
78 | } | 73 | } | ||
74 | } | ||||
79 | 75 | | |||
80 | Connections { | 76 | Connections { | ||
81 | target: plasmoid | 77 | target: plasmoid | ||
82 | onExpandedChanged: { | 78 | onExpandedChanged: { | ||
83 | connectionView.currentVisibleButtonIndex = -1; | 79 | connectionView.currentVisibleButtonIndex = -1; | ||
84 | if (expanded) { | 80 | if (expanded) { | ||
85 | var service = notificationsEngine.serviceForSource("notifications"); | 81 | var service = notificationsEngine.serviceForSource("notifications"); | ||
86 | var operation = service.operationDescription("inhibit"); | 82 | var operation = service.operationDescription("inhibit"); | ||
87 | operation.hint = "x-kde-appname"; | 83 | operation.hint = "x-kde-appname"; | ||
88 | operation.value = "networkmanagement"; | 84 | operation.value = "networkmanagement"; | ||
89 | var job = service.startOperationCall(operation); | 85 | var job = service.startOperationCall(operation); | ||
90 | job.finished.connect(function(job) { | 86 | job.finished.connect(function(job) { | ||
91 | if (expanded) { | 87 | if (expanded) { | ||
92 | notificationInhibitorLock = job.result; | 88 | notificationInhibitorLock = job.result; | ||
93 | } | 89 | } | ||
94 | }); | 90 | }); | ||
95 | } else { | 91 | } else { | ||
96 | notificationInhibitorLock = undefined; | 92 | notificationInhibitorLock = undefined; | ||
93 | toolbar.closeSearch() | ||||
97 | } | 94 | } | ||
98 | } | 95 | } | ||
99 | } | 96 | } | ||
100 | 97 | | |||
101 | PlasmaCore.DataSource { | 98 | PlasmaCore.DataSource { | ||
102 | id: notificationsEngine | 99 | id: notificationsEngine | ||
103 | engine: "notifications" | 100 | engine: "notifications" | ||
104 | } | 101 | } | ||
105 | } | 102 | } |
This is to solve layouting issues when toggling the search bar.