[SCM] kdeconnect packaging branch, master, updated. debian/0.9g-1-1183-g9d69498
Maximiliano Curia
maxy at moszumanska.debian.org
Fri Oct 14 14:28:12 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=c7c1974
The following commit has been merged in the master branch:
commit c7c1974ea9837bc4a4f71f67327bc51b20411a7f
Merge: 408533f25ccaa1c55e1bbfdbc15abe3120736bd5 d4382eec318e3d7bc6ac7d7068182d54af20d60c
Author: Albert Vaca <albertvaka at gmail.com>
Date: Sat Jan 10 20:14:01 2015 -0800
Merge branch 'master' into frameworks
Conflicts:
core/backends/lan/lanlinkprovider.cpp
plugins/ping/pingplugin.h
plugins/telephony/telephonyplugin.cpp
core/backends/devicelink.h | 1 +
core/backends/lan/landevicelink.cpp | 23 +++--
core/backends/lan/landevicelink.h | 2 +-
core/backends/lan/lanlinkprovider.cpp | 114 ++++++++++-----------
core/backends/lan/socketlinereader.cpp | 5 -
core/backends/lan/socketlinereader.h | 1 -
core/backends/linkprovider.h | 2 +-
core/networkpackagetypes.h | 1 -
fileitemactionplugin/kdeconnectsendfile.desktop | 2 +
plugins/CMakeLists.txt | 1 +
plugins/README.txt | 42 ++++++++
plugins/kdeconnect.notifyrc | 24 +++--
plugins/mousepad/kdeconnect_mousepad.desktop | 2 +
plugins/mousepad/mousepadplugin.cpp | 47 ++++++++-
plugins/mpriscontrol/mpriscontrolplugin.cpp | 38 +++++++
plugins/mpriscontrol/mpriscontrolplugin.h | 1 +
plugins/ping/kdeconnect_ping.desktop | 4 +-
plugins/ping/pingplugin.cpp | 2 +-
plugins/ping/pingplugin.h | 3 +-
plugins/screensaver-inhibit/CMakeLists.txt | 15 +++
plugins/screensaver-inhibit/README | 3 +
.../kdeconnect_screensaver_inhibit.desktop | 39 +++++++
.../screensaverinhibitplugin.cpp | 81 +++++++++++++++
.../screensaverinhibitplugin.h} | 24 ++---
plugins/share/kdeconnect_share.desktop | 2 +-
plugins/telephony/kdeconnect_telephony.desktop | 2 +-
plugins/telephony/telephonyplugin.cpp | 13 +++
plugins/telephony/telephonyplugin.h | 1 +
28 files changed, 386 insertions(+), 109 deletions(-)
diff --cc core/backends/lan/lanlinkprovider.cpp
index 6524076,3042ff7..fb819d1
--- a/core/backends/lan/lanlinkprovider.cpp
+++ b/core/backends/lan/lanlinkprovider.cpp
@@@ -155,10 -150,11 +149,10 @@@ void LanLinkProvider::newUdpConnection(
void LanLinkProvider::connectError()
{
QTcpSocket* socket = qobject_cast<QTcpSocket*>(sender());
-
- disconnect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(connectError()));
+ if (!socket) return;
disconnect(socket, SIGNAL(connected()), this, SLOT(connected()));
+ disconnect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(connectError()));
- kDebug(debugArea()) << "Fallback (1), try reverse connection";
NetworkPackage np("");
NetworkPackage::createIdentityPackage(&np);
np.set("tcpPort", mTcpPort);
@@@ -213,22 -208,23 +206,22 @@@ void LanLinkProvider::connected(
mLinks[deviceId] = deviceLink;
} else {
- //I think this will never happen
+ //I think this will never happen, but if it happens the deviceLink
+ //(or the socket that is now inside it) might not be valid. Delete them.
+ delete deviceLink;
-
- kDebug(debugArea()) << "Fallback (2), try reverse connection";
+ qCDebug(KDECONNECT_CORE) << "Fallback (2), try reverse connection";
mUdpSocket.writeDatagram(np2.serialize(), receivedIdentityPackages[socket].sender, port);
- delete deviceLink;
}
- receivedIdentityPackages.remove(socket);
-
delete receivedPackage;
-
+ receivedIdentityPackages.remove(socket);
+ //We don't delete the socket because now it's owned by the LanDeviceLink
}
- //I'm the new device and this is the answer to my UDP introduction (no data received yet)
+ //I'm the new device and this is the answer to my UDP identity package (no data received yet)
void LanLinkProvider::newConnection()
{
- //kDebug(debugArea()) << "LanLinkProvider newConnection";
+ //qCDebug(KDECONNECT_CORE) << "LanLinkProvider newConnection";
while(mTcpServer->hasPendingConnections()) {
QTcpSocket* socket = mTcpServer->nextPendingConnection();
@@@ -250,25 -245,27 +242,30 @@@
void LanLinkProvider::dataReceived()
{
QTcpSocket* socket = qobject_cast<QTcpSocket*>(sender());
- configureSocket(socket);
const QByteArray data = socket->readLine();
+
+ //qCDebug(KDECONNECT_CORE) << "LanLinkProvider received reply:" << data;
+
NetworkPackage np("");
bool success = NetworkPackage::unserialize(data, &np);
+ //kDebug(debugArea()) << "LanLinkProvider received reply:" << data;
if (!success || np.type() != PACKAGE_TYPE_IDENTITY) {
- kDebug(debugArea()) << "LanLinkProvider/newConnection: Not an identification package (wuh?)";
+ qCDebug(KDECONNECT_CORE) << "LanLinkProvider/newConnection: Not an identification package (wuh?)";
return;
}
- const QString& deviceId = np.get<QString>("deviceId");
- LanDeviceLink* deviceLink = new LanDeviceLink(deviceId, this, socket);
-
- kDebug(debugArea()) << "Handshaking done (i'm the new device)";
+ //qCDebug(KDECONNECT_CORE) << "Handshaking done (i'm the new device)";
+ //This socket will now be owned by the LanDeviceLink, forget about it
+ disconnect(socket, SIGNAL(readyRead()),
+ this, SLOT(dataReceived()));
+ disconnect(socket, SIGNAL(disconnected()),
+ socket, SLOT(deleteLater()));
+
+ const QString& deviceId = np.get<QString>("deviceId");
+ LanDeviceLink* deviceLink = new LanDeviceLink(deviceId, this, socket);
connect(deviceLink, SIGNAL(destroyed(QObject*)),
this, SLOT(deviceLinkDestroyed(QObject*)));
diff --cc plugins/CMakeLists.txt
index 9004c0a,ed1efe0..083c087
--- a/plugins/CMakeLists.txt
+++ b/plugins/CMakeLists.txt
@@@ -12,6 -11,7 +12,7 @@@ add_subdirectory(mousepad
add_subdirectory(share)
add_subdirectory(notifications)
add_subdirectory(sftp)
+ add_subdirectory(screensaver-inhibit)
#FIXME: If we split notifications in several files, they won't appear in the same group in the Notifications KCM
-install(FILES kdeconnect.notifyrc DESTINATION ${DATA_INSTALL_DIR}/kdeconnect)
+install(FILES kdeconnect.notifyrc DESTINATION ${KNOTIFYRC_INSTALL_DIR})
diff --cc plugins/mpriscontrol/mpriscontrolplugin.cpp
index 65b44b1,003ad42..7d705e7
--- a/plugins/mpriscontrol/mpriscontrolplugin.cpp
+++ b/plugins/mpriscontrol/mpriscontrolplugin.cpp
@@@ -85,6 -83,19 +85,19 @@@ void MprisControlPlugin::addPlayer(cons
OrgFreedesktopDBusPropertiesInterface* freedesktopInterface = new OrgFreedesktopDBusPropertiesInterface(service, "/org/mpris/MediaPlayer2", QDBusConnection::sessionBus(), this);
connect(freedesktopInterface, SIGNAL(PropertiesChanged(QString, QVariantMap, QStringList)), this, SLOT(propertiesChanged(QString, QVariantMap)));
+ OrgMprisMediaPlayer2PlayerInterface* mprisInterface0 = new OrgMprisMediaPlayer2PlayerInterface(service, "/org/mpris/MediaPlayer2", QDBusConnection::sessionBus());
+ connect(mprisInterface0, SIGNAL(Seeked(qlonglong)), this, SLOT(seeked(qlonglong)));
+ }
+
+ void MprisControlPlugin::seeked(qlonglong position){
- kDebug(debugArea()) << "Seeked in player";
++ qCDebug(KDECONNECT_PLUGIN_MPRIS) << "Seeked in player";
+ NetworkPackage np(PACKAGE_TYPE_MPRIS);
+ np.set("pos", position/1000); //Send milis instead of nanos
+ OrgFreedesktopDBusPropertiesInterface* interface = (OrgFreedesktopDBusPropertiesInterface*)sender();
+ const QString& service = interface->service();
+ const QString& player = playerList.key(service);
+ np.set("player", player);
+ sendPackage(np);
}
void MprisControlPlugin::propertiesChanged(const QString& propertyInterface, const QVariantMap& properties)
@@@ -173,6 -197,13 +199,13 @@@ bool MprisControlPlugin::receivePackag
mprisInterface.Seek(offset);
}
+ if (np.has("SetPosition")){
+ qlonglong position = np.get<qlonglong>("SetPosition",0)*1000;
+ qlonglong seek = position - mprisInterface.position();
- kDebug(debugArea()) << "Setting position by seeking" << seek << "to" << playerList[player];
++ qCDebug(KDECONNECT_PLUGIN_MPRIS) << "Setting position by seeking" << seek << "to" << playerList[player];
+ mprisInterface.Seek(seek);
+ }
+
//Send something read from the mpris interface
NetworkPackage answer(PACKAGE_TYPE_MPRIS);
bool somethingToSend = false;
diff --cc plugins/ping/pingplugin.cpp
index 0f73626,042a953..5c8ddb7
--- a/plugins/ping/pingplugin.cpp
+++ b/plugins/ping/pingplugin.cpp
@@@ -21,11 -21,10 +21,11 @@@
#include "pingplugin.h"
#include <KNotification>
-#include <KIcon>
+#include <QIcon>
+#include <QDebug>
#include <KLocalizedString>
-
-#include <core/kdebugnamespace.h>
+#include <KPluginFactory>
-
++#include <QLoggingCategory>
#include <core/device.h>
#include <QDBusConnection>
diff --cc plugins/ping/pingplugin.h
index 146db57,614da48..3217dcd
--- a/plugins/ping/pingplugin.h
+++ b/plugins/ping/pingplugin.h
@@@ -25,10 -25,9 +25,9 @@@
#include <core/kdeconnectplugin.h>
- Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_PLUGIN_PING)
+ #define PACKAGE_TYPE_PING QLatin1String("kdeconnect.ping")
-class KDE_EXPORT PingPlugin
+class Q_DECL_EXPORT PingPlugin
: public KdeConnectPlugin
{
Q_OBJECT
diff --cc plugins/screensaver-inhibit/CMakeLists.txt
index 0000000,2f0d56d..f7bda44
mode 000000,100644..100644
--- a/plugins/screensaver-inhibit/CMakeLists.txt
+++ b/plugins/screensaver-inhibit/CMakeLists.txt
@@@ -1,0 -1,10 +1,15 @@@
+ set(kdeconnect_screensaver_inhibit_SRCS
+ screensaverinhibitplugin.cpp
+ )
+
-kde4_add_plugin(kdeconnect_screensaver_inhibit ${kdeconnect_screensaver_inhibit_SRCS})
++add_library(kdeconnect_screensaver_inhibit ${kdeconnect_screensaver_inhibit_SRCS})
+
-target_link_libraries(kdeconnect_screensaver_inhibit kdeconnectcore ${KDE4_KDEUI_LIBS})
++target_link_libraries(kdeconnect_screensaver_inhibit kdeconnectcore
++ Qt5::DBus
++ KF5::I18n
++ KF5::Service
++ KF5::Notifications
++)
+
+ install(TARGETS kdeconnect_screensaver_inhibit DESTINATION ${PLUGIN_INSTALL_DIR} )
+ install(FILES kdeconnect_screensaver_inhibit.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
diff --cc plugins/screensaver-inhibit/screensaverinhibitplugin.cpp
index 0000000,85ac199..4d74fb4
mode 000000,100644..100644
--- a/plugins/screensaver-inhibit/screensaverinhibitplugin.cpp
+++ b/plugins/screensaver-inhibit/screensaverinhibitplugin.cpp
@@@ -1,0 -1,78 +1,81 @@@
+ /**
+ * Copyright 2014 Pramod Dematagoda <pmdematagoda at mykolab.ch>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License or (at your option) version 3 or any later version
+ * accepted by the membership of KDE e.V. (or its successor approved
+ * by the membership of KDE e.V.), which shall act as a proxy
+ * defined in Section 14 of version 3 of the license.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+ #include "screensaverinhibitplugin.h"
+
-#include <KNotification>
-#include <KIcon>
++#include <QDebug>
+ #include <KLocalizedString>
-
-#include <core/kdebugnamespace.h>
++#include <KPluginFactory>
++#include <QLoggingCategory>
+ #include <core/device.h>
+ #include <QDBusConnection>
+ #include <QDBusInterface>
+
+ K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< ScreensaverInhibitPlugin >(); )
-K_EXPORT_PLUGIN( KdeConnectPluginFactory("kdeconnect_screensaver_inhibit", "kdeconnect-plugins") )
++
++Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_SCREENSAVERINHIBIT, "kdeconnect.plugin.screensaverinhibit")
+
+ const QString INHIBIT_SERVICE = "org.freedesktop.ScreenSaver";
+ const QString INHIBIT_INTERFACE = INHIBIT_SERVICE;
+ const QString INHIBIT_PATH = "/ScreenSaver";
+ const QString INHIBIT_METHOD = "Inhibit";
+ const QString UNINHIBIT_METHOD = "UnInhibit";
+ const QString SIMULATE_ACTIVITY_METHOD = "SimulateUserActivity";
+
+ ScreensaverInhibitPlugin::ScreensaverInhibitPlugin(QObject* parent, const QVariantList& args)
+ : KdeConnectPlugin(parent, args)
+ {
+ QDBusInterface inhibitInterface(INHIBIT_SERVICE, INHIBIT_PATH, INHIBIT_INTERFACE);
+
+ QDBusMessage reply = inhibitInterface.call(INHIBIT_METHOD, "kdeconnect", "Phone is connected");
+
+ if (reply.errorMessage() != NULL) {
- kDebug(debugArea()) << "Unable to inhibit the screensaver: " << reply.errorMessage();
++ qCDebug(KDECONNECT_PLUGIN_SCREENSAVERINHIBIT) << "Unable to inhibit the screensaver: " << reply.errorMessage();
+ } else {
- // Store the cookie we receive, this will be sent back when sending the uninhibit call.
- this->inhibitCookie = reply.arguments().first().toUInt();
++ // Store the cookie we receive, this will be sent back when sending the uninhibit call.
++ this->inhibitCookie = reply.arguments().first().toUInt();
+ }
+ }
+
+ ScreensaverInhibitPlugin::~ScreensaverInhibitPlugin()
+ {
+ QDBusInterface inhibitInterface(INHIBIT_SERVICE, INHIBIT_PATH, INHIBIT_INTERFACE);
+ inhibitInterface.call(UNINHIBIT_METHOD, this->inhibitCookie);
+
+ /*
+ * Simulate user activity because what ever manages the screensaver does not seem to start the timer
+ * automatically when all inhibitions are lifted and the user does nothing which results in an
+ * unlocked desktop which would be dangerous. Ideally we should not be doing this and the screen should
+ * be locked anyway.
+ */
+ inhibitInterface.call(SIMULATE_ACTIVITY_METHOD);
+ }
+
+ void ScreensaverInhibitPlugin::connected()
+ {}
+
+ bool ScreensaverInhibitPlugin::receivePackage(const NetworkPackage& np)
+ {
- return false;
++ Q_UNUSED(np);
++ return false;
+ }
+
++
++#include "screensaverinhibitplugin.moc"
diff --cc plugins/screensaver-inhibit/screensaverinhibitplugin.h
index 76c08c0,460ac60..d2efeca
--- a/plugins/screensaver-inhibit/screensaverinhibitplugin.h
+++ b/plugins/screensaver-inhibit/screensaverinhibitplugin.h
@@@ -25,9 -25,7 +25,7 @@@
#include <core/kdeconnectplugin.h>
- class PauseMusicPlugin
-class KDE_EXPORT ScreensaverInhibitPlugin
++class Q_DECL_EXPORT ScreensaverInhibitPlugin
: public KdeConnectPlugin
{
Q_OBJECT
diff --cc plugins/telephony/telephonyplugin.cpp
index bea8c08,5e46ba3..114b5ea
--- a/plugins/telephony/telephonyplugin.cpp
+++ b/plugins/telephony/telephonyplugin.cpp
@@@ -21,14 -21,12 +21,15 @@@
#include "telephonyplugin.h"
#include <KLocalizedString>
-#include <KIcon>
-#include <core/kdebugnamespace.h>
+#include <QIcon>
+#include <QDebug>
+
+#include <KPluginFactory>
+
K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< TelephonyPlugin >(); )
-K_EXPORT_PLUGIN( KdeConnectPluginFactory("kdeconnect_telephony", "kdeconnect-plugins") )
+
+Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_TELEPHONY, "kdeconnect.plugin.telephony")
TelephonyPlugin::TelephonyPlugin(QObject *parent, const QVariantList &args)
: KdeConnectPlugin(parent, args)
@@@ -105,4 -105,9 +111,11 @@@ bool TelephonyPlugin::receivePackage(co
}
+ void TelephonyPlugin::sendMutePackage()
+ {
+ NetworkPackage package(PACKAGE_TYPE_TELEPHONY);
+ package.set<QString>( "action", "mute" );
+ sendPackage(package);
+ }
++
+#include "telephonyplugin.moc"
--
kdeconnect packaging
More information about the pkg-kde-commits
mailing list