Fixed KCM updating the wrong device if selection was changed

Info displayed when pairing was always shown in the currently selected
device
This commit is contained in:
Albert Vaca 2013-09-16 15:46:28 +02:00
parent f7bf963efe
commit dfe6c1273a

View file

@ -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()
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)
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()