[SCM] kdeconnect packaging branch, master, updated. debian/0.9g-1-1183-g9d69498
Maximiliano Curia
maxy at moszumanska.debian.org
Fri Oct 14 14:27:40 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=734b27e
The following commit has been merged in the master branch:
commit 734b27ed50ddfb4ee9e3913f8aca2e9911db09d8
Author: Albert Vaca <albertvaka at gmail.com>
Date: Sun Jun 15 21:39:46 2014 +0200
De-duplicated small piece of code
---
core/device.cpp | 21 +++++++++++----------
core/device.h | 1 +
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/core/device.cpp b/core/device.cpp
index 429ab75..29982e7 100644
--- a/core/device.cpp
+++ b/core/device.cpp
@@ -57,11 +57,7 @@ Device::Device(QObject* parent, const QString& id)
const QString& key = data.readEntry<QString>("publicKey", QString());
m_publicKey = QCA::RSAPublicKey::fromPEM(key);
- //TODO: It is redundant to have our own private key in every instance of Device, move this to a singleton somewhere (Daemon?)
- const QString privateKeyPath = KStandardDirs::locateLocal("appdata", "key.pem", true, KComponentData("kdeconnect", "kdeconnect"));
- QFile privKey(privateKeyPath);
- privKey.open(QIODevice::ReadOnly);
- m_privateKey = QCA::PrivateKey::fromPEM(privKey.readAll());
+ initPrivateKey();
//Register in bus
QDBusConnection::sessionBus().registerObject(dbusPath(), this, QDBusConnection::ExportScriptableContents | QDBusConnection::ExportAdaptors);
@@ -75,11 +71,7 @@ Device::Device(QObject* parent, const NetworkPackage& identityPackage, DeviceLin
, m_pairStatus(Device::NotPaired)
, m_protocolVersion(identityPackage.get<int>("protocolVersion"))
{
- //TODO: It is redundant to have our own private key in every instance of Device, move this to a singleton somewhere (Daemon?)
- const QString privateKeyPath = KStandardDirs::locateLocal("appdata", "key.pem", true, KComponentData("kdeconnect", "kdeconnect"));
- QFile privKey(privateKeyPath);
- privKey.open(QIODevice::ReadOnly);
- m_privateKey = QCA::PrivateKey::fromPEM(privKey.readAll());
+ initPrivateKey();
addLink(identityPackage, dl);
@@ -87,6 +79,15 @@ Device::Device(QObject* parent, const NetworkPackage& identityPackage, DeviceLin
QDBusConnection::sessionBus().registerObject(dbusPath(), this, QDBusConnection::ExportScriptableContents | QDBusConnection::ExportAdaptors);
}
+void Device::initPrivateKey()
+{
+ //TODO: It is redundant to have our own private key in every instance of Device, move this to a singleton somewhere (Daemon?)
+ const QString privateKeyPath = KStandardDirs::locateLocal("appdata", "key.pem", true, KComponentData("kdeconnect", "kdeconnect"));
+ QFile privKey(privateKeyPath);
+ privKey.open(QIODevice::ReadOnly);
+ m_privateKey = QCA::PrivateKey::fromPEM(privKey.readAll());
+}
+
Device::~Device()
{
diff --git a/core/device.h b/core/device.h
index bfff085..ec757b8 100644
--- a/core/device.h
+++ b/core/device.h
@@ -140,6 +140,7 @@ private:
void setAsPaired();
void storeAsTrusted();
bool sendOwnPublicKey();
+ void initPrivateKey();
};
--
kdeconnect packaging
More information about the pkg-kde-commits
mailing list