Open Source Telephony
 help / color / mirror / Atom feed
From: Nicolas Bertrand <nicolas.bertrand@linux.intel.com>
To: ofono@ofono.org
Subject: [PATCH 2/6] control: Update UI using call status
Date: Thu, 28 Apr 2011 11:49:35 +0200	[thread overview]
Message-ID: <1303984179-8333-3-git-send-email-nicolas.bertrand@linux.intel.com> (raw)
In-Reply-To: <1303984179-8333-1-git-send-email-nicolas.bertrand@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 3085 bytes --]

---
 src/control.cpp |   40 +++++++++++++++++++++++++++++++++++-----
 src/control.h   |    5 +++++
 2 files changed, 40 insertions(+), 5 deletions(-)

diff --git a/src/control.cpp b/src/control.cpp
index 645219c..2f12d91 100644
--- a/src/control.cpp
+++ b/src/control.cpp
@@ -134,6 +134,32 @@ Control::~Control()
     delete widget;
 }
 
+void Control::callManagement( QList<CallInfo> *list )
+{
+	bool enableCSSU = false;
+	bool enableCSSI = false;
+
+	foreach( CallInfo i, *list ) {
+		if ( i.incoming && !enableCSSU )
+			enableCSSU = true;
+		if ( !i.incoming && !enableCSSI )
+			enableCSSI = true;
+	}
+
+	widget->CSSIactivation( enableCSSI );
+	widget->CSSUactivation( enableCSSU );
+}
+
+void ControlWidget::CSSIactivation( bool enableCSSI )
+{
+    ui->cbCSSI->setEnabled( enableCSSI );
+}
+
+void ControlWidget::CSSUactivation( bool enableCSSU )
+{
+    ui->cbCSSU->setEnabled( enableCSSU );
+}
+
 void Control::setPhoneNumber( const QString &number )
 {
     widget->setWindowTitle("Phonesim - Number: " + number);
@@ -146,6 +172,10 @@ void Control::warning( const QString &title, const QString &message )
 
 void ControlWidget::handleCSSNNotif()
 {
+
+    ui->cbCSSU->setEnabled( false );
+    ui->cbCSSI->setEnabled( false );
+
     ui->cbCSSU->insertItem(0, "");
     ui->cbCSSU->insertItem(1, "0 - forwarded", 0);
     ui->cbCSSU->insertItem(3, "2 - on hold", 2);
@@ -160,15 +190,15 @@ void ControlWidget::handleCSSNNotif()
 
 void ControlWidget::sendCSSN()
 {
-    QVariant v = ui->cbCSSU->itemData(ui->cbCSSU->currentIndex());
+    QVariant v = ui->cbCSSU->itemData( ui->cbCSSU->currentIndex() );
 
-    if (v.canConvert<int>())
-        emit unsolicitedCommand("+CSSU: "+QString::number(v.toInt()));
+    if ( v.canConvert<int>() && ui->cbCSSU->isEnabled() )
+        emit unsolicitedCommand( "+CSSU: "+QString::number( v.toInt() ) );
 
     v = ui->cbCSSI->itemData(ui->cbCSSI->currentIndex());
 
-    if (v.canConvert<int>())
-        emit unsolicitedCommand("+CSSI: "+QString::number(v.toInt()));
+    if ( v.canConvert<int>() && ui->cbCSSI->isEnabled() )
+        emit unsolicitedCommand( "+CSSI: "+QString::number( v.toInt() ) );
 }
 
 void ControlWidget::sendSQ()
diff --git a/src/control.h b/src/control.h
index c17146a..2ccde29 100644
--- a/src/control.h
+++ b/src/control.h
@@ -25,6 +25,7 @@
 #include <QtScript>
 #include "ui_controlbase.h"
 #include "attranslator.h"
+#include "callmanager.h"
 
 class Control;
 
@@ -71,6 +72,9 @@ public:
     void handleToData( const QString& );
     void handleNewApp();
     void handleCSSNNotif();
+    void CSSUactivation( bool enableCSSU );
+    void CSSIactivation( bool enableCSSI );
+
 
 private slots:
     void sendSQ();
@@ -146,6 +150,7 @@ public slots:
     void handleToData( const QString& );
     void setPhoneNumber( const QString& );
     void handleNewApp();
+    void callManagement( QList<CallInfo> *info );
 
 protected:
     virtual void warning( const QString&, const QString& );
-- 
1.7.1


  parent reply	other threads:[~2011-04-28  9:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-28  9:49 [PATCH 0/6] phonesim: Add call status UI Nicolas Bertrand
2011-04-28  9:49 ` [PATCH 1/6] callmanager: Add signal on call status change Nicolas Bertrand
2011-04-28 19:52   ` Denis Kenzior
2011-04-28  9:49 ` Nicolas Bertrand [this message]
2011-04-28 19:58   ` [PATCH 2/6] control: Update UI using call status Denis Kenzior
2011-04-28  9:49 ` [PATCH 3/6] hardwaremanipulator: add callmanagement method Nicolas Bertrand
2011-04-28  9:49 ` [PATCH 4/6] phonesim: Connect call status signal Nicolas Bertrand
2011-04-28  9:49 ` [PATCH 5/6] controlbase.ui: Add call mangement tab Nicolas Bertrand
2011-04-28  9:49 ` [PATCH 6/6] control: Update call view Nicolas Bertrand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1303984179-8333-3-git-send-email-nicolas.bertrand@linux.intel.com \
    --to=nicolas.bertrand@linux.intel.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox