Commit dfe6c127 authored by Albert Vaca Cintora's avatar Albert Vaca Cintora

Fixed KCM updating the wrong device if selection was changed

Info displayed when pairing was always shown in the currently selected
device
parent f7bf963e
...@@ -86,7 +86,6 @@ void KdeConnectKcm::resetSelection() ...@@ -86,7 +86,6 @@ void KdeConnectKcm::resetSelection()
kcmUi->deviceList->selectionModel()->setCurrentIndex(sortProxyModel->mapFromSource(currentIndex), QItemSelectionModel::ClearAndSelect); kcmUi->deviceList->selectionModel()->setCurrentIndex(sortProxyModel->mapFromSource(currentIndex), QItemSelectionModel::ClearAndSelect);
} }
void KdeConnectKcm::deviceSelected(const QModelIndex& current) void KdeConnectKcm::deviceSelected(const QModelIndex& current)
{ {
...@@ -182,6 +181,8 @@ void KdeConnectKcm::unpair() ...@@ -182,6 +181,8 @@ void KdeConnectKcm::unpair()
void KdeConnectKcm::pairingFailed(const QString& error) void KdeConnectKcm::pairingFailed(const QString& error)
{ {
if (sender() != currentDevice) return;
kcmUi->messages->setText(i18n("Error trying to pair: %1",error)); kcmUi->messages->setText(i18n("Error trying to pair: %1",error));
kcmUi->messages->animatedShow(); kcmUi->messages->animatedShow();
kcmUi->progressBar->setVisible(false); kcmUi->progressBar->setVisible(false);
...@@ -190,14 +191,17 @@ void KdeConnectKcm::pairingFailed(const QString& error) ...@@ -190,14 +191,17 @@ void KdeConnectKcm::pairingFailed(const QString& error)
void KdeConnectKcm::pairingSuccesful() void KdeConnectKcm::pairingSuccesful()
{ {
DeviceDbusInterface* sender = (DeviceDbusInterface*) sender();
devicesModel->deviceStatusChanged(sender->id());
if (sender != currentDevice) return;
kcmUi->progressBar->setVisible(false); kcmUi->progressBar->setVisible(false);
kcmUi->unpair_button->setVisible(true); kcmUi->unpair_button->setVisible(true);
kcmUi->pair_button->setVisible(false); kcmUi->pair_button->setVisible(false);
kcmUi->ping_button->setVisible(true); kcmUi->ping_button->setVisible(true);
kcmUi->status_label->setText(i18n("(paired)")); kcmUi->status_label->setText(i18n("(paired)"));
devicesModel->deviceStatusChanged(currentDevice->id());
} }
void KdeConnectKcm::pluginsConfigChanged() void KdeConnectKcm::pluginsConfigChanged()
......
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