Hi Nicolas, On 04/28/2011 04:49 AM, Nicolas Bertrand wrote: > --- > 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 *list ) > +{ > + bool enableCSSU = false; > + bool enableCSSI = false; > + > + foreach( CallInfo i, *list ) { > + if ( i.incoming && !enableCSSU ) > + enableCSSU = true; > + if ( !i.incoming && !enableCSSI ) > + enableCSSI = true; indentation consistency please ;) > + } > + > + widget->CSSIactivation( enableCSSI ); > + widget->CSSUactivation( enableCSSU ); > +} > + > +void ControlWidget::CSSIactivation( bool enableCSSI ) > +{ > + ui->cbCSSI->setEnabled( enableCSSI ); > +} > + > +void ControlWidget::CSSUactivation( bool enableCSSU ) > +{ > + ui->cbCSSU->setEnabled( enableCSSU ); > +} These might be better named something like: setCssiEnabled and setCssuEnabled. Note that Qt APIs are strict CamelCase, even with abbreviations and the first word of a function should be all small-caps. > + > 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()) > - emit unsolicitedCommand("+CSSU: "+QString::number(v.toInt())); > + if ( v.canConvert() && ui->cbCSSU->isEnabled() ) > + emit unsolicitedCommand( "+CSSU: "+QString::number( v.toInt() ) ); > > v = ui->cbCSSI->itemData(ui->cbCSSI->currentIndex()); > > - if (v.canConvert()) > - emit unsolicitedCommand("+CSSI: "+QString::number(v.toInt())); > + if ( v.canConvert() && 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 > #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 *info ); > > protected: > virtual void warning( const QString&, const QString& ); Regards, -Denis