Changeset View
Changeset View
Standalone View
Standalone View
applet/contents/ui/ConnectionItem.qml
Show All 21 Lines | |||||
22 | import QtQuick.Layouts 1.2 | 22 | import QtQuick.Layouts 1.2 | ||
23 | import QtQuick.Controls 2.4 as Controls | 23 | import QtQuick.Controls 2.4 as Controls | ||
24 | import org.kde.kcoreaddons 1.0 as KCoreAddons | 24 | import org.kde.kcoreaddons 1.0 as KCoreAddons | ||
25 | import org.kde.kquickcontrolsaddons 2.0 | 25 | import org.kde.kquickcontrolsaddons 2.0 | ||
26 | import org.kde.plasma.components 2.0 as PlasmaComponents | 26 | import org.kde.plasma.components 2.0 as PlasmaComponents | ||
27 | import org.kde.plasma.core 2.0 as PlasmaCore | 27 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
28 | import org.kde.plasma.networkmanagement 0.2 as PlasmaNM | 28 | import org.kde.plasma.networkmanagement 0.2 as PlasmaNM | ||
29 | 29 | | |||
30 | PlasmaComponents.ListItem { | 30 | ListItem { | ||
31 | id: connectionItem | 31 | id: connectionItem | ||
32 | 32 | | |||
33 | property bool activating: ConnectionState == PlasmaNM.Enums.Activating | 33 | property bool activating: ConnectionState == PlasmaNM.Enums.Activating | ||
34 | property int baseHeight: Math.max(units.iconSizes.medium, connectionNameLabel.height + connectionStatusLabel.height) + Math.round(units.gridUnit / 2) | 34 | property bool deactivated: ConnectionState === PlasmaNM.Enums.Deactivated | ||
35 | property int baseHeight: Uuid ? connectionNameLabel.implicitHeight + connectionStatusLabel.implicitHeight + units.smallSpacing * 2 | ||||
36 | : stateChangeButton.implicitHeight + units.smallSpacing * 2 | ||||
35 | property bool expanded: visibleDetails || visiblePasswordDialog | 37 | property bool expanded: visibleDetails || visiblePasswordDialog | ||
36 | property bool predictableWirelessPassword: !Uuid && Type == PlasmaNM.Enums.Wireless && | 38 | property bool predictableWirelessPassword: !Uuid && Type == PlasmaNM.Enums.Wireless && | ||
37 | (SecurityType == PlasmaNM.Enums.StaticWep || SecurityType == PlasmaNM.Enums.WpaPsk || | 39 | (SecurityType == PlasmaNM.Enums.StaticWep || SecurityType == PlasmaNM.Enums.WpaPsk || | ||
38 | SecurityType == PlasmaNM.Enums.Wpa2Psk) | 40 | SecurityType == PlasmaNM.Enums.Wpa2Psk) | ||
39 | property bool showSpeed: plasmoid.expanded && | 41 | property bool showSpeed: plasmoid.expanded && | ||
40 | ConnectionState == PlasmaNM.Enums.Activated && | 42 | ConnectionState == PlasmaNM.Enums.Activated && | ||
41 | (Type == PlasmaNM.Enums.Wired || | 43 | (Type == PlasmaNM.Enums.Wired || | ||
42 | Type == PlasmaNM.Enums.Wireless || | 44 | Type == PlasmaNM.Enums.Wireless || | ||
43 | Type == PlasmaNM.Enums.Gsm || | 45 | Type == PlasmaNM.Enums.Gsm || | ||
44 | Type == PlasmaNM.Enums.Cdma) | 46 | Type == PlasmaNM.Enums.Cdma) | ||
45 | property bool visibleDetails: false | 47 | property bool visibleDetails: false | ||
46 | property bool visiblePasswordDialog: false | 48 | property bool visiblePasswordDialog: false | ||
47 | 49 | | |||
48 | property real rxBytes: 0 | 50 | property real rxBytes: 0 | ||
49 | property real txBytes: 0 | 51 | property real txBytes: 0 | ||
50 | 52 | | |||
51 | checked: connectionItem.containsMouse | 53 | height: expanded ? baseHeight + expandableComponentLoader.height + units.smallSpacing * (ConnectionState == PlasmaNM.Enums.Active ? 1 : Uuid ? 2 : 1) | ||
52 | enabled: true | 54 | : baseHeight | ||
53 | height: expanded ? baseHeight + separator.height + expandableComponentLoader.height + (2 * Math.round(units.gridUnit / 3)) : baseHeight | 55 | highlightRect: Qt.rect(mainColumn.x, mainColumn.y, mainColumn.width, baseHeight) | ||
54 | 56 | | |||
55 | ColumnLayout { | 57 | ColumnLayout { | ||
58 | id: mainColumn | ||||
56 | anchors.fill: parent | 59 | anchors.fill: parent | ||
57 | 60 | | |||
58 | RowLayout { | 61 | MouseArea { | ||
59 | Layout.fillWidth: true | 62 | Layout.fillWidth: true | ||
60 | spacing: Math.round(units.gridUnit / 2) | 63 | Layout.preferredHeight: mainRow.height | ||
64 | Layout.alignment: Qt.AlignTop | ||||
65 | acceptedButtons: Qt.LeftButton | Qt.RightButton | ||||
66 | hoverEnabled: true | ||||
67 | | ||||
68 | onEntered: { | ||||
69 | connectionView.currentVisibleButtonIndex = index | ||||
70 | connectionItem.checked = true | ||||
71 | } | ||||
72 | | ||||
73 | onExited: { | ||||
74 | connectionItem.checked = false | ||||
75 | } | ||||
76 | | ||||
77 | onPressed: { | ||||
78 | if (mouse.button & Qt.LeftButton) { | ||||
79 | changeExpanded() | ||||
80 | } | ||||
81 | | ||||
82 | if (mouse.button & Qt.RightButton) { | ||||
83 | contextMenu.visualParent = parent | ||||
84 | contextMenu.prepare(); | ||||
85 | contextMenu.open(mouse.x, mouse.y) | ||||
86 | } | ||||
87 | } | ||||
88 | | ||||
89 | RowLayout { | ||||
90 | id: mainRow | ||||
91 | spacing: units.smallSpacing * 2 | ||||
92 | height: baseHeight | ||||
93 | width: mainColumn.width | ||||
94 | anchors { | ||||
95 | left: parent.left | ||||
96 | right: parent.right | ||||
97 | leftMargin: units.smallSpacing | ||||
98 | // Identical margins around the button. | ||||
99 | rightMargin: Math.round((baseHeight - stateChangeButton.height) / 2) | ||||
100 | } | ||||
61 | 101 | | |||
62 | PlasmaCore.SvgItem { | 102 | PlasmaCore.SvgItem { | ||
63 | id: connectionSvgIcon | 103 | id: connectionSvgIcon | ||
64 | Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft | 104 | Layout.preferredHeight: Uuid ? units.iconSizes.medium : units.iconSizes.smallMedium | ||
65 | Layout.preferredHeight: units.iconSizes.medium | 105 | Layout.preferredWidth: Layout.preferredHeight | ||
66 | Layout.preferredWidth: units.iconSizes.medium | 106 | Layout.leftMargin: units.smallSpacing | ||
67 | elementId: ConnectionIcon | 107 | elementId: ConnectionIcon | ||
68 | svg: PlasmaCore.Svg { | 108 | svg: PlasmaCore.Svg { | ||
69 | multipleImages: true | 109 | multipleImages: true | ||
70 | imagePath: "icons/network" | 110 | imagePath: "icons/network" | ||
71 | colorGroup: PlasmaCore.ColorScope.colorGroup | 111 | colorGroup: PlasmaCore.ColorScope.colorGroup | ||
72 | } | 112 | } | ||
73 | } | 113 | } | ||
74 | 114 | | |||
75 | ColumnLayout { | 115 | // ColumnLayout with fillWidth in children, creates bind loop for width. | ||
76 | Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft | 116 | Column { | ||
117 | Layout.fillWidth: true | ||||
118 | Layout.preferredHeight: connectionNameLabel.height + (connectionStatusLabel.visible ? connectionStatusLabel.height : 0) | ||||
77 | spacing: 0 | 119 | spacing: 0 | ||
78 | 120 | | |||
79 | PlasmaComponents.Label { | 121 | PlasmaComponents.Label { | ||
80 | id: connectionNameLabel | 122 | id: connectionNameLabel | ||
81 | Layout.fillWidth: true | 123 | width: parent.width | ||
82 | height: paintedHeight | | |||
83 | elide: Text.ElideRight | 124 | elide: Text.ElideRight | ||
125 | height: undefined | ||||
84 | font.weight: ConnectionState == PlasmaNM.Enums.Activated ? Font.DemiBold : Font.Normal | 126 | font.weight: ConnectionState == PlasmaNM.Enums.Activated ? Font.DemiBold : Font.Normal | ||
85 | font.italic: ConnectionState == PlasmaNM.Enums.Activating ? true : false | 127 | font.italic: ConnectionState == PlasmaNM.Enums.Activating ? true : false | ||
86 | text: ItemUniqueName | 128 | text: ItemUniqueName | ||
87 | textFormat: Text.PlainText | 129 | textFormat: Text.PlainText | ||
88 | } | 130 | } | ||
89 | 131 | | |||
90 | PlasmaComponents.Label { | 132 | PlasmaComponents.Label { | ||
91 | id: connectionStatusLabel | 133 | id: connectionStatusLabel | ||
92 | Layout.fillWidth: true | 134 | width: parent.width | ||
93 | height: paintedHeight | | |||
94 | elide: Text.ElideRight | 135 | elide: Text.ElideRight | ||
136 | height: undefined | ||||
95 | font.pointSize: theme.smallestFont.pointSize | 137 | font.pointSize: theme.smallestFont.pointSize | ||
96 | opacity: 0.6 | 138 | opacity: 0.6 | ||
97 | text: itemText() | 139 | text: itemText() | ||
140 | visible: !!Uuid | ||||
98 | } | 141 | } | ||
99 | } | 142 | } | ||
100 | 143 | | |||
101 | PlasmaComponents.BusyIndicator { | 144 | PlasmaComponents.BusyIndicator { | ||
102 | id: connectingIndicator | 145 | id: connectingIndicator | ||
103 | Layout.alignment: Qt.AlignVCenter | Qt.AlignRight | | |||
104 | Layout.preferredHeight: units.iconSizes.medium | 146 | Layout.preferredHeight: units.iconSizes.medium | ||
105 | Layout.preferredWidth: units.iconSizes.medium | 147 | Layout.preferredWidth: Layout.preferredHeight | ||
106 | running: plasmoid.expanded && !stateChangeButton.visible && ConnectionState == PlasmaNM.Enums.Activating | 148 | running: plasmoid.expanded && !stateChangeButton.visible && ConnectionState == PlasmaNM.Enums.Activating | ||
107 | visible: running | 149 | visible: running | ||
108 | opacity: visible | 150 | opacity: visible | ||
109 | } | 151 | } | ||
110 | 152 | | |||
111 | PlasmaComponents.Button { | 153 | PlasmaComponents.Button { | ||
112 | id: stateChangeButton | 154 | id: stateChangeButton | ||
113 | Layout.alignment: Qt.AlignVCenter | Qt.AlignRight | | |||
114 | opacity: connectionView.currentVisibleButtonIndex == index ? 1 : 0 | 155 | opacity: connectionView.currentVisibleButtonIndex == index ? 1 : 0 | ||
115 | visible: opacity != 0 | 156 | visible: opacity != 0 | ||
116 | text: (ConnectionState == PlasmaNM.Enums.Deactivated) ? i18n("Connect") : i18n("Disconnect") | 157 | text: (ConnectionState == PlasmaNM.Enums.Deactivated) ? i18n("Connect") : i18n("Disconnect") | ||
117 | 158 | | |||
118 | Behavior on opacity { NumberAnimation { duration: units.shortDuration } } | 159 | Behavior on opacity { NumberAnimation { duration: units.shortDuration } } | ||
119 | 160 | | |||
120 | onClicked: changeState() | 161 | onClicked: changeState() | ||
121 | } | 162 | } | ||
122 | | ||||
123 | MouseArea { | | |||
124 | acceptedButtons: Qt.RightButton | | |||
125 | Layout.alignment: Qt.AlignTop | Qt.AlignLeft | | |||
126 | width: parent.width | | |||
127 | height: parent.height | | |||
128 | onPressed: { | | |||
129 | contextMenu.visualParent = parent | | |||
130 | contextMenu.prepare(); | | |||
131 | contextMenu.open(mouse.x, mouse.y) | | |||
132 | } | | |||
133 | } | | |||
134 | } | 163 | } | ||
135 | | ||||
136 | ColumnLayout { | | |||
137 | Layout.fillHeight: true | | |||
138 | PlasmaCore.SvgItem { | | |||
139 | id: separator | | |||
140 | height: lineSvg.elementSize("horizontal-line").height | | |||
141 | Layout.fillWidth: true | | |||
142 | Layout.maximumHeight: height | | |||
143 | elementId: "horizontal-line" | | |||
144 | svg: PlasmaCore.Svg { id: lineSvg; imagePath: "widgets/line" } | | |||
145 | visible: connectionItem.expanded | | |||
146 | opacity: visible | | |||
147 | } | 164 | } | ||
148 | 165 | | |||
149 | Loader { | 166 | Loader { | ||
150 | id: expandableComponentLoader | 167 | id: expandableComponentLoader | ||
151 | Layout.fillHeight: true | | |||
152 | Layout.fillWidth: true | 168 | Layout.fillWidth: true | ||
153 | height: childrenRect.height | 169 | Layout.alignment: Qt.AlignBottom | ||
170 | Layout.bottomMargin: units.smallSpacing | ||||
154 | } | 171 | } | ||
155 | } | 172 | } | ||
156 | } | | |||
157 | | ||||
158 | 173 | | |||
159 | PlasmaComponents.Menu { | 174 | PlasmaComponents.Menu { | ||
160 | id: contextMenu | 175 | id: contextMenu | ||
161 | 176 | | |||
162 | property Component showQRComponent: null | 177 | property Component showQRComponent: null | ||
163 | 178 | | |||
164 | function prepare() { | 179 | function prepare() { | ||
165 | showQRMenuItem.visible = false; | 180 | showQRMenuItem.visible = false; | ||
Show All 37 Lines | 216 | PlasmaComponents.MenuItem { | |||
203 | icon: "settings-configure" | 218 | icon: "settings-configure" | ||
204 | onClicked: KCMShell.open([mainWindow.kcm, "--args", "Uuid=" + Uuid]) | 219 | onClicked: KCMShell.open([mainWindow.kcm, "--args", "Uuid=" + Uuid]) | ||
205 | } | 220 | } | ||
206 | } | 221 | } | ||
207 | 222 | | |||
208 | Component { | 223 | Component { | ||
209 | id: detailsComponent | 224 | id: detailsComponent | ||
210 | 225 | | |||
211 | Item { | 226 | Column { | ||
212 | height: childrenRect.height | 227 | spacing: units.smallSpacing | ||
213 | 228 | | |||
214 | PlasmaComponents.TabBar { | 229 | PlasmaComponents.TabBar { | ||
215 | id: detailsTabBar | 230 | id: detailsTabBar | ||
216 | 231 | | |||
217 | anchors { | 232 | anchors { | ||
218 | left: parent.left | 233 | left: parent.left | ||
219 | right: parent.right | 234 | right: parent.right | ||
220 | top: parent.top | | |||
221 | } | 235 | } | ||
222 | height: visible ? implicitHeight : 0 | 236 | height: visible ? implicitHeight : 0 | ||
223 | visible: showSpeed | 237 | visible: showSpeed | ||
224 | 238 | | |||
225 | PlasmaComponents.TabButton { | 239 | PlasmaComponents.TabButton { | ||
226 | id: speedTabButton | 240 | id: speedTabButton | ||
227 | text: i18n("Speed") | 241 | text: i18n("Speed") | ||
228 | } | 242 | } | ||
229 | 243 | | |||
230 | PlasmaComponents.TabButton { | 244 | PlasmaComponents.TabButton { | ||
231 | id: detailsTabButton | 245 | id: detailsTabButton | ||
232 | text: i18n("Details") | 246 | text: i18n("Details") | ||
233 | } | 247 | } | ||
234 | 248 | | |||
235 | Component.onCompleted: { | 249 | Component.onCompleted: { | ||
236 | if (!speedTabButton.visible) { | 250 | if (!speedTabButton.visible) { | ||
237 | currentTab = detailsTabButton | 251 | currentTab = detailsTabButton | ||
238 | } | 252 | } | ||
239 | } | 253 | } | ||
240 | } | 254 | } | ||
241 | 255 | | |||
242 | DetailsText { | 256 | DetailsText { | ||
243 | anchors { | 257 | anchors { | ||
244 | left: parent.left | 258 | left: parent.left | ||
245 | leftMargin: units.iconSizes.medium | 259 | leftMargin: units.iconSizes.smallMedium | ||
246 | right: parent.right | 260 | right: parent.right | ||
247 | top: detailsTabBar.visible ? detailsTabBar.bottom : parent.top | | |||
248 | topMargin: Math.round(units.gridUnit / 3) | | |||
249 | } | 261 | } | ||
250 | details: ConnectionDetails | 262 | details: ConnectionDetails | ||
251 | visible: detailsTabBar.currentTab == detailsTabButton | 263 | visible: detailsTabBar.currentTab == detailsTabButton | ||
252 | } | 264 | } | ||
253 | 265 | | |||
254 | TrafficMonitor { | 266 | TrafficMonitor { | ||
255 | anchors { | 267 | anchors { | ||
256 | left: parent.left | 268 | left: parent.left | ||
257 | right: parent.right | 269 | right: parent.right | ||
258 | top: detailsTabBar.visible ? detailsTabBar.bottom : parent.top | | |||
259 | topMargin: Math.round(units.gridUnit / 3) | | |||
260 | } | 270 | } | ||
261 | rxBytes: RxBytes | 271 | rxBytes: RxBytes | ||
262 | txBytes: TxBytes | 272 | txBytes: TxBytes | ||
263 | interval: 2000 | 273 | interval: 2000 | ||
264 | visible: detailsTabBar.currentTab == speedTabButton | 274 | visible: detailsTabBar.currentTab == speedTabButton | ||
265 | } | 275 | } | ||
266 | } | 276 | } | ||
267 | } | 277 | } | ||
268 | 278 | | |||
269 | Component { | 279 | Component { | ||
270 | id: passwordDialogComponent | 280 | id: passwordDialogComponent | ||
271 | 281 | | |||
272 | Item { | 282 | ColumnLayout { | ||
273 | property alias password: passwordField.text | 283 | property alias password: passwordField.text | ||
274 | property alias passwordInput: passwordField | 284 | property alias passwordInput: passwordField | ||
275 | 285 | | |||
276 | height: childrenRect.height | | |||
277 | | ||||
278 | PasswordField { | 286 | PasswordField { | ||
279 | id: passwordField | 287 | id: passwordField | ||
280 | anchors { | 288 | Layout.leftMargin: units.iconSizes.smallMedium + units.smallSpacing * 2 | ||
281 | left: parent.left | 289 | Layout.bottomMargin: units.smallSpacing | ||
282 | right: parent.right | 290 | Layout.preferredWidth: units.gridUnit * 15 | ||
283 | top: parent.top | | |||
284 | } | | |||
285 | securityType: SecurityType | 291 | securityType: SecurityType | ||
286 | 292 | | |||
287 | onAccepted: { | 293 | onAccepted: { | ||
288 | stateChangeButton.clicked() | 294 | stateChangeButton.clicked() | ||
289 | } | 295 | } | ||
290 | 296 | | |||
291 | onAcceptableInputChanged: { | 297 | onAcceptableInputChanged: { | ||
292 | stateChangeButton.enabled = acceptableInput | 298 | stateChangeButton.enabled = acceptableInput | ||
▲ Show 20 Lines • Show All 93 Lines • ▼ Show 20 Line(s) | 391 | if (Type == PlasmaNM.Enums.Vpn) | |||
386 | return VpnState | 392 | return VpnState | ||
387 | else | 393 | else | ||
388 | return DeviceState | 394 | return DeviceState | ||
389 | } else if (ConnectionState == PlasmaNM.Enums.Deactivating) { | 395 | } else if (ConnectionState == PlasmaNM.Enums.Deactivating) { | ||
390 | if (Type == PlasmaNM.Enums.Vpn) | 396 | if (Type == PlasmaNM.Enums.Vpn) | ||
391 | return VpnState | 397 | return VpnState | ||
392 | else | 398 | else | ||
393 | return DeviceState | 399 | return DeviceState | ||
394 | } else if (ConnectionState == PlasmaNM.Enums.Deactivated) { | 400 | } else if (Uuid && ConnectionState == PlasmaNM.Enums.Deactivated) { | ||
395 | var result = LastUsed | 401 | return LastUsed | ||
396 | if (SecurityType > PlasmaNM.Enums.NoneSecurity) | | |||
397 | result += ", " + SecurityTypeString | | |||
398 | return result | | |||
399 | } else if (ConnectionState == PlasmaNM.Enums.Activated) { | 402 | } else if (ConnectionState == PlasmaNM.Enums.Activated) { | ||
400 | if (showSpeed) { | 403 | if (showSpeed) { | ||
401 | var downloadColor = theme.highlightColor | 404 | var downloadColor = theme.highlightColor | ||
402 | // cycle upload color by 180 degrees | 405 | // cycle upload color by 180 degrees | ||
403 | var uploadColor = Qt.hsva((downloadColor.hsvHue + 0.5) % 1, downloadColor.hsvSaturation, downloadColor.hsvValue, downloadColor.a) | 406 | var uploadColor = Qt.hsva((downloadColor.hsvHue + 0.5) % 1, downloadColor.hsvSaturation, downloadColor.hsvValue, downloadColor.a) | ||
404 | 407 | | |||
405 | return i18n("Connected, <font color='%1'>⬇</font> %2/s, <font color='%3'>⬆</font> %4/s", | 408 | return i18n("Connected, <font color='%1'>⬇</font> %2/s, <font color='%3'>⬆</font> %4/s", | ||
406 | downloadColor, | 409 | downloadColor, | ||
407 | KCoreAddons.Format.formatByteSize(rxBytes), | 410 | KCoreAddons.Format.formatByteSize(rxBytes), | ||
408 | uploadColor, | 411 | uploadColor, | ||
409 | KCoreAddons.Format.formatByteSize(txBytes)) | 412 | KCoreAddons.Format.formatByteSize(txBytes)) | ||
410 | } else { | 413 | } else { | ||
411 | return i18n("Connected") | 414 | return i18n("Connected") | ||
412 | } | 415 | } | ||
413 | } | 416 | } | ||
417 | return "" | ||||
414 | } | 418 | } | ||
415 | 419 | | |||
416 | onShowSpeedChanged: { | 420 | function changeExpanded() { | ||
417 | connectionModel.setDeviceStatisticsRefreshRateMs(DevicePath, showSpeed ? 2000 : 0) | | |||
418 | } | | |||
419 | | ||||
420 | onActivatingChanged: { | | |||
421 | if (ConnectionState == PlasmaNM.Enums.Activating) { | | |||
422 | ListView.view.positionViewAtBeginning() | | |||
423 | } | | |||
424 | } | | |||
425 | | ||||
426 | onClicked: { | | |||
427 | if (visiblePasswordDialog) { | 421 | if (visiblePasswordDialog) { | ||
428 | appletProxyModel.dynamicSortFilter = true | 422 | appletProxyModel.dynamicSortFilter = true | ||
429 | visiblePasswordDialog = false | 423 | visiblePasswordDialog = false | ||
430 | } else { | 424 | } else { | ||
431 | visibleDetails = !visibleDetails | 425 | visibleDetails = !visibleDetails | ||
432 | } | 426 | } | ||
433 | 427 | | |||
434 | if (visibleDetails || visiblePasswordDialog) { | 428 | if (visibleDetails || visiblePasswordDialog) { | ||
435 | ListView.view.currentIndex = index | 429 | ListView.view.currentIndex = index | ||
436 | } else { | 430 | } else { | ||
437 | ListView.view.currentIndex = -1 | 431 | ListView.view.currentIndex = -1 | ||
438 | } | 432 | } | ||
439 | } | 433 | } | ||
440 | 434 | | |||
435 | onShowSpeedChanged: { | ||||
436 | connectionModel.setDeviceStatisticsRefreshRateMs(DevicePath, showSpeed ? 2000 : 0) | ||||
437 | } | ||||
438 | | ||||
439 | onActivatingChanged: { | ||||
440 | if (ConnectionState == PlasmaNM.Enums.Activating) { | ||||
441 | ListView.view.positionViewAtBeginning() | ||||
442 | } | ||||
443 | } | ||||
444 | | ||||
441 | onContainsMouseChanged: { | 445 | onContainsMouseChanged: { | ||
442 | if (connectionItem.containsMouse) { | 446 | if (connectionItem.containsMouse) { | ||
443 | connectionView.currentVisibleButtonIndex = index | 447 | connectionView.currentVisibleButtonIndex = index | ||
444 | } | 448 | } | ||
445 | } | 449 | } | ||
450 | | ||||
451 | onDeactivatedChanged: { | ||||
452 | // Separator is part of section. Which only shows when available connections exist. | ||||
453 | // Only need to determine if there is a connection in use, there are always on top, checking first one is enough. | ||||
454 | if (appletProxyModel.data(appletProxyModel.index(0, 0), PlasmaNM.NetworkModel.SectionRole) !== "Available connections") { | ||||
455 | if (connectionView.showSeparator != true) { | ||||
456 | connectionView.showSeparator = true | ||||
457 | } | ||||
458 | return | ||||
459 | } | ||||
460 | connectionView.showSeparator = false | ||||
461 | return | ||||
462 | } | ||||
446 | } | 463 | } |