SLOT not capturing in kmtpdinterface
-
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 unpluggedKMTPd::devicesChanged
in kmtpd.cppIn 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. TheQ_EMIT
line above is for testing, this one works. But the one fromkmtpd.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
-
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 unpluggedKMTPd::devicesChanged
in kmtpd.cppIn 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. TheQ_EMIT
line above is for testing, this one works. But the one fromkmtpd.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
@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.
-
@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.
Theorg::kde::kmtp::Daemon
class is an adaptor class generated from this XML, and this is the content ofdaemonadaptor.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"
-
@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.
@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