[SCM] kdeconnect packaging branch, master, updated. debian/0.9g-1-1183-g9d69498
Maximiliano Curia
maxy at moszumanska.debian.org
Fri Oct 14 14:26:59 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=158e32a
The following commit has been merged in the master branch:
commit 158e32adcf440c7720ee9c0d79a3ab723b2122ea
Author: Albert Vaca <albertvaka at gmail.com>
Date: Mon Sep 16 15:21:22 2013 +0200
Debugging filetransfer
---
kded/device.cpp | 2 +-
kded/networkpackage.cpp | 10 +++++++---
kded/networkpackage.h | 1 +
kded/plugins/filetransfer/filetransferplugin.cpp | 24 ++++++++++++++----------
4 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/kded/device.cpp b/kded/device.cpp
index d9405f2..e0760fa 100644
--- a/kded/device.cpp
+++ b/kded/device.cpp
@@ -45,7 +45,7 @@ Device::Device(const NetworkPackage& identityPackage, DeviceLink* dl)
int protocolVersion = identityPackage.get<int>("protocolVersion");
if (protocolVersion != NetworkPackage::ProtocolVersion) {
- qDebug() << "WARNING: Device uses a different protocol version" << protocolVersion << "expected" << NetworkPackage::ProtocolVersion;
+ qDebug() << m_deviceName << "- warning, device uses a different protocol version" << protocolVersion << "expected" << NetworkPackage::ProtocolVersion;
//TODO: Do something
}
diff --git a/kded/networkpackage.cpp b/kded/networkpackage.cpp
index b82e070..0e23dcf 100644
--- a/kded/networkpackage.cpp
+++ b/kded/networkpackage.cpp
@@ -79,7 +79,9 @@ QByteArray NetworkPackage::serialize() const
if (!ok) {
qDebug() << "Serialization error:" << serializer.errorMessage();
} else {
- //qDebug() << "Serialized package:" << json;
+ if (!isEncrypted()) {
+ qDebug() << "Serialized package:" << json;
+ }
json.append('
');
}
@@ -95,7 +97,7 @@ bool NetworkPackage::unserialize(const QByteArray& a, NetworkPackage* np)
bool ok;
QVariantMap variant = parser.parse(a, &ok).toMap();
if (!ok) {
- qDebug() << "Unserialization error:" << parser.errorLine() << parser.errorString();
+ qDebug() << "Unserialization error:" << a;
return false;
}
@@ -103,7 +105,9 @@ bool NetworkPackage::unserialize(const QByteArray& a, NetworkPackage* np)
QJson::QObjectHelper::qvariant2qobject(variant,np);
if (variant.contains("payloadTransferInfo")) {
- //qDebug() << "Unserializing payloadTransferInfo";
+ if (!np->isEncrypted()) {
+ //qDebug() << "Unserializing payloadTransferInfo";
+ }
np->mPayloadTransferInfo = variant["payloadTransferInfo"].toMap();
}
diff --git a/kded/networkpackage.h b/kded/networkpackage.h
index 2f1f627..4556c4d 100644
--- a/kded/networkpackage.h
+++ b/kded/networkpackage.h
@@ -56,6 +56,7 @@ public:
void encrypt(QCA::PublicKey& key);
bool decrypt(QCA::PrivateKey& key, NetworkPackage* out) const;
+ bool isEncrypted() const { return mType == PACKAGE_TYPE_ENCRYPTED; }
const QString& id() const { return mId; }
const QString& type() const { return mType; }
diff --git a/kded/plugins/filetransfer/filetransferplugin.cpp b/kded/plugins/filetransfer/filetransferplugin.cpp
index 95c7ba0..097eab9 100644
--- a/kded/plugins/filetransfer/filetransferplugin.cpp
+++ b/kded/plugins/filetransfer/filetransferplugin.cpp
@@ -39,32 +39,36 @@ FileTransferPlugin::FileTransferPlugin(QObject* parent, const QVariantList& args
{
//TODO: Use downloads user path
//TODO: Be able to change this from config
- mDestinationDir = QDesktopServices::DesktopLocation;
+ mDestinationDir = QDesktopServices::storageLocation(QDesktopServices::DesktopLocation);
}
bool FileTransferPlugin::receivePackage(const NetworkPackage& np)
{
//TODO: Move this code to a test and do a diff between files
- /*
- if (np.type() == PACKAGE_TYPE_PING) {
+ //if (np.type() == PACKAGE_TYPE_PING) {
- NetworkPackage np(PACKAGE_TYPE_FILETRANSFER);
- np.set("filename", mDestinationDir + "/itworks.txt");
+ qDebug() << "sending file" << (QDesktopServices::storageLocation(QDesktopServices::HomeLocation) + "/.bashrc");
+
+ NetworkPackage out(PACKAGE_TYPE_FILETRANSFER);
+ out.set("filename", mDestinationDir + "/itworks.txt");
//TODO: Use shared pointers
- AutoClosingQFile* file = new AutoClosingQFile("/home/vaka/KdeConnect.apk"); //Test file to transfer
+ AutoClosingQFile* file = new AutoClosingQFile(QDesktopServices::storageLocation(QDesktopServices::HomeLocation) + "/.bashrc"); //Test file to transfer
- np.setPayload(file);
+ out.setPayload(file);
- device()->sendPackage(np);
+ device()->sendPackage(out);
return true;
- }
- */
+
+ //}
if (np.type() != PACKAGE_TYPE_FILETRANSFER) return false;
+ qDebug() << "file transfer";
+
if (np.hasPayload()) {
+ qDebug() << "receiving file";
QString filename = np.get<QString>("filename");
QIODevice* incoming = np.payload();
FileTransferJob* job = new FileTransferJob(incoming,filename);
--
kdeconnect packaging
More information about the pkg-kde-commits
mailing list