Only make actions enabled if they're available

This commit is contained in:
Aleix Pol 2017-01-11 17:54:52 +01:00
parent a164983b6f
commit d517dcea48

View file

@ -87,12 +87,15 @@ DeviceIndicator::DeviceIndicator(DeviceDbusInterface* device)
sftpIface->startBrowsing();
sftpIface->deleteLater();
});
setWhenAvailable(device->hasPlugin("kdeconnect_sftp"), [browse](bool available) { browse->setEnabled(available); }, this);
auto findDevice = addAction(i18n("Find device"));
connect(findDevice, &QAction::triggered, device, [device](){
FindMyPhoneDeviceDbusInterface* iface = new FindMyPhoneDeviceDbusInterface(device->id(), device);
iface->ring();
iface->deleteLater();
});
setWhenAvailable(device->hasPlugin("kdeconnect_findmyphone"), [findDevice](bool available) { findDevice->setEnabled(available); }, this);
// addAction(i18n("Send file")); //TODO