summaryrefslogtreecommitdiff
path: root/plugins/Listener/dbus/listener.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Listener/dbus/listener.cpp')
-rw-r--r--[-rwxr-xr-x]plugins/Listener/dbus/listener.cpp99
1 files changed, 49 insertions, 50 deletions
diff --git a/plugins/Listener/dbus/listener.cpp b/plugins/Listener/dbus/listener.cpp
index 2f23638..50ed196 100755..100644
--- a/plugins/Listener/dbus/listener.cpp
+++ b/plugins/Listener/dbus/listener.cpp
@@ -1,86 +1,85 @@
-#include <QtCore>
-#include <QMessageBox>
-
#include "listener.h"
-CatchCopyPlugin::CatchCopyPlugin()
+Listener::Listener()
{
- connect(&catchcopy,SIGNAL(newCopy(quint32,QStringList,QString)), this,SIGNAL(newCopy(quint32,QStringList,QString)));
- connect(&catchcopy,SIGNAL(newMove(quint32,QStringList,QString)), this,SIGNAL(newMove(quint32,QStringList,QString)));
+ connect(&catchcopy,&Catchcopy::newCopy, this,&Listener::newCopy);
+ connect(&catchcopy,&Catchcopy::newMove, this,&Listener::newMove);
}
-void CatchCopyPlugin::listen()
+void Listener::listen()
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- if (!QDBusConnection::sessionBus().isConnected())
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- emit newState(NotListening);
- return;
- }
- if (!QDBusConnection::sessionBus().registerService("info.first-world.catchcopy"))
- {
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QDBusConnection::sessionBus().lastError().message());
- emit newState(NotListening);
- return;
- }
- emit newState(FullListening);
- QDBusConnection::sessionBus().registerObject("/", &catchcopy, QDBusConnection::ExportAllSlots);
+ 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 CatchCopyPlugin::close()
+void Listener::close()
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- QDBusConnection::sessionBus().unregisterObject("/");
- QDBusConnection::sessionBus().unregisterService("info.first-world.catchcopy");
- emit newState(NotListening);
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start");
+ QDBusConnection::sessionBus().unregisterObject("/");
+ QDBusConnection::sessionBus().unregisterService("info.first-world.catchcopy");
+ emit newState(Ultracopier::NotListening);
}
-const QString CatchCopyPlugin::errorString()
+const QString Listener::errorString() const
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
- return "Unknow error";
+ return "Unknow error";
}
-void CatchCopyPlugin::setResources(OptionInterface * options,QString writePath,QString pluginPath,bool portableVersion)
+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);
+ Q_UNUSED(options);
+ Q_UNUSED(writePath);
+ Q_UNUSED(pluginPath);
+ Q_UNUSED(portableVersion);
}
/// \brief to get the options widget, NULL if not have
-QWidget * CatchCopyPlugin::options()
+QWidget * Listener::options()
{
- return NULL;
+ return NULL;
}
-Q_EXPORT_PLUGIN2(listener, CatchCopyPlugin);
-
-void CatchCopyPlugin::transferFinished(quint32 orderId,bool withError)
+void Listener::transferFinished(const quint32 &orderId,const bool &withError)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start, orderId: "+QString::number(orderId)+", withError: "+QString::number(withError));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start, orderId: "+QString::number(orderId)+", withError: "+QString::number(withError));
}
-void CatchCopyPlugin::transferCanceled(quint32 orderId)
+void Listener::transferCanceled(const quint32 &orderId)
{
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start, orderId: "+QString::number(orderId));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start, orderId: "+QString::number(orderId));
}
/// \brief to reload the translation, because the new language have been loaded
-void CatchCopyPlugin::newLanguageLoaded()
+void Listener::newLanguageLoaded()
{
}
-void CatchCopyPlugin::error(QString error)
+void Listener::error(QString error)
{
- Q_UNUSED(error);
+ Q_UNUSED(error);
}
-void CatchCopyPlugin::clientName(quint32 client,QString name)
+void Listener::clientName(quint32 client,QString name)
{
- Q_UNUSED(client);
- Q_UNUSED(name);
- ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Information,QString("clientName: %1, for the id: %2").arg(name).arg(client));
+ Q_UNUSED(client);
+ Q_UNUSED(name);
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("clientName: %1, for the id: %2").arg(name).arg(client));
}