diff --git a/applet/contents/ui/ConnectionItem.qml b/applet/contents/ui/ConnectionItem.qml --- a/applet/contents/ui/ConnectionItem.qml +++ b/applet/contents/ui/ConnectionItem.qml @@ -31,7 +31,8 @@ id: connectionItem property bool activating: ConnectionState == PlasmaNM.Enums.Activating - property int baseHeight: Math.max(units.iconSizes.medium, connectionNameLabel.height + connectionStatusLabel.height) + Math.round(units.gridUnit / 2) + property int baseHeight: Uuid ? connectionNameLabel.implicitHeight + connectionStatusLabel.implicitHeight + background.margins.top + + background.margins.bottom : stateChangeButton.implicitHeight property bool expanded: visibleDetails || visiblePasswordDialog property bool predictableWirelessPassword: !Uuid && Type == PlasmaNM.Enums.Wireless && (SecurityType == PlasmaNM.Enums.StaticWep || SecurityType == PlasmaNM.Enums.WpaPsk || @@ -48,22 +49,35 @@ property real rxBytes: 0 property real txBytes: 0 - checked: connectionItem.containsMouse + property bool capturePublicScreenshot: false // RESTORE before commit for final review + enabled: true - height: expanded ? baseHeight + separator.height + expandableComponentLoader.height + (2 * Math.round(units.gridUnit / 3)) : baseHeight + height: expanded ? baseHeight + units.smallSpacing + expandableComponentLoader.height + (Uuid ? 0 : background.margins.bottom) : baseHeight + separatorVisible: false + + // Background margins metrics + PlasmaCore.FrameSvgItem { + id : background + imagePath: "widgets/listitem" + prefix: "normal" + visible: false + } ColumnLayout { anchors.fill: parent + spacing: units.smallSpacing RowLayout { - Layout.fillWidth: true - spacing: Math.round(units.gridUnit / 2) + spacing: units.smallSpacing * 2 + Layout.alignment: Uuid ? Qt.AlignCenter : Qt.AlignTop + Layout.minimumHeight: stateChangeButton.implicitHeight + Layout.topMargin: Uuid ? 0 : - background.margins.top PlasmaCore.SvgItem { id: connectionSvgIcon - Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft - Layout.preferredHeight: units.iconSizes.medium - Layout.preferredWidth: units.iconSizes.medium + Layout.alignment: Qt.AlignLeft + Layout.preferredHeight: Uuid ? units.iconSizes.medium : units.iconSizes.smallMedium + Layout.preferredWidth: Layout.preferredHeight elementId: ConnectionIcon svg: PlasmaCore.Svg { multipleImages: true @@ -73,44 +87,43 @@ } ColumnLayout { - Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft + Layout.alignment: Qt.AlignLeft spacing: 0 PlasmaComponents.Label { + // TODO Fix bind loop messages for width. id: connectionNameLabel Layout.fillWidth: true - height: paintedHeight elide: Text.ElideRight font.weight: ConnectionState == PlasmaNM.Enums.Activated ? Font.DemiBold : Font.Normal font.italic: ConnectionState == PlasmaNM.Enums.Activating ? true : false - text: ItemUniqueName + text: capturePublicScreenshot ? "WIRELESS-12345" + index : ItemUniqueName // RESTORE before commit for final review textFormat: Text.PlainText } PlasmaComponents.Label { + // TODO Fix bind loop messages for width. id: connectionStatusLabel Layout.fillWidth: true - height: paintedHeight elide: Text.ElideRight font.pointSize: theme.smallestFont.pointSize opacity: 0.6 text: itemText() + visible: !!Uuid } } PlasmaComponents.BusyIndicator { id: connectingIndicator - Layout.alignment: Qt.AlignVCenter | Qt.AlignRight Layout.preferredHeight: units.iconSizes.medium - Layout.preferredWidth: units.iconSizes.medium + Layout.preferredWidth: Layout.preferredHeight running: plasmoid.expanded && !stateChangeButton.visible && ConnectionState == PlasmaNM.Enums.Activating visible: running opacity: visible } PlasmaComponents.Button { id: stateChangeButton - Layout.alignment: Qt.AlignVCenter | Qt.AlignRight opacity: connectionView.currentVisibleButtonIndex == index ? 1 : 0 visible: opacity != 0 text: (ConnectionState == PlasmaNM.Enums.Deactivated) ? i18n("Connect") : i18n("Disconnect") @@ -122,7 +135,6 @@ MouseArea { acceptedButtons: Qt.RightButton - Layout.alignment: Qt.AlignTop | Qt.AlignLeft width: parent.width height: parent.height onPressed: { @@ -133,25 +145,9 @@ } } - ColumnLayout { - Layout.fillHeight: true - PlasmaCore.SvgItem { - id: separator - height: lineSvg.elementSize("horizontal-line").height - Layout.fillWidth: true - Layout.maximumHeight: height - elementId: "horizontal-line" - svg: PlasmaCore.Svg { id: lineSvg; imagePath: "widgets/line" } - visible: connectionItem.expanded - opacity: visible - } - - Loader { - id: expandableComponentLoader - Layout.fillHeight: true - Layout.fillWidth: true - height: childrenRect.height - } + Loader { + id: expandableComponentLoader + Layout.fillWidth: true } } @@ -208,16 +204,15 @@ Component { id: detailsComponent - Item { - height: childrenRect.height + Column { + spacing: units.smallSpacing PlasmaComponents.TabBar { id: detailsTabBar anchors { left: parent.left right: parent.right - top: parent.top } height: visible ? implicitHeight : 0 visible: showSpeed @@ -242,10 +237,8 @@ DetailsText { anchors { left: parent.left - leftMargin: units.iconSizes.medium + leftMargin: units.iconSizes.smallMedium right: parent.right - top: detailsTabBar.visible ? detailsTabBar.bottom : parent.top - topMargin: Math.round(units.gridUnit / 3) } details: ConnectionDetails visible: detailsTabBar.currentTab == detailsTabButton @@ -255,8 +248,6 @@ anchors { left: parent.left right: parent.right - top: detailsTabBar.visible ? detailsTabBar.bottom : parent.top - topMargin: Math.round(units.gridUnit / 3) } rxBytes: RxBytes txBytes: TxBytes @@ -269,19 +260,14 @@ Component { id: passwordDialogComponent - Item { + Column { property alias password: passwordField.text property alias passwordInput: passwordField - height: childrenRect.height - PasswordField { id: passwordField - anchors { - left: parent.left - right: parent.right - top: parent.top - } + + height: implicitHeight - units.smallSpacing securityType: SecurityType onAccepted: { @@ -391,11 +377,8 @@ return VpnState else return DeviceState - } else if (ConnectionState == PlasmaNM.Enums.Deactivated) { - var result = LastUsed - if (SecurityType > PlasmaNM.Enums.NoneSecurity) - result += ", " + SecurityTypeString - return result + } else if (Uuid && ConnectionState == PlasmaNM.Enums.Deactivated) { + return LastUsed } else if (ConnectionState == PlasmaNM.Enums.Activated) { if (showSpeed) { var downloadColor = theme.highlightColor @@ -411,6 +394,7 @@ return i18n("Connected") } } + return "" } onShowSpeedChanged: { diff --git a/applet/contents/ui/DetailsText.qml b/applet/contents/ui/DetailsText.qml --- a/applet/contents/ui/DetailsText.qml +++ b/applet/contents/ui/DetailsText.qml @@ -25,7 +25,7 @@ Item { property var details: [] - height: repeater.contentHeight + height: childrenRect.height KQuickControlsAddons.Clipboard { id: clipboard @@ -50,7 +50,11 @@ } Column { - anchors.fill: parent + anchors { + left: parent.left + right: parent.right + } + height: childrenRect.height Repeater { id: repeater @@ -64,22 +68,21 @@ anchors { left: parent.left right: parent.right - topMargin: Math.round(units.gridUnit / 3) } height: Math.max(detailNameLabel.height, detailValueLabel.height) PlasmaComponents.Label { id: detailNameLabel anchors { left: parent.left - leftMargin: repeater.longestString - paintedWidth + Math.round(units.gridUnit / 2) - verticalCenter: parent.verticalCenter + leftMargin: repeater.longestString - paintedWidth + units.smallSpacing * 2 } height: paintedHeight font.pointSize: theme.smallestFont.pointSize horizontalAlignment: Text.AlignRight text: details[index*2] + ": " + opacity: 0.6 Component.onCompleted: { if (paintedWidth > repeater.longestString) { @@ -92,14 +95,23 @@ id: detailValueLabel anchors { + // TODO Fix bind loop messages for width. left: detailNameLabel.right right: parent.right - verticalCenter: parent.verticalCenter } height: paintedHeight elide: Text.ElideRight font.pointSize: theme.smallestFont.pointSize - text: details[(index*2)+1] + text: { // RESTORE before commit for final review + if (capturePublicScreenshot) { + if (index === 0) { + return "WIRELESS-123456" + } else if (index === 2 || index === 6) { + return "01:23:45:67:89:01" + } + } + return details[(index*2)+1] + } textFormat: Text.PlainText MouseArea { @@ -109,11 +121,6 @@ } } } - - // Count total height from added items, somehow contentRect.height doesn't work - onItemAdded: { - contentHeight = contentHeight + item.height - } } } } diff --git a/applet/contents/ui/Header.qml b/applet/contents/ui/Header.qml --- a/applet/contents/ui/Header.qml +++ b/applet/contents/ui/Header.qml @@ -26,34 +26,32 @@ PlasmaComponents.ListItem { id: header - property alias text: headerLabel.text + height: section === "Available connections" ? devicesLine.height + units.smallSpacing : 0 + separatorVisible: false - height: headerLabel.height + units.gridUnit; width: parent.width - sectionDelegate: true - - PlasmaNM.EnabledConnections { - id: enabledConnections - } - - PlasmaComponents.Label { - id: headerLabel - - anchors.centerIn: parent - height: paintedHeight - font.weight: Font.DemiBold + PlasmaCore.Svg { + id: lineSvg + imagePath: "widgets/line" } - Component.onCompleted: { - if (header.text === i18n("Available connections")) { - connectionView.availableConnectionsVisible = true + PlasmaCore.SvgItem { + id: devicesLine + anchors { + horizontalCenter: parent.horizontalCenter + top: parent.top + topMargin: Math.round(units.smallSpacing / 2) - background.margins.top } + elementId: "horizontal-line" + width: parent.width - units.gridUnit + svg: lineSvg + visible: section === "Available connections" } - Component.onDestruction: { - connectionView.availableConnectionsVisible = false - } - - onVisibleChanged: { - connectionView.availableConnectionsVisible = visible + // Background margins metrics + PlasmaCore.FrameSvgItem { + id : background + imagePath: "widgets/listitem" + prefix: "normal" + visible: false } } diff --git a/applet/contents/ui/PopupDialog.qml b/applet/contents/ui/PopupDialog.qml --- a/applet/contents/ui/PopupDialog.qml +++ b/applet/contents/ui/PopupDialog.qml @@ -57,20 +57,21 @@ id: scrollView Layout.fillWidth: true Layout.fillHeight: true + frameVisible: false ListView { id: connectionView - property bool availableConnectionsVisible: false property int currentVisibleButtonIndex: -1 + spacing: 0 anchors.fill: parent clip: true model: appletProxyModel currentIndex: -1 boundsBehavior: Flickable.StopAtBounds - section.property: showSections ? "Section" : "" - section.delegate: Header { text: section } + section.property: "Section" + section.delegate: Header { } delegate: ConnectionItem { } } } diff --git a/applet/contents/ui/Toolbar.qml b/applet/contents/ui/Toolbar.qml --- a/applet/contents/ui/Toolbar.qml +++ b/applet/contents/ui/Toolbar.qml @@ -36,11 +36,6 @@ rows: 2 columns: 2 - PlasmaCore.Svg { - id: lineSvg - imagePath: "widgets/line" - } - PlasmaNM.EnabledConnections { id: enabledConnections diff --git a/applet/contents/ui/TrafficMonitor.qml b/applet/contents/ui/TrafficMonitor.qml --- a/applet/contents/ui/TrafficMonitor.qml +++ b/applet/contents/ui/TrafficMonitor.qml @@ -28,18 +28,19 @@ property real txBytes: 0 property alias interval: timer.interval - height: visible ? plotter.height + units.gridUnit : 0 + height: visible ? plotter.height + plotter.anchors.topMargin + units.smallSpacing : 0 Repeater { model: 5 PlasmaComponents.Label { anchors { left: parent.left top: parent.top - topMargin: Math.round(units.gridUnit / 3) + (index * plotter.height / 5) + topMargin: index * plotter.height / 5 } - height: paintedHeight + // Workaround to get paintedHeight. + height: theme.mSize(theme.smallestFont).height font.pointSize: theme.smallestFont.pointSize lineHeight: 1.75 text: KCoreAddons.Format.formatByteSize(plotter.maxValue * (1 - index / 5)) + i18n("/s") @@ -57,7 +58,7 @@ leftMargin: units.gridUnit * 3 right: parent.right top: parent.top - topMargin: units.gridUnit + topMargin: theme.mSize(theme.smallestFont).height / 2 } width: units.gridUnit * 20 height: units.gridUnit * 8 diff --git a/applet/contents/ui/main.qml b/applet/contents/ui/main.qml --- a/applet/contents/ui/main.qml +++ b/applet/contents/ui/main.qml @@ -27,7 +27,6 @@ Item { id: mainWindow - property bool showSections: true readonly property string kcm: "kcm_networkmanagement.desktop" readonly property bool kcmAuthorized: KCMShell.authorize(kcm).length == 1 diff --git a/libs/models/networkmodelitem.cpp b/libs/models/networkmodelitem.cpp --- a/libs/models/networkmodelitem.cpp +++ b/libs/models/networkmodelitem.cpp @@ -585,9 +585,7 @@ if (m_mode == NetworkManager::WirelessSetting::Infrastructure) { m_details << i18n("Signal strength") << QStringLiteral("%1%").arg(m_signal); } - if (m_connectionState == NetworkManager::ActiveConnection::Activated) { - m_details << i18n("Security type") << UiUtils::labelFromWirelessSecurity(m_securityType); - } + m_details << i18n("Security type") << UiUtils::labelFromWirelessSecurity(m_securityType); if (wirelessDevice) { if (m_connectionState == NetworkManager::ActiveConnection::Activated) { m_details << i18n("Connection speed") << UiUtils::connectionSpeed(wirelessDevice->bitRate());