summaryrefslogtreecommitdiff
path: root/plugins-unmaintained/Listener/dbus/listener.cpp
diff options
context:
space:
mode:
authorThomas Preud'homme <robotux@celest.fr>2018-05-29 05:44:34 +0100
committerThomas Preud'homme <robotux@celest.fr>2018-05-29 05:44:34 +0100
commit594fcba67600704bee9115c86e18927b2237b304 (patch)
tree38dc620e6b8e9a76c1953ded39c1dc006a830728 /plugins-unmaintained/Listener/dbus/listener.cpp
parent20062a6a4bc2aec8ada645baa78ff68892ccd154 (diff)
New upstream version 1.4.0.8
Diffstat (limited to 'plugins-unmaintained/Listener/dbus/listener.cpp')
-rw-r--r--plugins-unmaintained/Listener/dbus/listener.cpp85
1 files changed, 85 insertions, 0 deletions
diff --git a/plugins-unmaintained/Listener/dbus/listener.cpp b/plugins-unmaintained/Listener/dbus/listener.cpp
new file mode 100644
index 0000000..50ed196
--- /dev/null
+++ b/plugins-unmaintained/Listener/dbus/listener.cpp
@@ -0,0 +1,85 @@
+#include "listener.h"
+
+Listener::Listener()
+{
+ connect(&catchcopy,&Catchcopy::newCopy, this,&Listener::newCopy);
+ connect(&catchcopy,&Catchcopy::newMove, this,&Listener::newMove);
+}
+
+void Listener::listen()
+{
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start");
+ if (!QDBusConnection::sessionBus().isConnected())
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start");
+ emit newState(Ultracopier::NotListening);
+ return;
+ }
+ if (!QDBusConnection::sessionBus().registerService("info.first-world.catchcopy"))
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QDBusConnection::sessionBus().lastError().message());
+ emit newState(Ultracopier::NotListening);
+ return;
+ }
+ if(!QDBusConnection::sessionBus().registerObject("/", &catchcopy, QDBusConnection::ExportAllSlots))
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QDBusConnection::sessionBus().lastError().message());
+ emit newState(Ultracopier::NotListening);
+ return;
+ }
+ emit newState(Ultracopier::FullListening);
+}
+
+void Listener::close()
+{
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start");
+ QDBusConnection::sessionBus().unregisterObject("/");
+ QDBusConnection::sessionBus().unregisterService("info.first-world.catchcopy");
+ emit newState(Ultracopier::NotListening);
+}
+
+const QString Listener::errorString() const
+{
+ return "Unknow error";
+}
+
+void Listener::setResources(OptionInterface * options,const QString &writePath,const QString &pluginPath,const bool &portableVersion)
+{
+ Q_UNUSED(options);
+ Q_UNUSED(writePath);
+ Q_UNUSED(pluginPath);
+ Q_UNUSED(portableVersion);
+}
+
+/// \brief to get the options widget, NULL if not have
+QWidget * Listener::options()
+{
+ return NULL;
+}
+
+void Listener::transferFinished(const quint32 &orderId,const bool &withError)
+{
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start, orderId: "+QString::number(orderId)+", withError: "+QString::number(withError));
+}
+
+void Listener::transferCanceled(const quint32 &orderId)
+{
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start, orderId: "+QString::number(orderId));
+}
+
+/// \brief to reload the translation, because the new language have been loaded
+void Listener::newLanguageLoaded()
+{
+}
+
+void Listener::error(QString error)
+{
+ Q_UNUSED(error);
+}
+
+void Listener::clientName(quint32 client,QString name)
+{
+ Q_UNUSED(client);
+ Q_UNUSED(name);
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("clientName: %1, for the id: %2").arg(name).arg(client));
+}