From 7bbf49cc61bcffe1ab66af70fe345e4d4b011249 Mon Sep 17 00:00:00 2001 From: l10n daemon script Date: Sat, 21 Jun 2014 04:25:08 +0000 Subject: [PATCH 01/31] SVN_SILENT made messages (.desktop file) --- plasmoid/package/metadata.desktop | 42 +++++++++++++++---------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/plasmoid/package/metadata.desktop b/plasmoid/package/metadata.desktop index 0418a225a..02c559ee6 100644 --- a/plasmoid/package/metadata.desktop +++ b/plasmoid/package/metadata.desktop @@ -1,27 +1,27 @@ [Desktop Entry] Name=KDE Connect -Name[bg]=KdeConnect -Name[bs]=Kde konekcija -Name[ca]=KdeConnect -Name[cs]=KdeConnect -Name[da]=KdeConnect -Name[de]=KdeConnect -Name[es]=KdeConnect -Name[fr]=KdeConnect -Name[hu]=KdeConnect -Name[it]=KdeConnect -Name[ko]=KdeConnect -Name[nl]=KdeConnect -Name[pl]=KdeConnect -Name[pt]=KDEConnect -Name[pt_BR]=KdeConnect -Name[ro]=KdeConnect -Name[ru]=KdeConnect -Name[sk]=KdeConnect +Name[bg]=KDE Connect +Name[bs]=Konekcija KDE +Name[ca]=KDE Connect +Name[cs]=KDE Connect +Name[da]=KDE Connect +Name[de]=KDE-Connect +Name[es]=KDE Connect +Name[fr]=KDE Connect +Name[hu]=KDE csatlakozás +Name[it]=KDE Connect +Name[ko]=KDE Connect +Name[nl]=KDE Connect +Name[pl]=KDE Connect +Name[pt]=KDE Connect +Name[pt_BR]=KDE Connect +Name[ro]=KDE Connect +Name[ru]=KDE Connect +Name[sk]=KDE Connect Name[sv]=KDE anslut -Name[tr]=KdeConnect -Name[uk]=KdeConnect -Name[x-test]=xxKdeConnectxx +Name[tr]=KDE Bağlan +Name[uk]=З’єднання KDE +Name[x-test]=xxKDE Connectxx Comment=Show notifications from your devices using KDE Connect Comment[bg]=Показване на уведомления от вашите устройства чрез KDE Connect Comment[bs]=Prikaži obavlještenja sa uređaja koji koriste KDE konekciju From 9ec74a8834f75aa34f2470a36c3d1e93ca079319 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Mon, 23 Jun 2014 17:30:23 +0200 Subject: [PATCH 02/31] The clipboard plugin also needs to send clipboard packages Note that kbuildsycoca4 needs to be run after the change. CCMAIL: albertvaka@gmail.com --- plugins/clipboard/kdeconnect_clipboard.desktop | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/clipboard/kdeconnect_clipboard.desktop b/plugins/clipboard/kdeconnect_clipboard.desktop index 8f976d41b..4f3330618 100644 --- a/plugins/clipboard/kdeconnect_clipboard.desktop +++ b/plugins/clipboard/kdeconnect_clipboard.desktop @@ -59,3 +59,5 @@ Comment[uk]=Спільне використання буфера обміну д Comment[x-test]=xxShare the clipboard between devicesxx X-KdeConnect-SupportedPackageType=kdeconnect.clipboard +X-KdeConnect-OutgoingPackageType=kdeconnect.clipboard + From dc2f9c0f3ca4b1cbb061045ae7ac8741882d8e5e Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Mon, 23 Jun 2014 18:13:43 +0200 Subject: [PATCH 03/31] Introduce a IsPaired role in the DevicesModel Reviewed by Albert Vaca --- interfaces/devicesmodel.cpp | 2 ++ interfaces/devicesmodel.h | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/interfaces/devicesmodel.cpp b/interfaces/devicesmodel.cpp index 8242107cb..479a1d169 100644 --- a/interfaces/devicesmodel.cpp +++ b/interfaces/devicesmodel.cpp @@ -170,6 +170,8 @@ QVariant DevicesModel::data(const QModelIndex& index, int role) const } case IconNameRole: return device->iconName(); + case IsPairedRole: + return QVariant::fromValue(device->isPaired()); default: return QVariant(); } diff --git a/interfaces/devicesmodel.h b/interfaces/devicesmodel.h index 15bcb6734..e8e6590ff 100644 --- a/interfaces/devicesmodel.h +++ b/interfaces/devicesmodel.h @@ -44,7 +44,8 @@ public: IconModelRole = Qt::DecorationRole, StatusModelRole = Qt::InitialSortOrderRole, IdModelRole = Qt::UserRole, - IconNameRole + IconNameRole, + IsPairedRole }; enum StatusFlags { StatusUnknown = 0x00, From 02e18a97593af05fb1e8838eb7a146c2a15e9fa3 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Mon, 23 Jun 2014 18:15:10 +0200 Subject: [PATCH 04/31] Extend kdeconnect-cli Make it show whether devices are paired. Let it un/pair devices. Reviewed by Albert Vaca --- cli/kdeconnect-cli.cpp | 42 +++++++++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/cli/kdeconnect-cli.cpp b/cli/kdeconnect-cli.cpp index 184ef7e66..d7f0da331 100644 --- a/cli/kdeconnect-cli.cpp +++ b/cli/kdeconnect-cli.cpp @@ -23,20 +23,23 @@ #include #include #include +#include #include #include #include int main(int argc, char** argv) { - KAboutData about("kctool", "kdeconnect-cli", ki18n(("kctool")), "1.0", ki18n("KDE Connect CLI tool"), + KAboutData about("kdeconnect-cli", "kdeconnect-cli", ki18n(("kdeconnect-cli")), "1.0", ki18n("KDE Connect CLI tool"), KAboutData::License_GPL, ki18n("(C) 2013 Aleix Pol Gonzalez")); about.addAuthor( ki18n("Aleix Pol Gonzalez"), KLocalizedString(), "aleixpol@kde.org" ); KCmdLineArgs::init(argc, argv, &about); KCmdLineOptions options; options.add("l") .add("list-devices", ki18n("List all devices")); - options.add("share ", ki18n("Share a file")); + options.add("share ", ki18n("Share a file to a said device")); + options.add("pair", ki18n("Request pairing to a said device")); + options.add("unpair", ki18n("Stop pairing to a said device")); options.add("device ", ki18n("Device ID")); KCmdLineArgs::addCmdLineOptions( options ); KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); @@ -46,8 +49,10 @@ int main(int argc, char** argv) devices.setDisplayFilter(DevicesModel::StatusUnknown); for(int i=0, rows=devices.rowCount(); iisSet("share")) { url = args->makeURL(args->getOption("share").toLatin1()); - } - args->clear(); - - if(!url.isEmpty() && !device.isEmpty()) { - QDBusMessage msg = QDBusMessage::createMethodCall("org.kde.kdeconnect", "/modules/kdeconnect/devices/"+device+"/share", "org.kde.kdeconnect.device.share", "shareUrl"); - msg.setArguments(QVariantList() << url.toString()); - - QDBusConnection::sessionBus().call(msg); + args->clear(); + if(!url.isEmpty() && !device.isEmpty()) { + QDBusMessage msg = QDBusMessage::createMethodCall("org.kde.kdeconnect", "/modules/kdeconnect/devices/"+device+"/share", "org.kde.kdeconnect.device.share", "shareUrl"); + msg.setArguments(QVariantList() << url.toString()); + QDBusConnection::sessionBus().call(msg); + } else + KCmdLineArgs::usageError(i18n("Couldn't share %1", url.toString())); + } else if(args->isSet("pair")) { + DeviceDbusInterface dev(device); + if(dev.isPaired()) + std::cout << "Already paired" << std::endl; + else { + QDBusPendingReply req = dev.requestPair(); + req.waitForFinished(); + } + } else if(args->isSet("unpair")) { + DeviceDbusInterface dev(device); + if(!dev.isPaired()) + std::cout << "Already not paired" << std::endl; + else { + QDBusPendingReply req = dev.unpair(); + req.waitForFinished(); + } } else KCmdLineArgs::usageError(i18n("Nothing to be done with the device")); } From 7cbd1c0d578e69b89c3e4d2b521c763f8fe1b8d3 Mon Sep 17 00:00:00 2001 From: l10n daemon script Date: Tue, 24 Jun 2014 05:03:52 +0000 Subject: [PATCH 05/31] SVN_SILENT made messages (.desktop file) --- fileitemactionplugin/kdeconnectsendfile.desktop | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fileitemactionplugin/kdeconnectsendfile.desktop b/fileitemactionplugin/kdeconnectsendfile.desktop index 79edbc246..0c9b804c5 100644 --- a/fileitemactionplugin/kdeconnectsendfile.desktop +++ b/fileitemactionplugin/kdeconnectsendfile.desktop @@ -2,6 +2,7 @@ Type=Service Name=Send file via KDE Connect service Name[ca]=Envia un fitxer a través del servei KDE Connect +Name[cs]=Poslat soubor přes službu KDE Connect Name[es]=Enviar archivo usando el servicio KDE Connect Name[hu]=Fájl küldése a KDE csatlakozás szolgáltatáson keresztül Name[nl]=Bestand via de service KDE Connect versturen @@ -15,6 +16,7 @@ Name[x-test]=xxSend file via KDE Connect servicexx X-KDE-Library=kdeconnectfiletiemaction X-KDE-Submenu=Connect X-KDE-Submenu[ca]=Connecta +X-KDE-Submenu[cs]=Připojit X-KDE-Submenu[es]=Conectar X-KDE-Submenu[hu]=Csatlakozás X-KDE-Submenu[nl]=Verbinden From ec9317e7ef5c322d87cf502dad5262b05e9e5c4f Mon Sep 17 00:00:00 2001 From: Christophe Giboudeaux Date: Tue, 24 Jun 2014 22:40:23 +0200 Subject: [PATCH 06/31] Fix build with older CMake versions. --- core/CMakeLists.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index e722ebab5..60cd81547 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -28,10 +28,7 @@ set(kded_kdeconnect_SRCS kde4_add_library(kdeconnectcore SHARED ${kded_kdeconnect_SRCS}) target_link_libraries(kdeconnectcore -PUBLIC ${KDE4_KDECORE_LIBS} - -PRIVATE ${KDE4_KIO_LIBS} ${QJSON_LIBRARIES} ${QT_QTNETWORK_LIBRARY} From 5a91db4427ebfb0b1233aab4a9e1b0deccd38f77 Mon Sep 17 00:00:00 2001 From: Christophe Giboudeaux Date: Tue, 24 Jun 2014 23:27:46 +0200 Subject: [PATCH 07/31] Use the compat link_public/link_private keywords instead. Just removing the public/private keywords uncovers some other build errors. --- core/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 60cd81547..4afa69f86 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -28,7 +28,9 @@ set(kded_kdeconnect_SRCS kde4_add_library(kdeconnectcore SHARED ${kded_kdeconnect_SRCS}) target_link_libraries(kdeconnectcore +LINK_PUBLIC ${KDE4_KDECORE_LIBS} +LINK_PRIVATE ${KDE4_KIO_LIBS} ${QJSON_LIBRARIES} ${QT_QTNETWORK_LIBRARY} From 2df8a8064feb15e9570660d0375b58fa084f570d Mon Sep 17 00:00:00 2001 From: Raphael Kubo da Costa Date: Sun, 22 Jun 2014 14:17:16 +0300 Subject: [PATCH 08/31] LanLinkProvider: Bind the UDP server socket to Any, not Broadcast. Trying to bind a UDP socket to 255.255.255.255 fails with EADDRNOTAVAIL at least on FreeBSD. The sender side on Android should send its message in broadcast mode (as it already does), but the receiver side should bind to INADDR_ANY, not INADDR_BROADCAST. BUG: 324769 REVIEW: 118870 --- core/backends/lan/lanlinkprovider.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/backends/lan/lanlinkprovider.cpp b/core/backends/lan/lanlinkprovider.cpp index 2369dc448..13855ffb8 100644 --- a/core/backends/lan/lanlinkprovider.cpp +++ b/core/backends/lan/lanlinkprovider.cpp @@ -68,7 +68,7 @@ LanLinkProvider::LanLinkProvider() void LanLinkProvider::onStart() { - bool buildSucceed = mUdpServer->bind(QHostAddress::Broadcast, port, QUdpSocket::ShareAddress); + bool buildSucceed = mUdpServer->bind(QHostAddress::Any, port, QUdpSocket::ShareAddress); Q_ASSERT(buildSucceed); mTcpPort = port; From d14b4411cd0bccf50e4b56962cc2d19b52c6da24 Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Khalil Date: Fri, 27 Jun 2014 15:41:47 +0200 Subject: [PATCH 09/31] Implementation of mousepad plugin CCMAIL: ahmedibrahimkhali@gmail.com --- cmake/FindXTest.cmake | 48 +++++++++++++++ plugins/CMakeLists.txt | 1 + plugins/mousepad/CMakeLists.txt | 15 +++++ plugins/mousepad/README | 5 ++ plugins/mousepad/kdeconnect_mousepad.desktop | 62 +++++++++++++++++++ plugins/mousepad/mousepadplugin.cpp | 65 ++++++++++++++++++++ plugins/mousepad/mousepadplugin.h | 43 +++++++++++++ 7 files changed, 239 insertions(+) create mode 100644 cmake/FindXTest.cmake create mode 100644 plugins/mousepad/CMakeLists.txt create mode 100644 plugins/mousepad/README create mode 100644 plugins/mousepad/kdeconnect_mousepad.desktop create mode 100644 plugins/mousepad/mousepadplugin.cpp create mode 100644 plugins/mousepad/mousepadplugin.h diff --git a/cmake/FindXTest.cmake b/cmake/FindXTest.cmake new file mode 100644 index 000000000..0c3cd1af0 --- /dev/null +++ b/cmake/FindXTest.cmake @@ -0,0 +1,48 @@ +# - Find XTEST +# Find the XTEST libraries +# +# This module defines the following variables: +# XTEST_FOUND - true if XTEST_INCLUDE_DIR & XTEST_LIBRARY are found +# XTEST_LIBRARIES - Set when XTEST_LIBRARY is found +# XTEST_INCLUDE_DIRS - Set when XTEST_INCLUDE_DIR is found +# +# XTEST_INCLUDE_DIR - where to find XTest.h, etc. +# XTEST_LIBRARY - the XTEST library +# + +#============================================================================= +# Copyright 2011 O.S. Systems Software Ltda. +# Copyright 2011 Otavio Salvador +# Copyright 2011 Marc-Andre Moreau +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#============================================================================= + +find_path(XTEST_INCLUDE_DIR NAMES X11/extensions/XTest.h + PATH_SUFFIXES X11/extensions + DOC "The XTest include directory" +) + +find_library(XTEST_LIBRARY NAMES Xtst + DOC "The XTest library" +) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(XTest DEFAULT_MSG XTEST_LIBRARY XTEST_INCLUDE_DIR) + +if(XTEST_FOUND) + set( XTEST_LIBRARIES ${XTEST_LIBRARY} ) + set( XTEST_INCLUDE_DIRS ${XTEST_INCLUDE_DIR} ) +endif() + +mark_as_advanced(XTEST_INCLUDE_DIR XTEST_LIBRARY) diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index e4eeb0e8d..f50335ab2 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -7,6 +7,7 @@ add_subdirectory(mpriscontrol) add_subdirectory(clipboard) add_subdirectory(telephony) add_subdirectory(battery) +add_subdirectory(mousepad) add_subdirectory(share) add_subdirectory(notifications) add_subdirectory(sftp) diff --git a/plugins/mousepad/CMakeLists.txt b/plugins/mousepad/CMakeLists.txt new file mode 100644 index 000000000..848b76ed6 --- /dev/null +++ b/plugins/mousepad/CMakeLists.txt @@ -0,0 +1,15 @@ +set(kdeconnect_mousepad_SRCS + mousepadplugin.cpp +) + +find_package(XTest REQUIRED) +find_package(X11 REQUIRED) + +kde4_add_plugin(kdeconnect_mousepad ${kdeconnect_mousepad_SRCS}) + +include_directories(${XTEST_INCLUDE_DIRS} ${X11_INCLUDE_DIR}) + +target_link_libraries(kdeconnect_mousepad kdeconnectcore ${QT_QTGUI_LIBRARY} ${X11_LIBRARIES} ${XTEST_LIBRARIES}) + +install(TARGETS kdeconnect_mousepad DESTINATION ${PLUGIN_INSTALL_DIR} ) +install(FILES kdeconnect_mousepad.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) diff --git a/plugins/mousepad/README b/plugins/mousepad/README new file mode 100644 index 000000000..14a0e569f --- /dev/null +++ b/plugins/mousepad/README @@ -0,0 +1,5 @@ + +When the user moves his on the phone, dx and dy (The difference between the last movement and the current movement of the X and Y Axis respectively) +is sent inside a NetworkPackage QCursor is used to move mouse cursor according to its relative position. + +When the user tap or double taps his phone, a mouse key button is simulated using XTestFakeButtonEvent diff --git a/plugins/mousepad/kdeconnect_mousepad.desktop b/plugins/mousepad/kdeconnect_mousepad.desktop new file mode 100644 index 000000000..531a65d3d --- /dev/null +++ b/plugins/mousepad/kdeconnect_mousepad.desktop @@ -0,0 +1,62 @@ +[Desktop Entry] +Encoding=UTF-8 +Type=Service +ServiceTypes=KdeConnect/Plugin +X-KDE-Library=kdeconnect_mousepad +X-KDE-PluginInfo-Author=Ahmed I. Khalil +X-KDE-PluginInfo-Email=ahmedibrahimkhali@gmail.com +X-KDE-PluginInfo-Name=kdeconnect_mousepad +X-KDE-PluginInfo-Version=0.1 +X-KDE-PluginInfo-License=GPL +X-KDE-PluginInfo-EnabledByDefault=true +Icon=input-mouse +Name=Mousepad +Name[bg]=Буфер за обмен +Name[bs]=Mousepad +Name[ca]=Porta-retalls +Name[cs]=Schránka +Name[da]=Udklipsholder +Name[de]=Zwischenablage +Name[es]=Portapapeles +Name[fr]=Presse-papiers +Name[hu]=Vágólap +Name[it]=Appunti +Name[ko]=클립보드 +Name[nl]=Klembord +Name[pl]=Schowek +Name[pt]=Área de Transferência +Name[pt_BR]=Área de transferência +Name[ro]=Mousepad +Name[ru]=Буфер обмена +Name[sk]=Schránka +Name[sv]=Klippbord +Name[tr]=Pano +Name[uk]=Буфер обміну +Name[x-test]=xxMousepadxx +Comment=Use your phone as a mousepad +Comment[bg]=Споделяне на буфера за обмен между устройства +Comment[bs]=Podijeli Mousepad među uređajima +Comment[ca]=Comparteix el porta-retalls entre els dispositius +Comment[cs]=Sdílejte schránku mezi zařízeními +Comment[da]=Del indholdet af udklipsholderen mellem enheder +Comment[de]=Die Zwischenablage mit Geräten teilen +Comment[es]=Compartir el portapapeles entre dispositivos +Comment[fr]=Partagez le presse-papiers entre périphériques +Comment[hu]=Vágólap megosztása az eszközök között +Comment[it]=Condividi gli appunti tra i dispositivi +Comment[ko]=장치간 클립보드 공유 +Comment[nl]=Het klembord tussen apparaten delen +Comment[pl]=Współdziel schowek pomiędzy urządzeniami +Comment[pt]=Partilhar a área de transferência entre dispositivos +Comment[pt_BR]=Compartilhar a área de transferência entre dispositivos +Comment[ro]=Partajează clipboardul între dispozitive +Comment[ru]=Общий буфер обмена для всех устройств +Comment[sk]=Zdieľať schránku medzi zariadeniami +Comment[sv]=Dela klippbordet mellan apparater +Comment[tr]=Aygıtlar arasında panoyu paylaştır +Comment[uk]=Спільне використання буфера обміну даними на пристроях +Comment[x-test]=xxShare the clipboard between devicesxx + +X-KdeConnect-SupportedPackageType=kdeconnect.mousepad +X-KdeConnect-OutgoingPackageType=kdeconnect.mousepad + diff --git a/plugins/mousepad/mousepadplugin.cpp b/plugins/mousepad/mousepadplugin.cpp new file mode 100644 index 000000000..87861729b --- /dev/null +++ b/plugins/mousepad/mousepadplugin.cpp @@ -0,0 +1,65 @@ +/** + * Copyright 2014 Ahmed I. Khalil + * + * 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 . + */ + +#include "mousepadplugin.h" + +#include +#include +#include + +K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< MousepadPlugin >(); ) +K_EXPORT_PLUGIN( KdeConnectPluginFactory("kdeconnect_mousepad", "kdeconnect-plugins") ) + +#define LEFT_MOUSE_BUTTON 1 // Source: http://bharathisubramanian.wordpress.com/2010/04/01/x11-fake-mouse-events-generation-using-xtest/ + +MousepadPlugin::MousepadPlugin(QObject* parent, const QVariantList& args) + : KdeConnectPlugin(parent, args) +{ + +} + +bool MousepadPlugin::receivePackage(const NetworkPackage& np) +{ + float dx = np.get("dx", 0); + float dy = np.get("dy", 0); + QPoint point = QCursor::pos(); + QCursor::setPos(point.x() + (int)dx, point.y() + (int)dy); + + bool isSingleClick = np.get("singleclick", false); + bool isDoubleClick = np.get("doubleclick", false); + + if (isSingleClick || isDoubleClick) { + Display *display = XOpenDisplay(NULL); + if(display) { + if (isSingleClick) { + XTestFakeButtonEvent(display, LEFT_MOUSE_BUTTON, true, CurrentTime); + XTestFakeButtonEvent(display, LEFT_MOUSE_BUTTON, false, CurrentTime); + } else if (isDoubleClick) { + XTestFakeButtonEvent(display, LEFT_MOUSE_BUTTON, true, CurrentTime); + XTestFakeButtonEvent(display, LEFT_MOUSE_BUTTON, false, CurrentTime); + XTestFakeButtonEvent(display, LEFT_MOUSE_BUTTON, true, CurrentTime); + XTestFakeButtonEvent(display, LEFT_MOUSE_BUTTON, false, CurrentTime); + } + XFlush(display); + } + XCloseDisplay(display); + } + return true; +} diff --git a/plugins/mousepad/mousepadplugin.h b/plugins/mousepad/mousepadplugin.h new file mode 100644 index 000000000..e9ca659fb --- /dev/null +++ b/plugins/mousepad/mousepadplugin.h @@ -0,0 +1,43 @@ +/** + * Copyright 2014 Ahmed I. Khalil + * + * 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 . + */ + +#ifndef MOUSEPADPLUGIN_H +#define MOUSEPADPLUGIN_H + +#include + +#include + +#define PACKAGE_TYPE_MOUSEPAD QLatin1String("kdeconnect.mousepad") + +class MousepadPlugin + : public KdeConnectPlugin +{ + Q_OBJECT + +public: + explicit MousepadPlugin(QObject *parent, const QVariantList &args); + +public Q_SLOTS: + virtual bool receivePackage(const NetworkPackage& np); + virtual void connected() { } +}; + +#endif From 5379bba55154e41045bfda2be37abfda65469fbf Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Fri, 27 Jun 2014 16:05:49 +0200 Subject: [PATCH 10/31] Fixed displayFilter in plasmoid that not was updated when we changed the enum --- plasmoid/package/contents/ui/kdeconnect.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plasmoid/package/contents/ui/kdeconnect.qml b/plasmoid/package/contents/ui/kdeconnect.qml index e58cc4ebc..8d682e365 100644 --- a/plasmoid/package/contents/ui/kdeconnect.qml +++ b/plasmoid/package/contents/ui/kdeconnect.qml @@ -68,7 +68,7 @@ Item { anchors.fill: parent model: KdeConnect.DevicesModel { id: connectDeviceModel - displayFilter: 0x11 + displayFilter: 3 } delegate: DeviceDelegate { } onCountChanged: shouldPlasmoidBeShown() @@ -81,7 +81,7 @@ Item { anchors.fill: parent id: devicesView model: KdeConnect.DevicesModel { - displayFilter: 0x11 + displayFilter: 3 } delegate: DeviceDelegate {} } From e227c61cf82e401d6d2af325b168b1a3eebfaa2c Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Fri, 27 Jun 2014 16:09:01 +0200 Subject: [PATCH 11/31] Expose flags so that the plasmoid doesn't need to use magic numbers --- interfaces/devicesmodel.h | 5 +++-- plasmoid/package/contents/ui/kdeconnect.qml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/interfaces/devicesmodel.h b/interfaces/devicesmodel.h index e8e6590ff..7cc0f9666 100644 --- a/interfaces/devicesmodel.h +++ b/interfaces/devicesmodel.h @@ -35,7 +35,7 @@ class KDECONNECTINTERFACES_EXPORT DevicesModel : public QAbstractListModel { Q_OBJECT - Q_PROPERTY(int displayFilter READ displayFilter WRITE setDisplayFilter) + Q_PROPERTY(StatusFlags displayFilter READ displayFilter WRITE setDisplayFilter) Q_PROPERTY(int count READ rowCount NOTIFY rowsChanged) public: @@ -47,11 +47,12 @@ public: IconNameRole, IsPairedRole }; - enum StatusFlags { + enum StatusFlag { StatusUnknown = 0x00, StatusPaired = 0x01, StatusReachable = 0x02 }; + Q_DECLARE_FLAGS(StatusFlags, StatusFlag) DevicesModel(QObject *parent = 0); virtual ~DevicesModel(); diff --git a/plasmoid/package/contents/ui/kdeconnect.qml b/plasmoid/package/contents/ui/kdeconnect.qml index 8d682e365..cbaa7d2b0 100644 --- a/plasmoid/package/contents/ui/kdeconnect.qml +++ b/plasmoid/package/contents/ui/kdeconnect.qml @@ -68,7 +68,7 @@ Item { anchors.fill: parent model: KdeConnect.DevicesModel { id: connectDeviceModel - displayFilter: 3 + displayFilter: StatusPaired | StatusReachable } delegate: DeviceDelegate { } onCountChanged: shouldPlasmoidBeShown() From 446dbbc230441aa8c6842276562e30cfcacd0f55 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Fri, 27 Jun 2014 16:16:45 +0200 Subject: [PATCH 12/31] Remove IsPairedRole It was not a good idea --- interfaces/devicesmodel.cpp | 2 -- interfaces/devicesmodel.h | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/interfaces/devicesmodel.cpp b/interfaces/devicesmodel.cpp index 479a1d169..8242107cb 100644 --- a/interfaces/devicesmodel.cpp +++ b/interfaces/devicesmodel.cpp @@ -170,8 +170,6 @@ QVariant DevicesModel::data(const QModelIndex& index, int role) const } case IconNameRole: return device->iconName(); - case IsPairedRole: - return QVariant::fromValue(device->isPaired()); default: return QVariant(); } diff --git a/interfaces/devicesmodel.h b/interfaces/devicesmodel.h index 7cc0f9666..7479dea61 100644 --- a/interfaces/devicesmodel.h +++ b/interfaces/devicesmodel.h @@ -44,8 +44,7 @@ public: IconModelRole = Qt::DecorationRole, StatusModelRole = Qt::InitialSortOrderRole, IdModelRole = Qt::UserRole, - IconNameRole, - IsPairedRole + IconNameRole }; enum StatusFlag { StatusUnknown = 0x00, From db0d30e2e94b54f938d5dd31801c7dd3d907cdb0 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Fri, 27 Jun 2014 16:18:43 +0200 Subject: [PATCH 13/31] When listing from the cli, display if a device is paired. --- cli/kdeconnect-cli.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/cli/kdeconnect-cli.cpp b/cli/kdeconnect-cli.cpp index d7f0da331..a4c4fd8db 100644 --- a/cli/kdeconnect-cli.cpp +++ b/cli/kdeconnect-cli.cpp @@ -49,10 +49,21 @@ int main(int argc, char** argv) devices.setDisplayFilter(DevicesModel::StatusUnknown); for(int i=0, rows=devices.rowCount(); i Date: Fri, 27 Jun 2014 16:46:49 +0200 Subject: [PATCH 14/31] When trying to send file, actually tell the plugin to send the file Works wonderfully on new apk's. \o/ Reviewed by Albert Vaca --- fileitemactionplugin/sendfileitemaction.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/fileitemactionplugin/sendfileitemaction.cpp b/fileitemactionplugin/sendfileitemaction.cpp index 6b2dd722b..54653b923 100644 --- a/fileitemactionplugin/sendfileitemaction.cpp +++ b/fileitemactionplugin/sendfileitemaction.cpp @@ -58,6 +58,7 @@ QList SendFileItemAction::actions(const KFileItemListProperties& fileI action->setProperty("id", idx.data(DevicesModel::IdModelRole)); action->setProperty("urls", QVariant::fromValue(fileItemInfos.urlList())); action->setProperty("parentWidget", QVariant::fromValue(parentWidget)); + connect(action, SIGNAL(triggered(bool)), this, SLOT(sendFile())); actions += action; } } From c8dbbed685cb6abde9cf13958764c6b30446b0b9 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Fri, 27 Jun 2014 18:21:40 +0200 Subject: [PATCH 15/31] Move the send ping code to the ping plugin turn it into a dbus call to the plugin Reviewed by Albert Vaca --- cli/kdeconnect-cli.cpp | 4 ++++ core/device.cpp | 7 ------- core/device.h | 1 - kcm/kcm.cpp | 3 ++- plugins/ping/kdeconnect_ping.desktop | 2 +- plugins/ping/pingplugin.cpp | 18 ++++++++++++++++++ plugins/ping/pingplugin.h | 7 ++++++- 7 files changed, 31 insertions(+), 11 deletions(-) diff --git a/cli/kdeconnect-cli.cpp b/cli/kdeconnect-cli.cpp index a4c4fd8db..d425bd3e1 100644 --- a/cli/kdeconnect-cli.cpp +++ b/cli/kdeconnect-cli.cpp @@ -40,6 +40,7 @@ int main(int argc, char** argv) options.add("share ", ki18n("Share a file to a said device")); options.add("pair", ki18n("Request pairing to a said device")); options.add("unpair", ki18n("Stop pairing to a said device")); + options.add("ping", ki18n("Sends a ping to said device")); options.add("device ", ki18n("Device ID")); KCmdLineArgs::addCmdLineOptions( options ); KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); @@ -98,6 +99,9 @@ int main(int argc, char** argv) QDBusPendingReply req = dev.unpair(); req.waitForFinished(); } + } else if(args->isSet("ping")) { + QDBusMessage msg = QDBusMessage::createMethodCall("org.kde.kdeconnect", "/modules/kdeconnect/devices/"+device+"/ping", "org.kde.kdeconnect.device.ping", "sendPing"); + QDBusConnection::sessionBus().call(msg); } else KCmdLineArgs::usageError(i18n("Nothing to be done with the device")); } diff --git a/core/device.cpp b/core/device.cpp index 29982e70a..b0051401b 100644 --- a/core/device.cpp +++ b/core/device.cpp @@ -470,13 +470,6 @@ QStringList Device::availableLinks() const return sl; } -void Device::sendPing() -{ - NetworkPackage np(PACKAGE_TYPE_PING); - bool success = sendPackage(np); - kDebug(kdeconnect_kded()) << "sendPing:" << success; -} - Device::DeviceType Device::str2type(QString deviceType) { if (deviceType == "desktop") return Desktop; if (deviceType == "laptop") return Laptop; diff --git a/core/device.h b/core/device.h index ec757b8de..d15430078 100644 --- a/core/device.h +++ b/core/device.h @@ -105,7 +105,6 @@ public Q_SLOTS: Q_SCRIPTABLE void requestPair(); Q_SCRIPTABLE void unpair(); Q_SCRIPTABLE void reloadPlugins(); //From kconf - Q_SCRIPTABLE void sendPing(); void acceptPairing(); void rejectPairing(); diff --git a/kcm/kcm.cpp b/kcm/kcm.cpp index 78a39cf93..f809a53c7 100644 --- a/kcm/kcm.cpp +++ b/kcm/kcm.cpp @@ -250,5 +250,6 @@ void KdeConnectKcm::save() void KdeConnectKcm::sendPing() { if (!currentDevice) return; - currentDevice->sendPing(); + QDBusMessage msg = QDBusMessage::createMethodCall("org.kde.kdeconnect", "/modules/kdeconnect/devices/"+currentDevice->id()+"/ping", "org.kde.kdeconnect.device.ping", "sendPing"); + QDBusConnection::sessionBus().call(msg); } diff --git a/plugins/ping/kdeconnect_ping.desktop b/plugins/ping/kdeconnect_ping.desktop index 23bfe8ebf..aa6c7a545 100644 --- a/plugins/ping/kdeconnect_ping.desktop +++ b/plugins/ping/kdeconnect_ping.desktop @@ -59,4 +59,4 @@ Comment[uk]=Надсилання і отримання сигналів підт Comment[x-test]=xxSend and receive pingsxx X-KdeConnect-SupportedPackageType=kdeconnect.ping -# X-KdeConnect-OutgoingPackageType=kdeconnect.ping +X-KdeConnect-OutgoingPackageType=kdeconnect.ping diff --git a/plugins/ping/pingplugin.cpp b/plugins/ping/pingplugin.cpp index 182cdbcdb..5d5575c04 100644 --- a/plugins/ping/pingplugin.cpp +++ b/plugins/ping/pingplugin.cpp @@ -26,6 +26,7 @@ #include #include +#include K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< PingPlugin >(); ) K_EXPORT_PLUGIN( KdeConnectPluginFactory("kdeconnect_ping", "kdeconnect-plugins") ) @@ -53,3 +54,20 @@ bool PingPlugin::receivePackage(const NetworkPackage& np) return true; } + +void PingPlugin::sendPing() +{ + NetworkPackage np(PACKAGE_TYPE_PING); + bool success = sendPackage(np); + kDebug(kdeconnect_kded()) << "sendPing:" << success; +} + +void PingPlugin::connected() +{ + QDBusConnection::sessionBus().registerObject(dbusPath(), this, QDBusConnection::ExportAllContents); +} + +QString PingPlugin::dbusPath() const +{ + return "/modules/kdeconnect/devices/" + device()->id() + "/ping"; +} diff --git a/plugins/ping/pingplugin.h b/plugins/ping/pingplugin.h index f31e66045..31563074c 100644 --- a/plugins/ping/pingplugin.h +++ b/plugins/ping/pingplugin.h @@ -29,15 +29,20 @@ class KDE_EXPORT PingPlugin : public KdeConnectPlugin { Q_OBJECT + Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.ping") public: explicit PingPlugin(QObject *parent, const QVariantList &args); virtual ~PingPlugin(); + Q_SCRIPTABLE void sendPing(); + public Q_SLOTS: virtual bool receivePackage(const NetworkPackage& np); - virtual void connected() { }; + virtual void connected(); +private: + QString dbusPath() const; }; #endif From 46ca1e7109a1e0ac2bdd803dbf5410b3d7cad69b Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Fri, 27 Jun 2014 18:33:24 +0200 Subject: [PATCH 16/31] Fixed wordpress being used as organization name and exported to dbus Reviewed by Aleix Pol --- kded/kdeconnectd.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kded/kdeconnectd.cpp b/kded/kdeconnectd.cpp index 65606a893..06cec7277 100644 --- a/kded/kdeconnectd.cpp +++ b/kded/kdeconnectd.cpp @@ -68,6 +68,8 @@ int main(int argc, char* argv[]) KLocalizedString(), "http://albertvaka.wordpress.com"); + aboutData.setOrganizationDomain("kde.org"); + KCmdLineArgs::init(argc, argv, &aboutData); KUniqueApplication app(true); // WARNING GUI required for QClipboard access From 7ff09fe2bb3a0d0c8203a2f61eaf0ff7988725c9 Mon Sep 17 00:00:00 2001 From: l10n daemon script Date: Sat, 28 Jun 2014 04:21:58 +0000 Subject: [PATCH 17/31] SVN_SILENT made messages (.desktop file) --- plugins/mousepad/kdeconnect_mousepad.desktop | 44 -------------------- 1 file changed, 44 deletions(-) diff --git a/plugins/mousepad/kdeconnect_mousepad.desktop b/plugins/mousepad/kdeconnect_mousepad.desktop index 531a65d3d..885b62871 100644 --- a/plugins/mousepad/kdeconnect_mousepad.desktop +++ b/plugins/mousepad/kdeconnect_mousepad.desktop @@ -11,51 +11,7 @@ X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=true Icon=input-mouse Name=Mousepad -Name[bg]=Буфер за обмен -Name[bs]=Mousepad -Name[ca]=Porta-retalls -Name[cs]=Schránka -Name[da]=Udklipsholder -Name[de]=Zwischenablage -Name[es]=Portapapeles -Name[fr]=Presse-papiers -Name[hu]=Vágólap -Name[it]=Appunti -Name[ko]=클립보드 -Name[nl]=Klembord -Name[pl]=Schowek -Name[pt]=Área de Transferência -Name[pt_BR]=Área de transferência -Name[ro]=Mousepad -Name[ru]=Буфер обмена -Name[sk]=Schránka -Name[sv]=Klippbord -Name[tr]=Pano -Name[uk]=Буфер обміну -Name[x-test]=xxMousepadxx Comment=Use your phone as a mousepad -Comment[bg]=Споделяне на буфера за обмен между устройства -Comment[bs]=Podijeli Mousepad među uređajima -Comment[ca]=Comparteix el porta-retalls entre els dispositius -Comment[cs]=Sdílejte schránku mezi zařízeními -Comment[da]=Del indholdet af udklipsholderen mellem enheder -Comment[de]=Die Zwischenablage mit Geräten teilen -Comment[es]=Compartir el portapapeles entre dispositivos -Comment[fr]=Partagez le presse-papiers entre périphériques -Comment[hu]=Vágólap megosztása az eszközök között -Comment[it]=Condividi gli appunti tra i dispositivi -Comment[ko]=장치간 클립보드 공유 -Comment[nl]=Het klembord tussen apparaten delen -Comment[pl]=Współdziel schowek pomiędzy urządzeniami -Comment[pt]=Partilhar a área de transferência entre dispositivos -Comment[pt_BR]=Compartilhar a área de transferência entre dispositivos -Comment[ro]=Partajează clipboardul între dispozitive -Comment[ru]=Общий буфер обмена для всех устройств -Comment[sk]=Zdieľať schránku medzi zariadeniami -Comment[sv]=Dela klippbordet mellan apparater -Comment[tr]=Aygıtlar arasında panoyu paylaştır -Comment[uk]=Спільне використання буфера обміну даними на пристроях -Comment[x-test]=xxShare the clipboard between devicesxx X-KdeConnect-SupportedPackageType=kdeconnect.mousepad X-KdeConnect-OutgoingPackageType=kdeconnect.mousepad From a48b066ab47a606f8af93650182a472f4c083936 Mon Sep 17 00:00:00 2001 From: l10n daemon script Date: Sun, 29 Jun 2014 04:35:25 +0000 Subject: [PATCH 18/31] SVN_SILENT made messages (.desktop file) --- fileitemactionplugin/kdeconnectsendfile.desktop | 2 ++ plugins/kdeconnect_plugin.desktop | 2 +- plugins/mousepad/kdeconnect_mousepad.desktop | 16 ++++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/fileitemactionplugin/kdeconnectsendfile.desktop b/fileitemactionplugin/kdeconnectsendfile.desktop index 0c9b804c5..9f20b51a7 100644 --- a/fileitemactionplugin/kdeconnectsendfile.desktop +++ b/fileitemactionplugin/kdeconnectsendfile.desktop @@ -3,6 +3,7 @@ Type=Service Name=Send file via KDE Connect service Name[ca]=Envia un fitxer a través del servei KDE Connect Name[cs]=Poslat soubor přes službu KDE Connect +Name[da]=Send fil via KDE Connect-tjeneste Name[es]=Enviar archivo usando el servicio KDE Connect Name[hu]=Fájl küldése a KDE csatlakozás szolgáltatáson keresztül Name[nl]=Bestand via de service KDE Connect versturen @@ -17,6 +18,7 @@ X-KDE-Library=kdeconnectfiletiemaction X-KDE-Submenu=Connect X-KDE-Submenu[ca]=Connecta X-KDE-Submenu[cs]=Připojit +X-KDE-Submenu[da]=Forbind X-KDE-Submenu[es]=Conectar X-KDE-Submenu[hu]=Csatlakozás X-KDE-Submenu[nl]=Verbinden diff --git a/plugins/kdeconnect_plugin.desktop b/plugins/kdeconnect_plugin.desktop index 017917b87..ec21bb543 100644 --- a/plugins/kdeconnect_plugin.desktop +++ b/plugins/kdeconnect_plugin.desktop @@ -5,7 +5,7 @@ X-KDE-Derived=KPluginInfo Name=KDEConnect Plugin Name[bg]=Приставка на KDEConnect Name[bs]=Priključak za KDE konekciju -Name[ca]=Connector de KDEConnect +Name[ca]=Connector del KDEConnect Name[cs]=Modul KDEConnect Name[da]=KDEConnect-plugin Name[de]=KDEConnect-Modul diff --git a/plugins/mousepad/kdeconnect_mousepad.desktop b/plugins/mousepad/kdeconnect_mousepad.desktop index 885b62871..782dcf22a 100644 --- a/plugins/mousepad/kdeconnect_mousepad.desktop +++ b/plugins/mousepad/kdeconnect_mousepad.desktop @@ -11,7 +11,23 @@ X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=true Icon=input-mouse Name=Mousepad +Name[ca]=Catifa del ratolí +Name[da]=Museplade +Name[nl]=Muispad +Name[pt]=Painel de Rato +Name[pt_BR]=Mousepad +Name[sv]=Musplatta +Name[uk]=Килимок для миші +Name[x-test]=xxMousepadxx Comment=Use your phone as a mousepad +Comment[ca]=Usa el vostre telèfon com una catifa del ratolí +Comment[da]=Brug din telefon som museplade +Comment[nl]=Uw telefoon gebruiken als muispad +Comment[pt]=Usar o seu telemóvel como painel de rato +Comment[pt_BR]=Use seu celular como mousepad +Comment[sv]=Använd telefonen som en musplatta +Comment[uk]=Використання телефону як килимка для миші +Comment[x-test]=xxUse your phone as a mousepadxx X-KdeConnect-SupportedPackageType=kdeconnect.mousepad X-KdeConnect-OutgoingPackageType=kdeconnect.mousepad From 4132f0c373cf95999d8045dbf24e7b61897448ce Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Sun, 29 Jun 2014 16:14:31 +0200 Subject: [PATCH 19/31] Renamed mousepad -> touchad --- plugins/mousepad/kdeconnect_mousepad.desktop | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/mousepad/kdeconnect_mousepad.desktop b/plugins/mousepad/kdeconnect_mousepad.desktop index 782dcf22a..33e2621bb 100644 --- a/plugins/mousepad/kdeconnect_mousepad.desktop +++ b/plugins/mousepad/kdeconnect_mousepad.desktop @@ -10,7 +10,7 @@ X-KDE-PluginInfo-Version=0.1 X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=true Icon=input-mouse -Name=Mousepad +Name=Touchpad Name[ca]=Catifa del ratolí Name[da]=Museplade Name[nl]=Muispad @@ -19,7 +19,7 @@ Name[pt_BR]=Mousepad Name[sv]=Musplatta Name[uk]=Килимок для миші Name[x-test]=xxMousepadxx -Comment=Use your phone as a mousepad +Comment=Use your phone as a touchpad Comment[ca]=Usa el vostre telèfon com una catifa del ratolí Comment[da]=Brug din telefon som museplade Comment[nl]=Uw telefoon gebruiken als muispad From 178fcc128d7ba130109682355361ba69d944be30 Mon Sep 17 00:00:00 2001 From: Ahmed Ibrahim Khalil Date: Sun, 29 Jun 2014 17:21:54 +0200 Subject: [PATCH 20/31] Implemented scrolling, by sending scroll down or scroll up button events, according to the difference value. REVIEW: 119006 --- plugins/mousepad/mousepadplugin.cpp | 65 +++++++++++++++++++---------- plugins/mousepad/mousepadplugin.h | 5 +++ 2 files changed, 48 insertions(+), 22 deletions(-) diff --git a/plugins/mousepad/mousepadplugin.cpp b/plugins/mousepad/mousepadplugin.cpp index 87861729b..0191f66c7 100644 --- a/plugins/mousepad/mousepadplugin.cpp +++ b/plugins/mousepad/mousepadplugin.cpp @@ -21,45 +21,66 @@ #include "mousepadplugin.h" #include -#include #include K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< MousepadPlugin >(); ) K_EXPORT_PLUGIN( KdeConnectPluginFactory("kdeconnect_mousepad", "kdeconnect-plugins") ) #define LEFT_MOUSE_BUTTON 1 // Source: http://bharathisubramanian.wordpress.com/2010/04/01/x11-fake-mouse-events-generation-using-xtest/ +#define MOUSE_WHEEL_UP_BUTTON 4 +#define MOUSE_WHEEL_DOWN_BUTTON 5 MousepadPlugin::MousepadPlugin(QObject* parent, const QVariantList& args) - : KdeConnectPlugin(parent, args) + : KdeConnectPlugin(parent, args), m_display(0) { - + +} + +MousepadPlugin::~MousepadPlugin() +{ + if (m_display) { + XCloseDisplay(m_display); + m_display = 0; + } } bool MousepadPlugin::receivePackage(const NetworkPackage& np) { float dx = np.get("dx", 0); float dy = np.get("dy", 0); - QPoint point = QCursor::pos(); - QCursor::setPos(point.x() + (int)dx, point.y() + (int)dy); - + bool isSingleClick = np.get("singleclick", false); bool isDoubleClick = np.get("doubleclick", false); - - if (isSingleClick || isDoubleClick) { - Display *display = XOpenDisplay(NULL); - if(display) { - if (isSingleClick) { - XTestFakeButtonEvent(display, LEFT_MOUSE_BUTTON, true, CurrentTime); - XTestFakeButtonEvent(display, LEFT_MOUSE_BUTTON, false, CurrentTime); - } else if (isDoubleClick) { - XTestFakeButtonEvent(display, LEFT_MOUSE_BUTTON, true, CurrentTime); - XTestFakeButtonEvent(display, LEFT_MOUSE_BUTTON, false, CurrentTime); - XTestFakeButtonEvent(display, LEFT_MOUSE_BUTTON, true, CurrentTime); - XTestFakeButtonEvent(display, LEFT_MOUSE_BUTTON, false, CurrentTime); - } - XFlush(display); - } - XCloseDisplay(display); + bool isScroll = np.get("scroll", false); + + if (isSingleClick || isDoubleClick || isScroll) { + if(!m_display) { + m_display = XOpenDisplay(NULL); + } + + if(m_display) { + if (isSingleClick) { + XTestFakeButtonEvent(m_display, LEFT_MOUSE_BUTTON, true, CurrentTime); + XTestFakeButtonEvent(m_display, LEFT_MOUSE_BUTTON, false, CurrentTime); + } else if (isDoubleClick) { + XTestFakeButtonEvent(m_display, LEFT_MOUSE_BUTTON, true, CurrentTime); + XTestFakeButtonEvent(m_display, LEFT_MOUSE_BUTTON, false, CurrentTime); + XTestFakeButtonEvent(m_display, LEFT_MOUSE_BUTTON, true, CurrentTime); + XTestFakeButtonEvent(m_display, LEFT_MOUSE_BUTTON, false, CurrentTime); + } else if( isScroll ) { + if (dy < 0) { + XTestFakeButtonEvent(m_display, MOUSE_WHEEL_DOWN_BUTTON, true, CurrentTime); + XTestFakeButtonEvent(m_display, MOUSE_WHEEL_DOWN_BUTTON, false, CurrentTime); + } else { + XTestFakeButtonEvent(m_display, MOUSE_WHEEL_UP_BUTTON, true, CurrentTime); + XTestFakeButtonEvent(m_display, MOUSE_WHEEL_UP_BUTTON, false, CurrentTime); + } + } + XFlush(m_display); + } + } else { + QPoint point = QCursor::pos(); + QCursor::setPos(point.x() + (int)dx, point.y() + (int)dy); } return true; } diff --git a/plugins/mousepad/mousepadplugin.h b/plugins/mousepad/mousepadplugin.h index e9ca659fb..6a0c047d6 100644 --- a/plugins/mousepad/mousepadplugin.h +++ b/plugins/mousepad/mousepadplugin.h @@ -22,6 +22,7 @@ #define MOUSEPADPLUGIN_H #include +#include #include @@ -34,10 +35,14 @@ class MousepadPlugin public: explicit MousepadPlugin(QObject *parent, const QVariantList &args); + virtual ~MousepadPlugin(); public Q_SLOTS: virtual bool receivePackage(const NetworkPackage& np); virtual void connected() { } + +private: + Display *m_display; }; #endif From 9cba780f751b72889df8aff7e83eea12802e5e0e Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Sun, 29 Jun 2014 17:30:24 +0200 Subject: [PATCH 21/31] Added right and middle click, even though it's not implemented in Android yet CCMAIL: ahmedibrahimkhali@gmail.com --- plugins/mousepad/mousepadplugin.cpp | 34 +++++++++++++++++------------ plugins/mousepad/mousepadplugin.h | 8 +++++++ 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/plugins/mousepad/mousepadplugin.cpp b/plugins/mousepad/mousepadplugin.cpp index 0191f66c7..08e06a447 100644 --- a/plugins/mousepad/mousepadplugin.cpp +++ b/plugins/mousepad/mousepadplugin.cpp @@ -26,9 +26,7 @@ K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< MousepadPlugin >(); ) K_EXPORT_PLUGIN( KdeConnectPluginFactory("kdeconnect_mousepad", "kdeconnect-plugins") ) -#define LEFT_MOUSE_BUTTON 1 // Source: http://bharathisubramanian.wordpress.com/2010/04/01/x11-fake-mouse-events-generation-using-xtest/ -#define MOUSE_WHEEL_UP_BUTTON 4 -#define MOUSE_WHEEL_DOWN_BUTTON 5 +// Source: http://bharathisubramanian.wordpress.com/2010/04/01/x11-fake-mouse-events-generation-using-xtest/ MousepadPlugin::MousepadPlugin(QObject* parent, const QVariantList& args) : KdeConnectPlugin(parent, args), m_display(0) @@ -51,29 +49,37 @@ bool MousepadPlugin::receivePackage(const NetworkPackage& np) bool isSingleClick = np.get("singleclick", false); bool isDoubleClick = np.get("doubleclick", false); + bool isMiddleClick = np.get("middleclick", false); + bool isRightClick = np.get("rightclick", false); bool isScroll = np.get("scroll", false); - if (isSingleClick || isDoubleClick || isScroll) { + if (isSingleClick || isDoubleClick || isMiddleClick || isRightClick || isScroll) { if(!m_display) { m_display = XOpenDisplay(NULL); } if(m_display) { if (isSingleClick) { - XTestFakeButtonEvent(m_display, LEFT_MOUSE_BUTTON, true, CurrentTime); - XTestFakeButtonEvent(m_display, LEFT_MOUSE_BUTTON, false, CurrentTime); + XTestFakeButtonEvent(m_display, LeftMouseButton, true, CurrentTime); + XTestFakeButtonEvent(m_display, LeftMouseButton, false, CurrentTime); } else if (isDoubleClick) { - XTestFakeButtonEvent(m_display, LEFT_MOUSE_BUTTON, true, CurrentTime); - XTestFakeButtonEvent(m_display, LEFT_MOUSE_BUTTON, false, CurrentTime); - XTestFakeButtonEvent(m_display, LEFT_MOUSE_BUTTON, true, CurrentTime); - XTestFakeButtonEvent(m_display, LEFT_MOUSE_BUTTON, false, CurrentTime); + XTestFakeButtonEvent(m_display, LeftMouseButton, true, CurrentTime); + XTestFakeButtonEvent(m_display, LeftMouseButton, false, CurrentTime); + XTestFakeButtonEvent(m_display, LeftMouseButton, true, CurrentTime); + XTestFakeButtonEvent(m_display, LeftMouseButton, false, CurrentTime); + } else if (isMiddleClick) { + XTestFakeButtonEvent(m_display, MiddleMouseButton, true, CurrentTime); + XTestFakeButtonEvent(m_display, MiddleMouseButton, false, CurrentTime); + } else if (isRightClick) { + XTestFakeButtonEvent(m_display, RightMouseButton, true, CurrentTime); + XTestFakeButtonEvent(m_display, RightMouseButton, false, CurrentTime); } else if( isScroll ) { if (dy < 0) { - XTestFakeButtonEvent(m_display, MOUSE_WHEEL_DOWN_BUTTON, true, CurrentTime); - XTestFakeButtonEvent(m_display, MOUSE_WHEEL_DOWN_BUTTON, false, CurrentTime); + XTestFakeButtonEvent(m_display, MouseWheelDown, true, CurrentTime); + XTestFakeButtonEvent(m_display, MouseWheelDown, false, CurrentTime); } else { - XTestFakeButtonEvent(m_display, MOUSE_WHEEL_UP_BUTTON, true, CurrentTime); - XTestFakeButtonEvent(m_display, MOUSE_WHEEL_UP_BUTTON, false, CurrentTime); + XTestFakeButtonEvent(m_display, MouseWheelUp, true, CurrentTime); + XTestFakeButtonEvent(m_display, MouseWheelUp, false, CurrentTime); } } XFlush(m_display); diff --git a/plugins/mousepad/mousepadplugin.h b/plugins/mousepad/mousepadplugin.h index 6a0c047d6..64f5d8800 100644 --- a/plugins/mousepad/mousepadplugin.h +++ b/plugins/mousepad/mousepadplugin.h @@ -33,6 +33,14 @@ class MousepadPlugin { Q_OBJECT + enum MouseButtons { + LeftMouseButton = 1, + MiddleMouseButton = 2, + RightMouseButton = 3, + MouseWheelUp = 4, + MouseWheelDown = 5 + }; + public: explicit MousepadPlugin(QObject *parent, const QVariantList &args); virtual ~MousepadPlugin(); From 0a87194d38caede6a3a09c3dfa491e90a947be1b Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Sun, 29 Jun 2014 17:46:39 +0200 Subject: [PATCH 22/31] Git: ignore *.kdev4 --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 506dca6d3..b2337110d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ build -android-shine.kdev4 +*.kdev4 Makefile lib src/Makefile From c32ff31516e7d045e691d78afe0f28c0751f3494 Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Sun, 29 Jun 2014 17:52:07 +0200 Subject: [PATCH 23/31] Should not scroll if dy is 0 --- plugins/mousepad/mousepadplugin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/mousepad/mousepadplugin.cpp b/plugins/mousepad/mousepadplugin.cpp index 08e06a447..64aae5cc9 100644 --- a/plugins/mousepad/mousepadplugin.cpp +++ b/plugins/mousepad/mousepadplugin.cpp @@ -77,7 +77,7 @@ bool MousepadPlugin::receivePackage(const NetworkPackage& np) if (dy < 0) { XTestFakeButtonEvent(m_display, MouseWheelDown, true, CurrentTime); XTestFakeButtonEvent(m_display, MouseWheelDown, false, CurrentTime); - } else { + } else if (dy > 0) { XTestFakeButtonEvent(m_display, MouseWheelUp, true, CurrentTime); XTestFakeButtonEvent(m_display, MouseWheelUp, false, CurrentTime); } From dcfb37c85bf367eb2b28b217e63f18cff0b2569e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Su=C3=A1rez?= Date: Mon, 30 Jun 2014 01:12:24 +0200 Subject: [PATCH 24/31] Provide versioned so files for kdeconnectcore lib REVIEW: 119013 --- core/CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 4afa69f86..aa7ee5ba0 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -1,5 +1,10 @@ project(KDEConnectCore) +set(KDECONNECT_VERSION_MAJOR 1) +set(KDECONNECT_VERSION_MINOR 0) +set(KDECONNECT_VERSION_PATCH 1) +set(KDECONNECT_VERSION "${KDECONNECT_VERSION_MAJOR}.${KDECONNECT_VERSION_MINOR}.${KDECONNECT_VERSION_PATCH}") + include_directories( ${KDE4_KIO_LIBS} ${QJSON_INCLUDE_DIR} @@ -27,6 +32,11 @@ set(kded_kdeconnect_SRCS ) kde4_add_library(kdeconnectcore SHARED ${kded_kdeconnect_SRCS}) +set_target_properties(kdeconnectcore PROPERTIES + VERSION ${KDECONNECT_VERSION} + SOVERSION ${KDECONNECT_VERSION_MAJOR} +) + target_link_libraries(kdeconnectcore LINK_PUBLIC ${KDE4_KDECORE_LIBS} From b18276f44e455ebc8b940cfa804fc3db5f699fc8 Mon Sep 17 00:00:00 2001 From: l10n daemon script Date: Mon, 30 Jun 2014 04:42:38 +0000 Subject: [PATCH 25/31] SVN_SILENT made messages (.desktop file) --- plugins/mousepad/kdeconnect_mousepad.desktop | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/plugins/mousepad/kdeconnect_mousepad.desktop b/plugins/mousepad/kdeconnect_mousepad.desktop index 33e2621bb..d91647873 100644 --- a/plugins/mousepad/kdeconnect_mousepad.desktop +++ b/plugins/mousepad/kdeconnect_mousepad.desktop @@ -11,23 +11,7 @@ X-KDE-PluginInfo-License=GPL X-KDE-PluginInfo-EnabledByDefault=true Icon=input-mouse Name=Touchpad -Name[ca]=Catifa del ratolí -Name[da]=Museplade -Name[nl]=Muispad -Name[pt]=Painel de Rato -Name[pt_BR]=Mousepad -Name[sv]=Musplatta -Name[uk]=Килимок для миші -Name[x-test]=xxMousepadxx Comment=Use your phone as a touchpad -Comment[ca]=Usa el vostre telèfon com una catifa del ratolí -Comment[da]=Brug din telefon som museplade -Comment[nl]=Uw telefoon gebruiken als muispad -Comment[pt]=Usar o seu telemóvel como painel de rato -Comment[pt_BR]=Use seu celular como mousepad -Comment[sv]=Använd telefonen som en musplatta -Comment[uk]=Використання телефону як килимка для миші -Comment[x-test]=xxUse your phone as a mousepadxx X-KdeConnect-SupportedPackageType=kdeconnect.mousepad X-KdeConnect-OutgoingPackageType=kdeconnect.mousepad From 4ef2a07f7b16ab5c72c37d998314c4877630b699 Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Tue, 1 Jul 2014 01:15:23 +0200 Subject: [PATCH 26/31] CLI can now list notifications from a device --- cli/kdeconnect-cli.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/cli/kdeconnect-cli.cpp b/cli/kdeconnect-cli.cpp index d425bd3e1..08acceedb 100644 --- a/cli/kdeconnect-cli.cpp +++ b/cli/kdeconnect-cli.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -41,13 +42,13 @@ int main(int argc, char** argv) options.add("pair", ki18n("Request pairing to a said device")); options.add("unpair", ki18n("Stop pairing to a said device")); options.add("ping", ki18n("Sends a ping to said device")); + options.add("list-notifications", ki18n("Display the notifications on a said device")); options.add("device ", ki18n("Device ID")); KCmdLineArgs::addCmdLineOptions( options ); KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); KApplication app; if(args->isSet("l")) { DevicesModel devices; - devices.setDisplayFilter(DevicesModel::StatusUnknown); for(int i=0, rows=devices.rowCount(); iisSet("ping")) { QDBusMessage msg = QDBusMessage::createMethodCall("org.kde.kdeconnect", "/modules/kdeconnect/devices/"+device+"/ping", "org.kde.kdeconnect.device.ping", "sendPing"); QDBusConnection::sessionBus().call(msg); - } else + } else if(args->isSet("list-notifications")) { + NotificationsModel notifications; + notifications.setDeviceId(device); + for(int i=0, rows=notifications.rowCount(); i Date: Tue, 1 Jul 2014 01:19:14 +0200 Subject: [PATCH 27/31] Workaround to make devices be correctly filtered again. Flags in QML are not working correctly (as they are in Qt5), so we will use integer values for the flags for now. --- interfaces/devicesmodel.cpp | 9 ++------- interfaces/devicesmodel.h | 10 ++++++---- plasmoid/package/contents/ui/kdeconnect.qml | 6 +++--- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/interfaces/devicesmodel.cpp b/interfaces/devicesmodel.cpp index 8242107cb..ce9af3d22 100644 --- a/interfaces/devicesmodel.cpp +++ b/interfaces/devicesmodel.cpp @@ -85,19 +85,14 @@ void DevicesModel::deviceStatusChanged(const QString& id) refreshDeviceList(); } -DevicesModel::StatusFlags DevicesModel::displayFilter() const +int DevicesModel::displayFilter() const { return m_displayFilter; } void DevicesModel::setDisplayFilter(int flags) { - setDisplayFilter((StatusFlags)flags); -} - -void DevicesModel::setDisplayFilter(DevicesModel::StatusFlags flags) -{ - m_displayFilter = flags; + m_displayFilter = (StatusFlag)flags; refreshDeviceList(); } diff --git a/interfaces/devicesmodel.h b/interfaces/devicesmodel.h index 7479dea61..75ee0c12b 100644 --- a/interfaces/devicesmodel.h +++ b/interfaces/devicesmodel.h @@ -35,7 +35,7 @@ class KDECONNECTINTERFACES_EXPORT DevicesModel : public QAbstractListModel { Q_OBJECT - Q_PROPERTY(StatusFlags displayFilter READ displayFilter WRITE setDisplayFilter) + Q_PROPERTY(int displayFilter READ displayFilter WRITE setDisplayFilter) Q_PROPERTY(int count READ rowCount NOTIFY rowsChanged) public: @@ -52,13 +52,14 @@ public: StatusReachable = 0x02 }; Q_DECLARE_FLAGS(StatusFlags, StatusFlag) + Q_FLAGS(StatusFlags) + Q_ENUMS(StatusFlag) DevicesModel(QObject *parent = 0); virtual ~DevicesModel(); - void setDisplayFilter(StatusFlags flags); void setDisplayFilter(int flags); - StatusFlags displayFilter() const; + int displayFilter() const; virtual QVariant data(const QModelIndex& index, int role) const; virtual int rowCount(const QModelIndex& parent = QModelIndex()) const; @@ -80,7 +81,8 @@ private: DaemonDbusInterface* m_dbusInterface; QList m_deviceList; StatusFlags m_displayFilter; - }; +//Q_DECLARE_OPERATORS_FOR_FLAGS(DevicesModel::StatusFlags) + #endif // DEVICESMODEL_H diff --git a/plasmoid/package/contents/ui/kdeconnect.qml b/plasmoid/package/contents/ui/kdeconnect.qml index cbaa7d2b0..27a594e2f 100644 --- a/plasmoid/package/contents/ui/kdeconnect.qml +++ b/plasmoid/package/contents/ui/kdeconnect.qml @@ -23,7 +23,7 @@ import org.kde.plasma.core 0.1 as PlasmaCore import org.kde.plasma.components 0.1 as PlasmaComponents import org.kde.plasma.extras 0.1 as PlasmaExtras import org.kde.plasma.graphicswidgets 0.1 as PlasmaWidgets -import org.kde.kdeconnect 1.0 as KdeConnect +import org.kde.kdeconnect 1.0 Item { id: kdeconnect @@ -66,9 +66,9 @@ Item { flickableItem: ListView { id: devicesView anchors.fill: parent - model: KdeConnect.DevicesModel { + model: DevicesModel { id: connectDeviceModel - displayFilter: StatusPaired | StatusReachable + displayFilter: 3 } delegate: DeviceDelegate { } onCountChanged: shouldPlasmoidBeShown() From 3147067fbf23641b3d9bc659f685562981c73bee Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Tue, 1 Jul 2014 01:23:21 +0200 Subject: [PATCH 28/31] Fixed notifications not being appearing in the model nor in the plasmoid The parent of the QDbusAdaptor has to be a Device, and now it was a KdeConnectPlugin for the Notifications plugin. Instead of passing the parent (that is actually a Device) to the QDbusAdaptor as we were doing in the Battery plugin, I preferred to get the actual Device from the KdeConnectPlugin, even though it needs a const_cast. --- plugins/battery/batterydbusinterface.cpp | 5 +++-- plugins/battery/batterydbusinterface.h | 4 +++- plugins/battery/batteryplugin.cpp | 2 +- plugins/notifications/notificationsdbusinterface.cpp | 6 +++++- plugins/notifications/notificationsdbusinterface.h | 4 +++- 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/plugins/battery/batterydbusinterface.cpp b/plugins/battery/batterydbusinterface.cpp index 5960da8d7..ea550fb8b 100644 --- a/plugins/battery/batterydbusinterface.cpp +++ b/plugins/battery/batterydbusinterface.cpp @@ -20,10 +20,11 @@ #include "batterydbusinterface.h" +#include #include -BatteryDbusInterface::BatteryDbusInterface(QObject *parent) - : QDBusAbstractAdaptor(parent) +BatteryDbusInterface::BatteryDbusInterface(const Device *device) + : QDBusAbstractAdaptor(const_cast(device)) { } diff --git a/plugins/battery/batterydbusinterface.h b/plugins/battery/batterydbusinterface.h index 2fef9f637..b444ae219 100644 --- a/plugins/battery/batterydbusinterface.h +++ b/plugins/battery/batterydbusinterface.h @@ -23,6 +23,8 @@ #include +class Device; + class BatteryDbusInterface : public QDBusAbstractAdaptor { @@ -30,7 +32,7 @@ class BatteryDbusInterface Q_CLASSINFO("D-Bus Interface", "org.kde.kdeconnect.device.battery") public: - explicit BatteryDbusInterface(QObject *parent); + explicit BatteryDbusInterface(const Device *device); virtual ~BatteryDbusInterface(); Q_SCRIPTABLE int charge() const { return mCharge; } diff --git a/plugins/battery/batteryplugin.cpp b/plugins/battery/batteryplugin.cpp index 7b677c211..975ebaefa 100644 --- a/plugins/battery/batteryplugin.cpp +++ b/plugins/battery/batteryplugin.cpp @@ -32,7 +32,7 @@ K_EXPORT_PLUGIN( KdeConnectPluginFactory("kdeconnect_battery", "kdeconnect-plugi BatteryPlugin::BatteryPlugin(QObject *parent, const QVariantList &args) : KdeConnectPlugin(parent, args) - , batteryDbusInterface(new BatteryDbusInterface(parent)) + , batteryDbusInterface(new BatteryDbusInterface(device())) { //TODO: Add battery reporting, could be based on: diff --git a/plugins/notifications/notificationsdbusinterface.cpp b/plugins/notifications/notificationsdbusinterface.cpp index 75172b20f..412640d71 100644 --- a/plugins/notifications/notificationsdbusinterface.cpp +++ b/plugins/notifications/notificationsdbusinterface.cpp @@ -26,18 +26,22 @@ #include #include +#include +#include #include #include + #include "notificationsplugin.h" NotificationsDbusInterface::NotificationsDbusInterface(KdeConnectPlugin* plugin) - : QDBusAbstractAdaptor(plugin) + : QDBusAbstractAdaptor(const_cast(plugin->device())) , mDevice(plugin->device()) , mPlugin(plugin) , mLastId(0) , imagesDir(QDir::temp().absoluteFilePath("kdeconnect")) { imagesDir.mkpath(imagesDir.absolutePath()); + } NotificationsDbusInterface::~NotificationsDbusInterface() diff --git a/plugins/notifications/notificationsdbusinterface.h b/plugins/notifications/notificationsdbusinterface.h index acd67368c..5c1244ef1 100644 --- a/plugins/notifications/notificationsdbusinterface.h +++ b/plugins/notifications/notificationsdbusinterface.h @@ -27,9 +27,11 @@ #include #include -#include #include "notification.h" +class KdeConnectPlugin; +class Device; + class NotificationsDbusInterface : public QDBusAbstractAdaptor { From cabb0f2f7bca256fbbfafd86e0bb6fa97007196b Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Tue, 1 Jul 2014 01:25:12 +0200 Subject: [PATCH 29/31] Simplified debug areas so we only have one, called "kdeconnect" --- core/CMakeLists.txt | 1 - core/backends/lan/landevicelink.cpp | 4 +-- core/backends/lan/lanlinkprovider.cpp | 20 ++++++------- core/backends/lan/uploadjob.cpp | 2 +- core/daemon.cpp | 24 +++++++-------- core/device.cpp | 22 +++++++------- core/filetransferjob.cpp | 16 +++++----- core/kdebugnamespace.cpp | 28 ------------------ core/kdebugnamespace.h | 6 +++- core/networkpackage.cpp | 8 ++--- core/pluginloader.cpp | 10 +++---- interfaces/CMakeLists.txt | 1 - interfaces/kdebugnamespace.cpp | 27 ----------------- interfaces/kdebugnamespace.h | 29 ------------------- kcm/CMakeLists.txt | 1 - kcm/devicessortproxymodel.cpp | 7 ++--- kcm/kcm.cpp | 3 +- kcm/kdebugnamespace.cpp | 26 ----------------- kcm/kdebugnamespace.h | 29 ------------------- kded/kded.cpp | 22 +++++++------- kio/CMakeLists.txt | 2 +- kio/kdebugnamespace.cpp | 26 ----------------- kio/kdebugnamespace.h | 29 ------------------- kio/kiokdeconnect.cpp | 14 ++++----- plugins/battery/batterydbusinterface.cpp | 2 +- plugins/mpriscontrol/mpriscontrolplugin.cpp | 18 ++++-------- .../notificationsdbusinterface.cpp | 6 ++-- plugins/ping/pingplugin.cpp | 6 ++-- plugins/sftp/mounter.cpp | 22 +++++++------- plugins/sftp/sftpplugin.cpp | 16 +++++----- plugins/share/shareplugin.cpp | 12 ++++---- plugins/telephony/telephonyplugin.cpp | 2 +- 32 files changed, 120 insertions(+), 321 deletions(-) delete mode 100644 core/kdebugnamespace.cpp delete mode 100644 interfaces/kdebugnamespace.cpp delete mode 100644 interfaces/kdebugnamespace.h delete mode 100644 kcm/kdebugnamespace.cpp delete mode 100644 kcm/kdebugnamespace.h delete mode 100644 kio/kdebugnamespace.cpp delete mode 100644 kio/kdebugnamespace.h diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index aa7ee5ba0..49bcaba5d 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -28,7 +28,6 @@ set(kded_kdeconnect_SRCS filetransferjob.cpp daemon.cpp device.cpp - kdebugnamespace.cpp ) kde4_add_library(kdeconnectcore SHARED ${kded_kdeconnect_SRCS}) diff --git a/core/backends/lan/landevicelink.cpp b/core/backends/lan/landevicelink.cpp index 03c9f1ff8..be8a37b1f 100644 --- a/core/backends/lan/landevicelink.cpp +++ b/core/backends/lan/landevicelink.cpp @@ -80,7 +80,7 @@ void LanDeviceLink::dataReceived() const QByteArray package = mSocketLineReader->readLine(); - //kDebug(kdeconnect_kded()) << "LanDeviceLink dataReceived" << package; + //kDebug(debugArea()) << "LanDeviceLink dataReceived" << package; NetworkPackage unserialized(QString::null); NetworkPackage::unserialize(package, &unserialized); @@ -90,7 +90,7 @@ void LanDeviceLink::dataReceived() unserialized.decrypt(mPrivateKey, &decrypted); if (decrypted.hasPayloadTransferInfo()) { - kDebug(kdeconnect_kded()) << "HasPayloadTransferInfo"; + kDebug(debugArea()) << "HasPayloadTransferInfo"; DownloadJob* job = new DownloadJob(mSocketLineReader->peerAddress(), decrypted.payloadTransferInfo()); job->start(); decrypted.setPayload(job->getPayload(), decrypted.payloadSize()); diff --git a/core/backends/lan/lanlinkprovider.cpp b/core/backends/lan/lanlinkprovider.cpp index 13855ffb8..c59cba242 100644 --- a/core/backends/lan/lanlinkprovider.cpp +++ b/core/backends/lan/lanlinkprovider.cpp @@ -151,7 +151,7 @@ void LanLinkProvider::connectError() disconnect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(connectError())); disconnect(socket, SIGNAL(connected()), this, SLOT(connected())); - kDebug(kdeconnect_kded()) << "Fallback (1), try reverse connection"; + kDebug(debugArea()) << "Fallback (1), try reverse connection"; NetworkPackage np(""); NetworkPackage::createIdentityPackage(&np); np.set("tcpPort", mTcpPort); @@ -173,7 +173,7 @@ void LanLinkProvider::connected() NetworkPackage* receivedPackage = receivedIdentityPackages[socket].np; const QString& deviceId = receivedPackage->get("deviceId"); - //kDebug(kdeconnect_kded()) << "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(kdeconnect_kded()) << "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*))); @@ -206,7 +206,7 @@ void LanLinkProvider::connected() } else { //I think this will never happen - kDebug(kdeconnect_kded()) << "Fallback (2), try reverse connection"; + kDebug(debugArea()) << "Fallback (2), try reverse connection"; mUdpSocket.writeDatagram(np2.serialize(), receivedIdentityPackages[socket].sender, port); delete deviceLink; } @@ -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(kdeconnect_kded()) << "LanLinkProvider newConnection"; + //kDebug(debugArea()) << "LanLinkProvider newConnection"; while(mTcpServer->hasPendingConnections()) { QTcpSocket* socket = mTcpServer->nextPendingConnection(); @@ -234,7 +234,7 @@ void LanLinkProvider::newConnection() NetworkPackage::createIdentityPackage(&np); int written = socket->write(np.serialize()); - kDebug(kdeconnect_kded()) << "LanLinkProvider sent package." << written << " bytes written, waiting for reply"; + kDebug(debugArea()) << "LanLinkProvider sent package." << written << " bytes written, waiting for reply"; */ } @@ -246,20 +246,20 @@ void LanLinkProvider::dataReceived() const QByteArray data = socket->readLine(); - //kDebug(kdeconnect_kded()) << "LanLinkProvider received reply:" << data; + //kDebug(debugArea()) << "LanLinkProvider received reply:" << data; NetworkPackage np(""); bool success = NetworkPackage::unserialize(data, &np); if (!success || np.type() != PACKAGE_TYPE_IDENTITY) { - kDebug(kdeconnect_kded()) << "LanLinkProvider/newConnection: Not an identification package (wuh?)"; + kDebug(debugArea()) << "LanLinkProvider/newConnection: Not an identification package (wuh?)"; return; } const QString& deviceId = np.get("deviceId"); LanDeviceLink* deviceLink = new LanDeviceLink(deviceId, this, socket); - //kDebug(kdeconnect_kded()) << "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(kdeconnect_kded()) << "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) { diff --git a/core/backends/lan/uploadjob.cpp b/core/backends/lan/uploadjob.cpp index a5b12154e..752bf69e6 100644 --- a/core/backends/lan/uploadjob.cpp +++ b/core/backends/lan/uploadjob.cpp @@ -39,7 +39,7 @@ void UploadJob::start() while(!mServer->listen(QHostAddress::Any, mPort)) { mPort++; if (mPort > 1764) { //No ports available? - kDebug(kdeconnect_kded()) << "Error opening a port in range 1739-1764 for file transfer"; + kDebug(debugArea()) << "Error opening a port in range 1739-1764 for file transfer"; mPort = 0; return; } diff --git a/core/daemon.cpp b/core/daemon.cpp index 9a259eebf..38ad08d15 100644 --- a/core/daemon.cpp +++ b/core/daemon.cpp @@ -69,13 +69,13 @@ Daemon::Daemon(QObject *parent) uuid = uuid.mid(1, uuid.length() - 2).replace("-", "_"); config->group("myself").writeEntry("id", uuid); config->sync(); - kDebug(kdeconnect_kded()) << "My id:" << uuid; + kDebug(debugArea()) << "My id:" << uuid; } - //kDebug(kdeconnect_kded()) << "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(kdeconnect_kded()) << "Error: KDE Connect could not find support for RSA in your QCA installation, if your distribution provides" + kWarning(debugArea()) << "Error: KDE Connect could not find support for RSA in your QCA installation, if your distribution provides" << "separate packages for QCA-ossl and QCA-gnupg plugins, make sure you have them installed and try again"; return; } @@ -89,13 +89,13 @@ Daemon::Daemon(QObject *parent) if (!privKey.open(QIODevice::ReadWrite | QIODevice::Truncate)) { - kWarning(kdeconnect_kded()) << "Error: KDE Connect could not create private keys file: " << privateKeyPath; + kWarning(debugArea()) << "Error: KDE Connect could not create private keys file: " << privateKeyPath; return; } if (!privKey.setPermissions(strict)) { - kWarning(kdeconnect_kded()) << "Error: KDE Connect could not set permissions for private file: " << privateKeyPath; + kWarning(debugArea()) << "Error: KDE Connect could not set permissions for private file: " << privateKeyPath; } //http://delta.affinix.com/docs/qca/rsatest_8cpp-example.html @@ -113,11 +113,11 @@ Daemon::Daemon(QObject *parent) if (QFile::permissions(config->group("myself").readEntry("privateKeyPath")) != strict) { - kWarning(kdeconnect_kded()) << "Error: KDE Connect detects wrong permissions for private file " << config->group("myself").readEntry("privateKeyPath"); + kWarning(debugArea()) << "Error: KDE Connect detects wrong permissions for private file " << config->group("myself").readEntry("privateKeyPath"); } //Debugging - kDebug(kdeconnect_kded()) << "Starting KdeConnect daemon"; + kDebug(debugArea()) << "Starting KdeConnect daemon"; //Load backends (hardcoded by now, should be plugins in a future) d->mLinkProviders.insert(new LanLinkProvider()); @@ -185,14 +185,14 @@ void Daemon::onNewDeviceLink(const NetworkPackage& identityPackage, DeviceLink* const QString& id = identityPackage.get("deviceId"); - //kDebug(kdeconnect_kded()) << "Device discovered" << id << "via" << dl->provider()->name(); + //kDebug(debugArea()) << "Device discovered" << id << "via" << dl->provider()->name(); if (d->mDevices.contains(id)) { - //kDebug(kdeconnect_kded()) << "It is a known device"; + //kDebug(debugArea()) << "It is a known device"; Device* device = d->mDevices[id]; device->addLink(identityPackage, dl); } else { - //kDebug(kdeconnect_kded()) << "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,12 +213,12 @@ void Daemon::onDeviceReachableStatusChanged() Q_EMIT deviceVisibilityChanged(id, device->isReachable()); - //kDebug(kdeconnect_kded()) << "Device" << device->name() << "reachable status changed:" << device->isReachable(); + //kDebug(debugArea()) << "Device" << device->name() << "reachable status changed:" << device->isReachable(); if (!device->isReachable()) { if (!device->isPaired()) { - kDebug(kdeconnect_kded()) << "Destroying device" << device->name(); + kDebug(debugArea()) << "Destroying device" << device->name(); Q_EMIT deviceRemoved(id); d->mDevices.remove(id); device->deleteLater(); diff --git a/core/device.cpp b/core/device.cpp index b0051401b..dacc7db79 100644 --- a/core/device.cpp +++ b/core/device.cpp @@ -233,7 +233,7 @@ static bool lessThan(DeviceLink* p1, DeviceLink* p2) void Device::addLink(const NetworkPackage& identityPackage, DeviceLink* link) { - //kDebug(kdeconnect_kded()) << "Adding link to" << id() << "via" << link->provider(); + //kDebug(debugArea()) << "Adding link to" << id() << "via" << link->provider(); m_protocolVersion = identityPackage.get("protocolVersion"); if (m_protocolVersion != NetworkPackage::ProtocolVersion) { @@ -280,7 +280,7 @@ void Device::removeLink(DeviceLink* link) { m_deviceLinks.removeOne(link); - //kDebug(kdeconnect_kded()) << "RemoveLink" << m_deviceLinks.size() << "links remaining"; + //kDebug(debugArea()) << "RemoveLink" << m_deviceLinks.size() << "links remaining"; if (m_deviceLinks.isEmpty()) { reloadPlugins(); @@ -313,12 +313,12 @@ void Device::privateReceivedPackage(const NetworkPackage& np) { if (np.type() == PACKAGE_TYPE_PAIR) { - //kDebug(kdeconnect_kded()) << "Pair package"; + //kDebug(debugArea()) << "Pair package"; bool wantsPair = np.get("pair"); if (wantsPair == isPaired()) { - kDebug(kdeconnect_kded()) << "Already" << (wantsPair? "paired":"unpaired"); + kDebug(debugArea()) << "Already" << (wantsPair? "paired":"unpaired"); if (m_pairStatus == Device::Requested) { m_pairStatus = Device::NotPaired; m_pairingTimeut.stop(); @@ -333,7 +333,7 @@ void Device::privateReceivedPackage(const NetworkPackage& np) const QString& key = np.get("publicKey"); m_publicKey = QCA::RSAPublicKey::fromPEM(key); if (m_publicKey.isNull()) { - kDebug(kdeconnect_kded()) << "ERROR decoding key"; + kDebug(debugArea()) << "ERROR decoding key"; if (m_pairStatus == Device::Requested) { m_pairStatus = Device::NotPaired; m_pairingTimeut.stop(); @@ -344,12 +344,12 @@ void Device::privateReceivedPackage(const NetworkPackage& np) if (m_pairStatus == Device::Requested) { //We started pairing - kDebug(kdeconnect_kded()) << "Pair answer"; + kDebug(debugArea()) << "Pair answer"; setAsPaired(); } else { - kDebug(kdeconnect_kded()) << "Pair request"; + kDebug(debugArea()) << "Pair request"; KNotification* notification = new KNotification("pingReceived"); //KNotification::Persistent notification->setPixmap(KIcon("dialog-information").pixmap(48, 48)); @@ -367,7 +367,7 @@ void Device::privateReceivedPackage(const NetworkPackage& np) } else { - kDebug(kdeconnect_kded()) << "Unpair request"; + kDebug(debugArea()) << "Unpair request"; PairStatus prevPairStatus = m_pairStatus; m_pairStatus = Device::NotPaired; @@ -390,7 +390,7 @@ void Device::privateReceivedPackage(const NetworkPackage& np) plugin->receivePackage(np); } } else { - kDebug(kdeconnect_kded()) << "device" << name() << "not paired, ignoring package" << np.type(); + kDebug(debugArea()) << "device" << name() << "not paired, ignoring package" << np.type(); unpair(); } @@ -408,7 +408,7 @@ bool Device::sendOwnPublicKey() void Device::rejectPairing() { - kDebug(kdeconnect_kded()) << "Rejected pairing"; + kDebug(debugArea()) << "Rejected pairing"; m_pairStatus = Device::NotPaired; @@ -424,7 +424,7 @@ void Device::acceptPairing() { if (m_pairStatus != Device::RequestedByPeer) return; - kDebug(kdeconnect_kded()) << "Accepted pairing"; + kDebug(debugArea()) << "Accepted pairing"; bool success = sendOwnPublicKey(); diff --git a/core/filetransferjob.cpp b/core/filetransferjob.cpp index f98e95a2d..a7db9d058 100644 --- a/core/filetransferjob.cpp +++ b/core/filetransferjob.cpp @@ -41,18 +41,18 @@ FileTransferJob::FileTransferJob(const QSharedPointer& origin, int si mDeviceName = i18nc("Device name that will appear on the jobs", "KDE-Connect"); setCapabilities(Killable); - kDebug(kdeconnect_kded()) << "FileTransferJob Downloading payload to" << destination; + kDebug(debugArea()) << "FileTransferJob Downloading payload to" << destination; } void FileTransferJob::openFinished(KJob* job) { - kDebug(kdeconnect_kded()) << job->errorString(); + kDebug(debugArea()) << job->errorString(); } void FileTransferJob::start() { QMetaObject::invokeMethod(this, "doStart", Qt::QueuedConnection); - //kDebug(kdeconnect_kded()) << "FileTransferJob start"; + //kDebug(debugArea()) << "FileTransferJob start"; } void FileTransferJob::doStart() @@ -136,10 +136,10 @@ void FileTransferJob::open(KIO::Job* job) { Q_UNUSED(job); - //kDebug(kdeconnect_kded()) << "FileTransferJob open"; + //kDebug(debugArea()) << "FileTransferJob open"; if (!mOrigin) { - kDebug(kdeconnect_kded()) << "FileTransferJob: Origin is null"; + kDebug(debugArea()) << "FileTransferJob: Origin is null"; return; } @@ -161,7 +161,7 @@ void FileTransferJob::readyRead() mWritten += data.size(); setProcessedAmount(Bytes, mWritten); - //kDebug(kdeconnect_kded()) << "readyRead" << mSize << mWritten << bytes; + //kDebug(debugArea()) << "readyRead" << mSize << mWritten << bytes; if (mSize > -1) { //If a least 1 second has passed since last update @@ -192,11 +192,11 @@ void FileTransferJob::sourceFinished() //TODO: MD5 check the file if (mSize > -1 && mWritten != mSize) { - kDebug(kdeconnect_kded()) << "Received incomplete file (" << mWritten << " of " << mSize << " bytes)"; + kDebug(debugArea()) << "Received incomplete file (" << mWritten << " of " << mSize << " bytes)"; setError(1); setErrorText(i18n("Received incomplete file")); } else { - kDebug(kdeconnect_kded()) << "Finished transfer" << mDestinationJob->url(); + kDebug(debugArea()) << "Finished transfer" << mDestinationJob->url(); } mDestinationJob->close(); mDestinationJob->deleteLater(); diff --git a/core/kdebugnamespace.cpp b/core/kdebugnamespace.cpp deleted file mode 100644 index a2c8e8799..000000000 --- a/core/kdebugnamespace.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright 2013 Albert Vaca - * - * 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 . - */ - -#include "kdebugnamespace.h" - -int kdeconnect_kded() { - static int s_area = KDebug::registerArea("kdeconnect_kded", true); - return s_area; -} - - diff --git a/core/kdebugnamespace.h b/core/kdebugnamespace.h index 60c733dab..c7a094a48 100644 --- a/core/kdebugnamespace.h +++ b/core/kdebugnamespace.h @@ -23,7 +23,11 @@ #include -KDE_EXPORT int kdeconnect_kded(); +inline int debugArea() +{ + static int theArea = KDebug::registerArea("kdeconnect"); + return theArea; +}; #endif diff --git a/core/networkpackage.cpp b/core/networkpackage.cpp index 16ade4a9c..330850ce9 100644 --- a/core/networkpackage.cpp +++ b/core/networkpackage.cpp @@ -82,10 +82,10 @@ QByteArray NetworkPackage::serialize() const QJson::Serializer serializer; QByteArray json = serializer.serialize(variant,&ok); if (!ok) { - kDebug(kdeconnect_kded()) << "Serialization error:" << serializer.errorMessage(); + kDebug(debugArea()) << "Serialization error:" << serializer.errorMessage(); } else { if (!isEncrypted()) { - //kDebug(kdeconnect_kded()) << "Serialized package:" << json; + //kDebug(kDebugArea) << "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) { - kDebug(kdeconnect_kded()) << "Unserialization error:" << a; + kDebug(debugArea()) << "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()) { - //kDebug(kdeconnect_kded()) << "Unserialized: " << a; + //kDebug(kDebugArea) << "Unserialized: " << a; } np->mPayloadSize = variant["payloadSize"].toInt(); //Will return 0 if was not present, which is ok diff --git a/core/pluginloader.cpp b/core/pluginloader.cpp index 1c10c0705..b5f971432 100644 --- a/core/pluginloader.cpp +++ b/core/pluginloader.cpp @@ -50,7 +50,7 @@ KPluginInfo PluginLoader::getPluginInfo(const QString& name) const { KService::Ptr service = plugins[name]; if (!service) { - kDebug(kdeconnect_kded()) << "Plugin unknown" << name; + kDebug(debugArea()) << "Plugin unknown" << name; return KPluginInfo(); } @@ -63,13 +63,13 @@ PluginData PluginLoader::instantiatePluginForDevice(const QString& name, Device* KService::Ptr service = plugins[name]; if (!service) { - kDebug(kdeconnect_kded()) << "Plugin unknown" << name; + kDebug(debugArea()) << "Plugin unknown" << name; return ret; } KPluginFactory *factory = KPluginLoader(service->library()).factory(); if (!factory) { - kDebug(kdeconnect_kded()) << "KPluginFactory could not load the plugin:" << service->library(); + kDebug(debugArea()) << "KPluginFactory could not load the plugin:" << service->library(); return ret; } @@ -81,11 +81,11 @@ PluginData PluginLoader::instantiatePluginForDevice(const QString& name, Device* //FIXME any reason to use QObject in template param instead KdeConnectPlugin? ret.plugin = factory->create(device, QVariantList() << deviceVariant << ret.outgoingInterfaces); if (!ret.plugin) { - kDebug(kdeconnect_kded()) << "Error loading plugin"; + kDebug(debugArea()) << "Error loading plugin"; return ret; } - kDebug(kdeconnect_kded()) << "Loaded plugin:" << service->name(); + kDebug(debugArea()) << "Loaded plugin:" << service->name(); return ret; } diff --git a/interfaces/CMakeLists.txt b/interfaces/CMakeLists.txt index a708ba1ab..3a8e9bc1e 100644 --- a/interfaces/CMakeLists.txt +++ b/interfaces/CMakeLists.txt @@ -15,7 +15,6 @@ set(libkdeconnect_SRC devicesmodel.cpp notificationsmodel.cpp modeltest.cpp - kdebugnamespace.cpp ) set(libkdeconnect_public_HEADERS diff --git a/interfaces/kdebugnamespace.cpp b/interfaces/kdebugnamespace.cpp deleted file mode 100644 index 749e63253..000000000 --- a/interfaces/kdebugnamespace.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright 2013 Albert Vaca - * - * 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 . - */ - -#include "kdebugnamespace.h" - -int libkdeconnect() { - static int s_area = KDebug::registerArea("kdeconnect_libkdeconnect", true); - return s_area; -} - diff --git a/interfaces/kdebugnamespace.h b/interfaces/kdebugnamespace.h deleted file mode 100644 index 322c8adca..000000000 --- a/interfaces/kdebugnamespace.h +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright 2013 Albert Vaca - * - * 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 . - */ - -#ifndef KDEBUG_LIBKDECONNECT_H -#define KDEBUG_LIBKDECONNECT_H - -#include - -int libkdeconnect(); - -#endif - diff --git a/kcm/CMakeLists.txt b/kcm/CMakeLists.txt index a1c1db4a7..0e30819ea 100644 --- a/kcm/CMakeLists.txt +++ b/kcm/CMakeLists.txt @@ -7,7 +7,6 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR} set(kcm_SRCS kcm.cpp devicessortproxymodel.cpp - kdebugnamespace.cpp ) kde4_add_ui_files(kcm_SRCS kcm.ui) diff --git a/kcm/devicessortproxymodel.cpp b/kcm/devicessortproxymodel.cpp index e17ec8b87..929371df4 100644 --- a/kcm/devicessortproxymodel.cpp +++ b/kcm/devicessortproxymodel.cpp @@ -20,10 +20,9 @@ #include "devicessortproxymodel.h" -#include "interfaces/dbusinterfaces.h" -#include "interfaces/devicesmodel.h" - -#include "kdebugnamespace.h" +#include +#include +#include DevicesSortProxyModel::DevicesSortProxyModel(DevicesModel* devicesModel) : QSortFilterProxyModel(devicesModel) diff --git a/kcm/kcm.cpp b/kcm/kcm.cpp index f809a53c7..746c7c8c8 100644 --- a/kcm/kcm.cpp +++ b/kcm/kcm.cpp @@ -34,11 +34,12 @@ #include #include +#include + #include "ui_kcm.h" #include "interfaces/dbusinterfaces.h" #include "interfaces/devicesmodel.h" #include "devicessortproxymodel.h" -#include "kdebugnamespace.h" K_PLUGIN_FACTORY(KdeConnectKcmFactory, registerPlugin();) K_EXPORT_PLUGIN(KdeConnectKcmFactory("kdeconnect-kcm", "kdeconnect-kcm")) diff --git a/kcm/kdebugnamespace.cpp b/kcm/kdebugnamespace.cpp deleted file mode 100644 index c38db0fbe..000000000 --- a/kcm/kdebugnamespace.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright 2013 Albert Vaca - * - * 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 . - */ - -#include "kdebugnamespace.h" - -int kdeconnect_kcm() { - static int s_area = KDebug::registerArea("kdeconnect_kcm", true); - return s_area; -} diff --git a/kcm/kdebugnamespace.h b/kcm/kdebugnamespace.h deleted file mode 100644 index 47a7d4374..000000000 --- a/kcm/kdebugnamespace.h +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright 2013 Albert Vaca - * - * 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 . - */ - -#ifndef KDEBUG_KDECONNECT_KCM_H -#define KDEBUG_KDECONNECT_KCM_H - -#include - -int kdeconnect_kcm(); - -#endif - diff --git a/kded/kded.cpp b/kded/kded.cpp index 8159124ce..2ec9062e6 100644 --- a/kded/kded.cpp +++ b/kded/kded.cpp @@ -27,8 +27,6 @@ #include "core/kdebugnamespace.h" -int theArea = KDebug::registerArea("kdeconnect-kded"); - K_PLUGIN_FACTORY(KdeConnectFactory, registerPlugin();) K_EXPORT_PLUGIN(KdeConnectFactory("kdeconnect", "kdeconnect-kded")) @@ -37,13 +35,13 @@ Kded::Kded(QObject *parent, const QList&) , m_daemon(0) { QMetaObject::invokeMethod(this, "start", Qt::QueuedConnection); - kDebug(theArea) << "kded_kdeconnect started"; + kDebug(debugArea()) << "kded_kdeconnect started"; } Kded::~Kded() { stop(); - kDebug(theArea) << "kded_kdeconnect stopped"; + kDebug(debugArea()) << "kded_kdeconnect stopped"; } void Kded::start() @@ -53,7 +51,7 @@ void Kded::start() } const QString daemon = KStandardDirs::locate("exe", "kdeconnectd"); - kDebug(theArea) << "Starting daemon " << daemon; + kDebug(debugArea()) << "Starting daemon " << daemon; m_daemon = new KProcess(this); connect(m_daemon, SIGNAL(started()), SLOT(daemonStarted())); connect(m_daemon, SIGNAL(error(QProcess::ProcessError)), this, SLOT(onError(QProcess::ProcessError))); @@ -85,24 +83,24 @@ void Kded::restart() void Kded::onError(QProcess::ProcessError errorCode) { - kError(theArea) << "Process error code=" << errorCode; + kError(debugArea()) << "Process error code=" << errorCode; } void Kded::daemonStarted() { - kDebug(theArea) << "Daemon successfuly started"; + kDebug(debugArea()) << "Daemon successfuly started"; Q_EMIT started(); } void Kded::onFinished(int exitCode, QProcess::ExitStatus status) { if (status == QProcess::CrashExit) { - kError(theArea) << "Process crashed with code=" << exitCode; - kError(theArea) << m_daemon->readAllStandardError(); - kWarning(theArea) << "Restarting in 5 sec..."; + kError(debugArea()) << "Process crashed with code=" << exitCode; + kError(debugArea()) << m_daemon->readAllStandardError(); + kWarning(debugArea()) << "Restarting in 5 sec..."; QTimer::singleShot(5000, this, SLOT(start())); } else { - kWarning(theArea) << "Process finished with code=" << exitCode; + kWarning(debugArea()) << "Process finished with code=" << exitCode; } Q_EMIT stopped(); @@ -116,5 +114,5 @@ void Kded::checkIfDaemonTerminated() } m_daemon->kill(); - kWarning(theArea) << "Daemon killed"; + kWarning(debugArea()) << "Daemon killed"; } diff --git a/kio/CMakeLists.txt b/kio/CMakeLists.txt index f5a202ab8..b54bb1a2a 100644 --- a/kio/CMakeLists.txt +++ b/kio/CMakeLists.txt @@ -2,7 +2,7 @@ include_directories(${CMAKE_SOURCE_DIR}) set(kio_kdeconnect_PART_SRCS kiokdeconnect.cpp - kdebugnamespace.cpp) +) kde4_add_plugin(kio_kdeconnect ${kio_kdeconnect_PART_SRCS}) diff --git a/kio/kdebugnamespace.cpp b/kio/kdebugnamespace.cpp deleted file mode 100644 index a8c13ae98..000000000 --- a/kio/kdebugnamespace.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright 2013 Albert Vaca - * - * 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 . - */ - -#include "kdebugnamespace.h" - -int kdeconnect_kio() { - static int s_area = KDebug::registerArea("kdeconnect_kio", true); - return s_area; -} diff --git a/kio/kdebugnamespace.h b/kio/kdebugnamespace.h deleted file mode 100644 index 9e536c0dd..000000000 --- a/kio/kdebugnamespace.h +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright 2013 Albert Vaca - * - * 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 . - */ - -#ifndef KDEBUG_KDECONNECT_KCM_H -#define KDEBUG_KDECONNECT_KCM_H - -#include - -int kdeconnect_kio(); - -#endif - diff --git a/kio/kiokdeconnect.cpp b/kio/kiokdeconnect.cpp index 662712664..3b8e84eb1 100644 --- a/kio/kiokdeconnect.cpp +++ b/kio/kiokdeconnect.cpp @@ -32,7 +32,7 @@ #include #include -#include "kdebugnamespace.h" +#include extern "C" int KDE_EXPORT kdemain(int argc, char **argv) { @@ -74,7 +74,7 @@ bool handleDBusError(QDBusReply& reply, KIO::SlaveBase* slave) { if (!reply.isValid()) { - kDebug(kdeconnect_kio()) << "Error in DBus request:" << reply.error(); + kDebug(debugArea()) << "Error in DBus request:" << reply.error(); slave->error(toKioError(reply.error().type()),reply.error().message()); return true; } @@ -129,7 +129,7 @@ void KioKdeconnect::listDevice() { infoMessage(i18n("Accessing device...")); - kDebug(kdeconnect_kio()) << "ListDevice" << m_currentDevice; + kDebug(debugArea()) << "ListDevice" << m_currentDevice; SftpDbusInterface interface(m_currentDevice); @@ -184,7 +184,7 @@ void KioKdeconnect::listDevice() void KioKdeconnect::listDir(const KUrl &url) { - kDebug(kdeconnect_kio()) << "Listing..." << url; + kDebug(debugArea()) << "Listing..." << url; /// Url is not used here becuase all we could care about the url is the host, and that's already /// handled in @p setHost @@ -206,7 +206,7 @@ void KioKdeconnect::listDir(const KUrl &url) void KioKdeconnect::stat(const KUrl &url) { - kDebug(kdeconnect_kio()) << "Stat: " << url; + kDebug(debugArea()) << "Stat: " << url; KIO::UDSEntry entry; entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR); @@ -217,7 +217,7 @@ void KioKdeconnect::stat(const KUrl &url) void KioKdeconnect::get(const KUrl &url) { - kDebug(kdeconnect_kio()) << "Get: " << url; + kDebug(debugArea()) << "Get: " << url; mimeType(""); finished(); } @@ -227,7 +227,7 @@ void KioKdeconnect::setHost(const QString &hostName, quint16 port, const QString //This is called before everything else to set the file we want to show - kDebug(kdeconnect_kio()) << "Setting host: " << hostName; + kDebug(debugArea()) << "Setting host: " << hostName; // In this kio only the hostname is used Q_UNUSED(port) diff --git a/plugins/battery/batterydbusinterface.cpp b/plugins/battery/batterydbusinterface.cpp index ea550fb8b..b3b22dd64 100644 --- a/plugins/battery/batterydbusinterface.cpp +++ b/plugins/battery/batterydbusinterface.cpp @@ -30,7 +30,7 @@ BatteryDbusInterface::BatteryDbusInterface(const Device *device) BatteryDbusInterface::~BatteryDbusInterface() { - kDebug(kdeconnect_kded()) << "Destroying BatteryDbusInterface"; + kDebug(debugArea()) << "Destroying BatteryDbusInterface"; } void BatteryDbusInterface::updateValues(bool isCharging, int currentCharge) diff --git a/plugins/mpriscontrol/mpriscontrolplugin.cpp b/plugins/mpriscontrol/mpriscontrolplugin.cpp index f76002098..dba821e8c 100644 --- a/plugins/mpriscontrol/mpriscontrolplugin.cpp +++ b/plugins/mpriscontrol/mpriscontrolplugin.cpp @@ -62,7 +62,7 @@ void MprisControlPlugin::serviceOwnerChanged(const QString &name, if (name.startsWith("org.mpris.MediaPlayer2")) { - kDebug(kdeconnect_kded()) << "Mpris (un)registered in bus" << name << oldOwner << newOwner; + kDebug(debugArea()) << "Mpris (un)registered in bus" << name << oldOwner << newOwner; if (oldOwner.isEmpty()) { addPlayer(name); @@ -78,7 +78,7 @@ void MprisControlPlugin::addPlayer(const QString& service) //FIXME: This call hangs and returns an empty string if KDED is still starting! const QString identity = mprisInterface.property("Identity").toString(); playerList[identity] = service; - kDebug(kdeconnect_kded()) << "Mpris addPlayer" << service << "->" << identity; + kDebug(debugArea()) << "Mpris addPlayer" << service << "->" << identity; sendPlayerList(); OrgFreedesktopDBusPropertiesInterface* freedesktopInterface = new OrgFreedesktopDBusPropertiesInterface(service, "/org/mpris/MediaPlayer2", QDBusConnection::sessionBus(), this); @@ -132,7 +132,7 @@ void MprisControlPlugin::propertiesChanged(const QString& propertyInterface, con void MprisControlPlugin::removePlayer(const QString& ifaceName) { const QString identity = playerList.key(ifaceName); - kDebug(kdeconnect_kded()) << "Mpris removePlayer" << ifaceName << "->" << identity; + kDebug(debugArea()) << "Mpris removePlayer" << ifaceName << "->" << identity; playerList.remove(identity); sendPlayerList(); } @@ -157,18 +157,18 @@ bool MprisControlPlugin::receivePackage (const NetworkPackage& np) OrgMprisMediaPlayer2PlayerInterface mprisInterface(playerList[player], "/org/mpris/MediaPlayer2", QDBusConnection::sessionBus()); if (np.has("action")) { const QString& action = np.get("action"); - kDebug(kdeconnect_kded()) << "Calling action" << action << "in" << playerList[player]; + kDebug(debugArea()) << "Calling action" << action << "in" << playerList[player]; //TODO: Check for valid actions mprisInterface.call(action); } if (np.has("setVolume")) { double volume = np.get("setVolume")/100.f; - kDebug(kdeconnect_kded()) << "Setting volume" << volume << "to" << playerList[player]; + kDebug(debugArea()) << "Setting volume" << volume << "to" << playerList[player]; mprisInterface.setVolume(volume); } if (np.has("Seek")) { int offset = np.get("Seek"); - kDebug(kdeconnect_kded()) << "Seeking" << offset << "to" << playerList[player]; + kDebug(debugArea()) << "Seeking" << offset << "to" << playerList[player]; mprisInterface.Seek(offset); } @@ -185,20 +185,15 @@ bool MprisControlPlugin::receivePackage (const NetworkPackage& np) answer.set("nowPlaying",nowPlaying); - - bool playing = (mprisInterface.playbackStatus() == QLatin1String("Playing")); answer.set("isPlaying", playing); somethingToSend = true; - - } if (np.get("requestVolume")) { int volume = (int)(mprisInterface.volume() * 100); answer.set("volume",volume); somethingToSend = true; - } if (somethingToSend) { answer.set("player", player); @@ -206,7 +201,6 @@ bool MprisControlPlugin::receivePackage (const NetworkPackage& np) } return true; - } void MprisControlPlugin::sendPlayerList() diff --git a/plugins/notifications/notificationsdbusinterface.cpp b/plugins/notifications/notificationsdbusinterface.cpp index 412640d71..84a71a73e 100644 --- a/plugins/notifications/notificationsdbusinterface.cpp +++ b/plugins/notifications/notificationsdbusinterface.cpp @@ -111,10 +111,10 @@ void NotificationsDbusInterface::addNotification(Notification* noti) void NotificationsDbusInterface::removeNotification(const QString& internalId) { - kDebug(kdeconnect_kded()) << "removeNotification" << internalId; + kDebug(debugArea()) << "removeNotification" << internalId; if (!mInternalIdToPublicId.contains(internalId)) { - kDebug(kdeconnect_kded()) << "Not found"; + kDebug(debugArea()) << "Not found"; return; } @@ -122,7 +122,7 @@ void NotificationsDbusInterface::removeNotification(const QString& internalId) Notification* noti = mNotifications.take(publicId); if (!noti) { - kDebug(kdeconnect_kded()) << "Not found"; + kDebug(debugArea()) << "Not found"; return; } diff --git a/plugins/ping/pingplugin.cpp b/plugins/ping/pingplugin.cpp index 5d5575c04..b0616e181 100644 --- a/plugins/ping/pingplugin.cpp +++ b/plugins/ping/pingplugin.cpp @@ -34,12 +34,12 @@ K_EXPORT_PLUGIN( KdeConnectPluginFactory("kdeconnect_ping", "kdeconnect-plugins" PingPlugin::PingPlugin(QObject* parent, const QVariantList& args) : KdeConnectPlugin(parent, args) { - //kDebug(kdeconnect_kded()) << "Ping plugin constructor for device" << device()->name(); + //kDebug(debugArea()) << "Ping plugin constructor for device" << device()->name(); } PingPlugin::~PingPlugin() { - //kDebug(kdeconnect_kded()) << "Ping plugin destructor for device" << device()->name(); + //kDebug(debugArea()) << "Ping plugin destructor for device" << device()->name(); } bool PingPlugin::receivePackage(const NetworkPackage& np) @@ -59,7 +59,7 @@ void PingPlugin::sendPing() { NetworkPackage np(PACKAGE_TYPE_PING); bool success = sendPackage(np); - kDebug(kdeconnect_kded()) << "sendPing:" << success; + kDebug(debugArea()) << "sendPing:" << success; } void PingPlugin::connected() diff --git a/plugins/sftp/mounter.cpp b/plugins/sftp/mounter.cpp index de28e1200..5947c24f4 100644 --- a/plugins/sftp/mounter.cpp +++ b/plugins/sftp/mounter.cpp @@ -59,13 +59,13 @@ Mounter::Mounter(SftpPlugin* sftp, int idleTimeout) m_idleTimer.setSingleShot(false); QTimer::singleShot(0, this, SLOT(start())); - kDebug(kdeconnect_kded()) << "Created"; + kDebug(debugArea()) << "Created"; } Mounter::~Mounter() { unmount(); - kDebug(kdeconnect_kded()) << "Destroyed"; + kDebug(debugArea()) << "Destroyed"; } bool Mounter::wait() @@ -75,7 +75,7 @@ bool Mounter::wait() return true; } - kDebug(kdeconnect_kded()) << "Starting loop to wait for mount"; + kDebug(debugArea()) << "Starting loop to wait for mount"; MountLoop loop; connect(this, SIGNAL(mounted()), &loop, SLOT(successed())); @@ -87,7 +87,7 @@ void Mounter::onPakcageReceived(const NetworkPackage& np) { if (np.get("stop", false)) { - kDebug(kdeconnect_kded()) << "SFTP server stopped"; + kDebug(debugArea()) << "SFTP server stopped"; unmount(); return; } @@ -142,13 +142,13 @@ void Mounter::onPakcageReceived(const NetworkPackage& np) cleanMountPoint(); - kDebug(kdeconnect_kded()) << "Staring process: " << m_proc->program().join(" "); + kDebug(debugArea()) << "Staring process: " << m_proc->program().join(" "); m_proc->start(); } void Mounter::onStarted() { - kDebug(kdeconnect_kded()) << "Porcess started"; + kDebug(debugArea()) << "Porcess started"; m_started = true; Q_EMIT mounted(); @@ -167,7 +167,7 @@ void Mounter::onError(QProcess::ProcessError error) { if (error == QProcess::FailedToStart) { - kDebug(kdeconnect_kded()) << "Porcess failed to start"; + kDebug(debugArea()) << "Porcess failed to start"; m_started = false; Q_EMIT failed(i18n("Failed to start sshfs")); } @@ -177,7 +177,7 @@ void Mounter::onFinished(int exitCode, QProcess::ExitStatus exitStatus) { if (exitStatus == QProcess::NormalExit) { - kDebug(kdeconnect_kded()) << "Process finished (exit code: " << exitCode << ")"; + kDebug(debugArea()) << "Process finished (exit code: " << exitCode << ")"; if (m_proc->property(idleTimeout_c).toBool()) { @@ -190,7 +190,7 @@ void Mounter::onFinished(int exitCode, QProcess::ExitStatus exitStatus) } else { - kDebug(kdeconnect_kded()) << "Porcess failed (exit code: " << exitCode << ")"; + kDebug(debugArea()) << "Porcess failed (exit code: " << exitCode << ")"; Q_EMIT failed(i18n("Error when accessing to filesystem")); } @@ -201,7 +201,7 @@ void Mounter::onFinished(int exitCode, QProcess::ExitStatus exitStatus) void Mounter::onMountTimeout() { - kDebug(kdeconnect_kded()) << "Timeout: device not responding"; + kDebug(debugArea()) << "Timeout: device not responding"; Q_EMIT failed(i18n("Failed to mount filesystem: device not responding")); } @@ -211,7 +211,7 @@ void Mounter::onIdleTimeout() if (m_lastActivity.secsTo(QDateTime::currentDateTime()) >= m_idleTimer.interval() / 1000) { - kDebug(kdeconnect_kded()) << "Timeout: there is no activity on moutned filesystem"; + kDebug(debugArea()) << "Timeout: there is no activity on moutned filesystem"; m_proc->setProperty(idleTimeout_c, true); unmount(); } diff --git a/plugins/sftp/sftpplugin.cpp b/plugins/sftp/sftpplugin.cpp index 1a04dc0a3..e4e4cdfa8 100644 --- a/plugins/sftp/sftpplugin.cpp +++ b/plugins/sftp/sftpplugin.cpp @@ -56,7 +56,7 @@ SftpPlugin::SftpPlugin(QObject *parent, const QVariantList &args) , m_d(new Pimpl) { addToDolphin(); - kDebug(kdeconnect_kded()) << "Created device:" << device()->name(); + kDebug(debugArea()) << "Created device:" << device()->name(); } SftpPlugin::~SftpPlugin() @@ -64,7 +64,7 @@ SftpPlugin::~SftpPlugin() QDBusConnection::sessionBus().unregisterObject(dbusPath(), QDBusConnection::UnregisterTree); removeFromDolphin(); unmount(); - kDebug(kdeconnect_kded()) << "Destroyed device:" << device()->name(); + kDebug(debugArea()) << "Destroyed device:" << device()->name(); } void SftpPlugin::addToDolphin() @@ -72,7 +72,7 @@ void SftpPlugin::addToDolphin() removeFromDolphin(); KUrl kioUrl("kdeconnect://"+device()->id()+"/"); m_d->placesModel.addPlace(device()->name(), kioUrl, "kdeconnect"); - kDebug(kdeconnect_kded()) << "add to dolphin"; + kDebug(debugArea()) << "add to dolphin"; } void SftpPlugin::removeFromDolphin() @@ -88,12 +88,12 @@ void SftpPlugin::removeFromDolphin() void SftpPlugin::connected() { bool state = QDBusConnection::sessionBus().registerObject(dbusPath(), this, QDBusConnection::ExportScriptableContents); - kDebug(kdeconnect_kded()) << "Exposing DBUS interface: " << state; + kDebug(debugArea()) << "Exposing DBUS interface: " << state; } void SftpPlugin::mount() { - kDebug(kdeconnect_kded()) << "Mount device:" << device()->name(); + kDebug(debugArea()) << "Mount device:" << device()->name(); if (m_d->mounter) { return; } @@ -160,7 +160,7 @@ QString SftpPlugin::mountPoint() void SftpPlugin::onMounted() { - kDebug(kdeconnect_kded()) << device()->name() << QString("Remote filesystem mounted at %1").arg(mountPoint()); + kDebug(debugArea()) << device()->name() << QString("Remote filesystem mounted at %1").arg(mountPoint()); Q_EMIT mounted(); } @@ -168,9 +168,9 @@ void SftpPlugin::onMounted() void SftpPlugin::onUnmounted(bool idleTimeout) { if (idleTimeout) { - kDebug(kdeconnect_kded()) << device()->name() << "Remote filesystem unmounted by idle timeout"; + kDebug(debugArea()) << device()->name() << "Remote filesystem unmounted by idle timeout"; } else { - kDebug(kdeconnect_kded()) << device()->name() << "Remote filesystem unmounted"; + kDebug(debugArea()) << device()->name() << "Remote filesystem unmounted"; } unmount(); diff --git a/plugins/share/shareplugin.cpp b/plugins/share/shareplugin.cpp index 7e4e0836a..214eecff5 100644 --- a/plugins/share/shareplugin.cpp +++ b/plugins/share/shareplugin.cpp @@ -55,7 +55,7 @@ KUrl SharePlugin::destinationDir() const QString url = dir.toLocalFile(); if (url.contains("%1")) url = url.arg(device()->name()); - kDebug(kdeconnect_kded()) << url; + kDebug(debugArea()) << url; QDir().mkpath(url); return url; @@ -67,7 +67,7 @@ bool SharePlugin::receivePackage(const NetworkPackage& np) //TODO: Use this code to write a test if (np.type() == PACKAGE_TYPE_PING) { - kDebug(kdeconnect_kded()) << "sending file" << (QDesktopServices::storageLocation(QDesktopServices::HomeLocation) + "/.bashrc"); + kDebug(debugArea()) << "sending file" << (QDesktopServices::storageLocation(QDesktopServices::HomeLocation) + "/.bashrc"); NetworkPackage out(PACKAGE_TYPE_SHARE); out.set("filename", mDestinationDir + "itworks.txt"); @@ -83,10 +83,10 @@ bool SharePlugin::receivePackage(const NetworkPackage& np) } */ - kDebug(kdeconnect_kded()) << "File transfer"; + kDebug(debugArea()) << "File transfer"; if (np.hasPayload()) { - //kDebug(kdeconnect_kded()) << "receiving file"; + //kDebug(debugArea()) << "receiving file"; QString filename = np.get("filename", QString::number(QDateTime::currentMSecsSinceEpoch())); KUrl destination = destinationDir(); destination.addPath(filename); @@ -115,7 +115,7 @@ bool SharePlugin::receivePackage(const NetworkPackage& np) QUrl url(np.get("url")); QDesktopServices::openUrl(url); } else { - kDebug(kdeconnect_kded()) << "Error: Nothing attached!"; + kDebug(debugArea()) << "Error: Nothing attached!"; } return true; @@ -124,7 +124,7 @@ bool SharePlugin::receivePackage(const NetworkPackage& np) void SharePlugin::finished(KJob* job) { - kDebug(kdeconnect_kded()) << "File transfer finished"; + kDebug(debugArea()) << "File transfer finished"; bool error = (job->error() != 0); diff --git a/plugins/telephony/telephonyplugin.cpp b/plugins/telephony/telephonyplugin.cpp index e547ca9d1..b708a9890 100644 --- a/plugins/telephony/telephonyplugin.cpp +++ b/plugins/telephony/telephonyplugin.cpp @@ -66,7 +66,7 @@ KNotification* TelephonyPlugin::createNotification(const NetworkPackage& np) content = i18n("Unknown telephony event: %2", event); } - kDebug(kdeconnect_kded()) << "Creating notification with type:" << type; + kDebug(debugArea()) << "Creating notification with type:" << type; KNotification* notification = new KNotification(type, KNotification::CloseOnTimeout, this); //, KNotification::Persistent notification->setPixmap(KIcon(icon).pixmap(48, 48)); From 12411da360eb21a12c6e7461b32caa063b862eac Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Tue, 1 Jul 2014 01:25:30 +0200 Subject: [PATCH 30/31] Added some debug info to devices and notifications models --- interfaces/devicesmodel.cpp | 12 ++++++++---- interfaces/notificationsmodel.cpp | 9 ++++++--- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/interfaces/devicesmodel.cpp b/interfaces/devicesmodel.cpp index ce9af3d22..bef9db4f3 100644 --- a/interfaces/devicesmodel.cpp +++ b/interfaces/devicesmodel.cpp @@ -26,9 +26,10 @@ #include #include -#include "kdebugnamespace.h" +#include + +#include "dbusinterfaces.h" // #include "modeltest.h" -#include "interfaces/dbusinterfaces.h" DevicesModel::DevicesModel(QObject *parent) : QAbstractListModel(parent) @@ -105,16 +106,19 @@ void DevicesModel::refreshDeviceList() } if (!m_dbusInterface->isValid()) { + kDebug(debugArea()) << "dbus interface not valid"; return; } - bool onlyPaired = (m_displayFilter & StatusPaired); bool onlyReachable = (m_displayFilter & StatusReachable); QDBusPendingReply pendingDeviceIds = m_dbusInterface->devices(onlyReachable, onlyPaired); pendingDeviceIds.waitForFinished(); - if (pendingDeviceIds.isError()) return; + if (pendingDeviceIds.isError()) { + kDebug(debugArea()) << pendingDeviceIds.error(); + return; + } const QStringList& deviceIds = pendingDeviceIds.value(); Q_FOREACH(const QString& id, deviceIds) { diff --git a/interfaces/notificationsmodel.cpp b/interfaces/notificationsmodel.cpp index ea84fd615..7ff163821 100644 --- a/interfaces/notificationsmodel.cpp +++ b/interfaces/notificationsmodel.cpp @@ -26,8 +26,10 @@ #include #include -#include "modeltest.h" -#include "kdebugnamespace.h" +#include + +//#include "modeltest.h" + NotificationsModel::NotificationsModel(QObject* parent) : QAbstractListModel(parent) @@ -110,12 +112,14 @@ void NotificationsModel::refreshNotificationList() } if (!m_dbusInterface->isValid()) { + kDebug(debugArea()) << "dbus interface not valid"; return; } QDBusPendingReply pendingNotificationIds = m_dbusInterface->activeNotifications(); pendingNotificationIds.waitForFinished(); if (pendingNotificationIds.isError()) { + kDebug(debugArea()) << pendingNotificationIds.error(); return; } const QStringList& notificationIds = pendingNotificationIds.value(); @@ -205,7 +209,6 @@ bool NotificationsModel::isAnyDimissable() const return false; } - void NotificationsModel::dismissAll() { Q_FOREACH (NotificationDbusInterface* notification, m_notificationList) { From cd8864fd92f7d624f74a7998a5f4c59e5a698652 Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Tue, 1 Jul 2014 01:25:54 +0200 Subject: [PATCH 31/31] Trying to fix a warning in the plasmoid: "root not defined" --- plasmoid/package/contents/ui/Battery.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plasmoid/package/contents/ui/Battery.qml b/plasmoid/package/contents/ui/Battery.qml index 6fcb7c456..4b58e2da1 100644 --- a/plasmoid/package/contents/ui/Battery.qml +++ b/plasmoid/package/contents/ui/Battery.qml @@ -53,8 +53,8 @@ QtObject { if (available) { battery = DeviceBatteryDbusInterfaceFactory.create(deviceId) - battery.stateChanged.connect(function(charging) {root.charging = charging}) - battery.chargeChanged.connect(function(charge) {root.charge = charge}) + battery.stateChanged.connect(function(c) {charging = c}) + battery.chargeChanged.connect(function(c) {charge = c}) startupCheck1.setPendingCall(battery.isCharging()) startupCheck2.setPendingCall(battery.charge())