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 @@ -111,6 +111,37 @@ } } + PlasmaComponents.ToolButton { + id: wifiRefreshButton + enabled: false + + anchors { + right: openEditorButton.left + rightMargin: Math.round(units.gridUnit / 2) + verticalCenter: parent.verticalCenter + } + + tooltip: i18ndc("plasma-nm", "button tooltip", "Scan for new wireless networks") + iconSource: "view-refresh" + visible: enabledConnections.wirelessHwEnabled && availableDevices.wirelessDeviceAvailable && !planeModeSwitchButton.airplaneModeEnabled + + onClicked: { + handler.requestScan() + enabled = false + coolDownTimer.start() + } + + Timer { + id: coolDownTimer + interval: 2500 + repeat: false + running: true + onTriggered: { + wifiRefreshButton.enabled = true + } + } + } + PlasmaComponents.ToolButton { id: openEditorButton diff --git a/libs/handler.h b/libs/handler.h --- a/libs/handler.h +++ b/libs/handler.h @@ -42,7 +42,6 @@ AddConnection, DeactivateConnection, RemoveConnection, - RequestScan, UpdateConnection }; diff --git a/libs/handler.cpp b/libs/handler.cpp --- a/libs/handler.cpp +++ b/libs/handler.cpp @@ -414,10 +414,7 @@ if (device->type() == NetworkManager::Device::Wifi) { NetworkManager::WirelessDevice::Ptr wifiDevice = device.objectCast(); if (wifiDevice) { - QDBusPendingReply<> reply = wifiDevice->requestScan(); - QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this); - watcher->setProperty("action", Handler::RequestScan); - connect(watcher, &QDBusPendingCallWatcher::finished, this, &Handler::replyFinished); + wifiDevice->requestScan(); } } } @@ -460,12 +457,6 @@ notification = new KNotification("FailedToRemoveConnection", KNotification::CloseOnTimeout, this); notification->setTitle(i18n("Failed to remove %1", watcher->property("connection").toString())); break; - case Handler::RequestScan: - /* INFO: Disabled for now as wifi scanning is now automatic - notification = new KNotification("FailedToRequestScan", KNotification::CloseOnTimeout, this); - notification->setTitle(i18n("Failed to request scan")); - */ - break; case Handler::UpdateConnection: notification = new KNotification("FailedToUpdateConnection", KNotification::CloseOnTimeout, this); notification->setTitle(i18n("Failed to update connection %1", watcher->property("connection").toString()));