Advertisement
Guest User

Untitled

a guest
Jul 19th, 2012
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.23 KB | None | 0 0
  1. #include <QtCore>
  2. #include <QMessageBox>
  3.  
  4. #include "listener.h"
  5.  
  6. CatchCopyPlugin::CatchCopyPlugin()
  7. {
  8. catchcopy=new Catchcopy(this);
  9. /*connect(catchcopy,SIGNAL(newCopy(quint32,QStringList,QString)), this,SIGNAL(copy(quint32,QStringList,QString)));
  10. connect(catchcopy,SIGNAL(newMove(quint32,QStringList,QString)), this,SIGNAL(move(quint32,QStringList,QString)));*/
  11. }
  12.  
  13. CatchCopyPlugin::~CatchCopyPlugin()
  14. {
  15. delete catchcopy;
  16. }
  17.  
  18. void CatchCopyPlugin::listen()
  19. {
  20. ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
  21. if(!QDBusConnection::sessionBus().isConnected())
  22. {
  23. ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,"is not connected");
  24. emit newState(NotListening);
  25. return;
  26. }
  27. if(!QDBusConnection::sessionBus().registerObject("/DBus", catchcopy, QDBusConnection::ExportAllSlots))
  28. {
  29. ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,QString("Error at register object: %1").arg(QDBusConnection::sessionBus().lastError().message()));
  30. emit newState(NotListening);
  31. return;
  32. }
  33. if(!QDBusConnection::sessionBus().registerService("info.first-world.CatchCopy"))
  34. {
  35. ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Warning,QString("Error at register service: %1").arg(QDBusConnection::sessionBus().lastError().message()));
  36. emit newState(NotListening);
  37. return;
  38. }
  39. emit newState(FullListening);
  40.  
  41. }
  42.  
  43. void CatchCopyPlugin::close()
  44. {
  45. ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
  46. QDBusConnection::sessionBus().unregisterService("info.first-world.catchcopy");
  47. QDBusConnection::sessionBus().unregisterObject("/");
  48. emit newState(NotListening);
  49. }
  50.  
  51. const QString CatchCopyPlugin::errorString()
  52. {
  53. ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start");
  54. return "Unknow error";
  55. }
  56.  
  57. void CatchCopyPlugin::setResources(OptionInterface * options,QString writePath,QString pluginPath,bool portableVersion)
  58. {
  59. Q_UNUSED(options);
  60. Q_UNUSED(writePath);
  61. Q_UNUSED(pluginPath);
  62. Q_UNUSED(portableVersion);
  63. }
  64.  
  65. /// \brief to get the options widget, NULL if not have
  66. QWidget * CatchCopyPlugin::options()
  67. {
  68. return NULL;
  69. }
  70.  
  71. Q_EXPORT_PLUGIN2(listener, CatchCopyPlugin);
  72.  
  73. /// \brief new copy is incoming, with destination
  74. void CatchCopyPlugin::copy()
  75. {
  76. ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start, new copy");
  77. // emit newCopy(orderId,sources,destination);
  78. }
  79.  
  80. /// \brief new move is incoming, with destination
  81. void CatchCopyPlugin::move()
  82. {
  83. ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start, new move");
  84. //emit newMove(orderId,sources,destination);
  85. }
  86.  
  87. void CatchCopyPlugin::transferFinished(quint32 orderId,bool withError)
  88. {
  89. ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start, orderId: "+QString::number(orderId)+", withError: "+QString::number(withError));
  90. }
  91.  
  92. void CatchCopyPlugin::transferCanceled(quint32 orderId)
  93. {
  94. ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start, orderId: "+QString::number(orderId));
  95. }
  96.  
  97. /// \brief to reload the translation, because the new language have been loaded
  98. void CatchCopyPlugin::newLanguageLoaded()
  99. {
  100. }
  101.  
  102. void CatchCopyPlugin::error(QString error)
  103. {
  104. Q_UNUSED(error);
  105. }
  106.  
  107. void CatchCopyPlugin::clientName(quint32 client,QString name)
  108. {
  109. Q_UNUSED(client);
  110. Q_UNUSED(name);
  111. ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Information,QString("clientName: %1, for the id: %2").arg(name).arg(client));
  112. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement