From d934470551e59da1b764187f74e9f7dd7ababa0a Mon Sep 17 00:00:00 2001
From: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
Date: Mon, 28 Sep 2015 17:48:36 -0400
Subject: [PATCH] dialing call: add helper constructor

this constructor takes the peer ContactMethod in argument.

Issue: #68327
Change-Id: Iaaba99dba303657e07470d58d2a837e78f36c4b3
---
 src/callmodel.cpp | 8 ++++++++
 src/callmodel.h   | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/callmodel.cpp b/src/callmodel.cpp
index e23bde52..36c5d105 100644
--- a/src/callmodel.cpp
+++ b/src/callmodel.cpp
@@ -480,6 +480,14 @@ Call* CallModelPrivate::addCall2(Call* call, Call* parentCall)
    return call;
 } //addCall
 
+///Return the current or create a new dialing call from peer ContactMethod
+Call* CallModel::dialingCall(ContactMethod* cm)
+{
+   auto call = dialingCall();
+   call->setPeerContactMethod(cm);
+   return call;
+}
+
 ///Return the current or create a new dialing call from peer name and the account
 Call* CallModel::dialingCall(const QString& peerName, Account* account)
 {
diff --git a/src/callmodel.h b/src/callmodel.h
index 64d784e9..4d2f8798 100644
--- a/src/callmodel.h
+++ b/src/callmodel.h
@@ -80,6 +80,7 @@ public:
 
    //Call related
    Q_INVOKABLE Call*       dialingCall       ( const QString& peerName=QString(), Account* account=nullptr );
+   Q_INVOKABLE Call*       dialingCall       ( ContactMethod* cm                                           );
    Q_INVOKABLE void        attendedTransfer  ( Call* toTransfer , Call* target                             );
    Q_INVOKABLE void        transfer          ( Call* toTransfer , const ContactMethod* target              );
    Q_INVOKABLE QByteArray  getMime           ( const Call* call                                            ) const;
@@ -163,4 +164,3 @@ Q_SIGNALS:
    void mediaStateChanged( Call* call, Media::Media* media, const Media::Media::State s, const Media::Media::State m);
 };
 Q_DECLARE_METATYPE(CallModel*)
-
-- 
GitLab