On Mon, 4 Apr 2011 11:47:49 +0300
Arun Ravindran <ext-arun.1.ravind...@nokia.com> wrote:

> Hi Shane,
> 
> > On Mon, 28 Mar 2011 14:34:42 +0300
> > ext-arun.1.ravind...@nokia.com wrote:
> >
> > Just a note that I have been reviewing this, but found a logic
> > error in existing code this touches, trying to sort out the right
> > solution. Hope to have it done early next week.
> >
> 
> Could you share some info on this issue?. Will the patch i mailed
> need changes after this is fixed?

Sorry, it was late on Friday and I didn't have time to do justice to an
proper explanation.

The crux of the issue was that I needed to re-think (and do a
little re-work) how we kept track of the "Merge" button state and when
we can and can not perform a merge.

I am attaching (yes, breaking my own rule...) two patch sets.
The first should be your original one, with only a few modifications to
the commit message.  The second patch set is my changes on top of yours.

We can do this one of two ways:

1) I apply these as is (with the only caveat being to please make the
commit message more concise and to the point)

2) You resubmit the patch, taking into account the changes I made to
yours in my add on patch.  Principally, I want to be sure you capture
the renaming of all instances of [Mm]ultiParty* to [Mm]ultiparty* and
the change from bool based multipartyCalls() to int returning
multipartyCallCount(), as described in my commit message.

Regards,

Shane...

>From 06e6d0b1723a5b990e79c309f4ba341fac256f8c Mon Sep 17 00:00:00 2001
From: Shane Bryan <shane.br...@linux.intel.com>
Date: Mon, 4 Apr 2011 13:37:47 -0700
Subject: [PATCH 2/2] Changed: Namespace and code cleanups to complete fix for BMC# 14618

- Renamed all instances of [Mm]ultiParty* to [Mm]ultiparty*
- Convert bool multipartyCalls() to int multipartyCallCount() since we
  need to compare the number of participants to total number of calls under
  certain conditions
- Removed unnecessary disconnect() calls when deleting objects
- Removed unused CallManager::multipartyCallsAsStrings() method
- Reworked "Merge" button state and handling
- Some minor code clean ups

Signed-off-by: Shane Bryan <shane.br...@linux.intel.com>
---
 src/callitem.cpp     |    6 +++---
 src/callitem.h       |    4 ++--
 src/callmanager.cpp  |   46 +++++++++++++++++-----------------------------
 src/callmanager.h    |    9 +++------
 src/callproxy.cpp    |    2 +-
 src/callproxy.h      |    2 +-
 src/dialerkeypad.cpp |   42 +++++++++++++++++++++---------------------
 7 files changed, 48 insertions(+), 63 deletions(-)

diff --git a/src/callitem.cpp b/src/callitem.cpp
index ff056dd..b975345 100644
--- a/src/callitem.cpp
+++ b/src/callitem.cpp
@@ -80,7 +80,7 @@ void CallItem::init()
             model()->setCall(call);
             connect(call,SIGNAL(stateChanged()),this,SLOT(callStateChanged()));
             connect(call,SIGNAL(dataChanged()),this,SLOT(callDataChanged()));
-            connect(call,SIGNAL(multiPartyChanged()),this,SLOT(callMultiPartyChanged()));
+            connect(call,SIGNAL(multipartyChanged()),this,SLOT(callMultipartyChanged()));
         } else
             qCritical("Invalid CallProxy instance!");
     } else
@@ -339,8 +339,8 @@ bool CallItem::multiparty()
     return (isValid())?model()->multiparty():false;
 }
 
-void CallItem::callMultiPartyChanged()
+void CallItem::callMultipartyChanged()
 {
     TRACE
-    emit multiPartyChanged();
+    emit multipartyChanged();
 }
diff --git a/src/callitem.h b/src/callitem.h
index e0b79c9..f52576b 100644
--- a/src/callitem.h
+++ b/src/callitem.h
@@ -68,14 +68,14 @@ Q_SIGNALS:
     void clicked();
     void stateChanged();
     void dataChanged();
-    void multiPartyChanged();
+    void multipartyChanged();
 
 private Q_SLOTS:
     void callStateChanged();
     void callDataChanged();
     void callDisconnected(const QString &reason);
     void ringtoneStatusChanged(QMediaPlayer::MediaStatus status);
-    void callMultiPartyChanged();
+    void callMultipartyChanged();
 
 private:
     QVariant itemChange(GraphicsItemChange change, const QVariant &val);
