diff --git a/core/networkpacket.h b/core/networkpacket.h --- a/core/networkpacket.h +++ b/core/networkpacket.h @@ -49,7 +49,8 @@ //const static QCA::EncryptionAlgorithm EncryptionAlgorithm; const static int s_protocolVersion; - explicit NetworkPacket(const QString& type, const QVariantMap& body = {}); + explicit NetworkPacket(const QString& type = QStringLiteral("empty"), const QVariantMap& body = {}); + NetworkPacket(const NetworkPacket& other); // Copy constructor, required for QMetaType and queued signals static void createIdentityPacket(NetworkPacket*); @@ -97,5 +98,6 @@ }; KDECONNECTCORE_EXPORT QDebug operator<<(QDebug s, const NetworkPacket& pkg); +Q_DECLARE_METATYPE(NetworkPacket) #endif // NETWORKPACKET_H diff --git a/core/networkpacket.cpp b/core/networkpacket.cpp --- a/core/networkpacket.cpp +++ b/core/networkpacket.cpp @@ -55,6 +55,15 @@ { } +NetworkPacket::NetworkPacket(const NetworkPacket& other) + : m_id(other.m_id) + , m_type(other.m_type) + , m_body(QVariantMap(other.m_body)) + , m_payload(other.m_payload) + , m_payloadSize(other.m_payloadSize) +{ +} + void NetworkPacket::createIdentityPacket(NetworkPacket* np) { KdeConnectConfig* config = KdeConnectConfig::instance();