Commit 8618f6a3 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇
Browse files

Fix removing KDE Connect context menu entries on host disconnect

Got broken when I meddled with the menus...
Just call the callback for each device to ensure behavior stays in sync here.

(Ideally we'd have some Port class where a module could register a callback
to get notified of when the host connects/disconnects :)
parent 6d7e1e08
......@@ -169,16 +169,14 @@ function connectHost() {
// Remove all kde connect menu entries since they won't work without a host
try {
for (let device in kdeConnectDevices) {
if (!kdeConnectDevices.hasOwnProperty(device)) {
continue;
}
chrome.contextMenus.remove(kdeConnectMenuIdPrefix + device);
}
Object.keys(kdeConnectDevices).forEach((deviceId) => {
callbacks.kdeconnect.deviceRemoved({
id: deviceId
});
});
} catch (e) {
console.warn("Failed to cleanup after port disconnect", e);
}
kdeConnectDevices = {};
portLastErrorMessage = error && error.message || "UNKNOWN";
if (receivedMessageOnce) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment