Commit 6e5de6f4 authored by Albert Vaca Cintora's avatar Albert Vaca Cintora

qDebug -> kDebug with namespaces

Added 3 namespaces: kdeconnect_kded, kdeconnect_kcm and libkdeconnect
parent b1c8726c
......@@ -4,8 +4,10 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_SOURCE_DIR}
${CMAKE_BINARY_DIR})
set(kcm_SRCS devicessortproxymodel.cpp
set(kcm_SRCS
kcm.cpp
devicessortproxymodel.cpp
kdebugnamespace.cpp
)
kde4_add_ui_files(kcm_SRCS kcm.ui)
......
......@@ -23,7 +23,7 @@
#include "libkdeconnect/dbusinterfaces.h"
#include "libkdeconnect/devicesmodel.h"
#include <QDebug>
#include "kdebugnamespace.h"
DevicesSortProxyModel::DevicesSortProxyModel(DevicesModel* devicesModel)
: QSortFilterProxyModel(devicesModel)
......
......@@ -28,7 +28,6 @@
#include <QtGui/QListView>
#include <QDBusConnection>
#include <QDBusInterface>
#include <QDebug>
#include <KServiceTypeTrader>
#include <KPluginInfo>
......@@ -38,6 +37,7 @@
#include "ui_kcm.h"
#include "libkdeconnect/dbusinterfaces.h"
#include "devicessortproxymodel.h"
#include "kdebugnamespace.h"
K_PLUGIN_FACTORY(KdeConnectKcmFactory, registerPlugin<KdeConnectKcm>();)
K_EXPORT_PLUGIN(KdeConnectKcmFactory("kdeconnect-kcm", "kdeconnect-kcm"))
......@@ -134,7 +134,6 @@ void KdeConnectKcm::deviceSelected(const QModelIndex& current)
}
}
//FIXME: KPluginSelector has no way to remove a list of plugins and load another, so we need to destroy and recreate it each time
delete kcmUi->pluginSelector;
kcmUi->pluginSelector = new KPluginSelector(this);
......
/**
* Copyright 2013 Albert Vaca <albertvaka@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "kdebugnamespace.h"
int kdeconnect_kcm() {
static int s_area = KDebug::registerArea("kdeconnect_kcm", true);
return s_area;
}
/**
* Copyright 2013 Albert Vaca <albertvaka@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KDEBUG_KDECONNECT_KCM_H
#define KDEBUG_KDECONNECT_KCM_H
#include <KDebug>
int kdeconnect_kcm();
#endif
......@@ -25,6 +25,7 @@ set(kded_kdeconnect_SRCS
filetransferjob.cpp
daemon.cpp
device.cpp
kdebugnamespace.cpp
)
kde4_add_plugin(kded_kdeconnect ${kded_kdeconnect_SRCS})
......
......@@ -29,7 +29,7 @@ DownloadJob::DownloadJob(QHostAddress address, QVariantMap transferInfo): KJob()
void DownloadJob::start()
{
//qDebug() << "DownloadJob Start";
//kDebug(kdeconnect_kded()) << "DownloadJob Start";
mSocket->connectToHost(mAddress, mPort, QIODevice::ReadOnly);
connect(mSocket.data(), SIGNAL(disconnected()),
this, SLOT(disconnected()));
......@@ -38,12 +38,12 @@ void DownloadJob::start()
void DownloadJob::disconnected()
{
//qDebug() << "DownloadJob End";
//kDebug(kdeconnect_kded()) << "DownloadJob End";
emitResult();
}
QSharedPointer<QIODevice> DownloadJob::getPayload()
{
//qDebug() << "getPayload";
//kDebug(kdeconnect_kded()) << "getPayload";
return mSocket.staticCast<QIODevice>();
}
......@@ -81,7 +81,7 @@ void LanDeviceLink::dataReceived()
QByteArray package = mSocketLineReader->readLine();
//qDebug() << "LanDeviceLink dataReceived" << package;
//kDebug(kdeconnect_kded()) << "LanDeviceLink dataReceived" << package;
NetworkPackage unserialized(QString::null);
NetworkPackage::unserialize(package, &unserialized);
......@@ -92,7 +92,7 @@ void LanDeviceLink::dataReceived()
unserialized.decrypt(mPrivateKey, &decrypted);
if (decrypted.hasPayloadTransferInfo()) {
qDebug() << "HasPayloadTransferInfo";
kDebug(kdeconnect_kded()) << "HasPayloadTransferInfo";
DownloadJob* job = new DownloadJob(mSocketLineReader->peerAddress(), decrypted.payloadTransferInfo());
job->start();
decrypted.setPayload(job->getPayload(), decrypted.payloadSize());
......
......@@ -29,6 +29,7 @@
#include <QTcpServer>
#include <QUdpSocket>
#include "../../kdebugnamespace.h"
#include "landevicelink.h"
void LanLinkProvider::configureSocket(QTcpSocket* socket)
......@@ -108,13 +109,13 @@ void LanLinkProvider::newUdpConnection()
NetworkPackage::createIdentityPackage(&np2);
if (np->get<QString>("deviceId") == np2.get<QString>("deviceId")) {
//qDebug() << "Ignoring my own broadcast";
//kDebug(kdeconnect_kded()) << "Ignoring my own broadcast";
return;
}
int tcpPort = np->get<int>("tcpPort",port);
//qDebug() << "Received Udp presentation from" << sender << "asking for a tcp connection on port " << tcpPort;
//kDebug(kdeconnect_kded()) << "Received Udp presentation from" << sender << "asking for a tcp connection on port " << tcpPort;
QTcpSocket* socket = new QTcpSocket(this);
receivedIdentityPackages[socket].np = np;
......@@ -140,7 +141,7 @@ void LanLinkProvider::connectError()
disconnect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(connectError()));
disconnect(socket, SIGNAL(connected()), this, SLOT(connected()));
qDebug() << "Fallback (1), try reverse connection";
kDebug(kdeconnect_kded()) << "Fallback (1), try reverse connection";
NetworkPackage np("");
NetworkPackage::createIdentityPackage(&np);
np.set("tcpPort",tcpPort);
......@@ -160,7 +161,7 @@ void LanLinkProvider::connected()
NetworkPackage* np = receivedIdentityPackages[socket].np;
const QString& id = np->get<QString>("deviceId");
//qDebug() << "Connected" << socket->isWritable();
//kDebug(kdeconnect_kded()) << "Connected" << socket->isWritable();
LanDeviceLink* dl = new LanDeviceLink(id, this, socket);
......@@ -172,7 +173,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) {
//qDebug() << "Handshaking done (i'm the existing device)";
//kDebug(kdeconnect_kded()) << "Handshaking done (i'm the existing device)";
connect(dl, SIGNAL(destroyed(QObject*)),
this, SLOT(deviceLinkDestroyed(QObject*)));
......@@ -192,7 +193,7 @@ void LanLinkProvider::connected()
} else {
//I think this will never happen
qDebug() << "Fallback (2), try reverse connection";
kDebug(kdeconnect_kded()) << "Fallback (2), try reverse connection";
QUdpSocket().writeDatagram(np2.serialize(), receivedIdentityPackages[socket].sender, port);
delete dl;
}
......@@ -206,7 +207,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()
{
//qDebug() << "LanLinkProvider newConnection";
//kDebug(kdeconnect_kded()) << "LanLinkProvider newConnection";
QTcpSocket* socket = mTcpServer->nextPendingConnection();
socket->setSocketOption(QAbstractSocket::KeepAliveOption, 1);
......@@ -218,7 +219,7 @@ void LanLinkProvider::newConnection()
NetworkPackage::createIdentityPackage(&np);
int written = socket->write(np.serialize());
qDebug() << "LanLinkProvider sent package." << written << " bytes written, waiting for reply";
kDebug(kdeconnect_kded()) << "LanLinkProvider sent package." << written << " bytes written, waiting for reply";
*/
}
......@@ -230,7 +231,7 @@ void LanLinkProvider::dataReceived()
QByteArray data = socket->readLine();
//qDebug() << "LanLinkProvider received reply:" << data;
//kDebug(kdeconnect_kded()) << "LanLinkProvider received reply:" << data;
NetworkPackage np("");
bool success = NetworkPackage::unserialize(data,&np);
......@@ -240,7 +241,7 @@ void LanLinkProvider::dataReceived()
const QString& id = np.get<QString>("deviceId");
LanDeviceLink* dl = new LanDeviceLink(id, this, socket);
//qDebug() << "Handshaking done (i'm the new device)";
//kDebug(kdeconnect_kded()) << "Handshaking done (i'm the new device)";
connect(dl, SIGNAL(destroyed(QObject*)),
this, SLOT(deviceLinkDestroyed(QObject*)));
......@@ -261,14 +262,14 @@ void LanLinkProvider::dataReceived()
disconnect(socket,SIGNAL(readyRead()),this,SLOT(dataReceived()));
} else {
qDebug() << "LanLinkProvider/newConnection: Not an identification package (wuh?)";
kDebug(kdeconnect_kded()) << "LanLinkProvider/newConnection: Not an identification package (wuh?)";
}
}
void LanLinkProvider::deviceLinkDestroyed(QObject* uncastedDeviceLink)
{
//qDebug() << "deviceLinkDestroyed";
//kDebug(kdeconnect_kded()) << "deviceLinkDestroyed";
DeviceLink* deviceLink = (DeviceLink*)uncastedDeviceLink;
const QString& id = deviceLink->deviceId();
......
......@@ -20,6 +20,7 @@
#include "socketlinereader.h"
#include "../../kdebugnamespace.h"
SocketLineReader::SocketLineReader(QTcpSocket* socket, QObject* parent)
: QObject(parent)
......@@ -64,7 +65,7 @@ void SocketLineReader::dataReceived()
if (mPackages.length() > 0) {
Q_EMIT readyRead();
} else {
qDebug() << "Received incomplete chunk of data, waiting for more";
kDebug(kdeconnect_kded()) << "Received incomplete chunk of data, waiting for more";
}
}
......
......@@ -19,8 +19,8 @@
*/
#include <qalgorithms.h>
#include <QDebug>
#include "kdebugnamespace.h"
#include "uploadjob.h"
UploadJob::UploadJob(const QSharedPointer<QIODevice>& source): KJob()
......@@ -36,7 +36,7 @@ void UploadJob::start()
while(!mServer->listen(QHostAddress::Any, mPort)) {
mPort++;
if (mPort > 1764) { //No ports available?
qDebug() << "Error opening a port in range 1739-1764 for file transfer";
kDebug(kdeconnect_kded()) << "Error opening a port in range 1739-1764 for file transfer";
mPort = 0;
return;
}
......
......@@ -20,7 +20,7 @@
#include "loopbacklinkprovider.h"
#include <QDebug>
#include "kdebugnamespace.h"
LoopbackLinkProvider::LoopbackLinkProvider()
: identityPackage(PACKAGE_TYPE_IDENTITY)
......@@ -37,7 +37,7 @@ LoopbackLinkProvider::~LoopbackLinkProvider()
void LoopbackLinkProvider::onNetworkChange(QNetworkSession::State state)
{
Q_UNUSED(state);
//qDebug() << "Echo Device discovery emitted";
//kDebug(kdeconnect_kded()) << "Echo Device discovery emitted";
LoopbackDeviceLink* newLoopbackDeviceLink = new LoopbackDeviceLink("loopback", this);
Q_EMIT onConnectionReceived(identityPackage, newLoopbackDeviceLink);
......
......@@ -20,20 +20,19 @@
#include "daemon.h"
#include "networkpackage.h"
#include "backends/lan/lanlinkprovider.h"
#include "backends/loopback/loopbacklinkprovider.h"
#include <QUuid>
#include <QDBusConnection>
#include <QNetworkSession>
#include <QNetworkConfigurationManager>
#include <QDebug>
#include <KConfig>
#include <KConfigGroup>
#include "kdebugnamespace.h"
#include "networkpackage.h"
#include "backends/lan/lanlinkprovider.h"
#include "backends/loopback/loopbacklinkprovider.h"
K_PLUGIN_FACTORY(KdeConnectFactory, registerPlugin<Daemon>();)
K_EXPORT_PLUGIN(KdeConnectFactory("kdeconnect", "kdeconnect"))
......@@ -48,10 +47,10 @@ Daemon::Daemon(QObject *parent, const QList<QVariant>&)
//uuids contain charcaters that are not exportable in dbus paths
uuid = uuid.mid(1, uuid.length() - 2).replace("-", "_");
config->group("myself").writeEntry("id", uuid);
qDebug() << "My id:" << uuid;
kDebug(kdeconnect_kded()) << "My id:" << uuid;
}
//qDebug() << "QCA supported capabilities:" << QCA::supportedFeatures().join(",");
//kDebug(kdeconnect_kded()) << "QCA supported capabilities:" << QCA::supportedFeatures().join(",");
if(!QCA::isSupported("rsa")) {
//TODO: Maybe display this in a more visible way?
qWarning() << "Error: KDE Connect could not find support for RSA in your QCA installation, if your distribution provides"
......@@ -72,7 +71,7 @@ Daemon::Daemon(QObject *parent, const QList<QVariant>&)
}
//Debugging
qDebug() << "Starting KdeConnect daemon";
kDebug(kdeconnect_kded()) << "Starting KdeConnect daemon";
//Load backends (hardcoded by now, should be plugins in a future)
mLinkProviders.insert(new LanLinkProvider());
......@@ -143,14 +142,14 @@ void Daemon::onNewDeviceLink(const NetworkPackage& identityPackage, DeviceLink*
{
const QString& id = identityPackage.get<QString>("deviceId");
//qDebug() << "Device discovered" << id << "via" << dl->provider()->name();
//kDebug(kdeconnect_kded()) << "Device discovered" << id << "via" << dl->provider()->name();
if (mDevices.contains(id)) {
//qDebug() << "It is a known device";
//kDebug(kdeconnect_kded()) << "It is a known device";
Device* device = mDevices[id];
device->addLink(identityPackage, dl);
} else {
//qDebug() << "It is a new device";
//kDebug(kdeconnect_kded()) << "It is a new device";
Device* device = new Device(identityPackage, dl);
connect(device, SIGNAL(reachableStatusChanged()), this, SLOT(onDeviceReachableStatusChanged()));
......@@ -171,12 +170,12 @@ void Daemon::onDeviceReachableStatusChanged()
Q_EMIT deviceVisibilityChanged(id, device->isReachable());
//qDebug() << "Device" << device->name() << "reachable status changed:" << device->isReachable();
//kDebug(kdeconnect_kded()) << "Device" << device->name() << "reachable status changed:" << device->isReachable();
if (!device->isReachable()) {
if (!device->isPaired()) {
qDebug() << "Destroying device" << device->name();
kDebug(kdeconnect_kded()) << "Destroying device" << device->name();
Q_EMIT deviceRemoved(id);
mDevices.remove(id);
device->deleteLater();
......
#include "device.h"
#include <QDBusConnection>
#include <KSharedConfig>
#include <KConfigGroup>
#include <KStandardDirs>
......@@ -8,9 +10,7 @@
#include <KNotification>
#include <KIcon>
#include <QDBusConnection>
#include <QDebug>
#include "kdebugnamespace.h"
#include "plugins/kdeconnectplugin.h"
#include "plugins/pluginloader.h"
#include "backends/devicelink.h"
......@@ -186,7 +186,7 @@ static bool lessThan(DeviceLink* p1, DeviceLink* p2)
void Device::addLink(const NetworkPackage& identityPackage, DeviceLink* link)
{
//qDebug() << "Adding link to" << id() << "via" << link->provider();
//kDebug(kdeconnect_kded()) << "Adding link to" << id() << "via" << link->provider();
m_protocolVersion = identityPackage.get<int>("protocolVersion");
if (m_protocolVersion != NetworkPackage::ProtocolVersion) {
......@@ -236,7 +236,7 @@ void Device::removeLink(DeviceLink* link)
{
m_deviceLinks.removeOne(link);
//qDebug() << "RemoveLink" << m_deviceLinks.size() << "links remaining";
//kDebug(kdeconnect_kded()) << "RemoveLink" << m_deviceLinks.size() << "links remaining";
if (m_deviceLinks.isEmpty()) {
reloadPlugins();
......@@ -264,12 +264,12 @@ void Device::privateReceivedPackage(const NetworkPackage& np)
{
if (np.type() == PACKAGE_TYPE_PAIR) {
//qDebug() << "Pair package";
//kDebug(kdeconnect_kded()) << "Pair package";
bool wantsPair = np.get<bool>("pair");
if (wantsPair == isPaired()) {
qDebug() << "Already" << (wantsPair? "paired":"unpaired");
kDebug(kdeconnect_kded()) << "Already" << (wantsPair? "paired":"unpaired");
if (m_pairStatus == Device::Requested) {
m_pairStatus = Device::NotPaired;
pairingTimer.stop();
......@@ -284,7 +284,7 @@ void Device::privateReceivedPackage(const NetworkPackage& np)
const QString& key = np.get<QString>("publicKey");
m_publicKey = QCA::RSAPublicKey::fromPEM(key);
if (m_publicKey.isNull()) {
qDebug() << "ERROR decoding key";
kDebug(kdeconnect_kded()) << "ERROR decoding key";
if (m_pairStatus == Device::Requested) {
m_pairStatus = Device::NotPaired;
pairingTimer.stop();
......@@ -295,12 +295,12 @@ void Device::privateReceivedPackage(const NetworkPackage& np)
if (m_pairStatus == Device::Requested) { //We started pairing
qDebug() << "Pair answer";
kDebug(kdeconnect_kded()) << "Pair answer";
setAsPaired();
} else {
qDebug() << "Pair request";
kDebug(kdeconnect_kded()) << "Pair request";
KNotification* notification = new KNotification("pingReceived"); //KNotification::Persistent
notification->setPixmap(KIcon("dialog-information").pixmap(48, 48));
......@@ -318,7 +318,7 @@ void Device::privateReceivedPackage(const NetworkPackage& np)
} else {
qDebug() << "Unpair request";
kDebug(kdeconnect_kded()) << "Unpair request";
if (m_pairStatus == Device::Requested) {
pairingTimer.stop();
......@@ -341,7 +341,7 @@ void Device::privateReceivedPackage(const NetworkPackage& np)
}
} else {
//TODO: Notify the other side that we don't trust them
qDebug() << "device" << name() << "not paired, ignoring package" << np.type();
kDebug(kdeconnect_kded()) << "device" << name() << "not paired, ignoring package" << np.type();
}
}
......@@ -359,7 +359,7 @@ bool Device::sendOwnPublicKey()
void Device::rejectPairing()
{
qDebug() << "Rejected pairing";
kDebug(kdeconnect_kded()) << "Rejected pairing";
m_pairStatus = Device::NotPaired;
......@@ -375,7 +375,7 @@ void Device::acceptPairing()
{
if (m_pairStatus != Device::RequestedByPeer) return;
qDebug() << "Accepted pairing";
kDebug(kdeconnect_kded()) << "Accepted pairing";
bool success = sendOwnPublicKey();
......@@ -424,7 +424,7 @@ void Device::sendPing()
{
NetworkPackage np(PACKAGE_TYPE_PING);
bool success = sendPackage(np);
qDebug() << "sendPing:" << success;
kDebug(kdeconnect_kded()) << "sendPing:" << success;
}
Device::DeviceType Device::str2type(QString deviceType) {
......
......@@ -20,10 +20,11 @@
#include "filetransferjob.h"
#include <qalgorithms.h>
#include <KLocalizedString>
#include <QDebug>
#include <qalgorithms.h>
#include "kdebugnamespace.h"
FileTransferJob::FileTransferJob(const QSharedPointer<QIODevice>& origin, int size, const KUrl& destination): KJob()
{
......@@ -36,17 +37,17 @@ FileTransferJob::FileTransferJob(const QSharedPointer<QIODevice>& origin, int si
mOrigin = origin;
mSize = size;
mWritten = 0;
qDebug() << "FileTransferJob Downloading payload to" << destination;
kDebug(kdeconnect_kded()) << "FileTransferJob Downloading payload to" << destination;
}
void FileTransferJob::openFinished(KJob* job)
{
qDebug() << job->errorString();
kDebug(kdeconnect_kded()) << job->errorString();
}
void FileTransferJob::start()
{
//qDebug() << "FileTransferJob start";
//kDebug(kdeconnect_kded()) << "FileTransferJob start";
//Open destination file
mDestination->start();
......@@ -56,10 +57,10 @@ void FileTransferJob::open(KIO::Job* job)
{
Q_UNUSED(job);
//qDebug() << "FileTransferJob open";
//kDebug(kdeconnect_kded()) << "FileTransferJob open";
if (!mOrigin) {
qDebug() << "FileTransferJob: Origin is null";
kDebug(kdeconnect_kded()) << "FileTransferJob: Origin is null";
return;
}
......@@ -80,7 +81,7 @@ void FileTransferJob::readyRead()
mDestination->write(data);
mWritten += bytes;
//qDebug() << "readyRead" << mSize << mWritten << bytes;
//kDebug(kdeconnect_kded()) << "readyRead" << mSize << mWritten << bytes;
if (mSize > -1) {
setPercent((mWritten*100)/mSize);
......@@ -101,12 +102,12 @@ void FileTransferJob::sourceFinished()
//TODO: MD5 check the file
if (mSize > -1 && mWritten != mSize) {
qDebug() << "Received incomplete file";
kDebug(kdeconnect_kded()) << "Received incomplete file";
setError(1);
setErrorText(i18n("Received incomplete file"));
emitResult();
} else {
qDebug() << "Finished transfer" << mDestination->url();
kDebug(kdeconnect_kded()) << "Finished transfer" << mDestination->url();
}
mDestination->close();
mDestination->deleteLater();
......
/**
* Copyright 2013 Albert Vaca <albertvaka@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "kdebugnamespace.h"
int kdeconnect_kded() {
static int s_area = KDebug::registerArea("kdeconnect_kded", true);
return s_area;
}
/**
* Copyright 2013 Albert Vaca <albertvaka@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KDEBUG_KDECONNECT_KDED_H
#define KDEBUG_KDECONNECT_KDED_H
#include <KDebug>
int kdeconnect_kded();
#endif
......@@ -59,7 +59,7 @@ void NetworkPackage::createIdentityPackage(NetworkPackage* np)
np->set("protocolType", "desktop"); //TODO: Detect laptop, tablet, phone...
np->set("protocolVersion", NetworkPackage::ProtocolVersion);
//qDebug() << "createIdentityPackage" << np->serialize();
//kDebug(kdeconnect_kded()) << "createIdentityPackage" << np->serialize();
}
QByteArray NetworkPackage::serialize() const
......@@ -72,7 +72,7 @@ QByteArray NetworkPackage::serialize() const
QVariantMap variant = QJson::QObjectHelper::qobject2qvariant(this);
if (hasPayload()) {
//qDebug() << "Serializing payloadTransferInfo";
//kDebug(kdeconnect_kded()) << "Serializing payloadTransferInfo";
variant["payloadSize"] = 0;
variant["payloadTransferInfo"] = mPayloadTransferInfo;
}
......@@ -82,10 +82,10 @@ QByteArray NetworkPackage::serialize() const
QJson::Serializer serializer;
QByteArray json = serializer.serialize(variant,&ok);
if (!ok) {
qDebug() << "Serialization error:" << serializer.errorMessage();
kDebug(kdeconnect_kded()) << "Serialization error:" << serializer.errorMessage();
} else {
if (!isEncrypted()) {
//qDebug() << "Serialized package:" << json;
//kDebug(kdeconnect_kded()) << "Serialized package:" << json;
}
json.append('\n');
}
......@@ -100,7 +100,7 @@ bool NetworkPackage::unserialize(const QByteArray& a, NetworkPackage* np)
bool ok;
QVariantMap variant = parser.parse(a, &ok).toMap();
if (!ok) {
qDebug() << "Unserialization error:" << a;
kDebug(kdeconnect_kded()) << "Unserialization error:" << a;
return false;
}
......@@ -108,7 +108,7 @@ bool NetworkPackage::unserialize(const QByteArray& a, NetworkPackage* np)
QJson::QObjectHelper::qvariant2qobject(variant, np);
if (!np->isEncrypted()) {
//qDebug() << "Unserialized: " << a;
//kDebug(kdeconnect_kded()) << "Unserialized: " << a;
}
np->mPayloadSize = variant["payloadSize"].toInt(); //Will return 0 if was not present, which is ok
......@@ -133,7 +133,7 @@ void NetworkPackage::encrypt(QCA::PublicKey& key)
chunks.append( encryptedChunk.toBase64() );
}
//qDebug() << chunks.size() << "chunks";
//kDebug(kdeconnect_kded()) << chunks.size() << "chunks";
mId = QString::number(QDateTime::currentMSecsSinceEpoch());
mType = PACKAGE_TYPE_ENCRYPTED;
......
......@@ -23,19 +23,18 @@
#include "networkpackagetypes.h"
#include <KUrl>
#include <QObject>
#include <QDebug>
#include <QString>
#include <QVariant>
#include <QStringList>
#include <QIODevice>
#include <QtCrypto>
#include <QSharedPointer>
#include <qjson/parser.h>
#include <KUrl>
#include "kdebugnamespace.h"
#include "default_args.h"
class FileTransferJob;
......
......@@ -19,6 +19,7 @@ set(kdeconnect_battery_SRCS
../../networkpackage.cpp
../../filetransferjob.cpp
../../device.cpp
../../kdebugnamespace.cpp
)
kde4_add_plugin(kdeconnect_battery ${kdeconnect_battery_SRCS})
......
......@@ -20,7 +20,7 @@
#include "batterydbusinterface.h"
#include <QDebug>
#include "../../kdebugnamespace.h"
BatteryDbusInterface::BatteryDbusInterface(QObject *parent)
: QDBusAbstractAdaptor(parent)
......@@ -29,7 +29,7 @@ BatteryDbusInterface::BatteryDbusInterface(QObject *parent)