Index: applet/contents/ui/PopupDialog.qml =================================================================== --- applet/contents/ui/PopupDialog.qml +++ applet/contents/ui/PopupDialog.qml @@ -28,6 +28,8 @@ FocusScope { id: full + property alias toolbarValues: toolbar + PlasmaNM.AvailableDevices { id: availableDevices } @@ -48,17 +50,49 @@ ColumnLayout { anchors.fill: parent - Toolbar { - id: toolbar - Layout.fillWidth: true - } - PlasmaExtras.ScrollArea { id: scrollView Layout.fillWidth: true Layout.fillHeight: true frameVisible: false + PlasmaExtras.Heading { + id: disabledMessage + anchors.fill: parent + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + level: 3 + visible: connectionView.count === 0 && text != "" + text: { + if (toolbarValues.displayplaneModeMessage) { + return i18n("Airplane mode is enabled") + } + if (toolbarValues.displayWifiMessage) { + if (toolbarValues.displayWwanMessage) { + return i18n("Wireless and mobile networks are deactivated") + } + return i18n("Wireless is deactivated") + } + if (toolbarValues.displayWwanMessage) { + return i18n("Mobile network is deactivated") + } + return "" + } + } + + PlasmaExtras.Heading { + id: message + anchors.fill: parent + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + level: 3 + opacity: connectionView.count === 0 && !disabledMessage.visible + // Check connectionView.count again, to avoid a small delay. + visible: opacity === 1 && connectionView.count === 0 + Behavior on opacity { NumberAnimation { duration: 5000 } } + text: i18n("No available connections") + } + ListView { id: connectionView @@ -76,6 +110,11 @@ delegate: ConnectionItem { } } } + + Toolbar { + id: toolbar + Layout.fillWidth: true + } } Connections { Index: applet/contents/ui/Toolbar.qml =================================================================== --- applet/contents/ui/Toolbar.qml +++ applet/contents/ui/Toolbar.qml @@ -26,15 +26,22 @@ import org.kde.plasma.networkmanagement 0.2 as PlasmaNM import org.kde.kquickcontrolsaddons 2.0 -GridLayout { - id: toolbar +ColumnLayout { + + property var displayWifiMessage: !wifiSwitchButton.checked && wifiSwitchButton.visible + property var displayWwanMessage: !wwanSwitchButton.checked && wwanSwitchButton.visible + property var displayplaneModeMessage: planeModeSwitchButton.checked && planeModeSwitchButton.visible + + spacing: units.smallSpacing function closeSearch() { searchToggleButton.checked = false } - rows: 2 - columns: 2 + PlasmaCore.Svg { + id: lineSvg + imagePath: "widgets/line" + } PlasmaNM.EnabledConnections { id: enabledConnections @@ -60,8 +67,56 @@ id: configuration } - Row { + PlasmaComponents.TextField { + id: searchTextField + Layout.fillWidth: true + Layout.leftMargin: units.smallSpacing + Layout.rightMargin: units.smallSpacing + Layout.bottomMargin: units.smallSpacing + Layout.topMargin: units.smallSpacing + + focus: true + clearButtonShown: true + placeholderText: i18ndc("plasma-nm", "text field placeholder text", "Search...") + + visible: searchToggleButton.checked + onVisibleChanged: { + if (visible) { + searchTextField.forceActiveFocus() + } else { + text = "" + } + } + Keys.onEscapePressed: { + //Check if the searchbar is actually visible before accepting the escape key. Otherwise, the escape key cannot dismiss the applet until one interacts with some other element. + if (searchToggleButton.checked) { + searchToggleButton.checked = false; + } else { + event.accepted = false; + } + } + + onTextChanged: { + // Show search field when starting to type directly + if (text.length && !searchToggleButton.checked) { + searchToggleButton.checked = true + } + appletProxyModel.setFilterRegExp(text) + } + } + + PlasmaCore.SvgItem { + id: devicesLine + + Layout.fillWidth: true + elementId: "horizontal-line" + Layout.leftMargin: - units.smallSpacing * 1.5 + Layout.rightMargin: - units.smallSpacing * 1.5 + svg: lineSvg + } + + RowLayout { SwitchButton { id: wifiSwitchButton @@ -119,11 +174,10 @@ initialized = true } } - } - - Row { - Layout.column: 1 + Item { + Layout.fillWidth: true + } PlasmaComponents3.ToolButton { id: hotspotButton @@ -203,43 +257,5 @@ } } - PlasmaComponents.TextField { - id: searchTextField - Layout.row: 1 - Layout.columnSpan: 2 - Layout.fillWidth: true - Layout.leftMargin: units.smallSpacing - Layout.rightMargin: units.smallSpacing - Layout.bottomMargin: units.smallSpacing - - focus: true - clearButtonShown: true - placeholderText: i18ndc("plasma-nm", "text field placeholder text", "Search...") - - visible: searchToggleButton.checked - onVisibleChanged: { - if (visible) { - searchTextField.forceActiveFocus() - } else { - text = "" - } - } - Keys.onEscapePressed: { - //Check if the searchbar is actually visible before accepting the escape key. Otherwise, the escape key cannot dismiss the applet until one interacts with some other element. - if (searchToggleButton.checked) { - searchToggleButton.checked = false; - } else { - event.accepted = false; - } - } - - onTextChanged: { - // Show search field when starting to type directly - if (text.length && !searchToggleButton.checked) { - searchToggleButton.checked = true - } - appletProxyModel.setFilterRegExp(text) - } - } }