[SCM] kdeconnect packaging branch, master, updated. debian/0.9g-1-1183-g9d69498
Maximiliano Curia
maxy at moszumanska.debian.org
Fri Oct 14 14:27:01 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=844a92a
The following commit has been merged in the master branch:
commit 844a92a508f26fd51a231e52f9a4a18e96c43861
Author: Albert Vaca <albertvaka at gmail.com>
Date: Mon Sep 16 16:52:40 2013 +0200
KCM updated when pairing state changes externally
Added an unpaired() signal to KDED's Device exported by dbus
---
kcm/kcm.cpp | 64 +++++++++++++++++++++++++++++++++++++++------------------
kcm/kcm.h | 1 +
kded/device.cpp | 3 +++
kded/device.h | 1 +
4 files changed, 49 insertions(+), 20 deletions(-)
diff --git a/kcm/kcm.cpp b/kcm/kcm.cpp
index b4be11d..7ad6814 100644
--- a/kcm/kcm.cpp
+++ b/kcm/kcm.cpp
@@ -89,6 +89,15 @@ void KdeConnectKcm::resetSelection()
void KdeConnectKcm::deviceSelected(const QModelIndex& current)
{
+ if (currentDevice) {
+ disconnect(currentDevice,SIGNAL(pairingSuccesful()),
+ this, SLOT(pairingSuccesful()));
+ disconnect(currentDevice,SIGNAL(pairingFailed(QString)),
+ this, SLOT(pairingFailed(QString)));
+ disconnect(currentDevice,SIGNAL(unpaired()),
+ this, SLOT(unpaired()));
+ }
+
//Store previous device config
pluginsConfigChanged();
@@ -134,6 +143,13 @@ void KdeConnectKcm::deviceSelected(const QModelIndex& current)
kcmUi->name_label->setText(currentDevice->name());
kcmUi->status_label->setText(currentDevice->isPaired()? i18n("(paired)") : i18n("(unpaired)"));
+ connect(currentDevice,SIGNAL(pairingSuccesful()),
+ this, SLOT(pairingSuccesful()));
+ connect(currentDevice,SIGNAL(pairingFailed(QString)),
+ this, SLOT(pairingFailed(QString)));
+ connect(currentDevice,SIGNAL(unpaired()),
+ this, SLOT(unpaired()));
+
KService::List offers = KServiceTypeTrader::self()->query("KdeConnect/Plugin");
QList<KPluginInfo> scriptinfos = KPluginInfo::fromServices(offers);
@@ -143,64 +159,72 @@ void KdeConnectKcm::deviceSelected(const QModelIndex& current)
connect(kcmUi->pluginSelector, SIGNAL(changed(bool)),
this, SLOT(pluginsConfigChanged()));
+
}
void KdeConnectKcm::requestPair()
{
- if (!currentDevice) return;
+ if (!currentDevice) {
+ return;
+ }
kcmUi->messages->hide();
kcmUi->pair_button->setVisible(false);
kcmUi->progressBar->setVisible(true);
- connect(currentDevice,SIGNAL(pairingSuccesful()),
- this, SLOT(pairingSuccesful()));
- connect(currentDevice,SIGNAL(pairingFailed(QString)),
- this, SLOT(pairingFailed(QString)));
-
currentDevice->requestPair();
}
void KdeConnectKcm::unpair()
{
- if (!currentDevice) return;
+ if (!currentDevice) {
+ return;
+ }
+
+ currentDevice->unpair();
+}
+
+void KdeConnectKcm::unpaired()
+{
+ DeviceDbusInterface* senderDevice = (DeviceDbusInterface*) sender();
+ devicesModel->deviceStatusChanged(senderDevice->id());
+
+ if (senderDevice != currentDevice) return;
kcmUi->pair_button->setVisible(true);
kcmUi->unpair_button->setVisible(false);
kcmUi->progressBar->setVisible(false);
kcmUi->ping_button->setVisible(false);
-
- currentDevice->unpair();
-
kcmUi->status_label->setText(i18n("(unpaired)"));
-
- devicesModel->deviceStatusChanged(currentDevice->id());
}
void KdeConnectKcm::pairingFailed(const QString& error)
{
if (sender() != currentDevice) return;
+ kcmUi->pair_button->setVisible(true);
+ kcmUi->unpair_button->setVisible(false);
+ kcmUi->progressBar->setVisible(false);
+ kcmUi->ping_button->setVisible(false);
+ kcmUi->status_label->setText(i18n("(unpaired)"));
+
kcmUi->messages->setText(i18n("Error trying to pair: %1",error));
kcmUi->messages->animatedShow();
- kcmUi->progressBar->setVisible(false);
- kcmUi->pair_button->setVisible(true);
}
void KdeConnectKcm::pairingSuccesful()
{
- DeviceDbusInterface* sender = (DeviceDbusInterface*) sender();
- devicesModel->deviceStatusChanged(sender->id());
+ DeviceDbusInterface* senderDevice = (DeviceDbusInterface*) sender();
+ devicesModel->deviceStatusChanged(senderDevice->id());
- if (sender != currentDevice) return;
+ if (senderDevice != currentDevice) return;
- kcmUi->progressBar->setVisible(false);
- kcmUi->unpair_button->setVisible(true);
kcmUi->pair_button->setVisible(false);
+ kcmUi->unpair_button->setVisible(true);
+ kcmUi->progressBar->setVisible(false);
kcmUi->ping_button->setVisible(true);
-
kcmUi->status_label->setText(i18n("(paired)"));
}
diff --git a/kcm/kcm.h b/kcm/kcm.h
index 32aac20..072c544 100644
--- a/kcm/kcm.h
+++ b/kcm/kcm.h
@@ -61,6 +61,7 @@ private Q_SLOTS:
void resetSelection();
void pairingSuccesful();
void pairingFailed(const QString& error);
+ void unpaired();
private:
Ui::KdeConnectKcmUi* kcmUi;
diff --git a/kded/device.cpp b/kded/device.cpp
index b67b3da..b13a1bd 100644
--- a/kded/device.cpp
+++ b/kded/device.cpp
@@ -177,6 +177,8 @@ void Device::unpair()
reloadPlugins(); //Will unload the plugins
+ Q_EMIT unpaired();
+
}
void Device::pairingTimeout()
@@ -333,6 +335,7 @@ void Device::privateReceivedPackage(const NetworkPackage& np)
KSharedConfigPtr config = KSharedConfig::openConfig("kdeconnectrc");
config->group("trusted_devices").deleteGroup(id());
reloadPlugins();
+ Q_EMIT unpaired();
}
m_pairStatus = Device::NotPaired;
diff --git a/kded/device.h b/kded/device.h
index a017db1..f7e8e68 100644
--- a/kded/device.h
+++ b/kded/device.h
@@ -100,6 +100,7 @@ Q_SIGNALS:
Q_SCRIPTABLE void pluginsChanged();
Q_SCRIPTABLE void pairingSuccesful();
Q_SCRIPTABLE void pairingFailed(const QString& error);
+ Q_SCRIPTABLE void unpaired();
private:
QString m_deviceId;
--
kdeconnect packaging
More information about the pkg-kde-commits
mailing list