Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. SLOT not capturing in kmtpdinterface
Forum Updated to NodeBB v4.3 + New Features

SLOT not capturing in kmtpdinterface

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 136 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    James John
    wrote on last edited by
    #1

    Hi,
    I need help in understanding why actually, no SLOT gets fired in kio-slaves interface. The signal is sent once a device is plugged and unplugged KMTPd::devicesChanged in kmtpd.cpp

    In shared/kmtpdinterfce.cpp, I am adding this:

    KMTPDInterface::KMTPDInterface(QObject *parent)
        : QObject(parent)
    {
        // connect to the KDE MTP daemon over D-Bus
        m_dbusInterface = new org::kde::kmtp::Daemon(QStringLiteral("org.kde.kmtpd5"),
                QStringLiteral("/modules/kmtpd"),
                QDBusConnection::sessionBus());
    
        auto connected = connect(m_dbusInterface, SIGNAL(devicesChanged()), this, SLOT(test()));
        qDebug() << "Connected: " << connected;
        // Q_EMIT m_dbusInterface->devicesChanged();
        updateDevices();
    }
    

    The Connected debug message returns true, but when the signal is emitted I still do not receive it. The Q_EMIT line above is for testing, this one works. But the one from kmtpd.cpp class does not connect here. But it fires okay.

    I know this is related to the KDE group, but I am just supporting fixing a bug, and they are not responding on why this signal is not being able to be captured. Anyone with KDE dev experience, please let me know if I am missing anything.

    Thanks

    jsulmJ 1 Reply Last reply
    0
    • J James John

      Hi,
      I need help in understanding why actually, no SLOT gets fired in kio-slaves interface. The signal is sent once a device is plugged and unplugged KMTPd::devicesChanged in kmtpd.cpp

      In shared/kmtpdinterfce.cpp, I am adding this:

      KMTPDInterface::KMTPDInterface(QObject *parent)
          : QObject(parent)
      {
          // connect to the KDE MTP daemon over D-Bus
          m_dbusInterface = new org::kde::kmtp::Daemon(QStringLiteral("org.kde.kmtpd5"),
                  QStringLiteral("/modules/kmtpd"),
                  QDBusConnection::sessionBus());
      
          auto connected = connect(m_dbusInterface, SIGNAL(devicesChanged()), this, SLOT(test()));
          qDebug() << "Connected: " << connected;
          // Q_EMIT m_dbusInterface->devicesChanged();
          updateDevices();
      }
      

      The Connected debug message returns true, but when the signal is emitted I still do not receive it. The Q_EMIT line above is for testing, this one works. But the one from kmtpd.cpp class does not connect here. But it fires okay.

      I know this is related to the KDE group, but I am just supporting fixing a bug, and they are not responding on why this signal is not being able to be captured. Anyone with KDE dev experience, please let me know if I am missing anything.

      Thanks

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @James-John said in SLOT not capturing in kmtpdinterface:

      but when the signal is emitted I still do not receive it

      Are you sure it is endeed emited? I don't mean Q_EMIT you added. I suggest you take a look at org::kde::kmtp::Daemon source code to see when this signal is emitted.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      J 1 Reply Last reply
      0
      • J Offline
        J Offline
        James John
        wrote on last edited by James John
        #3

        @jsulm Yes. It is emitted. I had to connect to the same SIGNAL but inside the same class where it is emitted. It emits and connects correctly.
        The org::kde::kmtp::Daemon class is an adaptor class generated from this XML, and this is the content of daemonadaptor.cpp in the build directory

        /*
         * This file was generated by qdbusxml2cpp version 0.8
         * Command line was: qdbusxml2cpp -m -a daemonadaptor -i kmtpd.h -l KMTPd /home/donjajo/kde/src/network/kio-extras/mtp/shared/org.kde.kmtp.daemon.xml
         *
         * qdbusxml2cpp is Copyright (C) 2020 The Qt Company Ltd.
         *
         * This is an auto-generated file.
         * Do not edit! All changes made to it will be lost.
         */
        
        #include "daemonadaptor.h"
        #include <QtCore/QMetaObject>
        #include <QtCore/QByteArray>
        #include <QtCore/QList>
        #include <QtCore/QMap>
        #include <QtCore/QString>
        #include <QtCore/QStringList>
        #include <QtCore/QVariant>
        
        /*
         * Implementation of adaptor class DaemonAdaptor
         */
        
        DaemonAdaptor::DaemonAdaptor(KMTPd *parent)
            : QDBusAbstractAdaptor(parent)
        {
            // constructor
            setAutoRelaySignals(true);
        }
        
        DaemonAdaptor::~DaemonAdaptor()
        {
            // destructor
        }
        
        QString DaemonAdaptor::version() const
        {
            // get the value of property version
            return qvariant_cast< QString >(parent()->property("version"));
        }
        
        QList<QDBusObjectPath> DaemonAdaptor::listDevices()
        {
            // handle method call org.kde.kmtp.Daemon.listDevices
            return parent()->listDevices();
        }
        
        
        #include "daemonadaptor.moc"
        
        1 Reply Last reply
        0
        • jsulmJ jsulm

          @James-John said in SLOT not capturing in kmtpdinterface:

          but when the signal is emitted I still do not receive it

          Are you sure it is endeed emited? I don't mean Q_EMIT you added. I suggest you take a look at org::kde::kmtp::Daemon source code to see when this signal is emitted.

          J Offline
          J Offline
          James John
          wrote on last edited by
          #4

          @jsulm said in SLOT not capturing in kmtpdinterface:

          @James-John said in SLOT not capturing in kmtpdinterface:

          but when the signal is emitted I still do not receive it

          Are you sure it is endeed emited? I don't mean Q_EMIT you added. I suggest you take a look at org::kde::kmtp::Daemon source code to see when this signal is emitted.

          And this is the content of daemoninterface.h

          /*
           * This file was generated by qdbusxml2cpp version 0.8
           * Command line was: qdbusxml2cpp -m -p daemoninterface /home/donjajo/kde/src/network/kio-extras/mtp/shared/org.kde.kmtp.daemon.xml
           *
           * qdbusxml2cpp is Copyright (C) 2020 The Qt Company Ltd.
           *
           * This is an auto-generated file.
           * Do not edit! All changes made to it will be lost.
           */
          
          #ifndef DAEMONINTERFACE_H
          #define DAEMONINTERFACE_H
          
          #include <QtCore/QObject>
          #include <QtCore/QByteArray>
          #include <QtCore/QList>
          #include <QtCore/QMap>
          #include <QtCore/QString>
          #include <QtCore/QStringList>
          #include <QtCore/QVariant>
          #include <QtDBus/QtDBus>
          
          /*
           * Proxy class for interface org.kde.kmtp.Daemon
           */
          class OrgKdeKmtpDaemonInterface: public QDBusAbstractInterface
          {
              Q_OBJECT
          public:
              static inline const char *staticInterfaceName()
              { return "org.kde.kmtp.Daemon"; }
          
          public:
              OrgKdeKmtpDaemonInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = nullptr);
          
              ~OrgKdeKmtpDaemonInterface();
          
              Q_PROPERTY(QString version READ version)
              inline QString version() const
              { return qvariant_cast< QString >(property("version")); }
          
          public Q_SLOTS: // METHODS
              inline QDBusPendingReply<QList<QDBusObjectPath> > listDevices()
              {
                  QList<QVariant> argumentList;
                  return asyncCallWithArgumentList(QStringLiteral("listDevices"), argumentList);
              }
          
          Q_SIGNALS: // SIGNALS
              void devicesChanged();
          };
          
          namespace org {
            namespace kde {
              namespace kmtp {
                typedef ::OrgKdeKmtpDaemonInterface Daemon;
              }
            }
          }
          #endif
          
          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved