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 passwordIsStatic: (SecurityType == PlasmaNM.Enums.StaticWep || SecurityType == PlasmaNM.Enums.WpaPsk || | 38 | property bool passwordIsStatic: (SecurityType == PlasmaNM.Enums.StaticWep || SecurityType == PlasmaNM.Enums.WpaPsk || | ||
37 | SecurityType == PlasmaNM.Enums.Wpa2Psk || SecurityType == PlasmaNM.Enums.SAE) | 39 | SecurityType == PlasmaNM.Enums.Wpa2Psk || SecurityType == PlasmaNM.Enums.SAE) | ||
38 | property bool predictableWirelessPassword: !Uuid && Type == PlasmaNM.Enums.Wireless && passwordIsStatic | 40 | property bool predictableWirelessPassword: !Uuid && Type == PlasmaNM.Enums.Wireless && passwordIsStatic | ||
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 36 Lines | 215 | PlasmaComponents.MenuItem { | |||
202 | icon: "settings-configure" | 217 | icon: "settings-configure" | ||
203 | onClicked: KCMShell.open([mainWindow.kcm, "--args", "Uuid=" + Uuid]) | 218 | onClicked: KCMShell.open([mainWindow.kcm, "--args", "Uuid=" + Uuid]) | ||
204 | } | 219 | } | ||
205 | } | 220 | } | ||
206 | 221 | | |||
207 | Component { | 222 | Component { | ||
208 | id: detailsComponent | 223 | id: detailsComponent | ||
209 | 224 | | |||
210 | Item { | 225 | Column { | ||
211 | height: childrenRect.height | 226 | spacing: units.smallSpacing | ||
212 | 227 | | |||
213 | PlasmaComponents.TabBar { | 228 | PlasmaComponents.TabBar { | ||
214 | id: detailsTabBar | 229 | id: detailsTabBar | ||
215 | 230 | | |||
216 | anchors { | 231 | anchors { | ||
217 | left: parent.left | 232 | left: parent.left | ||
218 | right: parent.right | 233 | right: parent.right | ||
219 | top: parent.top | | |||
220 | } | 234 | } | ||
221 | height: visible ? implicitHeight : 0 | 235 | height: visible ? implicitHeight : 0 | ||
222 | visible: showSpeed | 236 | visible: showSpeed | ||
223 | 237 | | |||
224 | PlasmaComponents.TabButton { | 238 | PlasmaComponents.TabButton { | ||
225 | id: speedTabButton | 239 | id: speedTabButton | ||
226 | text: i18n("Speed") | 240 | text: i18n("Speed") | ||
227 | } | 241 | } | ||
228 | 242 | | |||
229 | PlasmaComponents.TabButton { | 243 | PlasmaComponents.TabButton { | ||
230 | id: detailsTabButton | 244 | id: detailsTabButton | ||
231 | text: i18n("Details") | 245 | text: i18n("Details") | ||
232 | } | 246 | } | ||
233 | 247 | | |||
234 | Component.onCompleted: { | 248 | Component.onCompleted: { | ||
235 | if (!speedTabButton.visible) { | 249 | if (!speedTabButton.visible) { | ||
236 | currentTab = detailsTabButton | 250 | currentTab = detailsTabButton | ||
237 | } | 251 | } | ||
238 | } | 252 | } | ||
239 | } | 253 | } | ||
240 | 254 | | |||
241 | DetailsText { | 255 | DetailsText { | ||
242 | anchors { | 256 | anchors { | ||
243 | left: parent.left | 257 | left: parent.left | ||
244 | leftMargin: units.iconSizes.medium | 258 | leftMargin: units.iconSizes.smallMedium | ||
245 | right: parent.right | 259 | right: parent.right | ||
246 | top: detailsTabBar.visible ? detailsTabBar.bottom : parent.top | | |||
247 | topMargin: Math.round(units.gridUnit / 3) | | |||
248 | } | 260 | } | ||
249 | details: ConnectionDetails | 261 | details: ConnectionDetails | ||
250 | visible: detailsTabBar.currentTab == detailsTabButton | 262 | visible: detailsTabBar.currentTab == detailsTabButton | ||
251 | } | 263 | } | ||
252 | 264 | | |||
253 | TrafficMonitor { | 265 | TrafficMonitor { | ||
254 | anchors { | 266 | anchors { | ||
255 | left: parent.left | 267 | left: parent.left | ||
256 | right: parent.right | 268 | right: parent.right | ||
257 | top: detailsTabBar.visible ? detailsTabBar.bottom : parent.top | | |||
258 | topMargin: Math.round(units.gridUnit / 3) | | |||
259 | } | 269 | } | ||
260 | rxBytes: RxBytes | 270 | rxBytes: RxBytes | ||
261 | txBytes: TxBytes | 271 | txBytes: TxBytes | ||
262 | interval: 2000 | 272 | interval: 2000 | ||
263 | visible: detailsTabBar.currentTab == speedTabButton | 273 | visible: detailsTabBar.currentTab == speedTabButton | ||
264 | } | 274 | } | ||
265 | } | 275 | } | ||
266 | } | 276 | } | ||
267 | 277 | | |||
268 | Component { | 278 | Component { | ||
269 | id: passwordDialogComponent | 279 | id: passwordDialogComponent | ||
270 | 280 | | |||
271 | Item { | 281 | ColumnLayout { | ||
272 | property alias password: passwordField.text | 282 | property alias password: passwordField.text | ||
273 | property alias passwordInput: passwordField | 283 | property alias passwordInput: passwordField | ||
274 | 284 | | |||
275 | height: childrenRect.height | | |||
276 | | ||||
277 | PasswordField { | 285 | PasswordField { | ||
278 | id: passwordField | 286 | id: passwordField | ||
279 | anchors { | 287 | Layout.leftMargin: units.iconSizes.smallMedium + units.smallSpacing * 2 | ||
280 | left: parent.left | 288 | Layout.bottomMargin: units.smallSpacing | ||
281 | right: parent.right | 289 | Layout.preferredWidth: units.gridUnit * 15 | ||
282 | top: parent.top | | |||
283 | } | | |||
284 | securityType: SecurityType | 290 | securityType: SecurityType | ||
285 | 291 | | |||
286 | onAccepted: { | 292 | onAccepted: { | ||
287 | stateChangeButton.clicked() | 293 | stateChangeButton.clicked() | ||
288 | } | 294 | } | ||
289 | 295 | | |||
290 | onAcceptableInputChanged: { | 296 | onAcceptableInputChanged: { | ||
291 | stateChangeButton.enabled = acceptableInput | 297 | stateChangeButton.enabled = acceptableInput | ||
▲ Show 20 Lines • Show All 93 Lines • ▼ Show 20 Line(s) | 390 | if (Type == PlasmaNM.Enums.Vpn) | |||
385 | return VpnState | 391 | return VpnState | ||
386 | else | 392 | else | ||
387 | return DeviceState | 393 | return DeviceState | ||
388 | } else if (ConnectionState == PlasmaNM.Enums.Deactivating) { | 394 | } else if (ConnectionState == PlasmaNM.Enums.Deactivating) { | ||
389 | if (Type == PlasmaNM.Enums.Vpn) | 395 | if (Type == PlasmaNM.Enums.Vpn) | ||
390 | return VpnState | 396 | return VpnState | ||
391 | else | 397 | else | ||
392 | return DeviceState | 398 | return DeviceState | ||
393 | } else if (ConnectionState == PlasmaNM.Enums.Deactivated) { | 399 | } else if (Uuid && ConnectionState == PlasmaNM.Enums.Deactivated) { | ||
394 | var result = LastUsed | 400 | return LastUsed | ||
395 | if (SecurityType > PlasmaNM.Enums.NoneSecurity) | | |||
396 | result += ", " + SecurityTypeString | | |||
397 | return result | | |||
398 | } else if (ConnectionState == PlasmaNM.Enums.Activated) { | 401 | } else if (ConnectionState == PlasmaNM.Enums.Activated) { | ||
399 | if (showSpeed) { | 402 | if (showSpeed) { | ||
400 | var downloadColor = theme.highlightColor | 403 | var downloadColor = theme.highlightColor | ||
401 | // cycle upload color by 180 degrees | 404 | // cycle upload color by 180 degrees | ||
402 | var uploadColor = Qt.hsva((downloadColor.hsvHue + 0.5) % 1, downloadColor.hsvSaturation, downloadColor.hsvValue, downloadColor.a) | 405 | var uploadColor = Qt.hsva((downloadColor.hsvHue + 0.5) % 1, downloadColor.hsvSaturation, downloadColor.hsvValue, downloadColor.a) | ||
403 | 406 | | |||
404 | return i18n("Connected, <font color='%1'>⬇</font> %2/s, <font color='%3'>⬆</font> %4/s", | 407 | return i18n("Connected, <font color='%1'>⬇</font> %2/s, <font color='%3'>⬆</font> %4/s", | ||
405 | downloadColor, | 408 | downloadColor, | ||
406 | KCoreAddons.Format.formatByteSize(rxBytes), | 409 | KCoreAddons.Format.formatByteSize(rxBytes), | ||
407 | uploadColor, | 410 | uploadColor, | ||
408 | KCoreAddons.Format.formatByteSize(txBytes)) | 411 | KCoreAddons.Format.formatByteSize(txBytes)) | ||
409 | } else { | 412 | } else { | ||
410 | return i18n("Connected") | 413 | return i18n("Connected") | ||
411 | } | 414 | } | ||
412 | } | 415 | } | ||
416 | return "" | ||||
413 | } | 417 | } | ||
414 | 418 | | |||
415 | onShowSpeedChanged: { | 419 | function changeExpanded() { | ||
416 | connectionModel.setDeviceStatisticsRefreshRateMs(DevicePath, showSpeed ? 2000 : 0) | | |||
417 | } | | |||
418 | | ||||
419 | onActivatingChanged: { | | |||
420 | if (ConnectionState == PlasmaNM.Enums.Activating) { | | |||
421 | ListView.view.positionViewAtBeginning() | | |||
422 | } | | |||
423 | } | | |||
424 | | ||||
425 | onClicked: { | | |||
426 | if (visiblePasswordDialog) { | 420 | if (visiblePasswordDialog) { | ||
427 | appletProxyModel.dynamicSortFilter = true | 421 | appletProxyModel.dynamicSortFilter = true | ||
428 | visiblePasswordDialog = false | 422 | visiblePasswordDialog = false | ||
429 | } else { | 423 | } else { | ||
430 | visibleDetails = !visibleDetails | 424 | visibleDetails = !visibleDetails | ||
431 | } | 425 | } | ||
432 | 426 | | |||
433 | if (visibleDetails || visiblePasswordDialog) { | 427 | if (visibleDetails || visiblePasswordDialog) { | ||
434 | ListView.view.currentIndex = index | 428 | ListView.view.currentIndex = index | ||
435 | } else { | 429 | } else { | ||
436 | ListView.view.currentIndex = -1 | 430 | ListView.view.currentIndex = -1 | ||
437 | } | 431 | } | ||
438 | } | 432 | } | ||
439 | 433 | | |||
434 | onShowSpeedChanged: { | ||||
435 | connectionModel.setDeviceStatisticsRefreshRateMs(DevicePath, showSpeed ? 2000 : 0) | ||||
436 | } | ||||
437 | | ||||
438 | onActivatingChanged: { | ||||
439 | if (ConnectionState == PlasmaNM.Enums.Activating) { | ||||
440 | ListView.view.positionViewAtBeginning() | ||||
441 | } | ||||
442 | } | ||||
443 | | ||||
440 | onContainsMouseChanged: { | 444 | onContainsMouseChanged: { | ||
441 | if (connectionItem.containsMouse) { | 445 | if (connectionItem.containsMouse) { | ||
442 | connectionView.currentVisibleButtonIndex = index | 446 | connectionView.currentVisibleButtonIndex = index | ||
443 | } | 447 | } | ||
444 | } | 448 | } | ||
449 | | ||||
450 | onDeactivatedChanged: { | ||||
451 | /* Separator is part of section, which is visible only when available connections exist. Need to determine | ||||
452 | if there is a connection in use, to show Separator. Otherwise need to hide it from the top of the list. | ||||
453 | Connections in use are always on top, only need to check the first one. */ | ||||
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 | } | ||||
445 | } | 463 | } |