diff --git a/src/callmanager.cpp b/src/callmanager.cpp
index ac8e4ab..b73c3f6 100644
--- a/src/callmanager.cpp
+++ b/src/callmanager.cpp
@@ -88,22 +88,16 @@ QList<QString> CallManager::callsAsStrings() const
     return m_calls;
 }
 
-bool CallManager::multipartyCalls() const
+int CallManager::multipartyCallCount() const
 {
     TRACE
-    int call_count =0;
+    int call_count = 0;
     foreach (CallItem *c, m_callItems) {
-        if(c->multiparty())
+        if(c->multiparty()) {
             call_count++;
         }
-    qDebug()<<"Call Count: "<<call_count;
-    return call_count>=2?true:false;
-}
-
-QList<QString> CallManager::multipartyCallsAsStrings() const
-{
-    TRACE
-    return m_multipartyCalls;
+    }
+    return call_count;
 }
 
 CallItem *CallManager::activeCall() const
@@ -412,11 +406,8 @@ void CallManager::updateCallItems()
     // If ofono call list is empty (no calls), empty our CallItem list too.
     if (m_calls.isEmpty() && !m_callItems.isEmpty()) {
         qDebug() << QString("Purging all CallItems");
-        foreach (CallItem *item, m_callItems) {
-            disconnect(item, SIGNAL(stateChanged()));
-            disconnect(item, SIGNAL(multiPartyChanged()));
+        foreach (CallItem *item, m_callItems)
             delete item;
-        }
         m_callItems.clear();
         emit callsChanged();
 
@@ -432,8 +423,6 @@ void CallManager::updateCallItems()
         // This item is not in the ofono list, remove it
         if (!m_calls.contains(item->path())) {
             qDebug() << QString("Removing old CallItem %1").arg(item->path());
-            disconnect(item, SIGNAL(stateChanged()));
-            disconnect(item, SIGNAL(multiPartyChanged()));
             delete item;
             iter.remove();
             changed = true;
@@ -455,7 +444,7 @@ void CallManager::updateCallItems()
             qDebug() << QString("Inserting new CallItem %1").arg(callPath);
             CallItem *call = new CallItem(callPath);
             connect (call, SIGNAL(stateChanged()), SLOT(callStateChanged()));
-            connect (call, SIGNAL(multiPartyChanged()),SLOT(callMultiPartyChanged()));
+            connect (call, SIGNAL(multipartyChanged()),SLOT(callMultipartyChanged()));
             m_callItems << call;
 
             // NOTE: Must explicity bubble this up since incoming and waiting
@@ -587,6 +576,7 @@ void CallManager::getCallsFinished(QDBusPendingCallWatcher *watcher)
 
 void CallManager::callAdded(const QDBusObjectPath &in0,const QVariantMap &in1)
 {
+    Q_UNUSED(in1)
     TRACE
 
     QString path = in0.path();
@@ -776,17 +766,16 @@ void CallManager::callStateChanged()
     emit callsChanged();
 }
 
-void CallManager::callMultiPartyChanged()
+void CallManager::callMultipartyChanged()
 {
     TRACE
-    CallItem *call = dynamic_cast<CallItem *>(sender());
-    qDebug()<<"Multiparty Info: " <<call->multiparty();
     emit callsChanged();
 }
 
 QStringList CallManager::dumpProperties()
 {
     m_properties.clear();
+    QStringList l_multipartyCalls;
 
     // Single party calls
     m_properties << "<ul><li>Calls:</li>";
@@ -797,6 +786,9 @@ QStringList CallManager::dumpProperties()
             m_properties << QString("<li>State   : %1</li>").arg(c->state());
             m_properties << QString("<li>Started : %1</li>")
                             .arg(c->startTime().toString());
+            if (c->multiparty())
+                l_multipartyCalls << c->path();
+
             if (c->state() == CallItemModel::STATE_DISCONNECTED)
                 m_properties << QString("<li>Reason: %1</li></ul></ul>")
                                 .arg(c->reason());
@@ -808,14 +800,10 @@ QStringList CallManager::dumpProperties()
 
     // Multi party calls
     m_properties << "<ul><li>Multiparty Calls:</li>";
-    if (m_multipartyCallItems.size())
-        foreach (CallItem *c, m_multipartyCallItems) {
-            m_properties << QString("<ul><li>Path: %1</li>").arg(c->path());
-            if (c->state() == CallItemModel::STATE_DISCONNECTED)
-                m_properties << QString("<li>Reason: %1</li></ul></ul>")
-                                .arg(c->reason());
-            else
-                m_properties << QString("</ul></ul>");
+    if (l_multipartyCalls.size() >= 2)
+        foreach (QString path, l_multipartyCalls) {
+            m_properties << QString("<ul><li>Path: %1</li>").arg(path);
+            m_properties << QString("</ul></ul>");
         }
     else
         m_properties << "<ul><li>None</li></ul></ul>";
diff --git a/src/callmanager.h b/src/callmanager.h
index 1ee12e2..2fb1cd9 100644
--- a/src/callmanager.h
+++ b/src/callmanager.h
@@ -26,7 +26,7 @@ class CallManager: public org::ofono::VoiceCallManager
     Q_OBJECT
 
     Q_PROPERTY(QList<CallItem *> calls READ calls)
-    Q_PROPERTY(bool multipartyCalls READ multipartyCalls)
+    Q_PROPERTY(int multipartyCallCount READ multipartyCallCount)
 
 public:
     CallManager(const QString &modemPath);
@@ -35,8 +35,7 @@ public:
 
     QList<CallItem *> calls() const;
     QList<QString> callsAsStrings() const;
-    bool multipartyCalls() const;
-    QList<QString> multipartyCallsAsStrings() const;
+    int multipartyCallCount() const;
     CallItem *activeCall() const;
     CallItem *heldCall() const;
     CallItem *dialingCall() const;
@@ -112,7 +111,7 @@ private Q_SLOTS:
     void sendTonesFinished(QDBusPendingCallWatcher *watcher);
     void propertyChanged(const QString &in0, const QDBusVariant &in1);
     void callStateChanged();
-    void callMultiPartyChanged();
+    void callMultipartyChanged();
 
     void proceedCallDial(const QString number);
     void deniedCallDial();
@@ -129,8 +128,6 @@ private:
     QStringList        m_emergencyNumbers;
     QList<QString>     m_calls;
     QList<CallItem *>  m_callItems;
-    QList<QString>     m_multipartyCalls;
-    QList<CallItem *>  m_multipartyCallItems;
     bool               m_connected;
 
     Q_DISABLE_COPY(CallManager)
diff --git a/src/callproxy.cpp b/src/callproxy.cpp
index dc874b5..a670558 100644
--- a/src/callproxy.cpp
+++ b/src/callproxy.cpp
@@ -266,7 +266,7 @@ void CallProxy::propertyChanged(const QString &in0, const QDBusVariant &in1)
             setStartTimeFromString(qdbus_cast<QString>(in1.variant()));
     } else if (in0 == "Multiparty") {
         m_multiparty = qdbus_cast<bool>(in1.variant());
-        emit multiPartyChanged();
+        emit multipartyChanged();
     } else {
         qDebug() << QString("Unexpected property \"%1\" changed...").arg(in0);
     }
diff --git a/src/callproxy.h b/src/callproxy.h
index e69b81f..6f6469f 100644
--- a/src/callproxy.h
+++ b/src/callproxy.h
@@ -63,7 +63,7 @@ Q_SIGNALS:
     void callDisconnected(const QString &reason);
     void stateChanged();
     void dataChanged();
-    void multiPartyChanged();
+    void multipartyChanged();
 
 private Q_SLOTS:
     // Slots to handle asyncronous DBus replies
diff --git a/src/dialerkeypad.cpp b/src/dialerkeypad.cpp
index a125158..a598275 100644
--- a/src/dialerkeypad.cpp
+++ b/src/dialerkeypad.cpp
@@ -224,7 +224,7 @@ void DialerKeyPad::updateButtonStates()
 
     if (cm && cm->isValid())
         haveCalls = ((cm->calls().length() > 0) ||
-                     (cm->multipartyCalls()));
+                     (cm->multipartyCallCount() > 0));
 
     // Sync up the dial/hangup button state
     m_call->setChecked(haveCalls);
@@ -264,12 +264,17 @@ void DialerKeyPad::updateButtonStates()
 
     // Sync up the merge button state
     if (cm && cm->isValid()) {
-        if (cm->multipartyCalls())
-            //% "Add"
-            m_nway->setText(qtTrId("xx_add"));
-        else
-            //% "Merge Calls"
-            m_nway->setText(qtTrId("xx_merge"));
+        if (cm->multipartyCallCount() == 0) {
+            if (cm->calls().count() == 2)
+                m_nway->setEnabled(true);
+            else
+                m_nway->setEnabled(false);
+        } else {
+            if ((cm->calls().count() - cm->multipartyCallCount()) >= 1)
+                m_nway->setEnabled(true);
+            else
+                m_nway->setEnabled(false);
+        }
     }
 
     /*
@@ -752,7 +757,7 @@ void DialerKeyPad::callPressed(bool checked)
             c = cm->alertingCall();
 
         if (c) {
-            if (cm->multipartyCalls()) {
+            if (c->multiparty()) {
                 qDebug() << "Hanging up MultipartyCall";
                 cm->hangupMultipartyCall();
             }
@@ -824,24 +829,19 @@ void DialerKeyPad::nwayPressed(bool checked)
 {
     TRACE
     CallManager *cm = ManagerProxy::instance()->callManager();
-    if (!cm->isValid()) {
+    if (!cm || !cm->isValid()) {
         qDebug() << "Unable to merge, no valid connection";
         return;
     }
 
-    qDebug() << QString("nway option %1").arg((checked)?"set":"unset");
-
-    // If there is already a MultipartyCall, then we want to add an new
-    // participant
-    if (cm->multipartyCalls())
-        if (cm->activeCall() && cm->heldCall())
-            qCritical() << QString("Can't add participant all lines busy!");
-        else
-            qWarning() << QString("Add to MultipartyCall not yet working...");
-    // Otherwise, we're merging existing calls into a MultipartyCall
     // Fixes BMC#550, and BMC#2806
-    else
-        cm->createMultipartyCall();
+    if (cm->multipartyCallCount() == 0) {
+        if (cm->calls().count() == 2)
+            cm->createMultipartyCall();
+    } else {
+        if ((cm->calls().count() - cm->multipartyCallCount()) >= 1)
+            cm->createMultipartyCall();
+    }
 
     // Sync up the button states
     updateButtonStates();
-- 
1.7.2.2

>From 0841ff595abea920b133fe6ada01af559966b50e Mon Sep 17 00:00:00 2001
From: Arun Ravindran <ext-arun.1.ravind...@nokia.com>
Date: Mon, 28 Mar 2011 14:34:42 +0300
Subject: [PATCH 1/2] Fixed: BMC#14618 Not support end whole conference call by pressing end button one time

Added handling of multiparty property in the call proxy, call item and callitem
model by adding a signal to be emited for the property changes. This signal is
handled in call manager now. Removed the usage of multiparty call items and
call names from call manager. Also re arranged the GetCalls() and
GetProperties() because

When dialer starts, it creates the ofono binding objects (modem manager, call
manager etc). The call manager get the current call list and calls
updateCallItems() from getCallsFinished() function. The updateCallItems() in
fact send the signals for handling incoming call alert in the UI. But by this
time no UI component is connected for this signal.

The UI components are connected after receiving the connected() signal from
call manager. The connected signal is sent after GetProperties() return. But
calls are updated after GetCalls(), since GetProperties() did not complete the
call manager is not online. I think this has come because we initially had
GetProperties() function only from call manager and no GetCalls().
---
 src/callitem.cpp      |   13 ++++++
 src/callitem.h        |    4 ++
 src/callitemmodel.cpp |    8 ++++
 src/callitemmodel.h   |    1 +
 src/callmanager.cpp   |  108 ++++++++++++------------------------------------
 src/callmanager.h     |    7 +--
 src/callproxy.cpp     |   14 ++++++-
 src/callproxy.h       |    4 ++
 src/dialerkeypad.cpp  |    9 ++--
 9 files changed, 77 insertions(+), 91 deletions(-)

diff --git a/src/callitem.cpp b/src/callitem.cpp
index d33f359..ff056dd 100644
--- a/src/callitem.cpp
+++ b/src/callitem.cpp
@@ -80,6 +80,7 @@ void CallItem::init()
             model()->setCall(call);
             connect(call,SIGNAL(stateChanged()),this,SLOT(callStateChanged()));
             connect(call,SIGNAL(dataChanged()),this,SLOT(callDataChanged()));
+            connect(call,SIGNAL(multiPartyChanged()),this,SLOT(callMultiPartyChanged()));
         } else
             qCritical("Invalid CallProxy instance!");
     } else
@@ -331,3 +332,15 @@ void CallItem::ringtoneStatusChanged(QMediaPlayer::MediaStatus status)
       m_ringtone->play();
     }
 }
+
+bool CallItem::multiparty()
+{
+    TRACE
+    return (isValid())?model()->multiparty():false;
+}
+
+void CallItem::callMultiPartyChanged()
+{
+    TRACE
+    emit multiPartyChanged();
+}
diff --git a/src/callitem.h b/src/callitem.h
index ae19b78..e0b79c9 100644
--- a/src/callitem.h
+++ b/src/callitem.h
@@ -33,6 +33,7 @@ class CallItem: public MWidgetController
     Q_PROPERTY(CallItemModel::CallDisconnectReason reason READ reason)
     Q_PROPERTY(int duration READ duration)
     Q_PROPERTY(QDateTime startTime READ startTime)
+    Q_PROPERTY(bool multiparty READ multiparty)
 
     Q_PROPERTY(PeopleItem* peopleItem READ peopleItem WRITE setPeopleItem)
     Q_PROPERTY(CallProxy* callProxy READ callProxy)
@@ -53,6 +54,7 @@ public:
     CallProxy *callProxy() const;
     bool isValid();
     bool isValid() const;
+    bool multiparty();
 
 public Q_SLOTS:
     void init();
@@ -66,12 +68,14 @@ Q_SIGNALS:
     void clicked();
     void stateChanged();
     void dataChanged();
+    void multiPartyChanged();
 
 private Q_SLOTS:
     void callStateChanged();
     void callDataChanged();
     void callDisconnected(const QString &reason);
     void ringtoneStatusChanged(QMediaPlayer::MediaStatus status);
+    void callMultiPartyChanged();
 
 private:
     QVariant itemChange(GraphicsItemChange change, const QVariant &val);
diff --git a/src/callitemmodel.cpp b/src/callitemmodel.cpp
index 2c6c6ea..af75505 100644
--- a/src/callitemmodel.cpp
+++ b/src/callitemmodel.cpp
@@ -155,3 +155,11 @@ bool CallItemModel::disconnected() const
 {
     return (stateType() == STATE_DISCONNECTED);
 }
+
+bool CallItemModel::multiparty() const
+{
+    if (call() && call()->isValid())
+        return call()->multiparty();
+    else
+        return false;
+}
diff --git a/src/callitemmodel.h b/src/callitemmodel.h
index 538fbc2..f2d94d9 100644
--- a/src/callitemmodel.h
+++ b/src/callitemmodel.h
@@ -69,6 +69,7 @@ public:
     bool incoming() const;
     bool waiting() const;
     bool disconnected() const;
+    bool multiparty() const;
     CallItemModel::CallState stateType() const;
     CallItemModel::CallDisconnectReason reasonType() const;
 };
diff --git a/src/callmanager.cpp b/src/callmanager.cpp
index 0a92068..ac8e4ab 100644
--- a/src/callmanager.cpp
+++ b/src/callmanager.cpp
@@ -30,9 +30,6 @@ CallManager::CallManager(const QString &modemPath)
         QDBusPendingReply<QVariantMap> propsReply;
         QDBusPendingCallWatcher *calls_watcher, *props_watcher;
 
-        callsReply = GetCalls();
-        calls_watcher = new QDBusPendingCallWatcher(callsReply);
-
 	// unsync, but feel relief about recursion in manager proxy.
 #if 0
         // Force this to be sync to ensure we have initial properties
@@ -44,12 +41,17 @@ CallManager::CallManager(const QString &modemPath)
         propsReply = GetProperties();
         props_watcher = new QDBusPendingCallWatcher(propsReply);
 
-        connect(calls_watcher,
-                SIGNAL(finished(QDBusPendingCallWatcher*)),
-                SLOT(getCallsFinished(QDBusPendingCallWatcher*)));
         connect(props_watcher,
                 SIGNAL(finished(QDBusPendingCallWatcher*)),
                 SLOT(getPropertiesFinished(QDBusPendingCallWatcher*)));
+
+        callsReply = GetCalls();
+        calls_watcher = new QDBusPendingCallWatcher(callsReply);
+
+        connect(calls_watcher,
+                SIGNAL(finished(QDBusPendingCallWatcher*)),
+                SLOT(getCallsFinished(QDBusPendingCallWatcher*)));
+
         connect(this,
                 SIGNAL(CallAdded(const QDBusObjectPath&, const QVariantMap&)),
                 SLOT(callAdded(const QDBusObjectPath&, const QVariantMap&)));
@@ -86,10 +88,16 @@ QList<QString> CallManager::callsAsStrings() const
     return m_calls;
 }
 
-QList<CallItem *> CallManager::multipartyCalls() const
+bool CallManager::multipartyCalls() const
 {
     TRACE
-    return m_multipartyCallItems;
+    int call_count =0;
+    foreach (CallItem *c, m_callItems) {
+        if(c->multiparty())
+            call_count++;
+        }
+    qDebug()<<"Call Count: "<<call_count;
+    return call_count>=2?true:false;
 }
 
 QList<QString> CallManager::multipartyCallsAsStrings() const
@@ -406,6 +414,7 @@ void CallManager::updateCallItems()
         qDebug() << QString("Purging all CallItems");
         foreach (CallItem *item, m_callItems) {
             disconnect(item, SIGNAL(stateChanged()));
+            disconnect(item, SIGNAL(multiPartyChanged()));
             delete item;
         }
         m_callItems.clear();
@@ -424,6 +433,7 @@ void CallManager::updateCallItems()
         if (!m_calls.contains(item->path())) {
             qDebug() << QString("Removing old CallItem %1").arg(item->path());
             disconnect(item, SIGNAL(stateChanged()));
+            disconnect(item, SIGNAL(multiPartyChanged()));
             delete item;
             iter.remove();
             changed = true;
@@ -445,6 +455,7 @@ void CallManager::updateCallItems()
             qDebug() << QString("Inserting new CallItem %1").arg(callPath);
             CallItem *call = new CallItem(callPath);
             connect (call, SIGNAL(stateChanged()), SLOT(callStateChanged()));
+            connect (call, SIGNAL(multiPartyChanged()),SLOT(callMultiPartyChanged()));
             m_callItems << call;
 
             // NOTE: Must explicity bubble this up since incoming and waiting
@@ -494,51 +505,6 @@ void CallManager::lostIncomingCall(CallItem *call)
     qCritical() << QString("Lost: Incoming Call resource");
 }
 
-void CallManager::updateMultipartyCallItems()
-{
-    TRACE
-
-    // If ofono multiparty call list is empty (no calls), empty our
-    // multiparty CallItem list too.
-    if (m_multipartyCalls.isEmpty() && !m_multipartyCallItems.isEmpty()) {
-        qDebug() << QString("Purging all multiparty CallItems");
-        foreach (CallItem *item, m_multipartyCallItems) delete item;
-        m_multipartyCallItems.clear();
-        return;
-    }
-
-    // Remove CallItems that are not in the ofono "calls" list
-    QMutableListIterator<CallItem*> iter(m_multipartyCallItems);
-    while (iter.hasNext()) {
-        CallItem *item = iter.next();
-        // This item is not in the ofono list, remove it
-        if (!m_multipartyCalls.contains(item->path())) {
-            qDebug() << QString("Removing old multiparty CallItem %1")
-                        .arg(item->path());
-            delete item;
-            iter.remove();
-        }
-    }
-
-    // Insert new CallItems for paths in the ofono "calls" list we are missing
-    foreach (QString callPath, m_multipartyCalls) {
-        bool matchFound = false;
-        foreach (CallItem *item, m_multipartyCallItems) {
-            // This call is not in our CallItem list, insert it
-            if (item->path() == callPath) {
-                matchFound = true;
-                break;
-            }
-        }
-        // Insert a new CallItem
-        if (!matchFound) {
-            m_multipartyCallItems << new CallItem(callPath);
-            qDebug() << QString("Inserting new multiparty CallItem %1")
-                        .arg(callPath);
-        }
-    }
-}
-
 void CallManager::setCalls(QList<QDBusObjectPath> calls)
 {
     TRACE
@@ -551,18 +517,6 @@ void CallManager::setCalls(QList<QDBusObjectPath> calls)
     updateCallItems();
 }
 
-void CallManager::setMultipartyCalls(QList<QDBusObjectPath> calls)
-{
-    TRACE
-
-    m_multipartyCalls.clear();
-
-    foreach (QDBusObjectPath c, calls)
-        m_multipartyCalls << QString(c.path());
-
-    updateMultipartyCallItems();
-}
-
 void CallManager::getPropertiesFinished(QDBusPendingCallWatcher *watcher)
 {
     TRACE
@@ -626,13 +580,9 @@ void CallManager::getCallsFinished(QDBusPendingCallWatcher *watcher)
     QList<QDBusObjectPath> calls, mpcalls;
     foreach (OfonoPathProperties p, props) {
         calls   << p.path;
-        if (p.properties["Multiparty"].toBool()) {
-            mpcalls << p.path;
-        }
     }
 
     setCalls(calls);
-    setMultipartyCalls(mpcalls);
 }
 
 void CallManager::callAdded(const QDBusObjectPath &in0,const QVariantMap &in1)
@@ -640,18 +590,12 @@ void CallManager::callAdded(const QDBusObjectPath &in0,const QVariantMap &in1)
     TRACE
 
     QString path = in0.path();
-    bool isMultiparty = in1["Multiparty"].toBool();
 
     qDebug() << QString("CallAdded: \"%1\"").arg(path);
 
     m_calls << path;
 
     updateCallItems();
-
-    if (isMultiparty) {
-        m_multipartyCalls << path;
-        updateMultipartyCallItems();
-    }
 }
 
 void CallManager::callRemoved(const QDBusObjectPath &in0)
@@ -665,11 +609,6 @@ void CallManager::callRemoved(const QDBusObjectPath &in0)
         m_calls.removeAt(m_calls.indexOf(path));
 
     updateCallItems();
-
-    if (m_multipartyCalls.contains(path)) {
-        m_multipartyCalls.removeAt(m_multipartyCalls.indexOf(path));
-        updateMultipartyCallItems();
-    }
 }
 
 void CallManager::dialFinished(QDBusPendingCallWatcher *watcher)
@@ -821,7 +760,6 @@ void CallManager::propertyChanged(const QString &in0, const QDBusVariant &in1)
     } else if (in0 == "MultipartyCalls") {
         QList<QDBusObjectPath> calls;
         calls = qdbus_cast<QList<QDBusObjectPath> >(in1.variant());
-        setMultipartyCalls(calls);
     } else if (in0 == "EmergencyNumbers") {
         qDebug() << QString("TODO: Handle EmergencyNumber...");
     } else
@@ -838,6 +776,14 @@ void CallManager::callStateChanged()
     emit callsChanged();
 }
 
+void CallManager::callMultiPartyChanged()
+{
+    TRACE
+    CallItem *call = dynamic_cast<CallItem *>(sender());
+    qDebug()<<"Multiparty Info: " <<call->multiparty();
+    emit callsChanged();
+}
+
 QStringList CallManager::dumpProperties()
 {
     m_properties.clear();
diff --git a/src/callmanager.h b/src/callmanager.h
index 86ee1f6..1ee12e2 100644
--- a/src/callmanager.h
+++ b/src/callmanager.h
@@ -26,7 +26,7 @@ class CallManager: public org::ofono::VoiceCallManager
     Q_OBJECT
 
     Q_PROPERTY(QList<CallItem *> calls READ calls)
-    Q_PROPERTY(QList<CallItem *> multipartyCalls READ multipartyCalls)
+    Q_PROPERTY(bool multipartyCalls READ multipartyCalls)
 
 public:
     CallManager(const QString &modemPath);
@@ -35,7 +35,7 @@ public:
 
     QList<CallItem *> calls() const;
     QList<QString> callsAsStrings() const;
-    QList<CallItem *> multipartyCalls() const;
+    bool multipartyCalls() const;
     QList<QString> multipartyCallsAsStrings() const;
     CallItem *activeCall() const;
     CallItem *heldCall() const;
@@ -95,9 +95,7 @@ Q_SIGNALS:
 
 private Q_SLOTS:
     void updateCallItems();
-    void updateMultipartyCallItems();
     void setCalls(QList<QDBusObjectPath> calls);
-    void setMultipartyCalls(QList<QDBusObjectPath> calls);
     void getPropertiesFinished(QDBusPendingCallWatcher *watcher);
     void getCallsFinished(QDBusPendingCallWatcher *watcher);
     void callAdded(const QDBusObjectPath &in0, const QVariantMap &in1);
@@ -114,6 +112,7 @@ private Q_SLOTS:
     void sendTonesFinished(QDBusPendingCallWatcher *watcher);
     void propertyChanged(const QString &in0, const QDBusVariant &in1);
     void callStateChanged();
+    void callMultiPartyChanged();
 
     void proceedCallDial(const QString number);
     void deniedCallDial();
diff --git a/src/callproxy.cpp b/src/callproxy.cpp
index 42dda17..dc874b5 100644
--- a/src/callproxy.cpp
+++ b/src/callproxy.cpp
@@ -20,7 +20,8 @@ CallProxy::CallProxy(const QString &callPath)
       m_state(QString()),
       m_startTime(QDateTime()),
       m_reason(QString()),
-      m_connected(false)
+      m_connected(false),
+      m_multiparty(false)
 {
     TRACE
 
@@ -110,6 +111,12 @@ QString CallProxy::reason() const
     return m_reason;
 }
 
+bool CallProxy::multiparty() const
+{
+    TRACE
+    return m_multiparty;
+}
+
 void CallProxy::answer()
 {
     TRACE
@@ -205,6 +212,7 @@ void CallProxy::getPropertiesFinished(QDBusPendingCallWatcher *watcher)
     m_name   = qdbus_cast<QString>(props["Name"]);
     m_state  = qdbus_cast<QString>(props["State"]);
     l_start  = qdbus_cast<QString>(props["StartTime"]);
+    m_multiparty  = qdbus_cast<bool>(props["Multiparty"]);
 
     setStartTimeFromString(l_start);
 
@@ -256,6 +264,9 @@ void CallProxy::propertyChanged(const QString &in0, const QDBusVariant &in1)
     } else if (in0 == "StartTime") {
         if (!m_startTime.isValid()) // No start time set yet
             setStartTimeFromString(qdbus_cast<QString>(in1.variant()));
+    } else if (in0 == "Multiparty") {
+        m_multiparty = qdbus_cast<bool>(in1.variant());
+        emit multiPartyChanged();
     } else {
         qDebug() << QString("Unexpected property \"%1\" changed...").arg(in0);
     }
@@ -287,6 +298,7 @@ QStringList CallProxy::dumpProperties()
     m_properties << QString("<li>State: %1</li>").arg(m_state);
     m_properties << QString("<li>StartTime: %1</li>")
                     .arg(m_startTime.toString());
+    m_properties << QString("<ul><li>Multiparty: %1</li>").arg((int)m_multiparty);
     if (!m_reason.isEmpty())
         m_properties << QString("<li>DisconnectReason: %1</li></ul>")
                         .arg(m_reason);
diff --git a/src/callproxy.h b/src/callproxy.h
index 67e71ed..e69b81f 100644
--- a/src/callproxy.h
+++ b/src/callproxy.h
@@ -30,6 +30,7 @@ class CallProxy: public org::ofono::VoiceCall
     Q_PROPERTY(QDateTime startTime READ startTime)
     Q_PROPERTY(int       duration READ duration)
     Q_PROPERTY(QString   reason READ reason)
+    Q_PROPERTY(bool   multiparty READ multiparty)
 
 public:
     CallProxy(const QString &callPath);
@@ -42,6 +43,7 @@ public:
     QDateTime startTime() const;
     int duration() const;
     QString reason() const;
+    bool multiparty() const;
 
     QStringList dumpProperties();
 
@@ -61,6 +63,7 @@ Q_SIGNALS:
     void callDisconnected(const QString &reason);
     void stateChanged();
     void dataChanged();
+    void multiPartyChanged();
 
 private Q_SLOTS:
     // Slots to handle asyncronous DBus replies
@@ -87,6 +90,7 @@ private:
     QDateTime          m_startTime;
     QString            m_reason;
     bool               m_connected;
+    bool               m_multiparty;
 
     Q_DISABLE_COPY(CallProxy)
 };
diff --git a/src/dialerkeypad.cpp b/src/dialerkeypad.cpp
index 7eb3a4e..a125158 100644
--- a/src/dialerkeypad.cpp
+++ b/src/dialerkeypad.cpp
@@ -224,7 +224,7 @@ void DialerKeyPad::updateButtonStates()
 
     if (cm && cm->isValid())
         haveCalls = ((cm->calls().length() > 0) ||
-                     (cm->multipartyCalls().length() > 0));
+                     (cm->multipartyCalls()));
 
     // Sync up the dial/hangup button state
     m_call->setChecked(haveCalls);
@@ -264,7 +264,7 @@ void DialerKeyPad::updateButtonStates()
 
     // Sync up the merge button state
     if (cm && cm->isValid()) {
-        if (cm->multipartyCalls().length() > 0)
+        if (cm->multipartyCalls())
             //% "Add"
             m_nway->setText(qtTrId("xx_add"));
         else
@@ -752,8 +752,7 @@ void DialerKeyPad::callPressed(bool checked)
             c = cm->alertingCall();
 
         if (c) {
-            if (cm->multipartyCalls().length() &&
-                cm->multipartyCallsAsStrings().contains(c->path())) {
+            if (cm->multipartyCalls()) {
                 qDebug() << "Hanging up MultipartyCall";
                 cm->hangupMultipartyCall();
             }
@@ -834,7 +833,7 @@ void DialerKeyPad::nwayPressed(bool checked)
 
     // If there is already a MultipartyCall, then we want to add an new
     // participant
-    if (cm->multipartyCalls().length() > 0)
+    if (cm->multipartyCalls())
         if (cm->activeCall() && cm->heldCall())
             qCritical() << QString("Can't add participant all lines busy!");
         else
-- 
1.7.2.2

_______________________________________________
MeeGo-handset mailing list
MeeGo-handset@lists.meego.com
http://lists.meego.com/listinfo/meego-handset

Reply via email to