diff --git a/kde/plasma/plasmoid/MainWidget.cpp b/kde/plasma/plasmoid/MainWidget.cpp index 465e850e93cbc352fb3acbfe71c4d4b774b7ac71..1bcb7b5e6352eabf73b21ff9d6e47464d03501c9 100644 --- a/kde/plasma/plasmoid/MainWidget.cpp +++ b/kde/plasma/plasmoid/MainWidget.cpp @@ -6,50 +6,51 @@ MainWidget::MainWidget() : Plasma::Frame(), m_mainLayout(0), frmCalls(0), frmContact(0), frmHistory(0),currentMode(CALL) { - mainTabs = new Plasma::TabBar(this); + mainTabs = new Plasma::TabBar ( this ); + frmCalls = new Plasma::Frame ( this ); + callLayout = new QGraphicsLinearLayout ( Qt::Vertical ); + callScrollArea = new Plasma::ScrollWidget ( this ); + frmContact = new Plasma::Frame ( this ); + contactScrollArea = new Plasma::ScrollWidget ( this ); + frmHistory = new Plasma::Frame ( this ); + historyLayout = new QGraphicsLinearLayout ( Qt::Vertical ); + historyScrollArea = new Plasma::ScrollWidget ( this ); + mainLayout()->addItem(mainTabs); //connect(mainTabs, SIGNAL(currentChanged(int)), this, SLOT(modeChanged(int))); - frmCalls = new Plasma::Frame(this); frmCalls->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - callLayout = new QGraphicsLinearLayout(Qt::Vertical); frmCalls->setLayout(callLayout); - callScrollArea = new Plasma::ScrollWidget(this); callScrollArea->setWidget(frmCalls); - frmContact = new Plasma::Frame(this); frmContact->setText("Contact"); frmContact->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - contactScrollArea = new Plasma::ScrollWidget(this); contactScrollArea->setWidget(frmContact); - frmHistory = new Plasma::Frame(this); frmHistory->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - historyLayout = new QGraphicsLinearLayout(Qt::Vertical); frmHistory->setLayout(historyLayout); - historyScrollArea = new Plasma::ScrollWidget(this); historyScrollArea->setWidget(frmHistory); dialPage = new DialPage(); connect(dialPage, SIGNAL(call(QString)), this, SLOT(call(QString))); - QGraphicsLinearLayout* callTabLayout = new QGraphicsLinearLayout(Qt::Vertical); - QGraphicsLinearLayout* historyTabLayout = new QGraphicsLinearLayout(Qt::Vertical); - QGraphicsLinearLayout* contactTabLayout = new QGraphicsLinearLayout(Qt::Vertical); - QGraphicsLinearLayout* addTabLayout = new QGraphicsLinearLayout(Qt::Vertical); - - callTabLayout->addItem(callScrollArea); - historyTabLayout->addItem(historyScrollArea); - contactTabLayout->addItem(contactScrollArea); + QGraphicsLinearLayout* callTabLayout = new QGraphicsLinearLayout( Qt::Vertical ); + QGraphicsLinearLayout* historyTabLayout = new QGraphicsLinearLayout( Qt::Vertical ); + QGraphicsLinearLayout* contactTabLayout = new QGraphicsLinearLayout( Qt::Vertical ); + QGraphicsLinearLayout* addTabLayout = new QGraphicsLinearLayout( Qt::Vertical ); + + callTabLayout->addItem ( callScrollArea ); + historyTabLayout->addItem ( historyScrollArea ); + contactTabLayout->addItem ( contactScrollArea ); addTabLayout->addItem(dialPage); - mainTabs->addTab("Call", callTabLayout); - mainTabs->addTab("History", historyTabLayout); - mainTabs->addTab("Contact", contactTabLayout); - mainTabs->addTab(KIcon("list-add"),"", addTabLayout); + mainTabs->addTab( "Call" , callTabLayout ); + mainTabs->addTab( "History" , historyTabLayout ); + mainTabs->addTab( "Contact" , contactTabLayout ); + mainTabs->addTab( KIcon("list-add") , "", addTabLayout ); //mainLayout()->addItem(callTabLayout); @@ -58,9 +59,10 @@ MainWidget::MainWidget() : Plasma::Frame(), m_mainLayout(0), frmCalls(0), frmCon //mainLayout()->addItem(contactScrollArea); initPos = frmCalls->pos(); - frmCalls->setPos(initPos); - frmHistory->setPos(initPos); - frmContact->setPos(initPos); + + frmCalls->setPos ( initPos ); + frmHistory->setPos( initPos ); + frmContact->setPos( initPos ); setMinimumSize(285,390); } @@ -72,15 +74,15 @@ void MainWidget::dataUpdated(const QString& source, const Plasma::DataEngine::Da bool modified = false; foreach(QVariant call, value) { if (!callWidgetList[value.key(call)]) { - callWidgetList[value.key(call)] = new CallItem(); - callWidgetList[value.key(call)]->setCallId(value.key(call)); + callWidgetList[ value.key(call) ] = new CallItem(); + callWidgetList[ value.key(call) ]->setCallId(value.key(call)); callLayout->insertItem(0,callWidgetList[value.key(call)]); mainTabs->setCurrentIndex(CALL); modified = true; } - callWidgetList[value.key(call)]->setCallerName(call.toHash()["Name"].toString()); - callWidgetList[value.key(call)]->setCallerNumber(call.toHash()["Number"].toString()); - callWidgetList[value.key(call)]->setState(call.toHash()["State"].toInt()); + callWidgetList[value.key(call)]->setCallerName(call.toHash() [ "Name" ].toString()); + callWidgetList[value.key(call)]->setCallerNumber(call.toHash()[ "Number" ].toString()); + callWidgetList[value.key(call)]->setState(call.toHash() [ "State" ].toInt()); if (call.toHash()["State"].toInt() == CALL_STATE_INCOMING) { emit requierAttention(); @@ -93,7 +95,8 @@ void MainWidget::dataUpdated(const QString& source, const Plasma::DataEngine::Da //sflphoneEngine->connectSource("conferences", this,0/*Update only if something happen*/); } else if (source == "info") { - currentAccountId = data["Account"].toString(); + if (!data["Account"].isNull() || data["Account"].isValid()) + currentAccountId = data["Account"].toString(); } else if (source == "conferences") { QHash<QString, QVariant> value = data; @@ -122,15 +125,17 @@ void MainWidget::dataUpdated(const QString& source, const Plasma::DataEngine::Da } else if (source == "history") { QHash<QString, QVariant> value = data; - foreach(QVariant call, value) { - if (!historyWidgetList[value.key(call)]) { - historyWidgetList[value.key(call)] = new CallItem(); - historyWidgetList[value.key(call)]->setCallId(value.key(call)); - historyLayout->addItem(historyWidgetList[value.key(call)]); + for (QHash<QString, QVariant>::iterator i = value.begin(); i != value.end(); ++i) { + QString key = i.key(); + //QHash<QString, CallItem*> historyWidgetList; + if ( ! historyWidgetList[key]) { + historyWidgetList[ i.key() ] = new CallItem(); + historyWidgetList[ i.key() ]->setCallId(i.key()); + historyLayout->addItem(historyWidgetList[i.key()]); } - historyWidgetList[value.key(call)]->setCallerName(call.toHash()["Name"].toString()); - historyWidgetList[value.key(call)]->setCallerNumber(call.toHash()["Number"].toString()); - historyWidgetList[value.key(call)]->setDate(call.toHash()["Date"].toInt()); + historyWidgetList[ i.key() ]->setCallerName(i.value().toHash() [ "Name" ].toString()); + historyWidgetList[ i.key() ]->setCallerNumber(i.value().toHash() [ "Number" ].toString()); + historyWidgetList[ i.key() ]->setDate(i.value().toHash() [ "Date" ].toInt()) ; } } } @@ -148,7 +153,7 @@ QGraphicsLinearLayout* MainWidget::mainLayout() void MainWidget::call(QString number) { - qDebug() << "Calling " << number << " with account " << currentAccountId << ", " << CallModelConvenience::getAccountList()->size() << " account registred"; - CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance(); - callManager.placeCall(currentAccountId, CallModelConvenience::generateCallId(), number); +// qDebug() << "Calling " << number << " with account " << currentAccountId << ", " << CallModelConvenience::getAccountList()->size() << " account registred"; +// CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance(); +// callManager.placeCall(currentAccountId, CallModelConvenience::generateCallId(), number); } diff --git a/kde/plasma/plasmoid/MainWidget.h b/kde/plasma/plasmoid/MainWidget.h index fc356861ea4867f8137b2bcdbd20a0dbc01b3395..a5892ef228bd4023670d37fad07923d1bcfbe59c 100644 --- a/kde/plasma/plasmoid/MainWidget.h +++ b/kde/plasma/plasmoid/MainWidget.h @@ -12,6 +12,7 @@ #include <Plasma/DataEngine> #include <Plasma/ExtenderItem> #include <KIcon> +#include <QHash> #include "CallItem.h" #include "ConferenceItem.h" diff --git a/kde/plasma/plasmoid/SFLPhonePlasmoid.cpp b/kde/plasma/plasmoid/SFLPhonePlasmoid.cpp index d37a095b4f36475a767561100d0fe59f8c522c0e..d13e72ebab3033659d304637b09f4031f2c1b8d3 100644 --- a/kde/plasma/plasmoid/SFLPhonePlasmoid.cpp +++ b/kde/plasma/plasmoid/SFLPhonePlasmoid.cpp @@ -12,7 +12,7 @@ SFLPhonePlasmoid::SFLPhonePlasmoid(QObject* parent, const QVariantList& args) { //m_svg.setImagePath("widgets/background"); setBackgroundHints(DefaultBackground); - + CallModelConvenience::init(); setMinimumSize(24,24); diff --git a/kde/src/AccountWizard.cpp b/kde/src/AccountWizard.cpp index 2a23ef9fe88fa80b7e461b830d57c51f8e0d19a2..8c44a3fadfaeb8b8fee20cdde3df6f5b0c0b8e05 100755 --- a/kde/src/AccountWizard.cpp +++ b/kde/src/AccountWizard.cpp @@ -61,12 +61,13 @@ ***************************************************************************/ typedef struct { - bool success; - QString reason; - QString user; - QString passwd; + bool success ; + QString reason ; + QString user ; + QString passwd ; } rest_account; +///Validate if the connection can be done with the PBX int sendRequest(QString host, int port, QString req, QString & ret) { int s; @@ -131,6 +132,7 @@ int sendRequest(QString host, int port, QString req, QString & ret) return 0; } +/// rest_account get_rest_account(QString host, QString email) { QString req = "GET /rest/accountcreator?email=" + email; @@ -154,33 +156,35 @@ rest_account get_rest_account(QString host, QString email) /*************************************************************************** * Class AccountWizard * * Widget of the wizard for creating an account. * - ***************************************************************************/ + **************************************************************************/ +///Constructor AccountWizard::AccountWizard(QWidget * parent) : QWizard(parent) { - setPage(Page_Intro, new WizardIntroPage); - setPage(Page_AutoMan, new WizardAccountAutoManualPage); - setPage(Page_Type, new WizardAccountTypePage); - setPage(Page_Email, new WizardAccountEmailAddressPage); - setPage(Page_SIPForm, new WizardAccountSIPFormPage); - setPage(Page_IAXForm, new WizardAccountIAXFormPage); - setPage(Page_Stun, new WizardAccountStunPage); - setPage(Page_Conclusion, new WizardAccountConclusionPage); + setPage(Page_Intro , new WizardIntroPage ); + setPage(Page_AutoMan , new WizardAccountAutoManualPage ); + setPage(Page_Type , new WizardAccountTypePage ); + setPage(Page_Email , new WizardAccountEmailAddressPage ); + setPage(Page_SIPForm , new WizardAccountSIPFormPage ); + setPage(Page_IAXForm , new WizardAccountIAXFormPage ); + setPage(Page_Stun , new WizardAccountStunPage ); + setPage(Page_Conclusion , new WizardAccountConclusionPage ); setStartId(Page_Intro); setWindowTitle(i18n("Account creation wizard")); setWindowIcon(QIcon(ICON_SFLPHONE)); - setMinimumHeight(350); - setMinimumWidth(500); + setMinimumHeight ( 350 ); + setMinimumWidth ( 500 ); setPixmap(QWizard::WatermarkPixmap, QPixmap(ICON_SFLPHONE)); } - +///Destructor AccountWizard::~AccountWizard() { } +///The accept button have been pressed void AccountWizard::accept() { ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); @@ -188,33 +192,33 @@ void AccountWizard::accept() QString ret; MapStringString accountDetails; - QString & alias = accountDetails[QString(ACCOUNT_ALIAS)]; - QString & enabled = accountDetails[QString(ACCOUNT_ENABLED)]; - QString & mailbox = accountDetails[QString(ACCOUNT_MAILBOX)]; - QString & protocol = accountDetails[QString(ACCOUNT_TYPE)]; - QString & server = accountDetails[QString(ACCOUNT_HOSTNAME)]; - QString & user = accountDetails[QString(ACCOUNT_USERNAME)]; - QString & password = accountDetails[QString(ACCOUNT_PASSWORD)]; + QString & alias = accountDetails[ QString(ACCOUNT_ALIAS) ]; + QString & enabled = accountDetails[ QString(ACCOUNT_ENABLED) ]; + QString & mailbox = accountDetails[ QString(ACCOUNT_MAILBOX) ]; + QString & protocol = accountDetails[ QString(ACCOUNT_TYPE) ]; + QString & server = accountDetails[ QString(ACCOUNT_HOSTNAME) ]; + QString & user = accountDetails[ QString(ACCOUNT_USERNAME) ]; + QString & password = accountDetails[ QString(ACCOUNT_PASSWORD) ]; // sip only parameters - QString & stun_enabled = accountDetails[QString(ACCOUNT_SIP_STUN_ENABLED)]; - QString & stun_server = accountDetails[QString(ACCOUNT_SIP_STUN_SERVER)]; + QString & stun_enabled = accountDetails[ QString(ACCOUNT_SIP_STUN_ENABLED) ]; + QString & stun_server = accountDetails[ QString(ACCOUNT_SIP_STUN_SERVER) ]; // zrtp only parameters - QString & srtp_enabled = accountDetails[QString(ACCOUNT_SRTP_ENABLED)]; - QString & key_exchange = accountDetails[QString(ACCOUNT_KEY_EXCHANGE)]; - QString & zrtp_display_sas = accountDetails[QString(ACCOUNT_ZRTP_DISPLAY_SAS)]; - QString & zrtp_not_supp_warning = accountDetails[QString(ACCOUNT_ZRTP_NOT_SUPP_WARNING)]; - QString & zrtp_hello_hash = accountDetails[QString(ACCOUNT_ZRTP_HELLO_HASH)]; - QString & display_sas_once = accountDetails[QString(ACCOUNT_DISPLAY_SAS_ONCE)]; + QString & srtp_enabled = accountDetails[ QString(ACCOUNT_SRTP_ENABLED) ]; + QString & key_exchange = accountDetails[ QString(ACCOUNT_KEY_EXCHANGE) ]; + QString & zrtp_display_sas = accountDetails[ QString(ACCOUNT_ZRTP_DISPLAY_SAS) ]; + QString & zrtp_not_supp_warning = accountDetails[ QString(ACCOUNT_ZRTP_NOT_SUPP_WARNING) ]; + QString & zrtp_hello_hash = accountDetails[ QString(ACCOUNT_ZRTP_HELLO_HASH) ]; + QString & display_sas_once = accountDetails[ QString(ACCOUNT_DISPLAY_SAS_ONCE) ]; // interface paramters - QString & locale_interface = accountDetails[QString(LOCAL_INTERFACE)]; - QString & published_address = accountDetails[QString(PUBLISHED_ADDRESS)]; + QString & locale_interface = accountDetails[ QString(LOCAL_INTERFACE) ]; + QString & published_address = accountDetails[ QString(PUBLISHED_ADDRESS) ]; bool is_using_sflphone_org = field(FIELD_SFL_ACCOUNT).toBool(); - bool is_using_sip = false; - bool is_create_account = false; + bool is_using_sip = false; + bool is_create_account = false; // sflphone.org if(is_using_sflphone_org) { @@ -225,20 +229,20 @@ void AccountWizard::accept() if(acc.success) { ret += i18n("This assistant is now finished.") + "\n"; - field(FIELD_SIP_ALIAS) = QString(acc.user) + "@" + SFL_ACCOUNT_HOST; - field(FIELD_SIP_VOICEMAIL) = QString(); - field(FIELD_SIP_SERVER) = QString(SFL_ACCOUNT_HOST); - field(FIELD_SIP_PASSWORD) = QString(acc.passwd); - field(FIELD_SIP_USER) = QString(acc.user); - - protocol = QString(ACCOUNT_TYPE_SIP); - server = QString(SFL_ACCOUNT_HOST); - password = QString(acc.passwd); - user = QString(acc.user); - enabled = QString(ACCOUNT_ENABLED_TRUE); + field( FIELD_SIP_ALIAS ) = QString(acc.user) + "@" + SFL_ACCOUNT_HOST; + field( FIELD_SIP_VOICEMAIL ) = QString(); + field( FIELD_SIP_SERVER ) = QString(SFL_ACCOUNT_HOST); + field( FIELD_SIP_PASSWORD ) = QString(acc.passwd); + field( FIELD_SIP_USER ) = QString(acc.user); + + protocol = QString( ACCOUNT_TYPE_SIP ); + server = QString( SFL_ACCOUNT_HOST ); + password = QString( acc.passwd ); + user = QString( acc.user ); + enabled = QString( ACCOUNT_ENABLED_TRUE ); is_create_account = true; - is_using_sip = true; + is_using_sip = true; } else { ret += i18n("Creation of account has failed for the reason") + " :\n"; @@ -246,15 +250,15 @@ void AccountWizard::accept() } } else if(field(FIELD_SIP_ACCOUNT).toBool()) { //sip - ret += i18n("This assistant is now finished.") + "\n"; + ret += i18n("This assistant is now finished.") + "\n"; - alias = field(FIELD_SIP_ALIAS).toString(); - enabled = QString(ACCOUNT_ENABLED_TRUE); - mailbox = field(FIELD_SIP_VOICEMAIL).toString(); - protocol = QString(ACCOUNT_TYPE_SIP); - server = field(FIELD_SIP_SERVER).toString(); - password = field(FIELD_SIP_PASSWORD).toString(); - user = field(FIELD_SIP_USER).toString(); + alias = field ( FIELD_SIP_ALIAS ).toString(); + enabled = QString ( ACCOUNT_ENABLED_TRUE ); + mailbox = field ( FIELD_SIP_VOICEMAIL ).toString(); + protocol = QString ( ACCOUNT_TYPE_SIP ); + server = field ( FIELD_SIP_SERVER ).toString(); + password = field ( FIELD_SIP_PASSWORD ).toString(); + user = field ( FIELD_SIP_USER ).toString(); is_create_account = true; is_using_sip = true; @@ -263,13 +267,13 @@ void AccountWizard::accept() else { // iax ret += i18n("This assistant is now finished.") + "\n"; - alias = field(FIELD_IAX_ALIAS).toString(); - enabled = QString(ACCOUNT_ENABLED_TRUE); - mailbox = field(FIELD_IAX_VOICEMAIL).toString(); - protocol = QString(ACCOUNT_TYPE_IAX); - server = field(FIELD_IAX_SERVER).toString(); - password = field(FIELD_IAX_PASSWORD).toString(); - user = field(FIELD_IAX_USER).toString(); + alias = field ( FIELD_IAX_ALIAS ).toString(); + enabled = QString ( ACCOUNT_ENABLED_TRUE ); + mailbox = field ( FIELD_IAX_VOICEMAIL ).toString(); + protocol = QString ( ACCOUNT_TYPE_IAX ); + server = field ( FIELD_IAX_SERVER ).toString(); + password = field ( FIELD_IAX_PASSWORD ).toString(); + user = field ( FIELD_IAX_USER ).toString(); is_create_account = true; is_using_sip = false; @@ -280,33 +284,33 @@ void AccountWizard::accept() if(is_using_sip) { if(field(FIELD_SIP_ENABLE_STUN).toBool()) { stun_enabled = QString(ACCOUNT_ENABLED_TRUE); - stun_server = field(FIELD_SIP_STUN_SERVER).toString(); + stun_server = field(FIELD_SIP_STUN_SERVER).toString(); } else { stun_enabled = QString(ACCOUNT_ENABLED_FALSE); - stun_server = QString(); + stun_server = QString(); } if(field(FIELD_ZRTP_ENABLED).toBool()) { - srtp_enabled = QString(ACCOUNT_ENABLED_TRUE); - key_exchange = QString(ZRTP); - zrtp_display_sas = QString(ACCOUNT_ENABLED_TRUE); - zrtp_not_supp_warning = QString(ACCOUNT_ENABLED_TRUE); - zrtp_hello_hash = QString(ACCOUNT_ENABLED_TRUE); - display_sas_once = QString(ACCOUNT_ENABLED_FALSE); + srtp_enabled = QString( ACCOUNT_ENABLED_TRUE ); + key_exchange = QString( ZRTP ); + zrtp_display_sas = QString( ACCOUNT_ENABLED_TRUE ); + zrtp_not_supp_warning = QString( ACCOUNT_ENABLED_TRUE ); + zrtp_hello_hash = QString( ACCOUNT_ENABLED_TRUE ); + display_sas_once = QString( ACCOUNT_ENABLED_FALSE ); } QStringList ifaceList = configurationManager.getAllIpInterface(); - locale_interface = ifaceList.at(0); - published_address = ifaceList.at(0); + locale_interface = ifaceList.at(0); + published_address = ifaceList.at(0); - ret += i18n("Alias") + " : " + alias + "\n"; - ret += i18n("Server") + " : " + server + "\n"; - ret += i18n("Username") + " : " + user + "\n"; - ret += i18n("Password") + " : " + password + "\n"; - ret += i18n("Protocol") + " : " + protocol + "\n"; - ret += i18n("Voicemail number") + " : " + mailbox + "\n"; + ret += i18n( "Alias" ) + " : " + alias + "\n"; + ret += i18n( "Server" ) + " : " + server + "\n"; + ret += i18n( "Username" ) + " : " + user + "\n"; + ret += i18n( "Password" ) + " : " + password + "\n"; + ret += i18n( "Protocol" ) + " : " + protocol + "\n"; + ret += i18n( "Voicemail number" ) + " : " + mailbox + "\n"; } if(is_create_account) { @@ -323,8 +327,9 @@ void AccountWizard::accept() /*************************************************************************** * Class WizardIntroPage * * Widget of the introduction page of the wizard * - ***************************************************************************/ + **************************************************************************/ +///The first page WizardIntroPage::WizardIntroPage(QWidget *parent) : QWizardPage(parent) { @@ -354,34 +359,35 @@ int WizardIntroPage::nextId() const * Class WizardAccountAutoManualPage * * Page in which user choses to create an account on * * sflphone.org or register a new one. * - ***************************************************************************/ - + **************************************************************************/ +///The second page WizardAccountAutoManualPage::WizardAccountAutoManualPage(QWidget *parent) : QWizardPage(parent) { setTitle(i18n("Account")); setSubTitle(i18n("Please select one of the following options")); - radioButton_SFL = new QRadioButton(i18n("Create a free SIP/IAX2 account on sflphone.org")); + radioButton_SFL = new QRadioButton(i18n("Create a free SIP/IAX2 account on sflphone.org")); radioButton_manual = new QRadioButton(i18n("Register an existing SIP or IAX2 account")); radioButton_SFL->setChecked(true); - registerField(FIELD_SFL_ACCOUNT, radioButton_SFL); - registerField(FIELD_OTHER_ACCOUNT, radioButton_manual); + registerField( FIELD_SFL_ACCOUNT , radioButton_SFL ); + registerField( FIELD_OTHER_ACCOUNT , radioButton_manual ); QVBoxLayout *layout = new QVBoxLayout; - layout->addWidget(radioButton_SFL); - layout->addWidget(radioButton_manual); + layout->addWidget( radioButton_SFL ); + layout->addWidget( radioButton_manual ); setLayout(layout); } - +///Second page destructor WizardAccountAutoManualPage::~WizardAccountAutoManualPage() { delete radioButton_SFL; delete radioButton_manual; } +/// int WizardAccountAutoManualPage::nextId() const { if(radioButton_SFL->isChecked()) @@ -394,19 +400,19 @@ int WizardAccountAutoManualPage::nextId() const * Class WizardAccountTypePage * * Page in which user choses between SIP and IAX account. * ***************************************************************************/ - +///The third page WizardAccountTypePage::WizardAccountTypePage(QWidget *parent) : QWizardPage(parent) { - setTitle(i18n("VoIP Protocols")); - setSubTitle(i18n("Select an account type")); + setTitle ( i18n("VoIP Protocols" )); + setSubTitle ( i18n("Select an account type" )); - radioButton_SIP = new QRadioButton(i18n("SIP (Session Initiation Protocol)")); - radioButton_IAX = new QRadioButton(i18n("IAX2 (InterAsterix Exchange)")); + radioButton_SIP = new QRadioButton(i18n("SIP (Session Initiation Protocol)" )); + radioButton_IAX = new QRadioButton(i18n("IAX2 (InterAsterix Exchange)" )); radioButton_SIP->setChecked(true); - registerField(FIELD_SIP_ACCOUNT, radioButton_SIP); - registerField(FIELD_IAX_ACCOUNT, radioButton_IAX); + registerField( FIELD_SIP_ACCOUNT, radioButton_SIP ); + registerField( FIELD_IAX_ACCOUNT, radioButton_IAX ); QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(radioButton_SIP); @@ -414,13 +420,14 @@ WizardAccountTypePage::WizardAccountTypePage(QWidget *parent) setLayout(layout); } - +///Third page destructor WizardAccountTypePage::~WizardAccountTypePage() { delete radioButton_SIP; delete radioButton_IAX; } +/// int WizardAccountTypePage::nextId() const { if(radioButton_SIP->isChecked()) @@ -432,33 +439,34 @@ int WizardAccountTypePage::nextId() const /*************************************************************************** * Class WizardAccountEmailAddressPage * * Page in which user choses between SIP and IAX account. * - ***************************************************************************/ + **************************************************************************/ +///Set your email address WizardAccountEmailAddressPage::WizardAccountEmailAddressPage(QWidget *parent) : QWizardPage(parent) { setTitle(i18n("Optional email address")); setSubTitle(i18n("This email address will be used to send your voicemail messages.")); - label_emailAddress = new QLabel(i18n("Email address")); + label_emailAddress = new QLabel(i18n("Email address")); lineEdit_emailAddress = new QLineEdit(); - label_enableZrtp = new QLabel(i18n("Secure with ZRTP")); - checkBox_enableZrtp = new QCheckBox(); + label_enableZrtp = new QLabel(i18n("Secure with ZRTP")); + checkBox_enableZrtp = new QCheckBox(); - registerField(FIELD_EMAIL_ADDRESS, lineEdit_emailAddress); - registerField(FIELD_ZRTP_ENABLED, checkBox_enableZrtp); + registerField( FIELD_EMAIL_ADDRESS , lineEdit_emailAddress ); + registerField( FIELD_ZRTP_ENABLED , checkBox_enableZrtp ); QFormLayout *layout = new QFormLayout; - layout->setWidget(0, QFormLayout::LabelRole, label_emailAddress); - layout->setWidget(0, QFormLayout::FieldRole, lineEdit_emailAddress); - layout->setWidget(1, QFormLayout::LabelRole, label_enableZrtp); - layout->setWidget(1, QFormLayout::FieldRole, checkBox_enableZrtp); + layout->setWidget(0 , QFormLayout::LabelRole , label_emailAddress ); + layout->setWidget(0 , QFormLayout::FieldRole , lineEdit_emailAddress ); + layout->setWidget(1 , QFormLayout::LabelRole , label_enableZrtp ); + layout->setWidget(1 , QFormLayout::FieldRole , checkBox_enableZrtp ); setLayout(layout); } - +///Email page destructor WizardAccountEmailAddressPage::~WizardAccountEmailAddressPage() { delete label_emailAddress; @@ -467,6 +475,7 @@ WizardAccountEmailAddressPage::~WizardAccountEmailAddressPage() delete checkBox_enableZrtp; } +/// int WizardAccountEmailAddressPage::nextId() const { return AccountWizard::Page_Stun; @@ -475,7 +484,7 @@ int WizardAccountEmailAddressPage::nextId() const /*************************************************************************** * Class WizardAccountFormPage * * Page of account settings. * - ***************************************************************************/ + **************************************************************************/ WizardAccountSIPFormPage::WizardAccountSIPFormPage(QWidget *parent) : QWizardPage(parent) @@ -483,44 +492,44 @@ WizardAccountSIPFormPage::WizardAccountSIPFormPage(QWidget *parent) setTitle(i18n("SIP account settings")); setSubTitle(i18n("Please fill the following information")); - label_alias = new QLabel(i18n("Alias") + " *"); - label_server = new QLabel(i18n("Server") + " *"); - label_user = new QLabel(i18n("Username") + " *"); - label_password = new QLabel(i18n("Password") + " *"); - label_voicemail = new QLabel(i18n("Voicemail number")); - label_enableZrtp = new QLabel(i18n("Secure with ZRTP")); - - lineEdit_alias = new QLineEdit; - lineEdit_server = new QLineEdit; - lineEdit_user = new QLineEdit; - lineEdit_password = new QLineEdit; - lineEdit_voicemail = new QLineEdit; + label_alias = new QLabel( i18n( "Alias" ) + " *" ); + label_server = new QLabel( i18n( "Server" ) + " *" ); + label_user = new QLabel( i18n( "Username" ) + " *" ); + label_password = new QLabel( i18n( "Password" ) + " *" ); + label_voicemail = new QLabel( i18n( "Voicemail number" ) ); + label_enableZrtp = new QLabel( i18n( "Secure with ZRTP" ) ); + + lineEdit_alias = new QLineEdit; + lineEdit_server = new QLineEdit; + lineEdit_user = new QLineEdit; + lineEdit_password = new QLineEdit; + lineEdit_voicemail = new QLineEdit; checkBox_enableZrtp = new QCheckBox; lineEdit_password->setEchoMode(QLineEdit::Password); - registerField(QString(FIELD_SIP_ALIAS) + "*", lineEdit_alias); - registerField(QString(FIELD_SIP_SERVER) + "*", lineEdit_server); - registerField(QString(FIELD_SIP_USER) + "*", lineEdit_user); - registerField(QString(FIELD_SIP_PASSWORD) + "*", lineEdit_password); - registerField(QString(FIELD_SIP_VOICEMAIL), lineEdit_voicemail); - registerField(QString(FIELD_ZRTP_ENABLED), checkBox_enableZrtp); + registerField(QString( FIELD_SIP_ALIAS) + "*" , lineEdit_alias ); + registerField(QString( FIELD_SIP_SERVER) + "*" , lineEdit_server ); + registerField(QString( FIELD_SIP_USER) + "*" , lineEdit_user ); + registerField(QString( FIELD_SIP_PASSWORD) + "*" , lineEdit_password ); + registerField(QString( FIELD_SIP_VOICEMAIL) , lineEdit_voicemail ); + registerField(QString( FIELD_ZRTP_ENABLED) , checkBox_enableZrtp ); QFormLayout *layout = new QFormLayout; - layout->setWidget(0, QFormLayout::LabelRole, label_alias); - layout->setWidget(0, QFormLayout::FieldRole, lineEdit_alias); - layout->setWidget(1, QFormLayout::LabelRole, label_server); - layout->setWidget(1, QFormLayout::FieldRole, lineEdit_server); - layout->setWidget(2, QFormLayout::LabelRole, label_user); - layout->setWidget(2, QFormLayout::FieldRole, lineEdit_user); - layout->setWidget(3, QFormLayout::LabelRole, label_password); - layout->setWidget(3, QFormLayout::FieldRole, lineEdit_password); - layout->setWidget(4, QFormLayout::LabelRole, label_voicemail); - layout->setWidget(4, QFormLayout::FieldRole, lineEdit_voicemail); - layout->setWidget(5, QFormLayout::LabelRole, label_enableZrtp); - layout->setWidget(5, QFormLayout::FieldRole, checkBox_enableZrtp); + layout->setWidget( 0, QFormLayout::LabelRole , label_alias ); + layout->setWidget( 0, QFormLayout::FieldRole , lineEdit_alias ); + layout->setWidget( 1, QFormLayout::LabelRole , label_server ); + layout->setWidget( 1, QFormLayout::FieldRole , lineEdit_server ); + layout->setWidget( 2, QFormLayout::LabelRole , label_user ); + layout->setWidget( 2, QFormLayout::FieldRole , lineEdit_user ); + layout->setWidget( 3, QFormLayout::LabelRole , label_password ); + layout->setWidget( 3, QFormLayout::FieldRole , lineEdit_password ); + layout->setWidget( 4, QFormLayout::LabelRole , label_voicemail ); + layout->setWidget( 4, QFormLayout::FieldRole , lineEdit_voicemail ); + layout->setWidget( 5, QFormLayout::LabelRole , label_enableZrtp ); + layout->setWidget( 5, QFormLayout::FieldRole , checkBox_enableZrtp ); setLayout(layout); } @@ -558,38 +567,38 @@ WizardAccountIAXFormPage::WizardAccountIAXFormPage(QWidget *parent) setTitle(i18n("IAX2 account settings")); setSubTitle(i18n("Please fill the following information")); - label_alias = new QLabel(i18n("Alias") + " *"); - label_server = new QLabel(i18n("Server") + " *"); - label_user = new QLabel(i18n("Username") + " *"); - label_password = new QLabel(i18n("Password") + " *"); - label_voicemail = new QLabel(i18n("Voicemail number")); + label_alias = new QLabel(i18n("Alias") + " *" ); + label_server = new QLabel(i18n("Server") + " *" ); + label_user = new QLabel(i18n("Username") + " *" ); + label_password = new QLabel(i18n("Password") + " *" ); + label_voicemail = new QLabel(i18n("Voicemail number" )); - lineEdit_alias = new QLineEdit; - lineEdit_server = new QLineEdit; - lineEdit_user = new QLineEdit; - lineEdit_password = new QLineEdit; + lineEdit_alias = new QLineEdit; + lineEdit_server = new QLineEdit; + lineEdit_user = new QLineEdit; + lineEdit_password = new QLineEdit; lineEdit_voicemail = new QLineEdit; lineEdit_password->setEchoMode(QLineEdit::Password); - registerField(QString(FIELD_IAX_ALIAS) + "*", lineEdit_alias); - registerField(QString(FIELD_IAX_SERVER) + "*", lineEdit_server); - registerField(QString(FIELD_IAX_USER) + "*", lineEdit_user); - registerField(QString(FIELD_IAX_PASSWORD) + "*", lineEdit_password); - registerField(QString(FIELD_IAX_VOICEMAIL), lineEdit_voicemail); + registerField( QString( FIELD_IAX_ALIAS ) + "*", lineEdit_alias ); + registerField( QString( FIELD_IAX_SERVER ) + "*", lineEdit_server ); + registerField( QString( FIELD_IAX_USER ) + "*", lineEdit_user ); + registerField( QString( FIELD_IAX_PASSWORD ) + "*", lineEdit_password ); + registerField( QString( FIELD_IAX_VOICEMAIL ) , lineEdit_voicemail ); QFormLayout *layout = new QFormLayout; - layout->setWidget(0, QFormLayout::LabelRole, label_alias); - layout->setWidget(0, QFormLayout::FieldRole, lineEdit_alias); - layout->setWidget(1, QFormLayout::LabelRole, label_server); - layout->setWidget(1, QFormLayout::FieldRole, lineEdit_server); - layout->setWidget(2, QFormLayout::LabelRole, label_user); - layout->setWidget(2, QFormLayout::FieldRole, lineEdit_user); - layout->setWidget(3, QFormLayout::LabelRole, label_password); - layout->setWidget(3, QFormLayout::FieldRole, lineEdit_password); - layout->setWidget(4, QFormLayout::LabelRole, label_voicemail); - layout->setWidget(4, QFormLayout::FieldRole, lineEdit_voicemail); + layout->setWidget( 0 , QFormLayout::LabelRole , label_alias ); + layout->setWidget( 0 , QFormLayout::FieldRole , lineEdit_alias ); + layout->setWidget( 1 , QFormLayout::LabelRole , label_server ); + layout->setWidget( 1 , QFormLayout::FieldRole , lineEdit_server ); + layout->setWidget( 2 , QFormLayout::LabelRole , label_user ); + layout->setWidget( 2 , QFormLayout::FieldRole , lineEdit_user ); + layout->setWidget( 3 , QFormLayout::LabelRole , label_password ); + layout->setWidget( 3 , QFormLayout::FieldRole , lineEdit_password ); + layout->setWidget( 4 , QFormLayout::LabelRole , label_voicemail ); + layout->setWidget( 4 , QFormLayout::FieldRole , lineEdit_voicemail ); setLayout(layout); } @@ -626,20 +635,20 @@ WizardAccountStunPage::WizardAccountStunPage(QWidget *parent) setSubTitle(i18n("You should probably enable this if you are behind a firewall.")); checkBox_enableStun = new QCheckBox(i18n("Enable STUN")); - label_StunServer = new QLabel(i18n("Stun Server")); + label_StunServer = new QLabel(i18n("Stun Server")); lineEdit_StunServer = new QLineEdit(); - lineEdit_StunServer->setDisabled(true); + lineEdit_StunServer->setDisabled(true); registerField(FIELD_SIP_ENABLE_STUN, checkBox_enableStun); registerField(FIELD_SIP_STUN_SERVER, lineEdit_StunServer); QFormLayout *layout = new QFormLayout; - layout->addWidget(checkBox_enableStun); - layout->addWidget(label_StunServer); - layout->addWidget(lineEdit_StunServer); + layout->addWidget( checkBox_enableStun ); + layout->addWidget( label_StunServer ); + layout->addWidget( lineEdit_StunServer ); setLayout(layout); - connect(checkBox_enableStun, SIGNAL(toggled(bool)), lineEdit_StunServer, SLOT(setEnabled(bool))); + connect(checkBox_enableStun, SIGNAL(toggled(bool)), lineEdit_StunServer, SLOT(setEnabled(bool))); } diff --git a/kde/src/AkonadiBackend.cpp b/kde/src/AkonadiBackend.cpp index 6620e089bd3fc936bc5b494e641ac4e0af8c9daa..0f96b12a28e335ac2f0503a368c8487a24f8cf55 100644 --- a/kde/src/AkonadiBackend.cpp +++ b/kde/src/AkonadiBackend.cpp @@ -23,7 +23,7 @@ AkonadiBackend::AkonadiBackend(QObject* parent) : ContactBackend(parent) //QTimer::singleShot( 0, this, SLOT( delayedInit() ) ); m_pSession = new Akonadi::Session( "SFLPhone::instance" ); - // fetching all collections containing emails recursively, starting at the root collection + // fetching all collections containing emails recursively, starting at the root collection Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob( Akonadi::Collection::root(), Akonadi::CollectionFetchJob::Recursive, this ); job->fetchScope().setContentMimeTypes( QStringList() << "text/directory" ); connect( job, SIGNAL( collectionsReceived( const Akonadi::Collection::List& ) ), this, SLOT( collectionsReceived( const Akonadi::Collection::List& ) ) ); diff --git a/kde/src/CallView.cpp b/kde/src/CallView.cpp index 70cfae9480793e994982dfe648d26c1d058f7e65..2817b7562deb2955667b312f088d258d2c7575b5 100644 --- a/kde/src/CallView.cpp +++ b/kde/src/CallView.cpp @@ -159,8 +159,8 @@ bool CallView::phoneNumberToCall(QTreeWidgetItem *parent, int index, const QMime bool CallView::contactToCall(QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action) { qDebug() << "contactToCall"; - Q_UNUSED(index) - Q_UNUSED(action) + Q_UNUSED( index ) + Q_UNUSED( action ) QByteArray encodedContact = data->data( MIME_CONTACT ); if (!QString(encodedContact).isEmpty()) { Contact* contact = AkonadiBackend::getInstance()->getContactByUid(encodedContact); @@ -321,7 +321,6 @@ Call* CallView::getCurrentItem() ///Remove a TreeView item and delete it bool CallView::removeItem(Call* item) { - exit(66); if (indexOfTopLevelItem(SFLPhone::model()->getIndex(item)) != -1) {//TODO To remove once safe removeItemWidget(SFLPhone::model()->getIndex(item),0); return true; @@ -533,32 +532,7 @@ void CallView::clearHistory() //SFLPhone::model()->getHistory().clear(); } -// void CallView::conferenceCreatedSignal(const QString& confId) -// { -// addConference(confId); -// } -// -// void CallView::conferenceChangedSignal(const QString& confId, const QString& state) -// { -// qDebug() << "Conf changed signal"; -// conferenceChanged(confId, state); -// } -// -// void CallView::conferenceRemovedSignal(const QString& confId) -// { -// conferenceRemoved(confId); -// } -// -// void CallView::incomingMessageSignal(const QString& accountId, const QString& message) -// { -// Q_UNUSED(accountId) -// Q_UNUSED(message) -// //TODO -// } -// -// void CallView::voiceMailNotifySignal(const QString& accountId, int count) -// { -// Q_UNUSED(accountId) -// Q_UNUSED(count) -// //TODO -// } \ No newline at end of file +///Redirect keypresses to parent +void CallView::keyPressEvent(QKeyEvent* event) { + SFLPhone::app()->view()->keyPressEvent(event); +} diff --git a/kde/src/CallView.h b/kde/src/CallView.h index c291020bc5fe7b610c579a8694a3f64b1c3323d7..cb54f7b95e4f4288d52f08291caee6bdf282a942 100644 --- a/kde/src/CallView.h +++ b/kde/src/CallView.h @@ -27,48 +27,40 @@ typedef CallModel<CallTreeItem*,QTreeWidgetItem*> TreeWidgetCallModel; class CallView : public QTreeWidget/*, public TreeWidgetCallModel*/ { Q_OBJECT public: - CallView(QWidget* parent =0); - bool selectItem(Call* item); - Call* getCurrentItem(); - bool removeItem(Call* item); - QWidget* getWidget(); - void setTitle(QString title); - bool dropMimeData(QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action); - virtual QMimeData* mimeData( const QList<QTreeWidgetItem *> items) const; + CallView ( QWidget* parent = 0 ); + Call* getCurrentItem ( ); + QWidget* getWidget ( ); + void setTitle ( QString title ); + bool selectItem ( Call* item ); + bool removeItem ( Call* item ); + bool dropMimeData ( QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action ); + virtual QMimeData* mimeData ( const QList<QTreeWidgetItem *> items ) const; private: - QTreeWidgetItem* extractItem(QString callId); - QTreeWidgetItem* extractItem(QTreeWidgetItem* item); - CallTreeItem* insertItem(QTreeWidgetItem* item, QTreeWidgetItem* parent=0); - CallTreeItem* insertItem(QTreeWidgetItem* item, Call* parent); - void clearArtefact(QTreeWidgetItem* item); + QTreeWidgetItem* extractItem ( QString callId ); + QTreeWidgetItem* extractItem ( QTreeWidgetItem* item ); + CallTreeItem* insertItem ( QTreeWidgetItem* item, QTreeWidgetItem* parent=0 ); + CallTreeItem* insertItem ( QTreeWidgetItem* item, Call* parent ); + void clearArtefact ( QTreeWidgetItem* item ); protected: - void dragEnterEvent(QDragEnterEvent *e) { e->accept(); } - void dragMoveEvent(QDragMoveEvent *e) { e->accept(); } - bool callToCall(QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action); - bool phoneNumberToCall(QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action); - bool contactToCall(QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action); + void dragEnterEvent( QDragEnterEvent *e) { e->accept(); } + void dragMoveEvent ( QDragMoveEvent *e) { e->accept(); } + bool callToCall ( QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action ); + bool phoneNumberToCall ( QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action ); + bool contactToCall ( QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action ); public slots: - void destroyCall(Call* toDestroy); - void itemDoubleClicked(QTreeWidgetItem* item, int column); - void itemClicked(QTreeWidgetItem* item, int column); - Call* addCall(Call* call, Call* parent =0); - Call* addConference(Call* conf); - bool conferenceChanged(Call* conf); - void conferenceRemoved(Call* conf); - //D-Bus handling -// void callStateChangedSignal(const QString& callId, const QString& state); -// void incomingCallSignal(const QString& accountId, const QString& callId); - -// void conferenceCreatedSignal(const QString& confId); -// void conferenceChangedSignal(const QString& confId, const QString& state); -// void conferenceRemovedSignal(const QString& confId); - -// void incomingMessageSignal(const QString& accountId, const QString& message); -// void voiceMailNotifySignal(const QString& accountId, int count); - + void destroyCall ( Call* toDestroy); + void itemDoubleClicked ( QTreeWidgetItem* item, int column ); + void itemClicked ( QTreeWidgetItem* item, int column ); + Call* addCall ( Call* call, Call* parent =0 ); + Call* addConference ( Call* conf ); + bool conferenceChanged ( Call* conf ); + void conferenceRemoved ( Call* conf ); + + virtual void keyPressEvent(QKeyEvent* event); + public slots: void clearHistory(); diff --git a/kde/src/Codec.cpp b/kde/src/Codec.cpp index 7ba23343dc51b43ae26934e603a6aa20e0eee9c4..1fa741fe92d353bed3da311aca76b9810dac77b4 100755 --- a/kde/src/Codec.cpp +++ b/kde/src/Codec.cpp @@ -17,79 +17,92 @@ * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ + **************************************************************************/ #include "Codec.h" #include "lib/configurationmanager_interface_singleton.h" #include "lib/sflphone_const.h" +///Constructor Codec::Codec(int payload, bool enabled) { ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); QStringList details = configurationManager.getAudioCodecDetails(payload); - this->payload = QString::number(payload); - this->enabled = enabled; - this->name = details[CODEC_NAME]; + this->payload = QString::number(payload); + this->enabled = enabled; + this->name = details[CODEC_NAME]; this->frequency = details[CODEC_SAMPLE_RATE]; - this->bitrate = details[CODEC_BIT_RATE]; + this->bitrate = details[CODEC_BIT_RATE]; this->bandwidth = details[CODEC_BANDWIDTH]; } +///Return the payload QString Codec::getPayload() const { return payload; } +///Return the codec name QString Codec::getName() const { return name; } +///Return the frequency QString Codec::getFrequency() const { return frequency; } +///Return the bitrate QString Codec::getBitrate() const { return bitrate; } +///Return the bandwidth QString Codec::getBandwidth() const { return bandwidth; } +///Is this codec enabled bool Codec::isEnabled() const { return enabled; } +///Set the payload void Codec::setPayload(QString payload) { this->payload = payload; } +///Set the codec name void Codec::setName(QString name) { this->name = name; } +///Set the frequency void Codec::setFrequency(QString frequency) { this->frequency = frequency; } +///Set the bitrate void Codec::setBitrate(QString bitrate) { this->bitrate = bitrate; } +///Set the bandwidth void Codec::setBandwidth(QString bandwidth) { this->bandwidth = bandwidth; } +///Make this cedec enabled void Codec::setEnabled(bool enabled) { this->enabled = enabled; diff --git a/kde/src/Codec.h b/kde/src/Codec.h index 4bb408d67ff119ebb29d8eda512735c09e1e7c47..e4340f7473f5eca2f82b74e9125164c42f977a70 100755 --- a/kde/src/Codec.h +++ b/kde/src/Codec.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ + **************************************************************************/ #ifndef CODEC_H #define CODEC_H @@ -31,36 +31,31 @@ class Codec : public QObject { Q_OBJECT private: - QString payload; - QString name; - QString frequency; - QString bitrate; - QString bandwidth; + QString payload ; + QString name ; + QString frequency ; + QString bitrate ; + QString bandwidth ; bool enabled; public: Codec(int payload, bool enabled); -// Codec(const Codec & codec); - -// ~Codec(); - QString getPayload() const; - QString getName() const; - QString getFrequency() const; - QString getBitrate() const; - QString getBandwidth() const; - bool isEnabled() const; + QString getPayload () const; + QString getName () const; + QString getFrequency () const; + QString getBitrate () const; + QString getBandwidth () const; + bool isEnabled () const; - void setPayload(QString payload); - void setName(QString name); - void setFrequency(QString frequency); - void setBitrate(QString bitrate); - void setBandwidth(QString bandwidth); - void setEnabled(bool enabled); + void setPayload ( QString payload ); + void setName ( QString name ); + void setFrequency ( QString frequency ); + void setBitrate ( QString bitrate ); + void setBandwidth ( QString bandwidth ); + void setEnabled ( bool enabled ); Codec & operator=(const Codec&); - - }; #endif diff --git a/kde/src/SFLPhone.cpp b/kde/src/SFLPhone.cpp index 71ccc5eef9de5ad35343f819bc68b1797c5904ab..d179411252c9b0e187dbd5f58ff1f42cd08ec566 100755 --- a/kde/src/SFLPhone.cpp +++ b/kde/src/SFLPhone.cpp @@ -86,7 +86,7 @@ BookmarkDock* SFLPhone::bookmarkDock() SFLPhone::~SFLPhone() { - saveState(); + //saveState(); } bool SFLPhone::initialize() @@ -112,6 +112,7 @@ bool SFLPhone::initialize() // tell the KXmlGuiWindow that this is indeed the main widget //setCentralWidget(m_pView); m_pCentralDW = new QDockWidget(this); + m_pCentralDW->setObjectName("callDock"); m_pCentralDW->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); m_pCentralDW->setWidget(m_pView); m_pCentralDW->setWindowTitle("Call"); @@ -133,11 +134,10 @@ bool SFLPhone::initialize() addDockWidget(Qt::TopDockWidgetArea,m_pCentralDW); - m_pHistoryDW = new HistoryDock(this); - addDockWidget(Qt::TopDockWidgetArea,m_pHistoryDW); m_pBookmarkDW = new BookmarkDock(this); - addDockWidget(Qt::TopDockWidgetArea,m_pBookmarkDW); + addDockWidget( Qt::TopDockWidgetArea,m_pHistoryDW ); + addDockWidget( Qt::TopDockWidgetArea,m_pBookmarkDW ); tabifyDockWidget(m_pBookmarkDW,m_pHistoryDW); setWindowIcon(QIcon(ICON_SFLPHONE)); @@ -174,9 +174,9 @@ bool SFLPhone::initialize() void SFLPhone::setObjectNames() { - m_pView->setObjectName("m_pView"); - statusBar()->setObjectName("statusBar"); - trayIcon->setObjectName("trayIcon"); + m_pView->setObjectName ( "m_pView" ); + statusBar()->setObjectName ( "statusBar" ); + trayIcon->setObjectName ( "trayIcon" ); } void SFLPhone::setupActions() @@ -200,6 +200,7 @@ void SFLPhone::setupActions() action_screen = new QActionGroup(this); action_screen->setExclusive(true); + action_main = new KAction(KIcon(QIcon(ICON_SCREEN_MAIN)), i18n("Main screen"), action_screen); action_main->setCheckable(true); action_main->setChecked(true); @@ -211,13 +212,14 @@ void SFLPhone::setupActions() action_configureSflPhone = KStandardAction::preferences(m_pView, SLOT(configureSflPhone()), this); action_configureSflPhone->setText(i18n("Configure SFLphone")); - action_displayVolumeControls = new KAction(KIcon(QIcon(ICON_DISPLAY_VOLUME_CONSTROLS)), i18n("Display volume controls"), this); action_displayDialpad = new KAction(KIcon(QIcon(ICON_DISPLAY_DIALPAD)), i18n("Display dialpad"), this); action_displayDialpad->setCheckable(true); + action_displayDialpad->setChecked(ConfigurationSkeleton::displayDialpad()); + action_displayVolumeControls = new KAction(KIcon(QIcon(ICON_DISPLAY_VOLUME_CONSTROLS)), i18n("Display volume controls"), this); action_displayVolumeControls->setCheckable(true); action_displayVolumeControls->setChecked(ConfigurationSkeleton::displayVolume()); - action_displayDialpad->setChecked(ConfigurationSkeleton::displayDialpad()); + action_accountCreationWizard = new KAction(i18n("Account creation wizard"), this); connect(action_accept, SIGNAL(triggered()), m_pView , SLOT(accept() )); @@ -247,25 +249,8 @@ void SFLPhone::setupActions() actionCollection()->addAction("action_configureSflPhone" , action_configureSflPhone ); actionCollection()->addAction("action_accountCreationWizard" , action_accountCreationWizard ); - QString rcFilePath = QString(DATA_INSTALL_DIR) + "/sflphone-client-kde/sflphone-client-kdeui.rc"; - - if(! QFile::exists(rcFilePath)) { - QDir dir; - dir.cdUp(); - dir.cd("data"); - rcFilePath = dir.filePath("sflphone-client-kdeui.rc"); - qDebug() << "rcFilePath = " << rcFilePath ; - - if(! QFile::exists(rcFilePath)) { - QDir dir; - dir.cdUp(); - dir.cdUp(); - dir.cd("data"); - rcFilePath = dir.filePath("sflphone-client-kdeui.rc"); - } - } - qDebug() << "rcFilePath = " << rcFilePath ; - createGUI(rcFilePath); + setAutoSaveSettings(); + createGUI(); } @@ -283,12 +268,6 @@ bool SFLPhone::queryClose() void SFLPhone::quitButton() { - - //qDebug() << "quitButton : " << m_pView->callTree->count() << " calls open."; - - //if(m_pView->callTree->count() > 0 && instance.getRegistrationCount() <= 1) { - //qDebug() << "Attempting to quit when still having some calls open."; - //} m_pView->saveState(); qApp->quit(); } diff --git a/kde/src/SFLPhone.h b/kde/src/SFLPhone.h index 42f1d07d0ae923dd7afd61d5290cc1cca0d6451b..e84d0fae874f20a76e5443ebafcb2ca2fe77fa39 100755 --- a/kde/src/SFLPhone.h +++ b/kde/src/SFLPhone.h @@ -69,42 +69,44 @@ Q_OBJECT public: enum CallAction { - Accept, - Refuse, - Hold, - Transfer, - Record, - Mailbox, - NumberOfCallActions}; + Accept , + Refuse , + Hold , + Transfer , + Record , + Mailbox , + NumberOfCallActions +}; private: // Whether or not the object has been initialized bool initialized_; - KAction * action_accept; - KAction * action_refuse; - KAction * action_hold; - KAction * action_transfer; - KAction * action_record; - KAction * action_main; - KAction * action_mailBox; - KAction * action_close; - KAction * action_quit; - KAction * action_displayVolumeControls; - KAction * action_displayDialpad; - KAction * action_configureSflPhone; - KAction * action_accountCreationWizard; + KAction* action_accept ; + KAction* action_refuse ; + KAction* action_hold ; + KAction* action_transfer ; + KAction* action_record ; + KAction* action_main ; + KAction* action_mailBox ; + KAction* action_close ; + KAction* action_quit ; + KAction* action_displayVolumeControls ; + KAction* action_displayDialpad ; + KAction* action_configureSflPhone ; + KAction* action_accountCreationWizard ; + QActionGroup * action_screen; - SFLPhoneView * m_pView; - QMenu *trayIconMenu; - bool iconChanged; - SFLPhoneTray *trayIcon; - KNotification *notification; - QLabel* statusBarWidget; - ContactDock* m_pContactCD; - QDockWidget* m_pCentralDW; - HistoryDock* m_pHistoryDW; - BookmarkDock* m_pBookmarkDW; + SFLPhoneView* m_pView ; + QMenu* trayIconMenu ; + bool iconChanged ; + SFLPhoneTray* trayIcon ; + KNotification* notification ; + QLabel* statusBarWidget ; + ContactDock* m_pContactCD ; + QDockWidget* m_pCentralDW ; + HistoryDock* m_pHistoryDW ; + BookmarkDock* m_pBookmarkDW ; static SFLPhone* m_sApp; static TreeWidgetCallModel* m_pModel; @@ -118,33 +120,33 @@ protected: public: SFLPhone(QWidget *parent = 0); - ~SFLPhone(); - bool initialize(); - void setupActions(); - void trayIconSignal(); - SFLPhoneView * getView(); - QList<QAction *> getCallActions(); + ~SFLPhone (); + bool initialize (); + void setupActions (); + void trayIconSignal (); + SFLPhoneView* getView (); + QList<QAction *> getCallActions (); friend class SFLPhoneView; - static SFLPhone* app(); - SFLPhoneView* view(); - static TreeWidgetCallModel* model(); + static SFLPhone* app (); + static TreeWidgetCallModel* model (); + SFLPhoneView* view (); ContactDock* contactDock(); HistoryDock* historyDock(); BookmarkDock* bookmarkDock(); private slots: - void on_m_pView_statusMessageChangeAsked(const QString & message); - void on_m_pView_windowTitleChangeAsked(const QString & message); - void on_m_pView_enabledActionsChangeAsked(const bool * enabledActions); - void on_m_pView_actionIconsChangeAsked(const QString * actionIcons); - void on_m_pView_actionTextsChangeAsked(const QString * actionTexts); - void on_m_pView_transferCheckStateChangeAsked(bool transferCheckState); - void on_m_pView_recordCheckStateChangeAsked(bool recordCheckState); - void on_m_pView_screenChanged(int screen); - void on_m_pView_incomingCall(const Call * call); + void on_m_pView_statusMessageChangeAsked ( const QString& message ); + void on_m_pView_windowTitleChangeAsked ( const QString& message ); + void on_m_pView_enabledActionsChangeAsked ( const bool* enabledActions ); + void on_m_pView_actionIconsChangeAsked ( const QString* actionIcons ); + void on_m_pView_actionTextsChangeAsked ( const QString* actionTexts ); + void on_m_pView_transferCheckStateChangeAsked ( bool transferCheckState ); + void on_m_pView_recordCheckStateChangeAsked ( bool recordCheckState ); + void on_m_pView_screenChanged ( int screen ); + void on_m_pView_incomingCall ( const Call * call ); void updateScreen(QAction * action); diff --git a/kde/src/SFLPhoneView.cpp b/kde/src/SFLPhoneView.cpp index fe1e0963306ddd9004d378823e75074689e982ce..e4554b857a6ea867c11416dd5ae8d4269ec1e304 100755 --- a/kde/src/SFLPhoneView.cpp +++ b/kde/src/SFLPhoneView.cpp @@ -61,7 +61,6 @@ SFLPhoneView::SFLPhoneView(QWidget *parent) setupUi(this); ConfigurationManagerInterface& configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); - //CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance(); errorWindow = new QErrorMessage(this); callTreeModel->setTitle("Calls"); @@ -70,35 +69,13 @@ SFLPhoneView::SFLPhoneView(QWidget *parent) pal.setColor(QPalette::AlternateBase, Qt::lightGray); setPalette(pal); - //BEGIN Port to CallModel - connect(SFLPhone::model(), SIGNAL(incomingCall(Call*)), - this, SLOT(on1_incomingCall(Call*))); - connect(SFLPhone::model(), SIGNAL(voiceMailNotify(const QString &, int)), - this, SLOT(on1_voiceMailNotify(const QString &, int))); - connect(SFLPhone::model(), SIGNAL(volumeChanged(const QString &, double)), - this, SLOT(on1_volumeChanged(const QString &, double))); - connect(SFLPhone::model(), SIGNAL(callStateChanged(Call*)), - this, SLOT(updateWindowCallState())); - /*connect(&callManager, SIGNAL(callStateChanged(const QString &, const QString &)), - this, SLOT(on1_callStateChanged(const QString &, const QString &))); - - connect(&callManager, SIGNAL(conferenceCreated(const QString &)), - this, SLOT(on1_incomingConference(const QString &))); - connect(&callManager, SIGNAL(conferenceChanged(const QString &, const QString &)), - this, SLOT(on1_changingConference(const QString &, const QString &))); - connect(&callManager, SIGNAL(conferenceRemoved(const QString &)), - this, SLOT(on1_conferenceRemoved(const QString &)));*/ - //END Port to Call Model - - //connect(configDialog, SIGNAL(changesApplied()), - //this, SLOT(loadWindow())); - - connect(TreeWidgetCallModel::getAccountList(), SIGNAL(accountListUpdated()), - this, SLOT(updateStatusMessage())); - connect(TreeWidgetCallModel::getAccountList(), SIGNAL(accountListUpdated()), - this, SLOT(updateWindowCallState())); - connect(&configurationManager, SIGNAL(accountsChanged()), - TreeWidgetCallModel::getAccountList(), SLOT(updateAccounts())); + connect(SFLPhone::model() , SIGNAL(incomingCall(Call*)) , this , SLOT(on1_incomingCall(Call*) )); + connect(SFLPhone::model() , SIGNAL(voiceMailNotify(const QString &, int)) , this , SLOT(on1_voiceMailNotify(const QString &, int) )); + connect(SFLPhone::model() , SIGNAL(volumeChanged(const QString &, double)), this , SLOT(on1_volumeChanged(const QString &, double) )); + connect(SFLPhone::model() , SIGNAL(callStateChanged(Call*)) , this , SLOT(updateWindowCallState() )); + connect(TreeWidgetCallModel::getAccountList() , SIGNAL(accountListUpdated()) , this , SLOT(updateStatusMessage() )); + connect(TreeWidgetCallModel::getAccountList() , SIGNAL(accountListUpdated()) , this , SLOT(updateWindowCallState() )); + connect(&configurationManager , SIGNAL(accountsChanged()) , TreeWidgetCallModel::getAccountList() , SLOT(updateAccounts() )); TreeWidgetCallModel::getAccountList()->updateAccounts(); } @@ -117,14 +94,14 @@ void SFLPhoneView::saveState() void SFLPhoneView::loadWindow() { - updateWindowCallState(); - updateRecordButton(); - updateVolumeButton(); - updateRecordBar(); - updateVolumeBar(); - updateVolumeControls(); - updateDialpad(); - updateStatusMessage(); + updateWindowCallState (); + updateRecordButton (); + updateVolumeButton (); + updateRecordBar (); + updateVolumeBar (); + updateVolumeControls (); + updateDialpad (); + updateStatusMessage (); } QErrorMessage * SFLPhoneView::getErrorWindow() @@ -184,11 +161,6 @@ void SFLPhoneView::backspace() if(call->getState() == CALL_STATE_OVER) { if (callTreeModel->getCurrentItem()) callTreeModel->removeItem(callTreeModel->getCurrentItem()); - -// if(call->getHistoryState() != NONE) { -// //historyTree->insert(call); -// historyTreeModel->addCall(call); -// } } } } @@ -196,10 +168,9 @@ void SFLPhoneView::backspace() void SFLPhoneView::escape() { qDebug() << "escape"; - qDebug() << "In call list."; Call* call = callTreeModel->getCurrentItem(); if(!call) { - //qDebug() << "Escape when no item is selected. Doing nothing."; + qDebug() << "Escape when no item is selected. Doing nothing."; } else { if(call->getState() == CALL_STATE_TRANSFER || call->getState() == CALL_STATE_TRANSF_HOLD) { @@ -214,7 +185,6 @@ void SFLPhoneView::escape() void SFLPhoneView::enter() { qDebug() << "enter"; - qDebug() << "In call list."; Call* call = callTreeModel->getCurrentItem(); if(!call) { qDebug() << "Error : Enter on unexisting call."; @@ -269,96 +239,86 @@ void SFLPhoneView::updateWindowCallState() call = callTreeModel->getCurrentItem(); if (!call) { qDebug() << "No item selected."; - enabledActions[SFLPhone::Refuse] = false; - enabledActions[SFLPhone::Hold] = false; - enabledActions[SFLPhone::Transfer] = false; - enabledActions[SFLPhone::Record] = false; + enabledActions[ SFLPhone::Refuse ] = false; + enabledActions[ SFLPhone::Hold ] = false; + enabledActions[ SFLPhone::Transfer ] = false; + enabledActions[ SFLPhone::Record ] = false; } else { call_state state = call->getState(); recordActivated = call->getRecording(); - qDebug() << "State" << state << "call" << call; + qDebug() << "Reached State" << state << " with call" << call->getCallId(); switch (state) { case CALL_STATE_INCOMING: - qDebug() << "Reached CALL_STATE_INCOMING with call " << call->getCallId(); - buttonIconFiles[SFLPhone::Accept] = ICON_ACCEPT; - buttonIconFiles[SFLPhone::Refuse] = ICON_REFUSE; - actionTexts[SFLPhone::Accept] = ACTION_LABEL_ACCEPT; - actionTexts[SFLPhone::Refuse] = ACTION_LABEL_REFUSE; + buttonIconFiles [ SFLPhone::Accept ] = ICON_ACCEPT ; + buttonIconFiles [ SFLPhone::Refuse ] = ICON_REFUSE ; + actionTexts [ SFLPhone::Accept ] = ACTION_LABEL_ACCEPT ; + actionTexts [ SFLPhone::Refuse ] = ACTION_LABEL_REFUSE ; break; case CALL_STATE_RINGING: - qDebug() << "Reached CALL_STATE_RINGING with call " << call->getCallId(); - enabledActions[SFLPhone::Hold] = false; - enabledActions[SFLPhone::Transfer] = false; + enabledActions [ SFLPhone::Hold ] = false ; + enabledActions [ SFLPhone::Transfer ] = false ; break; case CALL_STATE_CURRENT: - qDebug() << "details = " << CallManagerInterfaceSingleton::getInstance().getCallDetails(call->getCallId()).value(); - qDebug() << "Reached CALL_STATE_CURRENT with call " << call->getCallId(); - buttonIconFiles[SFLPhone::Record] = ICON_REC_DEL_ON; + buttonIconFiles [ SFLPhone::Record ] = ICON_REC_DEL_ON ; break; case CALL_STATE_DIALING: - qDebug() << "Reached CALL_STATE_DIALING with call " << call->getCallId(); - enabledActions[SFLPhone::Hold] = false; - enabledActions[SFLPhone::Transfer] = false; - enabledActions[SFLPhone::Record] = false; - actionTexts[SFLPhone::Accept] = ACTION_LABEL_ACCEPT; - buttonIconFiles[SFLPhone::Accept] = ICON_ACCEPT; + enabledActions [ SFLPhone::Hold ] = false ; + enabledActions [ SFLPhone::Transfer ] = false ; + enabledActions [ SFLPhone::Record ] = false ; + actionTexts [ SFLPhone::Accept ] = ACTION_LABEL_ACCEPT ; + buttonIconFiles [ SFLPhone::Accept ] = ICON_ACCEPT ; break; case CALL_STATE_HOLD: - qDebug() << "Reached CALL_STATE_HOLD with call " << call->getCallId(); - buttonIconFiles[SFLPhone::Hold] = ICON_UNHOLD; - actionTexts[SFLPhone::Hold] = ACTION_LABEL_UNHOLD; + buttonIconFiles [ SFLPhone::Hold ] = ICON_UNHOLD ; + actionTexts [ SFLPhone::Hold ] = ACTION_LABEL_UNHOLD ; break; case CALL_STATE_FAILURE: - qDebug() << "Reached CALL_STATE_FAILURE with call " << call->getCallId(); - enabledActions[SFLPhone::Accept] = false; - enabledActions[SFLPhone::Hold] = false; - enabledActions[SFLPhone::Transfer] = false; - enabledActions[SFLPhone::Record] = false; + enabledActions [ SFLPhone::Accept ] = false ; + enabledActions [ SFLPhone::Hold ] = false ; + enabledActions [ SFLPhone::Transfer ] = false ; + enabledActions [ SFLPhone::Record ] = false ; break; case CALL_STATE_BUSY: - qDebug() << "Reached CALL_STATE_BUSY with call " << call->getCallId(); - enabledActions[SFLPhone::Accept] = false; - enabledActions[SFLPhone::Hold] = false; - enabledActions[SFLPhone::Transfer] = false; - enabledActions[SFLPhone::Record] = false; + enabledActions [ SFLPhone::Accept ] = false ; + enabledActions [ SFLPhone::Hold ] = false ; + enabledActions [ SFLPhone::Transfer ] = false ; + enabledActions [ SFLPhone::Record ] = false ; break; case CALL_STATE_TRANSFER: - qDebug() << "Reached CALL_STATE_TRANSFER with call " << call->getCallId(); - buttonIconFiles[SFLPhone::Accept] = ICON_EXEC_TRANSF; - actionTexts[SFLPhone::Transfer] = ACTION_LABEL_GIVE_UP_TRANSF; + buttonIconFiles [ SFLPhone::Accept ] = ICON_EXEC_TRANSF ; + actionTexts [ SFLPhone::Transfer ] = ACTION_LABEL_GIVE_UP_TRANSF ; + buttonIconFiles [ SFLPhone::Record ] = ICON_REC_DEL_ON ; transfer = true; - buttonIconFiles[SFLPhone::Record] = ICON_REC_DEL_ON; break; case CALL_STATE_TRANSF_HOLD: - qDebug() << "Reached CALL_STATE_TRANSF_HOLD with call " << call->getCallId(); - buttonIconFiles[SFLPhone::Accept] = ICON_EXEC_TRANSF; - buttonIconFiles[SFLPhone::Hold] = ICON_UNHOLD; - actionTexts[SFLPhone::Transfer] = ACTION_LABEL_GIVE_UP_TRANSF; - actionTexts[SFLPhone::Hold] = ACTION_LABEL_UNHOLD; + buttonIconFiles [ SFLPhone::Accept ] = ICON_EXEC_TRANSF ; + buttonIconFiles [ SFLPhone::Hold ] = ICON_UNHOLD ; + actionTexts [ SFLPhone::Transfer ] = ACTION_LABEL_GIVE_UP_TRANSF ; + actionTexts [ SFLPhone::Hold ] = ACTION_LABEL_UNHOLD ; transfer = true; break; case CALL_STATE_OVER: - qDebug() << "Error : Reached CALL_STATE_OVER with call " << call->getCallId() << "!"; + qDebug() << "Error : Reached CALL_STATE_OVER with call " << call->getCallId() << "!"; break; case CALL_STATE_ERROR: qDebug() << "Error : Reached CALL_STATE_ERROR with call " << call->getCallId() << "!"; break; default: - qDebug() << "Error : Reached unexisting state for call " << call->getCallId() << "!"; + qDebug() << "Error : Reached unexisting state for call " << call->getCallId() << "!"; break; } } qDebug() << "Updating Window."; - emit enabledActionsChangeAsked(enabledActions); - emit actionIconsChangeAsked(buttonIconFiles); - emit actionTextsChangeAsked(actionTexts); - emit transferCheckStateChangeAsked(transfer); - emit recordCheckStateChangeAsked(recordActivated); + emit enabledActionsChangeAsked ( enabledActions ); + emit actionIconsChangeAsked ( buttonIconFiles ); + emit actionTextsChangeAsked ( actionTexts ); + emit transferCheckStateChangeAsked ( transfer ); + emit recordCheckStateChangeAsked ( recordActivated ); qDebug() << "Window updated."; } @@ -475,10 +435,10 @@ void SFLPhoneView::updateVolumeControls() SFLPhone::app()->action_displayVolumeControls->setChecked(display); //widget_recVol->setVisible(display); //widget_sndVol->setVisible(display); - toolButton_recVol->setVisible(display && ConfigurationSkeleton::displayVolume()); - toolButton_sndVol->setVisible(display && ConfigurationSkeleton::displayVolume()); - slider_recVol->setVisible(display && ConfigurationSkeleton::displayVolume()); - slider_sndVol->setVisible(display && ConfigurationSkeleton::displayVolume()); + toolButton_recVol->setVisible ( display && ConfigurationSkeleton::displayVolume() ); + toolButton_sndVol->setVisible ( display && ConfigurationSkeleton::displayVolume() ); + slider_recVol->setVisible ( display && ConfigurationSkeleton::displayVolume() ); + slider_sndVol->setVisible ( display && ConfigurationSkeleton::displayVolume() ); } @@ -621,26 +581,25 @@ void SFLPhoneView::contextMenuEvent(QContextMenuEvent *event) SFLPhone * window = SFLPhone::app(); QList<QAction *> callActions = window->getCallActions(); - menu.addAction(callActions.at((int) SFLPhone::Accept)); - menu.addAction(callActions[SFLPhone::Refuse]); - menu.addAction(callActions[SFLPhone::Hold]); - menu.addAction(callActions[SFLPhone::Transfer]); - menu.addAction(callActions[SFLPhone::Record]); + + menu.addAction ( callActions.at((int) SFLPhone::Accept) ); + menu.addAction ( callActions[ SFLPhone::Refuse ] ); + menu.addAction ( callActions[ SFLPhone::Hold ] ); + menu.addAction ( callActions[ SFLPhone::Transfer ] ); + menu.addAction ( callActions[ SFLPhone::Record ] ); menu.addSeparator(); - QAction * action = new ActionSetAccountFirst(NULL, &menu); + QAction* action = new ActionSetAccountFirst(NULL, &menu); action->setChecked(SFLPhone::model()->getPriorAccoundId().isEmpty()); - connect(action, SIGNAL(setFirst(Account *)), - this , SLOT(setAccountFirst(Account *))); + connect(action, SIGNAL(setFirst(Account *)), this , SLOT(setAccountFirst(Account *))); menu.addAction(action); QVector<Account *> accounts = SFLPhone::model()->getAccountList()->registeredAccounts(); for (int i = 0 ; i < accounts.size() ; i++) { - Account * account = accounts.at(i); - QAction * action = new ActionSetAccountFirst(account, &menu); + Account* account = accounts.at(i); + QAction* action = new ActionSetAccountFirst(account, &menu); action->setChecked(account->getAccountId() == SFLPhone::model()->getPriorAccoundId()); - connect(action, SIGNAL(setFirst(Account *)), - this , SLOT(setAccountFirst(Account *))); + connect(action, SIGNAL(setFirst(Account *)), this , SLOT(setAccountFirst(Account *))); menu.addAction(action); } menu.exec(event->globalPos()); @@ -785,9 +744,9 @@ void SFLPhoneView::on1_incomingCall(Call* call) //NEED_PORT changeScreen(SCREEN_MAIN); - SFLPhone::app()->activateWindow(); - SFLPhone::app()->raise(); - SFLPhone::app()->setVisible(true); + SFLPhone::app()->activateWindow ( ); + SFLPhone::app()->raise ( ); + SFLPhone::app()->setVisible ( true ); emit incomingCall(call); } diff --git a/kde/src/SFLPhoneView.h b/kde/src/SFLPhoneView.h index e60407049bb4abff96b4a64c88fee156494577ae..4d5aef5439364926721bd4d6528e3794cddb1ec2 100755 --- a/kde/src/SFLPhoneView.h +++ b/kde/src/SFLPhoneView.h @@ -192,12 +192,12 @@ private slots: * text searched. * If empty, hide the search bar. */ - void updateRecordButton(); - void updateVolumeButton(); - void updateRecordBar(); - void updateVolumeBar(); - void updateVolumeControls(); - void updateDialpad(); + void updateRecordButton (); + void updateVolumeButton (); + void updateRecordBar (); + void updateVolumeBar (); + void updateVolumeControls (); + void updateDialpad (); public slots: @@ -223,7 +223,7 @@ public slots: else { QString text = event->text(); - if(! event->text().isEmpty()) + if(! text.isEmpty()) { typeString(text); } @@ -234,12 +234,12 @@ public slots: void displayDialpad(bool checked = true); void configureSflPhone(); void accountCreationWizard(); - void accept(); - void refuse(); - void hold(); - void transfer(); - void record(); - void mailBox(); + void accept (); + void refuse (); + void hold (); + void transfer (); + void record (); + void mailBox (); void on_widget_dialpad_typed(QString text); @@ -249,31 +249,21 @@ public slots: void on_toolButton_recVol_clicked(bool checked); void on_toolButton_sndVol_clicked(bool checked); - //void on_callTree_currentItemChanged(); - //void on_callTree_itemChanged(); - //void on_callTree_itemDoubleClicked(QTreeWidgetItem* item, int column); - -// void on1_callStateChanged(const QString &callID, const QString &state); void on1_error(MapStringString details); void on1_incomingCall(Call* call); - //void on1_incomingMessage(const QString &accountID, const QString &message); void on1_voiceMailNotify(const QString &accountID, int count); void on1_volumeChanged(const QString &device, double value); - //void on1_audioManagerChanged(); -// void on1_incomingConference(const QString &confID); -// void on1_changingConference(const QString &confID, const QString &state); -// void on1_conferenceRemoved(const QString &confId); void changeScreen(int screen); signals: - void statusMessageChangeAsked(const QString & message); - void windowTitleChangeAsked(const QString & title); - void enabledActionsChangeAsked(const bool * enabledActions); - void actionIconsChangeAsked(const QString * actionIcons); - void actionTextsChangeAsked(const QString * actionTexts); - void transferCheckStateChangeAsked(bool transferCheckState); - void recordCheckStateChangeAsked(bool recordCheckState); - void addressBookEnableAsked(bool enableAddressBook); + void statusMessageChangeAsked ( const QString& message ); + void windowTitleChangeAsked ( const QString& title ); + void enabledActionsChangeAsked ( const bool* enabledActions ); + void actionIconsChangeAsked ( const QString* actionIcons ); + void actionTextsChangeAsked ( const QString* actionTexts ); + void transferCheckStateChangeAsked ( bool transferCheckState ); + void recordCheckStateChangeAsked ( bool recordCheckState ); + void addressBookEnableAsked ( bool enableAddressBook ); void screenChanged(int screen); void incomingCall(const Call * call); diff --git a/kde/src/conf/dlgaccounts.cpp b/kde/src/conf/dlgaccounts.cpp index d7ce422edc10a33cbc20965b6902cf0b760a1f9b..f052871981666a07296b1a1c797c66a2673d6625 100755 --- a/kde/src/conf/dlgaccounts.cpp +++ b/kde/src/conf/dlgaccounts.cpp @@ -33,7 +33,7 @@ DlgAccounts::DlgAccounts(KConfigDialog* parent) : QWidget(parent) { setupUi(this); - + disconnect(keditlistbox_codec->addButton(),SIGNAL(clicked())); ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); button_accountUp->setIcon (KIcon("go-up") ); button_accountDown->setIcon (KIcon("go-down") ); @@ -45,47 +45,50 @@ DlgAccounts::DlgAccounts(KConfigDialog* parent) accountListHasChanged = false; //toolButton_accountsApply->setEnabled(false); + QRadioButton* rbloc = radioButton_pa_same_as_local; + QRadioButton* rbcus = radioButton_pa_custom; + //SLOTS - // SENDER SIGNAL RECEIVER SLOT / - /**/connect(edit1_alias, SIGNAL(textEdited(const QString &)) , this , SLOT(changedAccountList() )); - /**/connect(edit2_protocol, SIGNAL(activated(int)) , this , SLOT(changedAccountList() )); - /**/connect(edit3_server, SIGNAL(textEdited(const QString &)) , this , SLOT(changedAccountList() )); - /**/connect(edit4_user, SIGNAL(textEdited(const QString &)) , this , SLOT(changedAccountList() )); - /**/connect(edit5_password, SIGNAL(textEdited(const QString &)) , this , SLOT(changedAccountList() )); - /**/connect(edit6_mailbox, SIGNAL(textEdited(const QString &)) , this , SLOT(changedAccountList() )); - /**/connect(spinbox_regExpire, SIGNAL(editingFinished()) , this , SLOT(changedAccountList() )); - /**/connect(comboBox_ni_local_address, SIGNAL(currentIndexChanged (int)) , this , SLOT(changedAccountList() )); - /**/connect(checkBox_conformRFC, SIGNAL(clicked(bool)) , this , SLOT(changedAccountList() )); - /**/connect(button_accountUp, SIGNAL(clicked()) , this , SLOT(changedAccountList() )); - /**/connect(button_accountDown, SIGNAL(clicked()) , this , SLOT(changedAccountList() )); - /**/connect(button_accountAdd, SIGNAL(clicked()) , this , SLOT(changedAccountList() )); - /**/connect(button_accountRemove, SIGNAL(clicked()) , this , SLOT(changedAccountList() )); - /**/connect(edit_tls_private_key_password, SIGNAL(textEdited(const QString &)) , this , SLOT(changedAccountList() )); - /**/connect(spinbox_tls_listener, SIGNAL(editingFinished()) , this , SLOT(changedAccountList() )); - /**/connect(file_tls_authority, SIGNAL(textChanged(const QString &)), this , SLOT(changedAccountList() )); - /**/connect(file_tls_endpoint, SIGNAL(textChanged(const QString &)), this , SLOT(changedAccountList() )); - /**/connect(file_tls_private_key, SIGNAL(textChanged(const QString &)), this , SLOT(changedAccountList() )); - /**/connect(combo_tls_method, SIGNAL(currentIndexChanged(int)) , this , SLOT(changedAccountList() )); - /**/connect(edit_tls_cipher, SIGNAL(textEdited(const QString &)) , this , SLOT(changedAccountList() )); - /**/connect(edit_tls_outgoing, SIGNAL(textEdited(const QString &)) , this , SLOT(changedAccountList() )); - /**/connect(spinbox_tls_timeout_sec, SIGNAL(editingFinished()) , this , SLOT(changedAccountList() )); - /**/connect(spinbox_tls_timeout_msec, SIGNAL(editingFinished()) , this , SLOT(changedAccountList() )); - /**/connect(check_tls_incoming, SIGNAL(clicked(bool)) , this , SLOT(changedAccountList() )); - /**/connect(check_tls_answer, SIGNAL(clicked(bool)) , this , SLOT(changedAccountList() )); - /**/connect(check_tls_requier_cert, SIGNAL(clicked(bool)) , this , SLOT(changedAccountList() )); - /**/connect(group_security_tls, SIGNAL(clicked(bool)) , this , SLOT(changedAccountList() )); - /**/connect(radioButton_pa_same_as_local, SIGNAL(clicked(bool)) , this , SLOT(changedAccountList() )); - /**/connect(radioButton_pa_custom, SIGNAL(clicked(bool)) , this , SLOT(changedAccountList() )); - /**/connect(&configurationManager, SIGNAL(accountsChanged()) , this , SLOT(updateAccountStates() )); - /**/connect(edit_tls_private_key_password, SIGNAL(textEdited(const QString &)) , this , SLOT(changedAccountList() )); - /**/connect(this, SIGNAL(updateButtons()) , parent , SLOT(updateButtons() )); - /**/connect(keditlistbox_codec->listView(), SIGNAL(clicked(QModelIndex)) , this , SLOT(codecClicked(QModelIndex) )); - /**/connect(keditlistbox_codec->addButton(),SIGNAL(clicked()) , this , SLOT(addCodec() )); - /**/connect(keditlistbox_codec, SIGNAL(changed()) , this , SLOT(codecChanged() )); - /**/connect(combo_security_STRP, SIGNAL(currentIndexChanged(int)) , this , SLOT(updateCombo(int) )); - /**/connect(button_add_credential, SIGNAL(clicked()) , this , SLOT(addCredential() )); - /**/connect(button_remove_credential, SIGNAL(clicked()) , this , SLOT(removeCredential() )); - /* */ + // SENDER SIGNAL RECEIVER SLOT / + /**/connect(edit1_alias, SIGNAL(textEdited(const QString &)) , this , SLOT(changedAccountList() )); + /**/connect(edit2_protocol, SIGNAL(activated(int)) , this , SLOT(changedAccountList() )); + /**/connect(edit3_server, SIGNAL(textEdited(const QString &)) , this , SLOT(changedAccountList() )); + /**/connect(edit4_user, SIGNAL(textEdited(const QString &)) , this , SLOT(changedAccountList() )); + /**/connect(edit5_password, SIGNAL(textEdited(const QString &)) , this , SLOT(changedAccountList() )); + /**/connect(edit6_mailbox, SIGNAL(textEdited(const QString &)) , this , SLOT(changedAccountList() )); + /**/connect(spinbox_regExpire, SIGNAL(editingFinished()) , this , SLOT(changedAccountList() )); + /**/connect(comboBox_ni_local_address, SIGNAL(currentIndexChanged (int)) , this , SLOT(changedAccountList() )); + /**/connect(checkBox_conformRFC, SIGNAL(clicked(bool)) , this , SLOT(changedAccountList() )); + /**/connect(button_accountUp, SIGNAL(clicked()) , this , SLOT(changedAccountList() )); + /**/connect(button_accountDown, SIGNAL(clicked()) , this , SLOT(changedAccountList() )); + /**/connect(button_accountAdd, SIGNAL(clicked()) , this , SLOT(changedAccountList() )); + /**/connect(button_accountRemove, SIGNAL(clicked()) , this , SLOT(changedAccountList() )); + /**/connect(edit_tls_private_key_password, SIGNAL(textEdited(const QString &)) , this , SLOT(changedAccountList() )); + /**/connect(spinbox_tls_listener, SIGNAL(editingFinished()) , this , SLOT(changedAccountList() )); + /**/connect(file_tls_authority, SIGNAL(textChanged(const QString &)), this , SLOT(changedAccountList() )); + /**/connect(file_tls_endpoint, SIGNAL(textChanged(const QString &)), this , SLOT(changedAccountList() )); + /**/connect(file_tls_private_key, SIGNAL(textChanged(const QString &)), this , SLOT(changedAccountList() )); + /**/connect(combo_tls_method, SIGNAL(currentIndexChanged(int)) , this , SLOT(changedAccountList() )); + /**/connect(edit_tls_cipher, SIGNAL(textEdited(const QString &)) , this , SLOT(changedAccountList() )); + /**/connect(edit_tls_outgoing, SIGNAL(textEdited(const QString &)) , this , SLOT(changedAccountList() )); + /**/connect(spinbox_tls_timeout_sec, SIGNAL(editingFinished()) , this , SLOT(changedAccountList() )); + /**/connect(spinbox_tls_timeout_msec, SIGNAL(editingFinished()) , this , SLOT(changedAccountList() )); + /**/connect(check_tls_incoming, SIGNAL(clicked(bool)) , this , SLOT(changedAccountList() )); + /**/connect(check_tls_answer, SIGNAL(clicked(bool)) , this , SLOT(changedAccountList() )); + /**/connect(check_tls_requier_cert, SIGNAL(clicked(bool)) , this , SLOT(changedAccountList() )); + /**/connect(group_security_tls, SIGNAL(clicked(bool)) , this , SLOT(changedAccountList() )); + /**/connect(radioButton_pa_same_as_local, SIGNAL(clicked(bool)) , this , SLOT(changedAccountList() )); + /**/connect(radioButton_pa_custom, SIGNAL(clicked(bool)) , this , SLOT(changedAccountList() )); + /**/connect(&configurationManager, SIGNAL(accountsChanged()) , this , SLOT(updateAccountStates() )); + /**/connect(edit_tls_private_key_password, SIGNAL(textEdited(const QString &)) , this , SLOT(changedAccountList() )); + /**/connect(this, SIGNAL(updateButtons()) , parent , SLOT(updateButtons() )); + /**/connect(keditlistbox_codec->listView(), SIGNAL(clicked(QModelIndex)) , this , SLOT(codecClicked(QModelIndex) )); + /**/connect(keditlistbox_codec->addButton(),SIGNAL(clicked()) , this , SLOT(addCodec() )); + /**/connect(keditlistbox_codec, SIGNAL(changed()) , this , SLOT(codecChanged() )); + /**/connect(combo_security_STRP, SIGNAL(currentIndexChanged(int)) , this , SLOT(updateCombo(int) )); + /**/connect(button_add_credential, SIGNAL(clicked()) , this , SLOT(addCredential() )); + /**/connect(button_remove_credential, SIGNAL(clicked()) , this , SLOT(removeCredential() )); + /* */ connect(list_credential, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this,SLOT( selectCredential(QListWidgetItem*, QListWidgetItem*))); @@ -350,6 +353,8 @@ void DlgAccounts::loadAccount(QListWidgetItem * item) tab_advanced->setEnabled(true); line_stun->setEnabled(checkbox_stun->isChecked()); + radioButton_pa_same_as_local->setDisabled(checkbox_stun->isChecked()); + radioButton_pa_custom->setDisabled(checkbox_stun->isChecked()); } else { checkbox_stun->setChecked(false); @@ -650,12 +655,12 @@ void DlgAccounts::loadCredentails(QString accountId) { VectorMapStringString credentials = configurationManager.getCredentials(accountId); for (int i=0; i < credentials.size(); i++) { QListWidgetItem* newItem = new QListWidgetItem(); - newItem->setText(credentials[i]["username"]); + newItem->setText(credentials[i][ "username" ]); CredentialData data; - data.pointer = newItem ; - data.name = credentials[i]["username"] ; - data.password = credentials[i]["password"] ; - data.realm = credentials[i]["realm"] ; + data.pointer = newItem ; + data.name = credentials[i][ "username" ] ; + data.password = credentials[i][ "password" ] ; + data.realm = credentials[i][ "realm" ] ; credentialInfo[newItem] = data; credentialList << data; list_credential->addItem(newItem); diff --git a/kde/src/conf/dlgaccounts.h b/kde/src/conf/dlgaccounts.h index 48125a3edf0783e5190e9b2fe1d5dc02d62664d1..93784f26987cd4861478b4f51dca7111df609852 100755 --- a/kde/src/conf/dlgaccounts.h +++ b/kde/src/conf/dlgaccounts.h @@ -49,8 +49,18 @@ class Private_AddCodecDialog : public KDialog { Private_AddCodecDialog(QList< StringHash > itemList, QStringList currentItems ,QWidget* parent = 0) : KDialog(parent) { codecTable = new QTableWidget(this); codecTable->verticalHeader()->setVisible(false); - codecTable->setColumnCount(5); + codecTable->setColumnCount(4); + for (int i=0;i<4;i++) { + codecTable->setHorizontalHeaderItem( i, new QTableWidgetItem(0)); + codecTable->horizontalHeader()->setResizeMode(i,QHeaderView::ResizeToContents); + } + codecTable->setSelectionBehavior(QAbstractItemView::SelectRows); + codecTable->horizontalHeaderItem(0)->setText("Name"); + codecTable->horizontalHeaderItem(1)->setText("Bitrate"); + codecTable->horizontalHeaderItem(2)->setText("Frequency"); + codecTable->horizontalHeaderItem(3)->setText("Alias"); + codecTable->horizontalHeader()->setResizeMode(0,QHeaderView::Stretch); int i =0; foreach (StringHash aCodec, itemList) { if ( currentItems.indexOf(aCodec["alias"]) == -1) { @@ -62,12 +72,12 @@ class Private_AddCodecDialog : public KDialog { QTableWidgetItem* cFrequency = new QTableWidgetItem(aCodec["frequency"]); codecTable->setItem(i,2,cFrequency); QTableWidgetItem* cAlias = new QTableWidgetItem(aCodec["alias"]); - codecTable->setItem(i,4,cAlias); + codecTable->setItem(i,3,cAlias); i++; } } setMainWidget(codecTable); - resize(400,300); + resize(550,300); connect(this, SIGNAL(okClicked()), this, SLOT(emitNewCodec())); } @@ -75,7 +85,8 @@ class Private_AddCodecDialog : public KDialog { QTableWidget* codecTable; private slots: void emitNewCodec() { - emit addCodec(codecTable->item(codecTable->currentRow(),4)->text()); + if (codecTable->currentRow() >= 0) + emit addCodec(codecTable->item(codecTable->currentRow(),3)->text()); } signals: void addCodec(QString alias); diff --git a/kde/src/conf/dlgaccountsbase.ui b/kde/src/conf/dlgaccountsbase.ui index 29a0fe63ba81f9fac639d7fb3bbd140104f29b36..94f5f4c68cb83d067708c9d301ba76ca53571ccc 100755 --- a/kde/src/conf/dlgaccountsbase.ui +++ b/kde/src/conf/dlgaccountsbase.ui @@ -539,65 +539,54 @@ </widget> </item> <item> - <spacer name="verticalSpacer_3"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>138</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab_stun"> - <attribute name="title"> - <string>Stun</string> - </attribute> - <layout class="QGridLayout" name="gridLayout_6"> - <item row="0" column="0" colspan="2"> - <widget class="QLabel" name="label_commonSettings"> - <property name="text"> - <string>Stun parameters will be applied on each SIP account created.</string> - </property> - <property name="wordWrap"> - <bool>true</bool> + <widget class="QGroupBox" name="groupBox_4"> + <property name="title"> + <string>Stun</string> </property> + <layout class="QGridLayout" name="gridLayout_11"> + <item row="0" column="0" colspan="2"> + <widget class="QLabel" name="label_commonSettings"> + <property name="text"> + <string>Stun parameters will be applied on each SIP account created.</string> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QCheckBox" name="checkbox_stun"> + <property name="text"> + <string>Enable Stun</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="KLineEdit" name="line_stun"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="clickMessage"> + <string>choose Stun server (example : stunserver.org)</string> + </property> + </widget> + </item> + </layout> </widget> </item> - <item row="2" column="0"> - <spacer name="verticalSpacer_2"> + <item> + <spacer name="verticalSpacer_3"> <property name="orientation"> <enum>Qt::Vertical</enum> </property> <property name="sizeHint" stdset="0"> <size> <width>20</width> - <height>40</height> + <height>138</height> </size> </property> </spacer> </item> - <item row="1" column="0"> - <widget class="QCheckBox" name="checkbox_stun"> - <property name="text"> - <string>Enable Stun</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="KLineEdit" name="line_stun"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="clickMessage"> - <string>choose Stun server (example : stunserver.org)</string> - </property> - </widget> - </item> </layout> </widget> <widget class="QWidget" name="tab_codec"> @@ -1196,12 +1185,44 @@ <slot>setEnabled(bool)</slot> <hints> <hint type="sourcelabel"> - <x>324</x> - <y>74</y> + <x>320</x> + <y>415</y> + </hint> + <hint type="destinationlabel"> + <x>448</x> + <y>419</y> + </hint> + </hints> + </connection> + <connection> + <sender>checkbox_stun</sender> + <signal>toggled(bool)</signal> + <receiver>radioButton_pa_same_as_local</receiver> + <slot>setDisabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>307</x> + <y>412</y> + </hint> + <hint type="destinationlabel"> + <x>372</x> + <y>248</y> + </hint> + </hints> + </connection> + <connection> + <sender>checkbox_stun</sender> + <signal>toggled(bool)</signal> + <receiver>radioButton_pa_custom</receiver> + <slot>setDisabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>300</x> + <y>412</y> </hint> <hint type="destinationlabel"> - <x>429</x> - <y>77</y> + <x>341</x> + <y>278</y> </hint> </hints> </connection> diff --git a/kde/src/lib/CallModel.hpp b/kde/src/lib/CallModel.hpp index 2d89323c286d34ac2a83f0800795bcd29828bb15..b81efc9834430ec6c1f88441a412e9fcb6d29086 100644 --- a/kde/src/lib/CallModel.hpp +++ b/kde/src/lib/CallModel.hpp @@ -135,7 +135,6 @@ template<typename CallWidget, typename Index> QList<Call*> CallModel<CallWidget, template<typename CallWidget, typename Index> Call* CallModel<CallWidget,Index>::addCall(Call* call, Call* parent) { Q_UNUSED(parent) - qDebug() << "-------------------Adding call" << call << "-------------------"; InternalStruct* aNewStruct = new InternalStruct; aNewStruct->call_real = call; aNewStruct->conference = false; diff --git a/kde/src/lib/sflphone_const.h b/kde/src/lib/sflphone_const.h index 4ddd9ce0c5b5332f3042585340f6df05aac3b005..4475f5a67c3ec0c3a62632cb7c1988e8230c3464 100644 --- a/kde/src/lib/sflphone_const.h +++ b/kde/src/lib/sflphone_const.h @@ -282,27 +282,27 @@ typedef enum { /** Ringing incoming call */ - CALL_STATE_INCOMING =0, + CALL_STATE_INCOMING = 0, /** Ringing outgoing call */ - CALL_STATE_RINGING=1, + CALL_STATE_RINGING = 1, /** Call to which the user can speak and hear */ - CALL_STATE_CURRENT=2, + CALL_STATE_CURRENT = 2, /** Call which numbers are being added by the user */ - CALL_STATE_DIALING=3, + CALL_STATE_DIALING = 3, /** Call is on hold */ - CALL_STATE_HOLD=4, + CALL_STATE_HOLD = 4, /** Call has failed */ - CALL_STATE_FAILURE=5, + CALL_STATE_FAILURE = 5, /** Call is busy */ - CALL_STATE_BUSY=6, + CALL_STATE_BUSY = 6, /** Call is being transfered. During this state, the user can enter the new number. */ - CALL_STATE_TRANSFER=7, + CALL_STATE_TRANSFER = 7, /** Call is on hold for transfer */ - CALL_STATE_TRANSF_HOLD=8, + CALL_STATE_TRANSF_HOLD = 8, /** Call is over and should not be used */ - CALL_STATE_OVER=9, + CALL_STATE_OVER = 9, /** This state should never be reached */ - CALL_STATE_ERROR=10 + CALL_STATE_ERROR = 10 } call_state; /** MIME API */ diff --git a/kde/src/main.cpp b/kde/src/main.cpp index 87432f8dbd83d7bcde29705c460a3f7fc4dc1885..56019340d50f579c9622d34a3b487d13461ef5e1 100755 --- a/kde/src/main.cpp +++ b/kde/src/main.cpp @@ -26,7 +26,7 @@ static const char description[] = "A KDE 4 Client for SFLphone"; -static const char version[] = "0.9.6"; +static const char version[] = "0.9.14"; int main(int argc, char **argv) { @@ -36,19 +36,20 @@ int main(int argc, char **argv) KLocale::setMainCatalog("sflphone-client-kde"); KAboutData about( - "sflphone-client-kde", - "sflphone-client-kde", - ki18n("SFLphone KDE Client"), - version, - ki18n(description), - KAboutData::License_GPL_V3, - ki18n("(C) 2009-2010 Savoir-faire Linux"), - KLocalizedString(), - "http://www.sflphone.org.", - "sflphone@lists.savoirfairelinux.net"); - about.addAuthor( ki18n("Jérémy Quentin"), KLocalizedString(), "jeremy.quentin@savoirfairelinux.com" ); - about.addAuthor( ki18n("Emmanuel Lepage Vallee"), KLocalizedString(), "emmanuel.lepage@savoirfairelinux.com" ); - about.setTranslator( ki18nc("NAME OF TRANSLATORS","Your names"), ki18nc("EMAIL OF TRANSLATORS","Your emails") ); + "sflphone-client-kde" , + "sflphone-client-kde" , + ki18n("SFLphone KDE Client") , + version , + ki18n(description) , + KAboutData::License_GPL_V3 , + ki18n("(C) 2009-2010 Savoir-faire Linux") , + KLocalizedString() , + "http://www.sflphone.org." , + "sflphone@lists.savoirfairelinux.net" + ); + about.addAuthor( ki18n( "Jérémy Quentin" ), KLocalizedString(), "jeremy.quentin@savoirfairelinux.com" ); + about.addAuthor( ki18n( "Emmanuel Lepage Vallee" ), KLocalizedString(), "emmanuel.lepage@savoirfairelinux.com" ); + //about.setTranslator( ki18nc("NAME OF TRANSLATORS","Your names"), ki18nc("EMAIL OF TRANSLATORS","Your emails") ); KCmdLineArgs::init(argc, argv, &about); KCmdLineOptions options; KCmdLineArgs::addCmdLineOptions(options); @@ -69,6 +70,7 @@ int main(int argc, char **argv) ConfigurationSkeleton* conf = ConfigurationSkeleton::self(); conf->writeConfig(); + delete sflphoneWindow_; return retVal; } catch(const char * msg) diff --git a/kde/src/widgets/BookmarkDock.cpp b/kde/src/widgets/BookmarkDock.cpp index b08365a1ca5b0a417b1358ad691a3a2fb2bdbda4..42976ce90760d89e8c66b4a6c96feb5bafd4da46 100644 --- a/kde/src/widgets/BookmarkDock.cpp +++ b/kde/src/widgets/BookmarkDock.cpp @@ -30,6 +30,7 @@ class QNumericTreeWidgetItem : public QTreeWidgetItem { BookmarkDock::BookmarkDock(QWidget* parent) : QDockWidget(parent) { + setObjectName("bookmarkDock"); setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum); setMinimumSize(250,0); diff --git a/kde/src/widgets/ContactDock.cpp b/kde/src/widgets/ContactDock.cpp index 16647a4e0d307bb2ecfe2c9371bac6a545ad219a..d421405c52896ba6dc648ff429d5c354c1fa86bf 100644 --- a/kde/src/widgets/ContactDock.cpp +++ b/kde/src/widgets/ContactDock.cpp @@ -52,8 +52,20 @@ class QNumericTreeWidgetItem_hist : public QTreeWidgetItem { } }; +bool KeyPressEaterC::eventFilter(QObject *obj, QEvent *event) +{ + if (event->type() == QEvent::KeyPress) { + m_pDock->keyPressEvent((QKeyEvent*)event); + return true; + } else { + // standard event processing + return QObject::eventFilter(obj, event); + } +} + ContactDock::ContactDock(QWidget* parent) : QDockWidget(parent) { + setObjectName("contactDock"); m_pFilterLE = new KLineEdit ( ); m_pSplitter = new QSplitter ( Qt::Vertical,this ); m_pSortByCBB = new QComboBox ( this ); @@ -74,6 +86,8 @@ ContactDock::ContactDock(QWidget* parent) : QDockWidget(parent) m_pContactView->header()->setSortIndicatorShown(true); m_pContactView->setAcceptDrops(true); m_pContactView->setDragEnabled(true); + KeyPressEaterC *keyPressEater = new KeyPressEaterC(this); + m_pContactView->installEventFilter(keyPressEater); m_pContactView->setAlternatingRowColors(true); @@ -217,4 +231,15 @@ void ContactDock::setHistoryVisible(bool visible) qDebug() << "Toggling history visibility"; m_pCallView->setVisible(visible); ConfigurationSkeleton::setDisplayContactCallHistory(visible); +} + +void ContactDock::keyPressEvent(QKeyEvent* event) { + int key = event->key(); + if(key == Qt::Key_Escape) + m_pFilterLE->setText(QString()); + else if(key == Qt::Key_Return || key == Qt::Key_Enter) {} + else if((key == Qt::Key_Backspace) && (m_pFilterLE->text().size())) + m_pFilterLE->setText(m_pFilterLE->text().left( m_pFilterLE->text().size()-1 )); + else if (!event->text().isEmpty() && !(key == Qt::Key_Backspace)) + m_pFilterLE->setText(m_pFilterLE->text()+event->text()); } \ No newline at end of file diff --git a/kde/src/widgets/ContactDock.h b/kde/src/widgets/ContactDock.h index b0f6051b0bfd2c2010adbc8374032b5856071895..b446ac0726ab22e43e754d83c15492ebab101581 100644 --- a/kde/src/widgets/ContactDock.h +++ b/kde/src/widgets/ContactDock.h @@ -33,7 +33,8 @@ private: QComboBox* m_pSortByCBB; QCheckBox* m_pShowHistoCK; QList<ContactItemWidget*> m_pContacts; - +public slots: + virtual void keyPressEvent(QKeyEvent* event); private slots: void reloadContact(); void loadContactHistory(QTreeWidgetItem* item); @@ -49,4 +50,17 @@ public: bool dropMimeData(QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action); }; +class KeyPressEaterC : public QObject +{ + Q_OBJECT +public: + KeyPressEaterC(ContactDock* parent) : QObject(parent) { + m_pDock = parent; + } +protected: + bool eventFilter(QObject *obj, QEvent *event); +private: + ContactDock* m_pDock; +}; + #endif \ No newline at end of file diff --git a/kde/src/widgets/HistoryDock.cpp b/kde/src/widgets/HistoryDock.cpp index 2d53ae398f153d6074be42f73fb2d8170f8ef572..8ac63e802226f458d9c8b6836f0f7516c272dc70 100644 --- a/kde/src/widgets/HistoryDock.cpp +++ b/kde/src/widgets/HistoryDock.cpp @@ -36,8 +36,20 @@ class QNumericTreeWidgetItem : public QTreeWidgetItem { } }; +bool KeyPressEater::eventFilter(QObject *obj, QEvent *event) +{ + if (event->type() == QEvent::KeyPress) { + m_pDock->keyPressEvent((QKeyEvent*)event); + return true; + } else { + // standard event processing + return QObject::eventFilter(obj, event); + } +} + HistoryDock::HistoryDock(QWidget* parent) : QDockWidget(parent) { + setObjectName("historyDock"); setMinimumSize(250,0); setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum); m_pFilterLE = new KLineEdit(); @@ -66,6 +78,8 @@ HistoryDock::HistoryDock(QWidget* parent) : QDockWidget(parent) m_pItemView->setAlternatingRowColors(true ); m_pItemView->setAcceptDrops( true ); m_pItemView->setDragEnabled( true ); + KeyPressEater *keyPressEater = new KeyPressEater(this); + m_pItemView->installEventFilter(keyPressEater); m_pFilterLE->setPlaceholderText("Filter"); m_pFilterLE->setClearButtonShown(true); @@ -284,4 +298,15 @@ bool HistoryTree::dropMimeData(QTreeWidgetItem *parent, int index, const QMimeDa qDebug() << "In history import"<< QString(encodedData); return false; +} + +void HistoryDock::keyPressEvent(QKeyEvent* event) { + int key = event->key(); + if(key == Qt::Key_Escape) + m_pFilterLE->setText(QString()); + else if(key == Qt::Key_Return || key == Qt::Key_Enter) {} + else if((key == Qt::Key_Backspace) && (m_pFilterLE->text().size())) + m_pFilterLE->setText(m_pFilterLE->text().left( m_pFilterLE->text().size()-1 )); + else if (!event->text().isEmpty() && !(key == Qt::Key_Backspace)) + m_pFilterLE->setText(m_pFilterLE->text()+event->text()); } \ No newline at end of file diff --git a/kde/src/widgets/HistoryDock.h b/kde/src/widgets/HistoryDock.h index 466f798d95c1216b57a7ff4de5374676a99c3263..5f49d8b3865aa894cc7de5ab9391fcb9766e8353 100644 --- a/kde/src/widgets/HistoryDock.h +++ b/kde/src/widgets/HistoryDock.h @@ -23,6 +23,7 @@ typedef QList<HistoryTreeItem*> HistoryList; class HistoryDock : public QDockWidget { Q_OBJECT public: + friend class KeyPressEater; HistoryDock(QWidget* parent); virtual ~HistoryDock(); private: @@ -50,6 +51,7 @@ private: QDate m_pCurrentToDate; public slots: void enableDateRange(bool enable); + virtual void keyPressEvent(QKeyEvent* event); private slots: void filter(QString text); void updateLinkedFromDate(QDate date); @@ -66,4 +68,17 @@ public: bool dropMimeData(QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action); }; +class KeyPressEater : public QObject +{ + Q_OBJECT +public: + KeyPressEater(HistoryDock* parent) : QObject(parent) { + m_pDock = parent; + } +protected: + bool eventFilter(QObject *obj, QEvent *event); +private: + HistoryDock* m_pDock; +}; + #endif \ No newline at end of file