[SCM] kdeconnect packaging branch, master, updated. debian/0.9g-1-1183-g9d69498
Maximiliano Curia
maxy at moszumanska.debian.org
Fri Oct 14 14:26:39 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=669edf8
The following commit has been merged in the master branch:
commit 669edf8ea5cf3709544dbfc6a45612d0a47b8d89
Author: Albert Vaca <albertvaka at gmail.com>
Date: Tue Jul 2 02:46:41 2013 +0200
It even works now
---
daemon/announcers/avahiannouncer.cpp | 10 +++++++---
daemon/daemon.cpp | 29 ++++++++++++++++++++---------
daemon/daemon.h | 11 +++++++----
daemon/devicelinks/udpdevicelink.cpp | 2 ++
daemon/networkpackage.cpp | 4 +++-
kcm/devicesmodel.cpp | 1 +
kcm/kcm.cpp | 6 +++++-
kcm/wizard.cpp | 8 +++++---
8 files changed, 50 insertions(+), 21 deletions(-)
diff --git a/daemon/announcers/avahiannouncer.cpp b/daemon/announcers/avahiannouncer.cpp
index a78e3b0..6c94d6e 100644
--- a/daemon/announcers/avahiannouncer.cpp
+++ b/daemon/announcers/avahiannouncer.cpp
@@ -35,14 +35,14 @@ AvahiAnnouncer::AvahiAnnouncer()
connect(mUdpSocket, SIGNAL(readyRead()), this, SLOT(readPendingNotifications()));
- qDebug() << "listening to udp messages";
+ qDebug() << "Listening to udp messages";
}
void AvahiAnnouncer::readPendingNotifications()
{
- qDebug() << "readPendingNotifications";
+ qDebug() << "AvahiAnnouncer readPendingNotifications";
while (mUdpSocket->hasPendingDatagrams()) {
@@ -53,17 +53,21 @@ void AvahiAnnouncer::readPendingNotifications()
mUdpSocket->readDatagram(datagram.data(), datagram.size(), &sender, &senderPort);
//log.write(datagram);
- qDebug() << ("AvahiAnnouncer incomming udp datagram: " + datagram);
+ qDebug() << "AvahiAnnouncer incomming udp datagram: " << datagram;
NetworkPackage np = NetworkPackage::fromString(datagram);
QString id = np.deviceId();
QString name = np.body();
+ qDebug() << "AvahiAnnouncer creating link to device" << name;
+
Device* device = new Device(id, name);
DeviceLink* dl = new UdpDeviceLink(device, sender, 10600);
links.append(dl);
+ qDebug() << "Emitting link" << name;
+
emit deviceConnection(dl);
}
diff --git a/daemon/daemon.cpp b/daemon/daemon.cpp
index d988415..9148525 100644
--- a/daemon/daemon.cpp
+++ b/daemon/daemon.cpp
@@ -28,9 +28,10 @@
#include <QtNetwork/QUdpSocket>
#include <QFile>
-
#include <QDBusConnection>
-#include <KDE/KIcon>
+
+#include <KIcon>
+#include <KConfigGroup>
#include <sstream>
#include <iomanip>
@@ -53,6 +54,7 @@ void Daemon::linkTo(DeviceLink* dl)
Daemon::Daemon(QObject *parent, const QList<QVariant>&)
: KDEDModule(parent)
+ , config(KSharedConfig::openConfig("kdeconnectrc"))
{
qDebug() << "GO GO GO!";
@@ -69,8 +71,16 @@ Daemon::Daemon(QObject *parent, const QList<QVariant>&)
//TODO: Add package emitters
- //TODO: Read paired devices from config
- //pairedDevices.push_back(new Device("MyAndroid","MyAndroid"));
+ //Read remebered paired devices
+ const KConfigGroup& known = config->group("devices").group("paired");
+ const QStringList& list = known.groupList();
+ const QString defaultName("unnamed");
+ Q_FOREACH(QString id, list) {
+ const KConfigGroup& data = known.group(id);
+ const QString& name = data.readEntry<QString>("name",defaultName);
+ pairedDevices.push_back(new Device(id,name));
+ }
+
QDBusConnection::sessionBus().registerService("org.kde.kdeconnect");
@@ -116,6 +126,8 @@ bool Daemon::pairDevice(QString id)
{
if (!visibleDevices.contains(id)) return false;
+ config->group("devices").group("paired").group(id).writeEntry("name",visibleDevices[id]->device()->name());
+
linkTo(visibleDevices[id]);
return true;
@@ -139,6 +151,8 @@ QString Daemon::listLinkedDevices()
void Daemon::deviceConnection(DeviceLink* dl)
{
+ qDebug() << "deviceConnection";
+
QString id = dl->device()->id();
bool paired = false;
Q_FOREACH (Device* d, pairedDevices) {
@@ -151,15 +165,12 @@ void Daemon::deviceConnection(DeviceLink* dl)
visibleDevices[dl->device()->id()] = dl;
if (paired) {
- qDebug() << "Known device connected" + dl->device()->name();
+ qDebug() << "Known device connected" << dl->device()->name();
linkTo(dl);
}
else {
- qDebug() << "Unknown device connected" + dl->device()->name();
-
+ qDebug() << "Unknown device connected" << dl->device()->name();
emit deviceDiscovered(dl->device()->id(), dl->device()->name());
-
- //linkTo(dl);
}
}
diff --git a/daemon/daemon.h b/daemon/daemon.h
index 47ccfce..37c4dc0 100644
--- a/daemon/daemon.h
+++ b/daemon/daemon.h
@@ -26,8 +26,8 @@
#include <QRegExp>
#include <map>
-#include <KDE/KDEDModule>
-#include <KDE/KNotification>
+#include <KDEDModule>
+#include <KNotification>
#include "networkpackage.h"
#include <KDE/KPluginFactory>
@@ -36,6 +36,8 @@
#include <QSet>
+#include <KConfig>
+
#include "device.h"
#include "packagereceivers/packagereceiver.h"
#include "devicelinks/devicelink.h"
@@ -65,8 +67,6 @@ public Q_SLOTS:
Q_SCRIPTABLE bool pairDevice(QString id);
-
-
/*
Q_SCRIPTABLE QString listPairedDevices(QString id);
@@ -82,8 +82,11 @@ Q_SIGNALS:
private:
+
void linkTo(DeviceLink* dl);
+ KSharedConfigPtr config;
+
//(Non paired?) visible devices
QMap<QString, DeviceLink*> visibleDevices;
diff --git a/daemon/devicelinks/udpdevicelink.cpp b/daemon/devicelinks/udpdevicelink.cpp
index 68931aa..c32caab 100644
--- a/daemon/devicelinks/udpdevicelink.cpp
+++ b/daemon/devicelinks/udpdevicelink.cpp
@@ -37,6 +37,8 @@ UdpDeviceLink::UdpDeviceLink(Device* d, QHostAddress ip, quint16 port)
void UdpDeviceLink::readPendingNotifications()
{
+ qDebug() << "UdpDeviceLink readPendingNotifications";
+
while (mUdpSocket->hasPendingDatagrams()) {
QByteArray datagram;
diff --git a/daemon/networkpackage.cpp b/daemon/networkpackage.cpp
index 574f850..f3e9649 100644
--- a/daemon/networkpackage.cpp
+++ b/daemon/networkpackage.cpp
@@ -36,7 +36,7 @@ NetworkPackage NetworkPackage::fromString(QByteArray s)
long id;
ss >> id;
- qDebug() << "Receiving package with id: " << id;
+ //qDebug() << "Decoding package with id:" << id;
NetworkPackage pp(id);
@@ -59,6 +59,8 @@ NetworkPackage NetworkPackage::fromString(QByteArray s)
ss >> pp.mIsCancel;
+ qDebug() << "Decoded package with id:" << id;
+
return pp;
}
diff --git a/kcm/devicesmodel.cpp b/kcm/devicesmodel.cpp
index 9f47c12..c186501 100644
--- a/kcm/devicesmodel.cpp
+++ b/kcm/devicesmodel.cpp
@@ -69,6 +69,7 @@ void DevicesModel::addDevice(QString id, QString name, DevicesModel::DeviceStatu
setData(index(rown,0),QVariant(id),IdModelRole);
setData(index(rown,0),QVariant(name),NameModelRole);
setData(index(rown,0),QVariant(PairedConnected),StatusModelRole);
+ qDebug() << "Add device" << name;
emit dataChanged(index(rown,0),index(rown,0));
}
diff --git a/kcm/kcm.cpp b/kcm/kcm.cpp
index c3cdf74..8f7c7ce 100644
--- a/kcm/kcm.cpp
+++ b/kcm/kcm.cpp
@@ -82,7 +82,11 @@ void KdeConnectKcm::removeButtonClicked()
void KdeConnectKcm::deviceAdded(QString id,QString name)
{
qDebug() << "Succesfully paired: " + id;
- pairedDevicesList.addDevice(id,name,DevicesModel::PairedConnected);
+
+ //TODO: Do not use kconf directly but talk to daemon
+ dbusInterface.pairDevice(id);
+
+ pairedDevicesList.loadPaired();
}
void KdeConnectKcm::currentChanged(const QModelIndex& current, const QModelIndex& previous)
diff --git a/kcm/wizard.cpp b/kcm/wizard.cpp
index 90012c9..4707d30 100644
--- a/kcm/wizard.cpp
+++ b/kcm/wizard.cpp
@@ -54,10 +54,11 @@ AddDeviceWizard::AddDeviceWizard(QWidget* parent)
void AddDeviceWizard::wizardFinished()
{
- if (selectedIndex.row() > 0 && selectedIndex.row() < discoveredDevicesList->rowCount()) {
+
+ if (selectedIndex.isValid() && selectedIndex.row() >= 0 && selectedIndex.row() < discoveredDevicesList->rowCount()) {
QString name = discoveredDevicesList->data(selectedIndex,DevicesModel::NameModelRole).toString();
QString id = discoveredDevicesList->data(selectedIndex,DevicesModel::IdModelRole).toString();
- emit deviceAdded(name,id);
+ emit deviceAdded(id,name);
}
}
@@ -72,6 +73,7 @@ void AddDeviceWizard::pageChanged(int id)
void AddDeviceWizard::deviceDiscovered(QString id, QString name)
{
+ qDebug() << "Discovered"<<name;
discoveredDevicesList->addDevice(id,name,DevicesModel::Visible);
}
/*
@@ -100,7 +102,7 @@ void AddDeviceWizard::show()
void AddDeviceWizard::deviceSelected(const QModelIndex& index)
{
- qDebug() << "Selected: " + index.row();
+ qDebug() << "Selected:" << index.row();
selectedIndex = index;
next();
}
--
kdeconnect packaging
More information about the pkg-kde-commits
mailing list