Commit 3fde1bc8 authored by YANG Qiao's avatar YANG Qiao
Browse files

uncomment all kdebugs and fix some syntax error

parent c935ea83
......@@ -19,6 +19,8 @@
*/
#include "downloadjob.h"
#include "../../kdebugnamespace.h"
DownloadJob::DownloadJob(QHostAddress address, QVariantMap transferInfo): KJob()
{
......@@ -29,7 +31,7 @@ DownloadJob::DownloadJob(QHostAddress address, QVariantMap transferInfo): KJob()
void DownloadJob::start()
{
//kDebug(kdeconnect_kded()) << "DownloadJob Start";
kDebug(debugArea()) << "DownloadJob Start";
mSocket->connectToHost(mAddress, mPort, QIODevice::ReadOnly);
connect(mSocket.data(), SIGNAL(disconnected()),
this, SLOT(disconnected()));
......@@ -38,12 +40,12 @@ void DownloadJob::start()
void DownloadJob::disconnected()
{
//kDebug(kdeconnect_kded()) << "DownloadJob End";
kDebug(debugArea()) << "DownloadJob End";
emitResult();
}
QSharedPointer<QIODevice> DownloadJob::getPayload()
{
//kDebug(kdeconnect_kded()) << "getPayload";
kDebug(debugArea()) << "getPayload";
return mSocket.staticCast<QIODevice>();
}
......@@ -29,6 +29,8 @@
#include "uploadjob.h"
#include "downloadjob.h"
#include "socketlinereader.h"
#include "../../kdebugnamespace.h"
LanDeviceLink::LanDeviceLink(const QString& d, LinkProvider* a, QTcpSocket* socket)
: DeviceLink(d, a)
......@@ -80,7 +82,7 @@ void LanDeviceLink::dataReceived()
const QByteArray package = mSocketLineReader->readLine();
//kDebug(debugArea()) << "LanDeviceLink dataReceived" << package;
kDebug(debugArea()) << "LanDeviceLink dataReceived" << package;
NetworkPackage unserialized(QString::null);
NetworkPackage::unserialize(package, &unserialized);
......
......@@ -70,7 +70,7 @@ void LanLinkProvider::onStart()
{
bool buildSucceed = mUdpServer->bind(QHostAddress::Any, port, QUdpSocket::ShareAddress);
Q_ASSERT(buildSucceed);
Q_UNUSED(buildSucceed);
mTcpPort = port;
while (!mTcpServer->listen(QHostAddress::Any, mTcpPort)) {
mTcpPort++;
......@@ -127,13 +127,13 @@ void LanLinkProvider::newUdpConnection()
NetworkPackage::createIdentityPackage(&np2);
if (receivedPackage->get<QString>("deviceId") == np2.get<QString>("deviceId")) {
//kDebug(kdeconnect_kded()) << "Ignoring my own broadcast";
kDebug(debugArea()) << "Ignoring my own broadcast";
return;
}
int tcpPort = receivedPackage->get<int>("tcpPort", port);
//kDebug(kdeconnect_kded()) << "Received Udp presentation from" << sender << "asking for a tcp connection on port " << tcpPort;
kDebug(debugArea()) << "Received Udp presentation from" << sender << "asking for a tcp connection on port " << tcpPort;
QTcpSocket* socket = new QTcpSocket(this);
receivedIdentityPackages[socket].np = receivedPackage;
......@@ -173,7 +173,7 @@ void LanLinkProvider::connected()
NetworkPackage* receivedPackage = receivedIdentityPackages[socket].np;
const QString& deviceId = receivedPackage->get<QString>("deviceId");
//kDebug(debugArea()) << "Connected" << socket->isWritable();
kDebug(debugArea()) << "Connected" << socket->isWritable();
LanDeviceLink* deviceLink = new LanDeviceLink(deviceId, this, socket);
......@@ -185,7 +185,7 @@ void LanLinkProvider::connected()
//TODO: Use reverse connection too to preffer connecting a unstable device (a phone) to a stable device (a computer)
if (success) {
//kDebug(debugArea()) << "Handshaking done (i'm the existing device)";
kDebug(debugArea()) << "Handshaking done (i'm the existing device)";
connect(deviceLink, SIGNAL(destroyed(QObject*)),
this, SLOT(deviceLinkDestroyed(QObject*)));
......@@ -220,7 +220,7 @@ void LanLinkProvider::connected()
//I'm the new device and this is the answer to my UDP introduction (no data received yet)
void LanLinkProvider::newConnection()
{
//kDebug(debugArea()) << "LanLinkProvider newConnection";
kDebug(debugArea()) << "LanLinkProvider newConnection";
while(mTcpServer->hasPendingConnections()) {
QTcpSocket* socket = mTcpServer->nextPendingConnection();
......@@ -246,7 +246,7 @@ void LanLinkProvider::dataReceived()
const QByteArray data = socket->readLine();
//kDebug(debugArea()) << "LanLinkProvider received reply:" << data;
kDebug(debugArea()) << "LanLinkProvider received reply:" << data;
NetworkPackage np("");
bool success = NetworkPackage::unserialize(data, &np);
......@@ -259,7 +259,7 @@ void LanLinkProvider::dataReceived()
const QString& deviceId = np.get<QString>("deviceId");
LanDeviceLink* deviceLink = new LanDeviceLink(deviceId, this, socket);
//kDebug(debugArea()) << "Handshaking done (i'm the new device)";
kDebug(debugArea()) << "Handshaking done (i'm the new device)";
connect(deviceLink, SIGNAL(destroyed(QObject*)),
this, SLOT(deviceLinkDestroyed(QObject*)));
......@@ -282,7 +282,7 @@ void LanLinkProvider::dataReceived()
void LanLinkProvider::deviceLinkDestroyed(QObject* destroyedDeviceLink)
{
//kDebug(debugArea()) << "deviceLinkDestroyed";
kDebug(debugArea()) << "deviceLinkDestroyed";
const QString id = destroyedDeviceLink->property("deviceId").toString();
QMap< QString, DeviceLink* >::iterator oldLinkIterator = mLinks.find(id);
if (oldLinkIterator != mLinks.end() && oldLinkIterator.value() == destroyedDeviceLink) {
......
......@@ -22,6 +22,8 @@
#include "kdebugnamespace.h"
#include "uploadjob.h"
#include "../../kdebugnamespace.h"
UploadJob::UploadJob(const QSharedPointer<QIODevice>& source): KJob()
{
......
......@@ -37,7 +37,7 @@ LoopbackLinkProvider::~LoopbackLinkProvider()
void LoopbackLinkProvider::onNetworkChange(QNetworkSession::State state)
{
Q_UNUSED(state);
//kDebug(kdeconnect_kded()) << "Echo Device discovery emitted";
kDebug(debugArea()) << "Echo Device discovery emitted";
LoopbackDeviceLink* newLoopbackDeviceLink = new LoopbackDeviceLink("loopback", this);
Q_EMIT onConnectionReceived(identityPackage, newLoopbackDeviceLink);
......
......@@ -72,7 +72,7 @@ Daemon::Daemon(QObject *parent)
kDebug(debugArea()) << "My id:" << uuid;
}
//kDebug(debugArea()) << "QCA supported capabilities:" << QCA::supportedFeatures().join(",");
kDebug(debugArea()) << "QCA supported capabilities:" << QCA::supportedFeatures().join(",");
if(!QCA::isSupported("rsa")) {
//TODO: Maybe display this in a more visible way?
kWarning(debugArea()) << "Error: KDE Connect could not find support for RSA in your QCA installation, if your distribution provides"
......@@ -185,14 +185,14 @@ void Daemon::onNewDeviceLink(const NetworkPackage& identityPackage, DeviceLink*
const QString& id = identityPackage.get<QString>("deviceId");
//kDebug(debugArea()) << "Device discovered" << id << "via" << dl->provider()->name();
kDebug(debugArea()) << "Device discovered" << id << "via" << dl->provider()->name();
if (d->mDevices.contains(id)) {
//kDebug(debugArea()) << "It is a known device";
kDebug(debugArea()) << "It is a known device";
Device* device = d->mDevices[id];
device->addLink(identityPackage, dl);
} else {
//kDebug(debugArea()) << "It is a new device";
kDebug(debugArea()) << "It is a new device";
Device* device = new Device(this, identityPackage, dl);
connect(device, SIGNAL(reachableStatusChanged()), this, SLOT(onDeviceReachableStatusChanged()));
......@@ -213,7 +213,7 @@ void Daemon::onDeviceReachableStatusChanged()
Q_EMIT deviceVisibilityChanged(id, device->isReachable());
//kDebug(debugArea()) << "Device" << device->name() << "reachable status changed:" << device->isReachable();
kDebug(debugArea()) << "Device" << device->name() << "reachable status changed:" << device->isReachable();
if (!device->isReachable()) {
......
......@@ -233,7 +233,7 @@ static bool lessThan(DeviceLink* p1, DeviceLink* p2)
void Device::addLink(const NetworkPackage& identityPackage, DeviceLink* link)
{
//kDebug(debugArea()) << "Adding link to" << id() << "via" << link->provider();
kDebug(debugArea()) << "Adding link to" << id() << "via" << link->provider();
m_protocolVersion = identityPackage.get<int>("protocolVersion");
if (m_protocolVersion != NetworkPackage::ProtocolVersion) {
......@@ -280,7 +280,7 @@ void Device::removeLink(DeviceLink* link)
{
m_deviceLinks.removeOne(link);
//kDebug(debugArea()) << "RemoveLink" << m_deviceLinks.size() << "links remaining";
kDebug(debugArea()) << "RemoveLink" << m_deviceLinks.size() << "links remaining";
if (m_deviceLinks.isEmpty()) {
reloadPlugins();
......@@ -313,7 +313,7 @@ void Device::privateReceivedPackage(const NetworkPackage& np)
{
if (np.type() == PACKAGE_TYPE_PAIR) {
//kDebug(debugArea()) << "Pair package";
kDebug(debugArea()) << "Pair package";
bool wantsPair = np.get<bool>("pair");
......
......@@ -52,7 +52,7 @@ void FileTransferJob::openFinished(KJob* job)
void FileTransferJob::start()
{
QMetaObject::invokeMethod(this, "doStart", Qt::QueuedConnection);
//kDebug(debugArea()) << "FileTransferJob start";
kDebug(debugArea()) << "FileTransferJob start";
}
void FileTransferJob::doStart()
......@@ -136,7 +136,7 @@ void FileTransferJob::open(KIO::Job* job)
{
Q_UNUSED(job);
//kDebug(debugArea()) << "FileTransferJob open";
kDebug(debugArea()) << "FileTransferJob open";
if (!mOrigin) {
kDebug(debugArea()) << "FileTransferJob: Origin is null";
......@@ -161,7 +161,7 @@ void FileTransferJob::readyRead()
mWritten += data.size();
setProcessedAmount(Bytes, mWritten);
//kDebug(debugArea()) << "readyRead" << mSize << mWritten << bytes;
kDebug(debugArea()) << "readyRead" << mSize << mWritten << bytes;
if (mSize > -1) {
//If a least 1 second has passed since last update
......
......@@ -33,6 +33,7 @@
#include <qjson/qobjecthelper.h>
#include "filetransferjob.h"
#include "kdebugnamespace.h"
const QCA::EncryptionAlgorithm NetworkPackage::EncryptionAlgorithm = QCA::EME_PKCS1v15;
const int NetworkPackage::ProtocolVersion = 5;
......@@ -59,7 +60,7 @@ void NetworkPackage::createIdentityPackage(NetworkPackage* np)
np->set("protocolType", "desktop"); //TODO: Detect laptop, tablet, phone...
np->set("protocolVersion", NetworkPackage::ProtocolVersion);
//kDebug(kdeconnect_kded()) << "createIdentityPackage" << np->serialize();
kDebug(debugArea()) << "createIdentityPackage" << np->serialize();
}
QByteArray NetworkPackage::serialize() const
......@@ -72,7 +73,7 @@ QByteArray NetworkPackage::serialize() const
QVariantMap variant = QJson::QObjectHelper::qobject2qvariant(this);
if (hasPayload()) {
//kDebug(kdeconnect_kded()) << "Serializing payloadTransferInfo";
kDebug(debugArea()) << "Serializing payloadTransferInfo";
variant["payloadSize"] = payloadSize();
variant["payloadTransferInfo"] = mPayloadTransferInfo;
}
......@@ -85,7 +86,7 @@ QByteArray NetworkPackage::serialize() const
kDebug(debugArea()) << "Serialization error:" << serializer.errorMessage();
} else {
if (!isEncrypted()) {
//kDebug(kDebugArea) << "Serialized package:" << json;
kDebug(debugArea()) << "Serialized package:" << json;
}
json.append('\n');
}
......@@ -108,7 +109,7 @@ bool NetworkPackage::unserialize(const QByteArray& a, NetworkPackage* np)
QJson::QObjectHelper::qvariant2qobject(variant, np);
if (!np->isEncrypted()) {
//kDebug(kDebugArea) << "Unserialized: " << a;
kDebug(debugArea()) << "Unserialized: " << a;
}
np->mPayloadSize = variant["payloadSize"].toInt(); //Will return 0 if was not present, which is ok
......@@ -136,7 +137,7 @@ void NetworkPackage::encrypt(QCA::PublicKey& key)
chunks.append( encryptedChunk.toBase64() );
}
//kDebug(kdeconnect_kded()) << chunks.size() << "chunks";
kDebug(debugArea()) << chunks.size() << "chunks";
mId = QString::number(QDateTime::currentMSecsSinceEpoch());
mType = PACKAGE_TYPE_ENCRYPTED;
......
......@@ -42,7 +42,7 @@ void ClipboardPlugin::clipboardChanged(QClipboard::Mode mode)
ignore_next_clipboard_change = false;
return;
}
//kDebug(kdeconnect_kded()) << "ClipboardChanged";
kDebug(debugArea()) << "ClipboardChanged";
NetworkPackage np(PACKAGE_TYPE_CLIPBOARD);
np.set("content",clipboard->text());
sendPackage(np);
......
......@@ -34,12 +34,12 @@ K_EXPORT_PLUGIN( KdeConnectPluginFactory("kdeconnect_ping", "kdeconnect-plugins"
PingPlugin::PingPlugin(QObject* parent, const QVariantList& args)
: KdeConnectPlugin(parent, args)
{
//kDebug(debugArea()) << "Ping plugin constructor for device" << device()->name();
kDebug(debugArea()) << "Ping plugin constructor for device" << device()->name();
}
PingPlugin::~PingPlugin()
{
//kDebug(debugArea()) << "Ping plugin destructor for device" << device()->name();
kDebug(debugArea()) << "Ping plugin destructor for device" << device()->name();
}
bool PingPlugin::receivePackage(const NetworkPackage& np)
......
......@@ -86,7 +86,7 @@ bool SharePlugin::receivePackage(const NetworkPackage& np)
kDebug(debugArea()) << "File transfer";
if (np.hasPayload()) {
//kDebug(debugArea()) << "receiving file";
kDebug(debugArea()) << "receiving file";
QString filename = np.get<QString>("filename", QString::number(QDateTime::currentMSecsSinceEpoch()));
KUrl destination = destinationDir();
destination.addPath(filename);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment