diff options
author | Nicolas Bertrand <nicolas.bertrand@linux.intel.com> | 2011-05-02 11:17:14 +0200 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2011-05-02 02:53:22 -0500 |
commit | 287a55b43bae5bf3828ed0629c53bab10802a495 (patch) | |
tree | 5c8849cfd6cc4302ffd3339261a23a22237d0089 | |
parent | ef3593e5880ffab4a56a0527433e76ba2524a920 (diff) | |
download | phonesim-287a55b43bae5bf3828ed0629c53bab10802a495.tar.gz |
control: Update UI using call status
-rw-r--r-- | src/control.cpp | 40 | ||||
-rw-r--r-- | src/control.h | 5 |
2 files changed, 40 insertions, 5 deletions
diff --git a/src/control.cpp b/src/control.cpp index 645219c..1e71593 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->setCssiEnabled( enableCSSI ); + widget->setCssuEnabled( enableCSSU ); +} + +void ControlWidget::setCssiEnabled( bool enableCSSI ) +{ + ui->cbCSSI->setEnabled( enableCSSI ); +} + +void ControlWidget::setCssuEnabled( 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..3acffc9 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 setCssuEnabled( bool enableCSSU ); + void setCssiEnabled( 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& ); |