[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdeconnect-kde/sms-history] plugins/telephony: Add dbus signal to output incoming messages
From:       Simon Redman <null () kde ! org>
Date:       2018-04-01 3:20:58
Message-ID: E1f2TYA-0005kJ-2w () code ! kde ! org
[Download RAW message or body]

Git commit 96bcf4e04ccdada73fa8c100cc4def88b5c3d19e by Simon Redman.
Committed on 01/04/2018 at 03:20.
Pushed by sredman into branch 'sms-history'.

Add dbus signal to output incoming messages

M  +8    -0    plugins/telephony/telephonyplugin.cpp
M  +12   -0    plugins/telephony/telephonyplugin.h

https://commits.kde.org/kdeconnect-kde/96bcf4e04ccdada73fa8c100cc4def88b5c3d19e

diff --git a/plugins/telephony/telephonyplugin.cpp b/plugins/telephony/telephonyplugin.cpp
index 4d3b91b0..443fc58e 100644
--- a/plugins/telephony/telephonyplugin.cpp
+++ b/plugins/telephony/telephonyplugin.cpp
@@ -55,6 +55,7 @@ bool TelephonyPlugin::receivePacket(const NetworkPacket& np)
     {
         const telephonyMessage& message = convertPacketToMessage(np);
         this->forwardToTelepathy(message);
+        this->emitIncomingMessage(message);
     }
 
     return true;
@@ -128,6 +129,13 @@ bool TelephonyPlugin::forwardToTelepathy(const telephonyMessage& message)
     return false;
 }
 
+bool TelephonyPlugin::emitIncomingMessage(const telephonyMessage& message)
+{
+    Q_EMIT incomingMessage(message);
+
+    return true;
+}
+
 QString TelephonyPlugin::dbusPath() const
 {
     return "/modules/kdeconnect/devices/" + device()->id() + "/telephony";
diff --git a/plugins/telephony/telephonyplugin.h b/plugins/telephony/telephonyplugin.h
index cd3ed07b..3a4fb596 100644
--- a/plugins/telephony/telephonyplugin.h
+++ b/plugins/telephony/telephonyplugin.h
@@ -79,6 +79,13 @@ public Q_SLOTS:
      */
     Q_SCRIPTABLE void sendAllConversationsRequest();
 
+public:
+Q_SIGNALS:
+    /**
+     * Emitted to indicated a message has arrived for handling
+     */
+    Q_SCRIPTABLE void incomingMessage(const telephonyMessage& message);
+
 private Q_SLOTS:
     void sendMutePacket();
     void showSendSmsDialog();
@@ -91,6 +98,11 @@ protected:
      */
     bool forwardToTelepathy(const telephonyMessage& message);
 
+    /**
+     * Report that a message has arrived
+     */
+    bool emitIncomingMessage(const telephonyMessage& message);
+
 private:
     QDBusInterface m_telepathyInterface;
 };
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic