Changeset View
Changeset View
Standalone View
Standalone View
applet/contents/ui/ConnectionItem.qml
| Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Line(s) | 30 | ListItem { | |||
|---|---|---|---|---|---|
| 47 | property bool visibleDetails: false | 47 | property bool visibleDetails: false | ||
| 48 | property bool visiblePasswordDialog: false | 48 | property bool visiblePasswordDialog: false | ||
| 49 | 49 | | |||
| 50 | property real rxBytes: 0 | 50 | property real rxBytes: 0 | ||
| 51 | property real txBytes: 0 | 51 | property real txBytes: 0 | ||
| 52 | 52 | | |||
| 53 | height: expanded ? baseHeight + expandableComponentLoader.height + units.smallSpacing * (ConnectionState == PlasmaNM.Enums.Active ? 1 : Uuid ? 2 : 1) | 53 | height: expanded ? baseHeight + expandableComponentLoader.height + units.smallSpacing * (ConnectionState == PlasmaNM.Enums.Active ? 1 : Uuid ? 2 : 1) | ||
| 54 | : baseHeight | 54 | : baseHeight | ||
| 55 | highlightRect: Qt.rect(mainColumn.x, mainColumn.y, mainColumn.width, baseHeight) | | |||
| 56 | 55 | | |||
| 57 | ColumnLayout { | 56 | ColumnLayout { | ||
ngraham: `ConnectionItem.qml` already has `onContainsMouseChanged` (at the bottom of the file); add the… | |||||
| 58 | id: mainColumn | 57 | id: mainColumn | ||
| 59 | anchors.fill: parent | 58 | anchors.fill: parent | ||
| 60 | 59 | | |||
| 61 | MouseArea { | 60 | MouseArea { | ||
| 62 | Layout.fillWidth: true | 61 | Layout.fillWidth: true | ||
| 63 | Layout.preferredHeight: mainRow.height | 62 | Layout.preferredHeight: mainRow.height | ||
| 64 | Layout.alignment: Qt.AlignTop | 63 | Layout.alignment: Qt.AlignTop | ||
| 65 | acceptedButtons: Qt.LeftButton | Qt.RightButton | 64 | acceptedButtons: Qt.LeftButton | Qt.RightButton | ||
| 66 | hoverEnabled: true | 65 | hoverEnabled: true | ||
| 67 | 66 | | |||
| 68 | onEntered: { | 67 | onEntered: { | ||
| 69 | connectionView.currentVisibleButtonIndex = index | 68 | connectionView.currentVisibleButtonIndex = index | ||
| 70 | connectionItem.checked = true | 69 | connectionView.currentIndex = index | ||
| 71 | } | 70 | } | ||
| 72 | 71 | | |||
| 73 | onExited: { | 72 | onExited: { | ||
| 74 | connectionItem.checked = false | 73 | connectionView.currentIndex = -1 | ||
| 75 | } | 74 | } | ||
| 76 | 75 | | |||
| 77 | onPressed: { | 76 | onPressed: { | ||
| 78 | if (mouse.button & Qt.LeftButton) { | 77 | if (mouse.button & Qt.LeftButton) { | ||
| 79 | changeExpanded() | 78 | changeExpanded() | ||
| 80 | } | 79 | } | ||
| 81 | 80 | | |||
| 82 | if (mouse.button & Qt.RightButton) { | 81 | if (mouse.button & Qt.RightButton) { | ||
| ▲ Show 20 Lines • Show All 353 Lines • ▼ Show 20 Line(s) | |||||
| 436 | } | 435 | } | ||
| 437 | 436 | | |||
| 438 | onActivatingChanged: { | 437 | onActivatingChanged: { | ||
| 439 | if (ConnectionState == PlasmaNM.Enums.Activating) { | 438 | if (ConnectionState == PlasmaNM.Enums.Activating) { | ||
| 440 | ListView.view.positionViewAtBeginning() | 439 | ListView.view.positionViewAtBeginning() | ||
| 441 | } | 440 | } | ||
| 442 | } | 441 | } | ||
| 443 | 442 | | |||
| 444 | onContainsMouseChanged: { | | |||
| 445 | if (connectionItem.containsMouse) { | | |||
| 446 | connectionView.currentVisibleButtonIndex = index | | |||
| 447 | } | | |||
| 448 | } | | |||
| 449 | | ||||
| 450 | onDeactivatedChanged: { | 443 | onDeactivatedChanged: { | ||
| 451 | /* Separator is part of section, which is visible only when available connections exist. Need to determine | 444 | /* 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. | 445 | 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. */ | 446 | 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") { | 447 | if (appletProxyModel.data(appletProxyModel.index(0, 0), PlasmaNM.NetworkModel.SectionRole) !== "Available connections") { | ||
| 455 | if (connectionView.showSeparator != true) { | 448 | if (connectionView.showSeparator != true) { | ||
| 456 | connectionView.showSeparator = true | 449 | connectionView.showSeparator = true | ||
| 457 | } | 450 | } | ||
| 458 | return | 451 | return | ||
| 459 | } | 452 | } | ||
| 460 | connectionView.showSeparator = false | 453 | connectionView.showSeparator = false | ||
| 461 | return | 454 | return | ||
| 462 | } | 455 | } | ||
| 463 | } | 456 | } | ||
ConnectionItem.qml already has onContainsMouseChanged (at the bottom of the file); add the new stuff there.