Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
home:epopov:branches:openSUSE:Factory
plasma6-nm
2000-applet.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 2000-applet.patch of Package plasma6-nm
diff --git a/applet/contents/ui/ConnectionListPage.qml b/applet/contents/ui/ConnectionListPage.qml index 2b3db1b43be47da4e7b54aa367ede8db8ba49fa6..19b4e62f1b919f63535c52448b3fe5ab31f2e1b3 100644 --- a/applet/contents/ui/ConnectionListPage.qml +++ b/applet/contents/ui/ConnectionListPage.qml @@ -48,6 +48,7 @@ ColumnLayout { Layout.fillWidth: true Layout.fillHeight: true + PlasmaComponents3.ScrollBar.horizontal.policy: PlasmaComponents3.ScrollBar.AlwaysOff contentWidth: availableWidth - contentItem.leftMargin - contentItem.rightMargin contentItem: ListView { @@ -98,29 +99,33 @@ ColumnLayout { asynchronous: true visible: status === Loader.Ready sourceComponent: PlasmaExtras.PlaceholderMessage { + readonly property bool displayWifiMessage: wifiAction.visible && !wifiAction.checked + readonly property bool displayWwanMessage: wwanAction.visible && !wwanAction.checked + readonly property bool displayPlaneModeMessage: planeAction.visible && planeAction.checked + iconName: { - if (toolbar.displayplaneModeMessage) { + if (displayPlaneModeMessage) { return "network-flightmode-on" } - if (toolbar.displayWifiMessage) { + if (displayWifiMessage) { return "network-wireless-off" } - if (toolbar.displayWwanMessage) { + if (displayWwanMessage) { return "network-mobile-off" } return "edit-none" } text: { - if (toolbar.displayplaneModeMessage) { + if (displayPlaneModeMessage) { return i18n("Airplane mode is enabled") } - if (toolbar.displayWifiMessage) { - if (toolbar.displayWwanMessage) { + if (displayWifiMessage) { + if (displayWwanMessage) { return i18n("Wireless and mobile networks are deactivated") } return i18n("Wireless is deactivated") } - if (toolbar.displayWwanMessage) { + if (displayWwanMessage) { return i18n("Mobile network is deactivated") } if (toolbar.searchTextField.text.length > 0) { diff --git a/applet/contents/ui/Toolbar.qml b/applet/contents/ui/Toolbar.qml index 33ef7f0d95d9e2b5716bf031ab3874efbb24eeca..1aa3de1dd492fb8c8239e38e0f1e9d28ffe3f4e8 100644 --- a/applet/contents/ui/Toolbar.qml +++ b/applet/contents/ui/Toolbar.qml @@ -16,185 +16,9 @@ import org.kde.kcmutils as KCMUtils RowLayout { id: toolbar - readonly property var displayWifiMessage: !wifiSwitchButton.checked && wifiSwitchButton.visible - readonly property var displayWwanMessage: !wwanSwitchButton.checked && wwanSwitchButton.visible - readonly property var displayplaneModeMessage: planeModeSwitchButton.checked && planeModeSwitchButton.visible - property bool hasConnections property alias searchTextField: searchTextField - PlasmaNM.EnabledConnections { - id: enabledConnections - - // When user interactively toggles a checkbox, a binding may be - // preserved, but the state gets out of sync until next relevant - // notify signal is dispatched. So, we refresh the bindings here. - - onWirelessEnabledChanged: wifiSwitchButton.checked = Qt.binding(() => - wifiSwitchButton.administrativelyEnabled && enabledConnections.wirelessEnabled - ); - - onWwanEnabledChanged: wwanSwitchButton.checked = Qt.binding(() => - wwanSwitchButton.administrativelyEnabled && enabledConnections.wwanEnabled - ); - } - - spacing: Kirigami.Units.smallSpacing * 3 - - RowLayout { - // Add margin before switches for consistency with other applets - Layout.leftMargin: Kirigami.Units.smallSpacing - - spacing: parent.spacing - - // Only show when switches are visible (and avoid parent spacing otherwise) - visible: availableDevices.wirelessDeviceAvailable || availableDevices.modemDeviceAvailable - - PlasmaComponents3.Switch { - id: wifiSwitchButton - - // can't overload Item::enabled, because it's being used for other things, like Edit Mode on a desktop - readonly property bool administrativelyEnabled: - !PlasmaNM.Configuration.airplaneModeEnabled - && availableDevices.wirelessDeviceAvailable - && enabledConnections.wirelessHwEnabled - - checked: administrativelyEnabled && enabledConnections.wirelessEnabled - enabled: administrativelyEnabled - - icon.name: administrativelyEnabled ? "network-wireless-on" : "network-wireless-off" - visible: availableDevices.wirelessDeviceAvailable - - KeyNavigation.right: wwanSwitchButton.visible ? wwanSwitchButton : wwanSwitchButton.KeyNavigation.right - - onToggled: handler.enableWireless(checked); - - PlasmaComponents3.ToolTip { - text: i18n("Enable Wi-Fi") - } - - PlasmaComponents3.BusyIndicator { - parent: wifiSwitchButton - anchors { - fill: wifiSwitchButton.contentItem - leftMargin: wifiSwitchButton.indicator.width + wifiSwitchButton.spacing - } - z: 1 - - // Scanning may be too fast to notice. Prolong the animation up to at least `humanMoment`. - running: handler.scanning || timer.running - Timer { - id: timer - interval: Kirigami.Units.humanMoment - } - Connections { - target: handler - function onScanningChanged() { - if (handler.scanning) { - timer.restart(); - } - } - } - } - } - - PlasmaComponents3.Switch { - id: wwanSwitchButton - - // can't overload Item::enabled, because it's being used for other things, like Edit Mode on a desktop - readonly property bool administrativelyEnabled: - !PlasmaNM.Configuration.airplaneModeEnabled - && availableDevices.modemDeviceAvailable - && enabledConnections.wwanHwEnabled - - checked: administrativelyEnabled && enabledConnections.wwanEnabled - enabled: administrativelyEnabled - - icon.name: administrativelyEnabled ? "network-mobile-on" : "network-mobile-off" - visible: availableDevices.modemDeviceAvailable - - KeyNavigation.left: wifiSwitchButton - KeyNavigation.right: planeModeSwitchButton.visible ? planeModeSwitchButton : planeModeSwitchButton.KeyNavigation.right - - onToggled: handler.enableWwan(checked); - - PlasmaComponents3.ToolTip { - text: i18n("Enable mobile network") - } - } - - PlasmaComponents3.Switch { - id: planeModeSwitchButton - - property bool initialized: false - - checked: PlasmaNM.Configuration.airplaneModeEnabled - - icon.name: PlasmaNM.Configuration.airplaneModeEnabled ? "network-flightmode-on" : "network-flightmode-off" - - visible: availableDevices.modemDeviceAvailable || availableDevices.wirelessDeviceAvailable - - KeyNavigation.left: wwanSwitchButton.visible ? wwanSwitchButton : wwanSwitchButton.KeyNavigation.left - KeyNavigation.right: hotspotButton.visible ? hotspotButton : hotspotButton.KeyNavigation.right - - onToggled: { - handler.enableAirplaneMode(checked); - PlasmaNM.Configuration.airplaneModeEnabled = checked; - } - - PlasmaComponents3.ToolTip { - text: planeModeSwitchButton.checked ? - xi18nc("@info", "Disable airplane mode<nl/><nl/>This will enable Wi-Fi and Bluetooth") : - xi18nc("@info", "Enable airplane mode<nl/><nl/>This will disable Wi-Fi and Bluetooth") - } - } - } - - PlasmaComponents3.ToolButton { - id: hotspotButton - - visible: handler.hotspotSupported - checkable: true - - text: i18n("Hotspot") - icon.name: "network-wireless-on" - - KeyNavigation.left: planeModeSwitchButton.visible ? planeModeSwitchButton : planeModeSwitchButton.KeyNavigation.left - KeyNavigation.right: searchTextField - - onClicked: { - if (PlasmaNM.Configuration.hotspotConnectionPath) { - checked = false - handler.stopHotspot() - } else { - checked = true - handler.createHotspot() - } - } - - PlasmaComponents3.ToolTip { - id: tooltip - } - - Connections { - target: handler - function onHotspotCreated() { - hotspotButton.checked = true - tooltip.text = i18n("Disable Hotspot") - } - - function onHotspotDisabled() { - hotspotButton.checked = false - tooltip.text = i18n("Create Hotspot") - } - } - - Component.onCompleted: { - checked = PlasmaNM.Configuration.hotspotConnectionPath - tooltip.text = PlasmaNM.Configuration.hotspotConnectionPath ? i18n("Disable Hotspot") : i18n("Create Hotspot") - } - } - PlasmaExtras.SearchField { id: searchTextField @@ -207,9 +31,6 @@ RowLayout { // always in the correct state on show. focus: mainWindow.expanded && !Kirigami.InputMethod.willShowOnActive - KeyNavigation.left: hotspotButton.visible ? hotspotButton : hotspotButton.KeyNavigation.left - KeyNavigation.right: openEditorButton - onTextChanged: { appletProxyModel.setFilterFixedString(text) } diff --git a/applet/contents/ui/main.qml b/applet/contents/ui/main.qml index 05daee587b5b512f99e5e6f93cd8a8353b8ff1cc..f636de03d1c3c908b6e29dc4f0cb67f20c344de1 100644 --- a/applet/contents/ui/main.qml +++ b/applet/contents/ui/main.qml @@ -69,9 +69,10 @@ PlasmoidItem { Plasmoid.contextualActions: [ PlasmaCore.Action { + id: wifiAction text: i18n("Enable Wi-Fi") icon.name: "network-wireless-on" - priority: PlasmaCore.Action.LowPriority + priority: PlasmaCore.Action.HighPriority checkable: true checked: enabledConnections.wirelessEnabled visible: enabledConnections.wirelessHwEnabled @@ -80,9 +81,10 @@ PlasmoidItem { onTriggered: checked => {handler.enableWireless(checked)} }, PlasmaCore.Action { + id: wwanAction text: i18n("Enable Mobile Network") icon.name: "network-mobile-on" - priority: PlasmaCore.Action.LowPriority + priority: PlasmaCore.Action.HighPriority checkable: true checked: enabledConnections.wwanEnabled visible: enabledConnections.wwanHwEnabled @@ -94,7 +96,7 @@ PlasmoidItem { id: planeAction text: i18n("Enable Airplane Mode") icon.name: "network-flightmode-on" - priority: PlasmaCore.Action.LowPriority + priority: PlasmaCore.Action.HighPriority checkable: true checked: PlasmaNM.Configuration.airplaneModeEnabled visible: mainWindow.airplaneModeAvailable @@ -103,6 +105,24 @@ PlasmoidItem { PlasmaNM.Configuration.airplaneModeEnabled = checked } }, + PlasmaCore.Action { + isSeparator: true + }, + PlasmaCore.Action { + id: hotspotAction + text: i18n("Enable Hotspot") + icon.name: "network-wireless-hotspot" + checkable: true + checked: PlasmaNM.Configuration.hotspotConnectionPath + visible: handler.hotspotSupported && !PlasmaNM.Configuration.airplaneModeEnabled + onTriggered: { + if (PlasmaNM.Configuration.hotspotConnectionPath) { + handler.stopHotspot(); + } else { + handler.createHotspot(); + } + } + }, PlasmaCore.Action { text: i18n("Open Network Login Pageā¦") icon.name: "network-flightmode-on" @@ -144,6 +164,9 @@ PlasmoidItem { PlasmaNM.Handler { id: handler + + onHotspotCreated: hotspotAction.checked = true + onHotspotDisabled: hotspotAction.checked = false } Timer { diff --git a/libs/handler.cpp b/libs/handler.cpp index ec4659c0c2809b8968b45b42cdc4621af81fdcce..56a218d515be4f6ff02de642652e7ae3f361550b 100644 --- a/libs/handler.cpp +++ b/libs/handler.cpp @@ -60,6 +60,7 @@ Handler::Handler(QObject *parent) : QObject(parent) , m_tmpWirelessEnabled(NetworkManager::isWirelessEnabled()) , m_tmpWwanEnabled(NetworkManager::isWwanEnabled()) + , m_tmpHotspotEnabled(!Configuration::self().hotspotConnectionPath().isEmpty()) { QDBusConnection::sessionBus().connect(QStringLiteral(AGENT_SERVICE), QStringLiteral(AGENT_PATH), @@ -68,7 +69,7 @@ Handler::Handler(QObject *parent) this, SLOT(secretAgentError(QString, QString))); - if (!Configuration::self().hotspotConnectionPath().isEmpty()) { + if (m_tmpHotspotEnabled) { NetworkManager::ActiveConnection::Ptr hotspot = NetworkManager::findActiveConnection(Configuration::self().hotspotConnectionPath()); if (!hotspot) { Configuration::self().setHotspotConnectionPath(QString()); @@ -492,6 +493,8 @@ void Handler::enableAirplaneMode(bool enable) if (enable) { m_tmpWirelessEnabled = NetworkManager::isWirelessEnabled(); m_tmpWwanEnabled = NetworkManager::isWwanEnabled(); + m_tmpHotspotEnabled = !Configuration::self().hotspotConnectionPath().isEmpty(); + stopHotspot(); enableBluetooth(false); enableWireless(false); enableWwan(false); @@ -503,6 +506,9 @@ void Handler::enableAirplaneMode(bool enable) if (m_tmpWwanEnabled) { enableWwan(true); } + if (m_tmpHotspotEnabled) { + createHotspot(); + } } } diff --git a/libs/handler.h b/libs/handler.h index f4f2737b08a296221a80d7ff9349ac6dff7fef68..b1f2a84b81fbb67471ddb02a44ba152e97c3821b 100644 --- a/libs/handler.h +++ b/libs/handler.h @@ -150,6 +150,7 @@ private: bool m_hotspotSupported; bool m_tmpWirelessEnabled; bool m_tmpWwanEnabled; + bool m_tmpHotspotEnabled; QString m_tmpConnectionPath; QString m_tmpConnectionUuid; QString m_tmpDevicePath;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor