diff --git a/sflphone_kde/Account.h b/sflphone_kde/Account.h index d7157eb1ab5802685f0f9f1eab8fc2f48e696eaf..f3fedda48ecf39dda73aa0f46ba9ffe8936f9878 100644 --- a/sflphone_kde/Account.h +++ b/sflphone_kde/Account.h @@ -36,19 +36,18 @@ public: QColor getStateColor(); QString getStateColorName(); QString getAccountDetail(QString & param); - //QString getAccountDetail(std::string param); //Setters void setItemText(QString text); void initAccountItem(); void setAccountId(QString id); void setAccountDetails(MapStringString m); - //void setState(account_state_t s); void setAccountDetail(QString param, QString val); //Operators bool operator==(const Account&)const; + }; diff --git a/sflphone_kde/AccountList.cpp b/sflphone_kde/AccountList.cpp index 13ffbce09b209d0b19b1ca4e805dcdd4e20e848f..915189f9419c428eca43234d485a6a18e1930f93 100644 --- a/sflphone_kde/AccountList.cpp +++ b/sflphone_kde/AccountList.cpp @@ -21,6 +21,17 @@ AccountList::AccountList(QStringList & _accountIds) } } +AccountList::AccountList() +{ + ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); + //ask for the list of accounts ids to the configurationManager + QStringList accountIds = configurationManager.getAccountList().value(); + accounts = new QVector<Account *>(); + for (int i = 0; i < accountIds.size(); ++i){ + (*accounts) += Account::buildExistingAccountFromId(accountIds[i]); + } +} + AccountList::~AccountList() { delete accounts; diff --git a/sflphone_kde/AccountList.h b/sflphone_kde/AccountList.h index 8edaf3f5fddc672da24336e3c3f3b1e24eb665ca..dba419d63f0b33c76bf45418b89fac132ffdaf29 100644 --- a/sflphone_kde/AccountList.h +++ b/sflphone_kde/AccountList.h @@ -13,7 +13,6 @@ private: public: //Constructors - //AccountList(VectorString & _accountIds); AccountList(QStringList & _accountIds); ~AccountList(); @@ -21,12 +20,10 @@ public: QVector<Account *> & getAccounts(); Account * getAccountById(QString & id); QVector<Account *> getAccountByState(QString & state); - //Account * getAccountByRow(int row); Account * getAccountByItem(QListWidgetItem * item); int size(); //Setters - //void addAccount(Account & account); Account * addAccount(QString & alias); void removeAccount(QListWidgetItem * item); diff --git a/sflphone_kde/AccountWizard.cpp b/sflphone_kde/AccountWizard.cpp index 6433a230caf9e965dcb1259a612d08c57c71f66d..aaad97d8b51850fc7a2c23ead599dde454a690f6 100644 --- a/sflphone_kde/AccountWizard.cpp +++ b/sflphone_kde/AccountWizard.cpp @@ -22,18 +22,132 @@ #include <QVBoxLayout> #include <QFormLayout> #include "sflphone_const.h" +#include "configurationmanager_interface_singleton.h" +#include <netdb.h> + + +#define FIELD_SFL_ACCOUNT "SFL" +#define FIELD_OTHER_ACCOUNT "OTHER" +#define FIELD_SIP_ACCOUNT "SIP" +#define FIELD_IAX_ACCOUNT "IAX" +#define FIELD_EMAIL_ADDRESS "EMAIL_ADDRESS" +#define FIELD_ENABLE_STUN "ENABLE_STUN" +#define FIELD_STUN_SERVER "STUN_SERVER" +#define FIELD_SIP_ALIAS "SIP_ALIAS" +#define FIELD_SIP_SERVER "SIP_SERVER" +#define FIELD_SIP_USER "SIP_USER" +#define FIELD_SIP_PASSWORD "SIP_PASSWORD" +#define FIELD_IAX_ALIAS "IAX_ALIAS" +#define FIELD_IAX_SERVER "IAX_SERVER" +#define FIELD_IAX_USER "IAX_USER" +#define FIELD_IAX_PASSWORD "IAX_PASSWORD" + + +#define SFL_ACCOUNT_HOST "sip.sflphone.org" + +/*************************************************************************** + * Global functions for creating an account on sflphone.org * + * * + ***************************************************************************/ + +typedef struct { + char success; + char reason[200]; + char user[200]; + char passwd[200]; +} rest_account; + +int req(char *host, int port, char *req, char *ret) { + + int s; + struct sockaddr_in servSockAddr; + struct hostent *servHostEnt; + long int length=0; + long int status=0; + int i=0; + FILE *f; + char buf[1024]; + + bzero(&servSockAddr, sizeof(servSockAddr)); + servHostEnt = gethostbyname(host); + if (servHostEnt == NULL) { + strcpy(ret, "gethostbyname"); + return -1; + } + bcopy((char *)servHostEnt->h_addr, (char *)&servSockAddr.sin_addr, servHostEnt->h_length); + servSockAddr.sin_port = htons(port); + servSockAddr.sin_family = AF_INET; + + if ((s = socket(AF_INET,SOCK_STREAM,0)) < 0) { + strcpy(ret, "socket"); + return -1; + } + + if(connect(s, (const struct sockaddr *) &servSockAddr, (socklen_t) sizeof(servSockAddr)) < 0 ) { + perror("foo"); + strcpy(ret, "connect"); + return -1; + } + + f = fdopen(s, "r+"); + + fprintf(f, "%s HTTP/1.1\r\n", req); + fprintf(f, "Host: %s\r\n", host); + fputs("User-Agent: SFLphone\r\n", f); + fputs("\r\n", f); + + while (strncmp(fgets(buf, sizeof(buf), f), "\r\n", 2)) { + const char *len_h = "content-length"; + const char *status_h = "HTTP/1.1"; + if (strncasecmp(buf, len_h, strlen(len_h)) == 0) + length = atoi(buf + strlen(len_h) + 1); + if (strncasecmp(buf, status_h, strlen(status_h)) == 0) + status = atoi(buf + strlen(status_h) + 1); + } + for (i = 0; i < length; i++) + ret[i] = fgetc(f); + + if (status != 200) { + sprintf(ret, "http error: %ld", status); + return -1; + } + + fclose(f); + shutdown(s, 2); + close(s); + return 0; +} + +rest_account get_rest_account(char *host,char *email) { + char ret[4096]; + rest_account ra; + bzero(ret, sizeof(ret)); + printf("HOST: %s\n", host); + strcpy(ret,"GET /rest/accountcreator?email="); + strcat(ret, email); + if (req(host, 80, ret, ret) != -1) { + strcpy(ra.user, strtok(ret, "\n")); + strcpy(ra.passwd, strtok(NULL, "\n"));\ + ra.success = 1; + } else { + ra.success = 0; + strcpy(ra.reason, ret); + } + puts(ret); + return ra; +} + /*************************************************************************** * Class AccountWizard * * Widget of the wizard for creating an account. * ***************************************************************************/ -AccountWizard::AccountWizard(QWidget *parent) +AccountWizard::AccountWizard(QWidget * parent) : QWizard(parent) { - setPage(Page_Intro, new WizardIntroPage); setPage(Page_AutoMan, new WizardAccountAutoManualPage); setPage(Page_Type, new WizardAccountTypePage); @@ -56,18 +170,108 @@ AccountWizard::~AccountWizard() } void AccountWizard::accept() - { - QByteArray className = field("className").toByteArray(); - QByteArray baseClass = field("baseClass").toByteArray(); - QByteArray macroName = field("macroName").toByteArray(); - QByteArray baseInclude = field("baseInclude").toByteArray(); +{ + QString ret; + MapStringString accountDetails; + accountDetails[QString(ACCOUNT_ALIAS)] = QString(); + accountDetails[QString(ACCOUNT_HOSTNAME)] = QString(); + accountDetails[QString(ACCOUNT_USERNAME)] = QString(); + accountDetails[QString(ACCOUNT_PASSWORD)] = QString(); + accountDetails[QString(ACCOUNT_TYPE)] = QString(); + accountDetails[QString(ACCOUNT_MAILBOX)] = QString(); + + QString & alias = accountDetails[QString(ACCOUNT_ALIAS)]; + QString & server = accountDetails[QString(ACCOUNT_HOSTNAME)]; + QString & user = accountDetails[QString(ACCOUNT_USERNAME)]; + QString & password = accountDetails[QString(ACCOUNT_PASSWORD)]; + QString & protocol = accountDetails[QString(ACCOUNT_TYPE)]; + QString & mailbox = accountDetails[QString(ACCOUNT_MAILBOX)]; + + bool createAccount = false; + bool sip = false; + bool SFL = field(FIELD_SFL_ACCOUNT).toBool(); + if(SFL) + { + QString emailAddress = field(FIELD_EMAIL_ADDRESS).toString(); + char charEmailAddress[1024]; + strncpy(charEmailAddress, emailAddress.toLatin1(), sizeof(charEmailAddress) - 1); + + rest_account acc = get_rest_account(SFL_ACCOUNT_HOST, charEmailAddress); + if(acc.success) + { + ret += tr("Creation of account succeed with parameters :\n"); + alias = QString(acc.user) + "@" + SFL_ACCOUNT_HOST; + server = QString(SFL_ACCOUNT_HOST); + user = QString(acc.user); + password = QString(acc.passwd); + protocol = QString(ACCOUNT_TYPE_SIP); + createAccount = true; + sip = true; + } + else + { + ret += tr("Creation of account has failed for the reason :\n"); + ret += acc.reason; + } + } + else + { + ret += tr("Register of account succeed with parameters :\n"); + bool SIPAccount = field(FIELD_SIP_ACCOUNT).toBool(); + if(SIPAccount) + { + alias = field(FIELD_SIP_ALIAS).toString(); + server = field(FIELD_SIP_SERVER).toString(); + user = field(FIELD_SIP_USER).toString(); + password = field(FIELD_SIP_PASSWORD).toString(); + protocol = QString(ACCOUNT_TYPE_SIP); + sip = true; + + } + else + { + alias = field(FIELD_IAX_ALIAS).toString(); + server = field(FIELD_IAX_SERVER).toString(); + user = field(FIELD_IAX_USER).toString(); + password = field(FIELD_IAX_PASSWORD).toString(); + protocol = QString(ACCOUNT_TYPE_IAX); + } + createAccount = true; + } + if(createAccount) + { + mailbox = QString(ACCOUNT_MAILBOX_DEFAULT_VALUE); + qDebug() << "ligne1"; + ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); + qDebug() << "ligne2"; + QString accountId = configurationManager.addAccount(accountDetails); + qDebug() << "ligne3"; + configurationManager.sendRegister(accountId, 1); + qDebug() << "ligne4"; + if(sip) + { + qDebug() << "ligne5"; + bool enableStun = field(FIELD_ENABLE_STUN).toBool(); + qDebug() << "ligne6"; + QString stunServer = field(FIELD_STUN_SERVER).toString(); + qDebug() << "ligne7"; + if(enableStun != configurationManager.isStunEnabled()) configurationManager.enableStun(); + qDebug() << "ligne8"; + if(enableStun) configurationManager.setStunServer(stunServer); + qDebug() << "ligne9"; + } + ret += tr("Alias : ") + alias + "\n"; + ret += tr("Server : ") + server + "\n"; + ret += tr("User : ") + user + "\n"; + ret += tr("Password : ") + password + "\n"; + ret += tr("Protocol : ") + protocol + "\n"; + ret += tr("Mailbox : ") + mailbox + "\n"; + } + qDebug() << ret; + QDialog::accept(); +} + - QString outputDir = field("outputDir").toString(); - QString header = field("header").toString(); - QString implementation = field("implementation").toString(); - - QDialog::accept(); - } /*************************************************************************** @@ -116,8 +320,8 @@ WizardAccountAutoManualPage::WizardAccountAutoManualPage(QWidget *parent) radioButton_manual = new QRadioButton(tr("Register an existing SIP/IAX2 account")); radioButton_SFL->setChecked(true); - registerField("SFL", radioButton_SFL); - registerField("manual", radioButton_manual); + registerField(FIELD_SFL_ACCOUNT, radioButton_SFL); + registerField(FIELD_OTHER_ACCOUNT, radioButton_manual); QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(radioButton_SFL); @@ -159,8 +363,8 @@ WizardAccountTypePage::WizardAccountTypePage(QWidget *parent) radioButton_IAX = new QRadioButton(tr("Create a IAX2 (InterAsterisk eXchange) account")); radioButton_SIP->setChecked(true); - registerField("SIP", radioButton_SIP); - registerField("IAX", radioButton_IAX); + registerField(FIELD_SIP_ACCOUNT, radioButton_SIP); + registerField(FIELD_IAX_ACCOUNT, radioButton_IAX); QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(radioButton_SIP); @@ -201,7 +405,7 @@ WizardAccountEmailAddressPage::WizardAccountEmailAddressPage(QWidget *parent) label_emailAddress = new QLabel(tr("Email address")); lineEdit_emailAddress = new QLineEdit(); - registerField("emailAddress", lineEdit_emailAddress); + registerField(FIELD_EMAIL_ADDRESS, lineEdit_emailAddress); QFormLayout *layout = new QFormLayout; layout->setWidget(0, QFormLayout::LabelRole, label_emailAddress); @@ -250,21 +454,21 @@ WizardAccountFormPage::WizardAccountFormPage(int type, QWidget *parent) lineEdit_user = new QLineEdit; lineEdit_password = new QLineEdit; - lineEdit_password->setEchoMode(QLineEdit::PasswordEchoOnEdit); + lineEdit_password->setEchoMode(QLineEdit::Password); if(type == SIP) { - registerField("alias_SIP", lineEdit_alias); - registerField("server_SIP", lineEdit_server); - registerField("user_SIP", lineEdit_user); - registerField("password_SIP", lineEdit_password); + registerField(FIELD_SIP_ALIAS, lineEdit_alias); + registerField(FIELD_SIP_SERVER, lineEdit_server); + registerField(FIELD_SIP_USER, lineEdit_user); + registerField(FIELD_SIP_PASSWORD, lineEdit_password); } else { - registerField("alias_IAX", lineEdit_alias); - registerField("server_IAX", lineEdit_server); - registerField("user_IAX", lineEdit_user); - registerField("password_IAX", lineEdit_password); + registerField(FIELD_IAX_ALIAS, lineEdit_alias); + registerField(FIELD_IAX_SERVER, lineEdit_server); + registerField(FIELD_IAX_USER, lineEdit_user); + registerField(FIELD_IAX_PASSWORD, lineEdit_password); } QFormLayout *layout = new QFormLayout; @@ -322,8 +526,8 @@ WizardAccountStunPage::WizardAccountStunPage(QWidget *parent) label_StunServer = new QLabel(tr("Stun Server")); lineEdit_StunServer = new QLineEdit(); - registerField("enableStun", checkBox_enableStun); - registerField("stunServer", lineEdit_StunServer); + registerField(FIELD_ENABLE_STUN, checkBox_enableStun); + registerField(FIELD_STUN_SERVER, lineEdit_StunServer); QFormLayout *layout = new QFormLayout; layout->addWidget(checkBox_enableStun); diff --git a/sflphone_kde/AccountWizard.h b/sflphone_kde/AccountWizard.h index d5aa52358f0b658d5fd37bfff3ef845e61cc853c..625c8c627717173172435deb72bad260dbfc4724 100644 --- a/sflphone_kde/AccountWizard.h +++ b/sflphone_kde/AccountWizard.h @@ -27,17 +27,19 @@ #include <QLineEdit> #include <QCheckBox> + /** @author Jérémy Quentin <jeremy.quentin@gmail.com> */ class AccountWizard : public QWizard { Q_OBJECT + public: enum { Page_Intro, Page_AutoMan, Page_Type, Page_Email, Page_SIPForm, Page_IAXForm, Page_Stun, Page_Conclusion }; - AccountWizard(QWidget *parent = 0); + AccountWizard(QWidget * parent = 0); ~AccountWizard(); void accept(); diff --git a/sflphone_kde/Call.cpp b/sflphone_kde/Call.cpp index 9e78d9bb1803ff6683a776b8b09c5ad51aa20816..fa61898d5330a3bbe4c0d5a592c99b29f30ff8d0 100644 --- a/sflphone_kde/Call.cpp +++ b/sflphone_kde/Call.cpp @@ -23,21 +23,6 @@ const call_state Call::actionPerformedStateMap [11][5] = /*ERROR */ {CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_ERROR } }; -const call_state Call::stateChangedStateMap [11][6] = -{ -// RINGING CURRENT BUSY HOLD HUNGUP FAILURE -/*INCOMING */ {CALL_STATE_INCOMING , CALL_STATE_CURRENT , CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_OVER , CALL_STATE_FAILURE }, -/*RINGING */ {CALL_STATE_ERROR , CALL_STATE_CURRENT , CALL_STATE_BUSY , CALL_STATE_ERROR , CALL_STATE_OVER , CALL_STATE_FAILURE }, -/*CURRENT */ {CALL_STATE_ERROR , CALL_STATE_CURRENT , CALL_STATE_ERROR , CALL_STATE_HOLD , CALL_STATE_OVER , CALL_STATE_FAILURE }, -/*DIALING */ {CALL_STATE_RINGING , CALL_STATE_CURRENT , CALL_STATE_BUSY , CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_FAILURE }, -/*HOLD */ {CALL_STATE_ERROR , CALL_STATE_CURRENT , CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_OVER , CALL_STATE_FAILURE }, -/*FAILURE */ {CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_OVER , CALL_STATE_ERROR }, -/*BUSY */ {CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_OVER , CALL_STATE_FAILURE }, -/*TRANSFER */ {CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_TRANSF_HOLD , CALL_STATE_OVER , CALL_STATE_FAILURE }, -/*TRANSF_HOLD */ {CALL_STATE_ERROR , CALL_STATE_TRANSFER , CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_OVER , CALL_STATE_FAILURE }, -/*OVER */ {CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_ERROR }, -/*ERROR */ {CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_ERROR } -}; const function Call::actionPerformedFunctionMap[11][5] = { @@ -55,6 +40,25 @@ const function Call::actionPerformedFunctionMap[11][5] = /*ERROR */ {&Call::nothing , &Call::nothing , &Call::nothing , &Call::nothing , &Call::nothing } }; + +const call_state Call::stateChangedStateMap [11][6] = +{ +// RINGING CURRENT BUSY HOLD HUNGUP FAILURE +/*INCOMING */ {CALL_STATE_INCOMING , CALL_STATE_CURRENT , CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_OVER , CALL_STATE_FAILURE }, +/*RINGING */ {CALL_STATE_ERROR , CALL_STATE_CURRENT , CALL_STATE_BUSY , CALL_STATE_ERROR , CALL_STATE_OVER , CALL_STATE_FAILURE }, +/*CURRENT */ {CALL_STATE_ERROR , CALL_STATE_CURRENT , CALL_STATE_ERROR , CALL_STATE_HOLD , CALL_STATE_OVER , CALL_STATE_FAILURE }, +/*DIALING */ {CALL_STATE_RINGING , CALL_STATE_CURRENT , CALL_STATE_BUSY , CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_FAILURE }, +/*HOLD */ {CALL_STATE_ERROR , CALL_STATE_CURRENT , CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_OVER , CALL_STATE_FAILURE }, +/*FAILURE */ {CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_OVER , CALL_STATE_ERROR }, +/*BUSY */ {CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_OVER , CALL_STATE_FAILURE }, +/*TRANSFER */ {CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_TRANSF_HOLD , CALL_STATE_OVER , CALL_STATE_FAILURE }, +/*TRANSF_HOLD */ {CALL_STATE_ERROR , CALL_STATE_TRANSFER , CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_OVER , CALL_STATE_FAILURE }, +/*OVER */ {CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_ERROR }, +/*ERROR */ {CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_ERROR } +}; + + + const char * Call::callStateIcons[11] = {ICON_INCOMING, ICON_RINGING, ICON_CURRENT, ICON_DIALING, ICON_HOLD, ICON_FAILURE, ICON_BUSY, ICON_TRANSFER, ICON_TRANSF_HOLD, "", ""}; const char * Call::historyIcons[3] = {ICON_HISTORY_INCOMING, ICON_HISTORY_OUTGOING, ICON_HISTORY_MISSED}; @@ -69,19 +73,15 @@ void Call::initCallItem() itemWidget = new QWidget(); labelIcon = new QLabel(itemWidget); labelCallNumber = new QLabel(peer, itemWidget); - labelTransferTo = new QLabel("Transfer to : ", itemWidget); + labelTransferPrefix = new QLabel("Transfer to : ", itemWidget); labelTransferNumber = new QLabel(itemWidget); QSpacerItem * horizontalSpacer = new QSpacerItem(16777215, 20, QSizePolicy::Preferred, QSizePolicy::Minimum); - labelIcon->setObjectName(QString(CALL_ITEM_ICON)); - labelCallNumber->setObjectName(QString(CALL_ITEM_CALL_NUMBER)); - labelTransferTo->setObjectName(QString(CALL_ITEM_TRANSFER_LABEL)); - labelTransferNumber->setObjectName(QString(CALL_ITEM_TRANSFER_NUMBER)); QGridLayout * layout = new QGridLayout(itemWidget); layout->setMargin(3); layout->setSpacing(3); layout->addWidget(labelIcon, 0, 0, 2, 1); layout->addWidget(labelCallNumber, 0, 1, 1, 2); - layout->addWidget(labelTransferTo, 1, 1, 1, 1); + layout->addWidget(labelTransferPrefix, 1, 1, 1, 1); layout->addWidget(labelTransferNumber, 1, 2, 1, 2); layout->addItem(horizontalSpacer, 0, 3, 1, 3); //labelIcon->raise(); @@ -92,37 +92,19 @@ void Call::initCallItem() itemWidget->setLayout(layout); //item->setSizeHint(itemWidget->sizeHint()); //setItemIcon(QString(ICON_REFUSE)); - updateItem(); } void Call::setItemIcon(const QString pixmap) { - qDebug() << "setItemIcon(" << pixmap << ");"; - QString str(CALL_ITEM_ICON); - qDebug() << "str = " << str; - qDebug() << "setItemIcon1"; - //QLabel * labelIcon = itemWidget->findChild<QLabel * >(str); - qDebug() << "setItemIcon2"; - //QPixmap icon(pixmap); - QPixmap * icon = new QPixmap(":/images/icons/dial.svg"); - qDebug() << "setItemIcon2b"; - labelIcon->setPixmap(*icon); - qDebug() << "setItemIcon3"; + labelIcon->setPixmap(QPixmap(pixmap)); } Call::Call(call_state startState, QString callId, QString from, QString account) { - for(int i = 0 ; i < 100 ; i++) - { - qDebug() << i << " :"; - QString str(callStateIcons[startState]); - qDebug() << str; - } - qDebug() << "<<<<Done>>>>"; this->callId = callId; this->peer = from; - changeCurrentState(startState); initCallItem(); + changeCurrentState(startState); this->account = account; this->recording = false; this->historyItem = NULL; @@ -130,7 +112,15 @@ Call::Call(call_state startState, QString callId, QString from, QString account) Call::~Call() { + delete startTime; + delete stopTime; delete item; + delete itemWidget; + delete labelIcon; + delete labelCallNumber; + delete labelTransferPrefix; + delete labelTransferNumber; + delete historyItem; } Call * Call::buildDialingCall(QString callId) @@ -147,6 +137,18 @@ Call * Call::buildIncomingCall(const QString & callId, const QString & from, con return call; } +Call * Call::buildRingingCall(const QString & callId) +{ + CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); + MapStringString details = callManager.getCallDetails(callId).value(); + //QString from = details[CALL_FROM]; + //QString from = details[CALL_ACCOUNT]; + //Call * call = new Call(CALL_STATE_RINGING, callId, from, account); + Call * call = new Call(CALL_STATE_RINGING, callId); + call->historyState = OUTGOING; + return call; +} + daemon_call_state Call::toDaemonCallState(const QString & stateName) { if(stateName == QString(CALL_STATE_CHANGE_HUNG_UP)) @@ -197,9 +199,10 @@ QWidget * Call::getItemWidget() QListWidgetItem * Call::getHistoryItem() { - if(historyItem == NULL) + if(historyItem == NULL && historyState != NONE) { historyItem = new QListWidgetItem(peer); + qDebug() << "historystate = " << historyState; historyItem->setIcon(QIcon(historyIcons[historyState])); } return historyItem; @@ -210,10 +213,16 @@ call_state Call::getState() const return currentState; } +history_state Call::getHistoryState() const +{ + return historyState; +} + call_state Call::stateChanged(const QString & newStateName) { call_state previousState = currentState; daemon_call_state dcs = toDaemonCallState(newStateName); + //(this->*(stateChangedFunctionMap[currentState][dcs]))(); changeCurrentState(stateChangedStateMap[currentState][dcs]); qDebug() << "Calling stateChanged " << newStateName << " -> " << toDaemonCallState(newStateName) << " on call with state " << previousState << ". Become " << currentState; return currentState; @@ -289,8 +298,7 @@ void Call::refuse() void Call::acceptTransf() { CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); - QLabel * transferNumber = itemWidget->findChild<QLabel *>(QString(CALL_ITEM_TRANSFER_NUMBER)); - QString number = transferNumber->text(); + QString number = labelTransferNumber->text(); qDebug() << "Accepting call and transfering it to number : " << number << ". callId : " << callId; callManager.accept(callId); callManager.transfert(callId, number); @@ -323,8 +331,7 @@ void Call::hold() void Call::call() { CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); - QLabel * callNumber = itemWidget->findChild<QLabel *>(QString(CALL_ITEM_CALL_NUMBER)); - QString number = callNumber->text(); + QString number = labelCallNumber->text(); this->account = SFLPhone::firstAccount(); if(!account.isEmpty()) { @@ -345,8 +352,7 @@ void Call::call() void Call::transfer() { CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); - QLabel * transferNumber = itemWidget->findChild<QLabel *>(QString(CALL_ITEM_TRANSFER_NUMBER)); - QString number = transferNumber->text(); + QString number = labelTransferNumber->text(); qDebug() << "Transfering call to number : " << number << ". callId : " << callId; callManager.transfert(callId, number); this->stopTime = new QDateTime(QDateTime::currentDateTime()); @@ -377,15 +383,48 @@ void Call::setRecord() void Call::appendItemText(QString text) { - if(currentState == CALL_STATE_TRANSFER || currentState == CALL_STATE_TRANSF_HOLD) + QLabel * editNumber; + switch(currentState) + { + case CALL_STATE_TRANSFER: + case CALL_STATE_TRANSF_HOLD: + editNumber = labelTransferNumber; + break; + case CALL_STATE_DIALING: + editNumber = labelCallNumber; + break; + default: + qDebug() << "Type key on call not editable. Doing nothing."; + return; + } + editNumber->setText(editNumber->text() + text); +} + +void Call::backspaceItemText() +{ + QLabel * editNumber; + switch (currentState) + { + case CALL_STATE_TRANSFER: + case CALL_STATE_TRANSF_HOLD: + editNumber = labelTransferNumber; + break; + case CALL_STATE_DIALING: + editNumber = labelCallNumber; + break; + default: + qDebug() << "Backspace on call not editable. Doing nothing."; + return; + } + QString text = editNumber->text(); + int textSize = text.size(); + if(textSize > 0) { - QLabel * transferNumber = itemWidget->findChild<QLabel *>(QString(CALL_ITEM_TRANSFER_NUMBER)); - transferNumber->setText(transferNumber->text() + text); + editNumber->setText(text.remove(textSize-1, 1)); } else { - QLabel * callNumber = itemWidget->findChild<QLabel *>(QString(CALL_ITEM_CALL_NUMBER)); - callNumber->setText(callNumber->text() + text); + changeCurrentState(CALL_STATE_OVER); } } @@ -397,25 +436,16 @@ void Call::changeCurrentState(call_state newState) void Call::updateItem() { - qDebug() << callStateIcons[currentState]; - qDebug() << "updateItem0"; - QString str(callStateIcons[currentState]); - qDebug() << "updateItem1"; - setItemIcon(str); - qDebug() << "updateItem2"; + if(currentState == CALL_STATE_CURRENT && recording) + setItemIcon(ICON_CURRENT_REC); + else + { + QString str(callStateIcons[currentState]); + setItemIcon(str); + } bool transfer = currentState == CALL_STATE_TRANSFER || currentState == CALL_STATE_TRANSF_HOLD; - qDebug() << "updateItem3"; - qDebug() << "transfer : " << transfer; - qDebug() << "updateItem4"; - QLabel * transferLabel = itemWidget->findChild<QLabel *>(QString(CALL_ITEM_TRANSFER_LABEL)); - qDebug() << "updateItem5"; - QLabel * transferNumber = itemWidget->findChild<QLabel *>(QString(CALL_ITEM_TRANSFER_NUMBER)); - qDebug() << "updateItem6"; - transferLabel->setVisible(transfer); - qDebug() << "updateItem7"; - transferNumber->setVisible(transfer); - qDebug() << "updateItem8"; + labelTransferPrefix->setVisible(transfer); + labelTransferNumber->setVisible(transfer); if(!transfer) - transferNumber->setText(""); - qDebug() << "updateItem9"; + labelTransferNumber->setText(""); } diff --git a/sflphone_kde/Call.h b/sflphone_kde/Call.h index d3938fea931346dc1b97e93442ed213f817e75ef..0a788715ac80903f31ae59b432a3105b5e42b658 100644 --- a/sflphone_kde/Call.h +++ b/sflphone_kde/Call.h @@ -100,7 +100,7 @@ private: QWidget * itemWidget; QLabel * labelIcon; QLabel * labelCallNumber; - QLabel * labelTransferTo; + QLabel * labelTransferPrefix; QLabel * labelTransferNumber; QListWidgetItem * historyItem; @@ -140,6 +140,7 @@ public: void initCallItem(); static Call * buildDialingCall(QString callId); static Call * buildIncomingCall(const QString & callId, const QString & from, const QString & account); + static Call * buildRingingCall(const QString & callId); QListWidgetItem * getItem(); QWidget * getItemWidget(); QListWidgetItem * getHistoryItem(); @@ -151,6 +152,7 @@ public: history_state getHistoryState() const; bool getRecording() const; void appendItemText(QString text); + void backspaceItemText(); void setItemIcon(const QString pixmap); void changeCurrentState(call_state newState); void updateItem(); diff --git a/sflphone_kde/CallList.cpp b/sflphone_kde/CallList.cpp index cf8a00a3bb012715b6b45188b8b71f10978370f9..a5d0736299ac8c93e7e15cd9606777f408c447d8 100644 --- a/sflphone_kde/CallList.cpp +++ b/sflphone_kde/CallList.cpp @@ -6,6 +6,14 @@ CallList::CallList() calls = new QVector<Call *>(); } +CallList::~CallList() +{ + for(int i=0 ; i<size() ; i++) + { + delete (*calls)[i]; + } + delete calls; +} Call * CallList::operator[](const QListWidgetItem * item) { @@ -72,4 +80,11 @@ Call * CallList::addIncomingCall(const QString & callId, const QString & from, c Call * call = Call::buildIncomingCall(callId, from, account); calls->append(call); return call; +} + +Call * CallList::addRingingCall(const QString & callId) +{ + Call * call = Call::buildRingingCall(callId); + calls->append(call); + return call; } \ No newline at end of file diff --git a/sflphone_kde/CallList.h b/sflphone_kde/CallList.h index 5980252bb224ccda6ba0bb840321bf7849856fcf..50842d3ca4952be76d039b75e8cd1ec1a4be3074 100644 --- a/sflphone_kde/CallList.h +++ b/sflphone_kde/CallList.h @@ -21,6 +21,7 @@ public: Call * addDialingCall(); Call * addIncomingCall(const QString & callId, const QString & from, const QString & account); + Call * addRingingCall(const QString & callId); QString getAndIncCallId(); int size(); diff --git a/sflphone_kde/ConfigDialog.cpp b/sflphone_kde/ConfigDialog.cpp index 0de3f2a58d01002047bd5a85da7c8036415bf203..461c16c549242e49c6687ef306378b1fd14b0e49 100644 --- a/sflphone_kde/ConfigDialog.cpp +++ b/sflphone_kde/ConfigDialog.cpp @@ -115,7 +115,6 @@ void ConfigurationDialog::loadOptions() //ringtones settings checkBox_ringtones->setCheckState(configurationManager.isRingtoneEnabled() ? Qt::Checked : Qt::Unchecked); - //TODO widget choix de sonnerie urlComboRequester_ringtone->setUrl(KUrl::fromPath(configurationManager.getRingtoneChoice())); //codecs settings @@ -206,8 +205,6 @@ void ConfigurationDialog::saveOptions() //ringtones settings qDebug() << "setting ringtone options"; if(checkBox_ringtones->checkState() != (configurationManager.isRingtoneEnabled() ? Qt::Checked : Qt::Unchecked)) configurationManager.ringtoneEnabled(); - //TODO widget choix de sonnerie - //configurationManager.setRingtoneChoice(urlComboRequester_ringtone->text()); configurationManager.setRingtoneChoice(urlComboRequester_ringtone->url().url()); //codecs settings @@ -265,7 +262,7 @@ void ConfigurationDialog::saveAccountList() //if the account has no instanciated id, it has just been created in the client if(current.isNew()) { - currentId = QString(configurationManager.addAccount(current.getAccountDetails())); + currentId = configurationManager.addAccount(current.getAccountDetails()); } //if the account has an instanciated id but it's not in configurationManager else{ @@ -284,10 +281,13 @@ void ConfigurationDialog::saveAccountList() } //remove accounts that are in the configurationManager but not in the client for (int i = 0; i < accountIds.size(); i++) - if(! accountList->getAccountById(accountIds[i])){ + { + if(! accountList->getAccountById(accountIds[i])) + { qDebug() << "remove account " << accountIds[i]; configurationManager.removeAccount(accountIds[i]); } + } } void ConfigurationDialog::loadAccount(QListWidgetItem * item) @@ -298,8 +298,15 @@ void ConfigurationDialog::loadAccount(QListWidgetItem * item) if(! account ) { qDebug() << "Attempting to load details of an unexisting account"; return; } edit1_alias->setText( account->getAccountDetail(*(new QString(ACCOUNT_ALIAS)))); - int protocoleIndex = getProtocoleIndex(account->getAccountDetail(*(new QString(ACCOUNT_TYPE)))); - edit2_protocol->setCurrentIndex( (protocoleIndex < 0) ? 0 : protocoleIndex ); + + QString protocolsTab[] = ACCOUNT_TYPES_TAB; + QList<QString> * protocolsList = new QList<QString>(); + for(int i=0;i<sizeof(protocolsTab)/sizeof(QString);i++) protocolsList->append(protocolsTab[i]); + QString accountName = account->getAccountDetail(* new QString(ACCOUNT_TYPE)); + int protocolIndex = protocolsList->indexOf(accountName); + delete protocolsList; + + edit2_protocol->setCurrentIndex( (protocolIndex < 0) ? 0 : protocolIndex ); edit3_server->setText( account->getAccountDetail(*(new QString(ACCOUNT_HOSTNAME)))); edit4_user->setText( account->getAccountDetail(*(new QString(ACCOUNT_USERNAME)))); edit5_password->setText( account->getAccountDetail(*(new QString(ACCOUNT_PASSWORD)))); @@ -319,7 +326,8 @@ void ConfigurationDialog::saveAccount(QListWidgetItem * item) if(! account) { qDebug() << "Attempting to save details of an unexisting account : " << item->text(); return; } account->setAccountDetail(ACCOUNT_ALIAS, edit1_alias->text()); - account->setAccountDetail(ACCOUNT_TYPE, getIndexProtocole(edit2_protocol->currentIndex())); + QString protocolsTab[] = ACCOUNT_TYPES_TAB; + account->setAccountDetail(ACCOUNT_TYPE, protocolsTab[edit2_protocol->currentIndex()]); account->setAccountDetail(ACCOUNT_HOSTNAME, edit3_server->text()); account->setAccountDetail(ACCOUNT_USERNAME, edit4_user->text()); account->setAccountDetail(ACCOUNT_PASSWORD, edit5_password->text()); diff --git a/sflphone_kde/ConfigDialog.ui b/sflphone_kde/ConfigDialog.ui index dad667766bed75c39d699a55806af719b452053c..03b803514d7338235aa3163898a83fcf638cd404 100644 --- a/sflphone_kde/ConfigDialog.ui +++ b/sflphone_kde/ConfigDialog.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>681</width> - <height>455</height> + <width>504</width> + <height>449</height> </rect> </property> <property name="minimumSize" > @@ -152,7 +152,7 @@ <item> <widget class="QStackedWidget" name="stackedWidget_options" > <property name="currentIndex" > - <number>3</number> + <number>2</number> </property> <widget class="QWidget" name="page_general" > <layout class="QVBoxLayout" name="verticalLayout_18" > @@ -452,9 +452,30 @@ </item> <item> <widget class="QWidget" native="1" name="widget1_configAccounts" > + <property name="autoFillBackground" > + <bool>false</bool> + </property> <layout class="QHBoxLayout" name="horizontalLayout_3" > + <property name="sizeConstraint" > + <enum>QLayout::SetDefaultConstraint</enum> + </property> + <property name="leftMargin" > + <number>0</number> + </property> + <property name="topMargin" > + <number>0</number> + </property> + <property name="bottomMargin" > + <number>0</number> + </property> <item> <widget class="QFrame" name="frame1_accountList" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Preferred" hsizetype="Preferred" > + <horstretch>1</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="minimumSize" > <size> <width>0</width> @@ -477,7 +498,7 @@ <item> <widget class="QListWidget" name="listWidget_accountList" > <property name="sizePolicy" > - <sizepolicy vsizetype="Expanding" hsizetype="Preferred" > + <sizepolicy vsizetype="Expanding" hsizetype="Expanding" > <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> @@ -490,7 +511,7 @@ </property> <property name="maximumSize" > <size> - <width>150</width> + <width>16777215</width> <height>16777215</height> </size> </property> @@ -526,6 +547,9 @@ <property name="spacing" > <number>0</number> </property> + <property name="sizeConstraint" > + <enum>QLayout::SetNoConstraint</enum> + </property> <property name="margin" > <number>0</number> </property> @@ -573,19 +597,32 @@ </widget> </item> <item> - <widget class="QToolButton" name="button_accountDown" > + <widget class="QToolButton" name="button_accountUp" > <property name="text" > - <string>Down</string> + <string>Up</string> </property> </widget> </item> <item> - <widget class="QToolButton" name="button_accountUp" > + <widget class="QToolButton" name="button_accountDown" > <property name="text" > - <string>Up</string> + <string>Down</string> </property> </widget> </item> + <item> + <spacer name="horizontalSpacer" > + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0" > + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> </layout> </widget> </item> @@ -596,7 +633,7 @@ <widget class="QFrame" name="frame2_editAccounts" > <property name="sizePolicy" > <sizepolicy vsizetype="Expanding" hsizetype="Expanding" > - <horstretch>0</horstretch> + <horstretch>1</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> @@ -1069,6 +1106,16 @@ </widget> </widget> </item> + <item> + <widget class="QWidget" native="1" name="widget_fullConfigAudio" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Expanding" hsizetype="Preferred" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> </layout> </widget> </widget> diff --git a/sflphone_kde/SFLPhone.cpp b/sflphone_kde/SFLPhone.cpp index 9199bccef872f367974e691cdac075cc895f9aa0..8d93445fb6d5858f26103670674dde381f81a2a6 100644 --- a/sflphone_kde/SFLPhone.cpp +++ b/sflphone_kde/SFLPhone.cpp @@ -73,17 +73,36 @@ QString SFLPhone::firstAccount() return QString(); } +QList<Account *> SFLPhone::registeredAccounts() +{ + ConfigurationManagerInterface & daemon = ConfigurationManagerInterfaceSingleton::getInstance(); + //ask for the list of accounts ids to the daemon + QStringList accountIds = daemon.getAccountList().value(); + for (int i = 0; i < accountIds.size(); ++i){ + MapStringString accountDetails = daemon.getAccountDetails(accountIds[i]); + if(accountDetails[QString(ACCOUNT_STATUS)] == QString(ACCOUNT_STATE_REGISTERED)) + { + return accountIds[i]; + } + } + return QString(); +} + void SFLPhone::addCallToCallList(Call * call) { - qDebug() << "addCallToCallList"; QListWidgetItem * item = call->getItem(); - qDebug() << "addCallToCallList2"; QWidget * widget = call->getItemWidget(); - qDebug() << "addCallToCallList3"; listWidget_callList->addItem(item); - qDebug() << "addCallToCallList4"; listWidget_callList->setItemWidget(item, widget); - qDebug() << "addCallToCallList5"; +} + +void SFLPhone::addCallToCallHistory(Call * call) +{ + QListWidgetItem * item = call->getHistoryItem(); + if(item) + { + listWidget_callHistory->addItem(item); + } } void SFLPhone::typeString(QString str) @@ -102,13 +121,46 @@ void SFLPhone::typeString(QString str) listWidget_callList->setCurrentRow(listWidget_callList->count() - 1); } callList->getCallByItem(listWidget_callList->currentItem())->appendItemText(str); - //listWidget_callList->currentItem()->setText(listWidget_callList->currentItem()->text() + str); } if(stackedWidget_screen->currentWidget() == page_callHistory) { qDebug() << "In call history."; label_searchHistory->setText(label_searchHistory->text() + str); - + } +} + +void SFLPhone::backspace() +{ + qDebug() << "backspace"; + if(stackedWidget_screen->currentWidget() == page_callList) + { + QListWidgetItem * item = listWidget_callList->currentItem(); + if(!item) + { + qDebug() << "Backspace when no item is selected. Doing nothing."; + } + else + { + Call * call = callList->getCallByItem(listWidget_callList->currentItem()); + if(!call) + { + qDebug() << "Error : Backspace on unexisting call."; + } + else + { + call->backspaceItemText(); + updateCallItem(call); + } + } + } + if(stackedWidget_screen->currentWidget() == page_callHistory) + { + qDebug() << "In call history."; + int textSize = label_searchHistory->text().size(); + if(textSize > 0) + { + label_searchHistory->setText(label_searchHistory->text().remove(textSize-1, 1)); + } } } @@ -122,6 +174,7 @@ void SFLPhone::actionb(Call * call, call_action action) { errorWindow->showMessage(QString(msg)); } + updateCallItem(call); updateWindowCallState(); } @@ -134,6 +187,17 @@ void SFLPhone::action(QListWidgetItem * item, call_action action) ******** Update Display Functions ********** *******************************************/ +void SFLPhone::updateCallItem(Call * call) +{ + QListWidgetItem * item = call->getItem(); + call_state state = call->getState(); + if(state == CALL_STATE_OVER) + { + qDebug() << "Updating call with CALL_STATE_OVER. Deleting item " << (*callList)[item]->getCallId(); + listWidget_callList->takeItem(listWidget_callList->row(item)); + addCallToCallHistory(call); + } +} void SFLPhone::updateWindowCallState() @@ -142,7 +206,6 @@ void SFLPhone::updateWindowCallState() QListWidgetItem * item; bool enabledActions[6]= {true,true,true,true,true,true}; - char * iconFile; char * buttonIconFiles[3] = {ICON_CALL, ICON_HANGUP, ICON_HOLD}; bool transfer = false; //tells whether the call is in recording position @@ -172,7 +235,6 @@ void SFLPhone::updateWindowCallState() { case CALL_STATE_INCOMING: qDebug() << "Reached CALL_STATE_INCOMING with call " << (*callList)[item]->getCallId() << ". Updating window."; - iconFile = ICON_INCOMING; buttonIconFiles[0] = ICON_ACCEPT; buttonIconFiles[1] = ICON_REFUSE; break; @@ -180,11 +242,9 @@ void SFLPhone::updateWindowCallState() qDebug() << "Reached CALL_STATE_RINGING with call " << (*callList)[item]->getCallId() << ". Updating window."; enabledActions[2] = false; enabledActions[3] = false; - iconFile = ICON_RINGING; break; case CALL_STATE_CURRENT: qDebug() << "Reached CALL_STATE_CURRENT with call " << (*callList)[item]->getCallId() << ". Updating window."; - iconFile = ICON_CURRENT; recordEnabled = true; break; case CALL_STATE_DIALING: @@ -192,12 +252,10 @@ void SFLPhone::updateWindowCallState() enabledActions[2] = false; enabledActions[3] = false; enabledActions[4] = false; - iconFile = ICON_DIALING; buttonIconFiles[0] = ICON_ACCEPT; break; case CALL_STATE_HOLD: qDebug() << "Reached CALL_STATE_HOLD with call " << (*callList)[item]->getCallId() << ". Updating window."; - iconFile = ICON_HOLD; buttonIconFiles[2] = ICON_UNHOLD; break; case CALL_STATE_FAILURE: @@ -206,7 +264,6 @@ void SFLPhone::updateWindowCallState() enabledActions[2] = false; enabledActions[3] = false; enabledActions[4] = false; - iconFile = ICON_FAILURE; break; case CALL_STATE_BUSY: qDebug() << "Reached CALL_STATE_BUSY with call " << (*callList)[item]->getCallId() << ". Updating window."; @@ -214,44 +271,30 @@ void SFLPhone::updateWindowCallState() enabledActions[2] = false; enabledActions[3] = false; enabledActions[4] = false; - iconFile = ICON_BUSY; break; case CALL_STATE_TRANSFER: qDebug() << "Reached CALL_STATE_TRANSFER with call " << (*callList)[item]->getCallId() << ". Updating window."; - iconFile = ICON_TRANSFER; buttonIconFiles[0] = ICON_EXEC_TRANSF; transfer = true; recordEnabled = true; break; case CALL_STATE_TRANSF_HOLD: qDebug() << "Reached CALL_STATE_TRANSF_HOLD with call " << (*callList)[item]->getCallId() << ". Updating window."; - iconFile = ICON_TRANSF_HOLD; buttonIconFiles[0] = ICON_EXEC_TRANSF; buttonIconFiles[2] = ICON_UNHOLD; transfer = true; break; case CALL_STATE_OVER: - qDebug() << "Reached CALL_STATE_OVER. Deleting item " << (*callList)[item]->getCallId(); - listWidget_callList->takeItem(listWidget_callList->row(item)); - listWidget_callHistory->addItem(call->getHistoryItem()); - qDebug() << call->getHistoryItem(); - listWidget_callHistory->setCurrentRow(listWidget_callHistory->count() - 1); - return; + qDebug() << "Error : Reached CALL_STATE_OVER with call " << (*callList)[item]->getCallId() << "!"; break; case CALL_STATE_ERROR: - qDebug() << "Reached CALL_STATE_ERROR with call " << (*callList)[item]->getCallId() << "!"; + qDebug() << "Error : Reached CALL_STATE_ERROR with call " << (*callList)[item]->getCallId() << "!"; break; default: - qDebug() << "Reached unexisting state for call " << (*callList)[item]->getCallId() << "!"; + qDebug() << "Error : Reached unexisting state for call " << (*callList)[item]->getCallId() << "!"; break; } } - //qDebug() << "mi"; - if (item && iconFile) - { - qDebug() << "rentre " << item; - item->setIcon(QIcon(iconFile)); - } } if(stackedWidget_screen->currentWidget() == page_callHistory) { @@ -314,7 +357,7 @@ void SFLPhone::updateCallHistory() { Call * call = (*callList)[i]; qDebug() << "" << call->getCallId(); - if(call->getState() == CALL_STATE_OVER && call->getHistoryItem()->text().contains(textSearched)) + if(call->getState() == CALL_STATE_OVER && call->getHistoryState() != NONE && call->getHistoryItem()->text().contains(textSearched)) { qDebug() << "call->getItem()->text()=" << call->getHistoryItem()->text() << " contains textSearched=" << textSearched; listWidget_callHistory->addItem(call->getHistoryItem()); @@ -370,6 +413,8 @@ void SFLPhone::updateVolumeButton() if(sndVol > 0) toolButton_sndVol->setChecked(false); } + + void SFLPhone::updateRecordBar() { qDebug() << "updateRecordBar"; @@ -459,11 +504,11 @@ void SFLPhone::on_slider_sndVol_valueChanged(int value) updateVolumeButton(); } -void SFLPhone::on_toolButton_recVol_clicked() +void SFLPhone::on_toolButton_recVol_clicked(bool checked) { CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); qDebug() << "on_toolButton_recVol_clicked()."; - if(! toolButton_recVol->isChecked()) + if(!checked) { qDebug() << "checked"; toolButton_recVol->setChecked(false); @@ -478,22 +523,13 @@ void SFLPhone::on_toolButton_recVol_clicked() callManager.setVolume(RECORD_DEVICE, 0.0); } updateRecordButton(); - /* - qDebug() << "on_toolButton_recVol_clicked(). checked = " << toolButton_recVol->isChecked(); - CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); - toolButton_recVol->setChecked(toolButton_recVol->isChecked()); - //toolButton_recVol->setChecked(true); - slider_recVol->setEnabled(! toolButton_recVol->isChecked()); - callManager.setVolume(RECORD_DEVICE, toolButton_recVol->isChecked() ? (double)slider_recVol->value() / 100.0 : 0.0); - updateRecordButton(); - */ } -void SFLPhone::on_toolButton_sndVol_clicked() +void SFLPhone::on_toolButton_sndVol_clicked(bool checked) { CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); qDebug() << "on_toolButton_sndVol_clicked()."; - if(! toolButton_sndVol->isChecked()) + if(!checked) { qDebug() << "checked"; toolButton_sndVol->setChecked(false); @@ -508,15 +544,6 @@ void SFLPhone::on_toolButton_sndVol_clicked() callManager.setVolume(SOUND_DEVICE, 0.0); } updateVolumeButton(); - /* - qDebug() << "on_toolButton_sndVol_clicked(). checked = " << toolButton_recVol->isChecked(); - CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); - toolButton_sndVol->setChecked(toolButton_sndVol->isChecked()); - slider_sndVol->setEnabled(! toolButton_sndVol->isChecked()); - //callManager.setVolume(SOUND_DEVICE, toolButton_recVol->isChecked() ? 0.0 : (double)slider_sndVol->value() / 100.0); - callManager.setVolume(SOUND_DEVICE, 0.0); - updateVolumeButton(); - */ } @@ -532,6 +559,38 @@ void SFLPhone::on_listWidget_callList_itemChanged() stackedWidget_screen->setCurrentWidget(page_callList); } +void SFLPhone::on_listWidget_callList_itemDoubleClicked(QListWidgetItem * item) +{ + qDebug() << "on_listWidget_callList_itemDoubleClicked"; + Call * call = callList->getCallByItem(item); + call_state state = call->getCurrentState(); + switch(state) + { + case CALL_STATE_HOLD: + actionb(call, CALL_ACTION_HOLD); + break; + case CALL_STATE_DIALING: + actionb(call, CALL_ACTION_ACCEPT); + break; + default: + qDebug() << "Double clicked an item with no action on double click."; + } +} + + +void SFLPhone::contextMenuEvent(QContextMenuEvent *event) +{ + QMenu menu(this); + menu.addAction(action_accept); + menu.addAction(action_refuse); + menu.addAction(action_hold); + menu.addAction(action_transfer); + menu.addAction(action_record); + //TODO accounts to choose + menu.addSeparator(); + menu.exec(event->globalPos()); +} + void SFLPhone::on_listWidget_callHistory_currentItemChanged() { qDebug() << "on_listWidget_callHistory_currentItemChanged"; @@ -600,7 +659,7 @@ void SFLPhone::on_action_refuse_triggered() QListWidgetItem * item = listWidget_callList->currentItem(); if(!item) { - qDebug() << "Hanging up when no item selected. Should not happen."; + qDebug() << "Error : Hanging up when no item selected. Should not happen."; } else { @@ -618,7 +677,7 @@ void SFLPhone::on_action_hold_triggered() QListWidgetItem * item = listWidget_callList->currentItem(); if(!item) { - qDebug() << "Holding when no item selected. Should not happen."; + qDebug() << "Error : Holding when no item selected. Should not happen."; } else { @@ -631,7 +690,7 @@ void SFLPhone::on_action_transfer_triggered() QListWidgetItem * item = listWidget_callList->currentItem(); if(!item) { - qDebug() << "Transfering when no item selected. Should not happen."; + qDebug() << "Error : Transfering when no item selected. Should not happen."; } else { @@ -644,7 +703,7 @@ void SFLPhone::on_action_record_triggered() QListWidgetItem * item = listWidget_callList->currentItem(); if(!item) { - qDebug() << "Recording when no item selected. Should not happen."; + qDebug() << "Error : Recording when no item selected. Should not happen."; } else { @@ -679,27 +738,37 @@ void SFLPhone::on_action_mailBox_triggered() void SFLPhone::on1_callStateChanged(const QString &callID, const QString &state) { - qDebug() << "on_callStateChanged " << callID << " . New state : " << state; + qDebug() << "Signal : Call State Changed for call " << callID << " . New state : " << state; Call * call = (*callList)[callID]; if(!call) { - qDebug() << "Call doesn't exist in this client. Might have been initialized by another client instance before this one started."; + if(state == CALL_STATE_CHANGE_RINGING) + { + call = callList->addRingingCall(callID); + addCallToCallList(call); + } + else + { + qDebug() << "Call doesn't exist in this client. Might have been initialized by another client instance before this one started."; + return; + } } else { call->stateChanged(state); } + updateCallItem(call); updateWindowCallState(); } void SFLPhone::on1_error(MapStringString details) { - qDebug() << "Daemon error : " << details; + qDebug() << "Signal : Daemon error : " << details; } void SFLPhone::on1_incomingCall(const QString &accountID, const QString & callID, const QString &from) { - qDebug() << "Incoming Call !"; + qDebug() << "Signal : Incoming Call !"; Call * call = callList->addIncomingCall(callID, from, accountID); addCallToCallList(call); listWidget_callList->setCurrentRow(listWidget_callList->count() - 1); @@ -707,17 +776,17 @@ void SFLPhone::on1_incomingCall(const QString &accountID, const QString & callID void SFLPhone::on1_incomingMessage(const QString &accountID, const QString &message) { - qDebug() << "on_incomingMessage ! "; + qDebug() << "Signal : Incoming Message ! "; } void SFLPhone::on1_voiceMailNotify(const QString &accountID, int count) { - qDebug() << "on_voiceMailNotify ! " << count << " new voice mails for account " << accountID; + qDebug() << "Signal : VoiceMail Notify ! " << count << " new voice mails for account " << accountID; } void SFLPhone::on1_volumeChanged(const QString &device, double value) { - qDebug() << "on_volumeChanged !"; + qDebug() << "Signal : Volume Changed !"; if(! (toolButton_recVol->isChecked() && value == 0.0)) updateRecordBar(); if(! (toolButton_sndVol->isChecked() && value == 0.0)) @@ -725,11 +794,3 @@ void SFLPhone::on1_volumeChanged(const QString &device, double value) } -/*void SFLPhone::on_actionAbout() -{ - -}*/ - - - - diff --git a/sflphone_kde/SFLPhone.h b/sflphone_kde/SFLPhone.h index fb6b520d403621ea04d8041575baafe22964af3c..93f5a11984d32a449d72dea53d4b17beb073b972 100644 --- a/sflphone_kde/SFLPhone.h +++ b/sflphone_kde/SFLPhone.h @@ -20,6 +20,9 @@ private: CallList * callList; QErrorMessage * errorWindow; +protected: + void contextMenuEvent(QContextMenuEvent *event); + public: SFLPhone(QMainWindow *parent = 0); ~SFLPhone(); @@ -29,11 +32,14 @@ public: private slots: //void typeChar(QChar c); void typeString(QString str); + void backspace(); void actionb(Call * call, call_action action); void action(QListWidgetItem * item, call_action action); void addCallToCallList(Call * call); + void addCallToCallHistory(Call * call); + void updateCallItem(Call * call); void updateWindowCallState(); void updateSearchHistory(); void updateCallHistory(); @@ -46,12 +52,23 @@ private slots: virtual void keyPressEvent(QKeyEvent *event) { - QString text = event->text(); - if(! text.isEmpty()) + int key = event->key(); + if(key == Qt::Key_Escape) + on_action_refuse_triggered(); + else if(key == Qt::Key_Return || key == Qt::Key_Enter) + on_action_accept_triggered(); + else if(key == Qt::Key_Backspace) + backspace(); + else { - typeString(text); + QString text = event->text(); + if(! event->text().isEmpty()) + { + typeString(text); + } } } + void on_action_displayVolumeControls_toggled(); void on_action_displayDialpad_toggled(); @@ -86,11 +103,12 @@ private slots: void on_slider_recVol_valueChanged(int value); void on_slider_sndVol_valueChanged(int value); - void on_toolButton_recVol_clicked(); - void on_toolButton_sndVol_clicked(); + void on_toolButton_recVol_clicked(bool checked); + void on_toolButton_sndVol_clicked(bool checked); void on_listWidget_callList_currentItemChanged(); void on_listWidget_callList_itemChanged(); + void on_listWidget_callList_itemDoubleClicked(QListWidgetItem * item); void on_listWidget_callHistory_currentItemChanged(); void on1_callStateChanged(const QString &callID, const QString &state); diff --git a/sflphone_kde/icons/record.svg b/sflphone_kde/icons/record.svg new file mode 100644 index 0000000000000000000000000000000000000000..9147567fec03ead2e355bc685db957fd18da2db0 --- /dev/null +++ b/sflphone_kde/icons/record.svg @@ -0,0 +1,1057 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="24" + height="24" + id="svg2" + sodipodi:version="0.32" + inkscape:version="0.46" + version="1.0" + sodipodi:docbase="/home/plbeaudoin/SFLPhone/sflphone/sflphone-gtk/pixmaps" + sodipodi:docname="rec_call2.svg" + inkscape:output_extension="org.inkscape.output.svg.inkscape" + sodipodi:modified="true"> + <defs + id="defs4"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 12 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="24 : 12 : 1" + inkscape:persp3d-origin="12 : 8 : 1" + id="perspective77" /> + <linearGradient + id="linearGradient4045"> + <stop + style="stop-color:#ffffff;stop-opacity:0" + offset="0" + id="stop4047" /> + <stop + style="stop-color:#fefee7;stop-opacity:0.89308178" + offset="1" + id="stop4049" /> + </linearGradient> + <linearGradient + id="linearGradient4269"> + <stop + style="stop-color:#1db000;stop-opacity:1;" + offset="0" + id="stop4271" /> + <stop + style="stop-color:#1db000;stop-opacity:0;" + offset="1" + id="stop4273" /> + </linearGradient> + <linearGradient + id="linearGradient4183"> + <stop + id="stop4185" + offset="0" + style="stop-color:#1db000;stop-opacity:1;" /> + <stop + id="stop4187" + offset="1" + style="stop-color:#0f5f00;stop-opacity:1;" /> + </linearGradient> + <linearGradient + id="linearGradient4167"> + <stop + style="stop-color:#80000e;stop-opacity:1;" + offset="0" + id="stop4169" /> + <stop + style="stop-color:#b00014;stop-opacity:0;" + offset="1" + id="stop4171" /> + </linearGradient> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient4183" + id="linearGradient2224" + x1="16.826796" + y1="6.7288713" + x2="27.5625" + y2="22.512505" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(0.875025,0,0,0.875025,0.666703,0.177907)" /> + <linearGradient + y2="13.920053" + x2="6.8378897" + y1="12.625902" + x1="2.0651877" + gradientTransform="matrix(-1,0,0,1,32.04188,-2.86473)" + gradientUnits="userSpaceOnUse" + id="linearGradient1388" + xlink:href="#linearGradient4269" + inkscape:collect="always" /> + <linearGradient + gradientTransform="translate(0.426158,-2.762136)" + gradientUnits="userSpaceOnUse" + y2="13.920053" + x2="6.8378897" + y1="12.625902" + x1="2.0651877" + id="linearGradient1386" + xlink:href="#linearGradient4269" + inkscape:collect="always" /> + <linearGradient + gradientUnits="userSpaceOnUse" + y2="10.576721" + x2="14.013638" + y1="2.7028866" + x1="15.647213" + id="linearGradient1384" + xlink:href="#linearGradient4183" + inkscape:collect="always" /> + <linearGradient + gradientTransform="translate(-0.947018,-0.885198)" + gradientUnits="userSpaceOnUse" + y2="12.535715" + x2="31.31678" + y1="12.535715" + x1="24.397505" + id="linearGradient1382" + xlink:href="#linearGradient4183" + inkscape:collect="always" /> + <linearGradient + gradientTransform="translate(1.262691,-1.100752)" + gradientUnits="userSpaceOnUse" + y2="12.825893" + x2="7.9239235" + y1="12.825893" + x1="1.0046476" + id="linearGradient1380" + xlink:href="#linearGradient4183" + inkscape:collect="always" /> + <linearGradient + id="linearGradient1374"> + <stop + id="stop1376" + offset="0" + style="stop-color:#80000e;stop-opacity:1;" /> + <stop + id="stop1378" + offset="1" + style="stop-color:#b00014;stop-opacity:0;" /> + </linearGradient> + <linearGradient + id="linearGradient1368"> + <stop + style="stop-color:#26b000;stop-opacity:1;" + offset="0" + id="stop1370" /> + <stop + style="stop-color:#145f00;stop-opacity:1;" + offset="1" + id="stop1372" /> + </linearGradient> + <linearGradient + id="linearGradient1362"> + <stop + id="stop1364" + offset="0" + style="stop-color:#26b000;stop-opacity:1;" /> + <stop + id="stop1366" + offset="1" + style="stop-color:#26b000;stop-opacity:0;" /> + </linearGradient> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient4183" + id="linearGradient1406" + gradientUnits="userSpaceOnUse" + x1="15.647213" + y1="2.7028866" + x2="14.013638" + y2="10.576721" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient4183" + id="linearGradient1408" + gradientUnits="userSpaceOnUse" + gradientTransform="translate(1.262691,-1.100752)" + x1="10.57493" + y1="12.115559" + x2="-0.68574232" + y2="12.115559" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient4183" + id="linearGradient1410" + gradientUnits="userSpaceOnUse" + gradientTransform="translate(-0.947018,-0.885198)" + x1="31.692968" + y1="11.264216" + x2="23.888865" + y2="13.35532" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient4269" + id="linearGradient1412" + gradientUnits="userSpaceOnUse" + gradientTransform="translate(0.426158,-2.762136)" + x1="7.8517423" + y1="15.912388" + x2="7.1114841" + y2="11.597325" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient4269" + id="linearGradient1414" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(-1,0,0,1,32.04188,-2.86473)" + x1="2.0651877" + y1="12.625902" + x2="6.8378897" + y2="13.920053" /> + <radialGradient + inkscape:collect="always" + xlink:href="#linearGradient4045" + id="radialGradient4051" + cx="19.285715" + cy="9.8571424" + fx="19.285715" + fy="9.8571424" + r="10.885714" + gradientUnits="userSpaceOnUse" + spreadMethod="reflect" + gradientTransform="matrix(0.418975,0,0,0.418975,11.20548,5.727248)" /> + <linearGradient + gradientTransform="matrix(1.256521,0,0,-1.256521,-7.854319,28.773309)" + gradientUnits="userSpaceOnUse" + y2="8.5305319" + x2="15.630395" + y1="22.874208" + x1="15.630395" + id="linearGradient2444" + xlink:href="#linearGradient4269" + inkscape:collect="always" /> + <linearGradient + y2="13.920053" + x2="6.8378897" + y1="12.625902" + x1="2.0651877" + gradientTransform="matrix(-1,0,0,1,31.179578,-2.86473)" + gradientUnits="userSpaceOnUse" + id="linearGradient2442" + xlink:href="#linearGradient4269" + inkscape:collect="always" /> + <linearGradient + gradientTransform="translate(1.1362892,-2.762136)" + gradientUnits="userSpaceOnUse" + y2="13.920053" + x2="6.8378897" + y1="12.625902" + x1="2.0651877" + id="linearGradient2440" + xlink:href="#linearGradient4269" + inkscape:collect="always" /> + <linearGradient + gradientUnits="userSpaceOnUse" + y2="10.576721" + x2="14.013638" + y1="2.7028866" + x1="15.647213" + id="linearGradient2438" + xlink:href="#linearGradient4183" + inkscape:collect="always" /> + <linearGradient + gradientTransform="translate(-1.9107675,-0.885198)" + gradientUnits="userSpaceOnUse" + y2="12.535715" + x2="31.31678" + y1="12.535715" + x1="24.397505" + id="linearGradient2436" + xlink:href="#linearGradient4183" + inkscape:collect="always" /> + <linearGradient + gradientTransform="translate(1.9220986,-1.100752)" + gradientUnits="userSpaceOnUse" + y2="12.825893" + x2="7.9239235" + y1="12.825893" + x1="1.0046476" + id="linearGradient2434" + xlink:href="#linearGradient4183" + inkscape:collect="always" /> + <linearGradient + id="linearGradient2428"> + <stop + id="stop2430" + offset="0" + style="stop-color:#80000e;stop-opacity:1;" /> + <stop + id="stop2432" + offset="1" + style="stop-color:#b00014;stop-opacity:0;" /> + </linearGradient> + <linearGradient + id="linearGradient2422"> + <stop + style="stop-color:#26b000;stop-opacity:1;" + offset="0" + id="stop2424" /> + <stop + style="stop-color:#145f00;stop-opacity:1;" + offset="1" + id="stop2426" /> + </linearGradient> + <linearGradient + id="linearGradient2416"> + <stop + id="stop2418" + offset="0" + style="stop-color:#26b000;stop-opacity:1;" /> + <stop + id="stop2420" + offset="1" + style="stop-color:#26b000;stop-opacity:0;" /> + </linearGradient> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient4183" + id="linearGradient2483" + gradientUnits="userSpaceOnUse" + x1="15.647213" + y1="2.7028866" + x2="14.013638" + y2="10.576721" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient4183" + id="linearGradient2485" + gradientUnits="userSpaceOnUse" + gradientTransform="translate(1.262691,-1.100752)" + x1="10.57493" + y1="12.115559" + x2="-0.68574232" + y2="12.115559" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient4183" + id="linearGradient2487" + gradientUnits="userSpaceOnUse" + gradientTransform="translate(-0.947018,-0.885198)" + x1="31.692968" + y1="11.264216" + x2="23.888865" + y2="13.35532" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient4269" + id="linearGradient2489" + gradientUnits="userSpaceOnUse" + gradientTransform="translate(0.426158,-2.762136)" + x1="7.8517423" + y1="15.912388" + x2="7.1114841" + y2="11.597325" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient4269" + id="linearGradient2491" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(-1,0,0,1,32.04188,-2.86473)" + x1="2.0651877" + y1="12.625902" + x2="6.8378897" + y2="13.920053" /> + <linearGradient + gradientUnits="userSpaceOnUse" + y2="355.44769" + x2="189.20502" + y1="118.36168" + x1="192.86734" + id="linearGradient2702" + xlink:href="#linearGradient3169" + inkscape:collect="always" /> + <linearGradient + inkscape:collect="always" + id="linearGradient3308"> + <stop + style="stop-color:#ffffff;stop-opacity:1" + offset="0" + id="stop3310" /> + <stop + style="stop-color:#ffffff;stop-opacity:0" + offset="1" + id="stop3312" /> + </linearGradient> + <linearGradient + id="linearGradient3289" + inkscape:collect="always"> + <stop + id="stop3291" + offset="0" + style="stop-color:#999999;stop-opacity:1" /> + <stop + id="stop3293" + offset="1" + style="stop-color:#000000;stop-opacity:1" /> + </linearGradient> + <linearGradient + inkscape:collect="always" + id="linearGradient3193"> + <stop + style="stop-color:#ffffff;stop-opacity:1" + offset="0" + id="stop3195" /> + <stop + style="stop-color:#000000;stop-opacity:1" + offset="1" + id="stop3197" /> + </linearGradient> + <linearGradient + id="linearGradient3181"> + <stop + id="stop3183" + offset="0" + style="stop-color:#ff0000;stop-opacity:1;" /> + <stop + style="stop-color:#ff0000;stop-opacity:0.65271967" + offset="0.11529652" + id="stop3185" /> + <stop + id="stop3187" + offset="1" + style="stop-color:#000000;stop-opacity:0.15481172" /> + </linearGradient> + <linearGradient + id="linearGradient3169"> + <stop + id="stop3171" + offset="0" + style="stop-color:#ff0000;stop-opacity:1;" /> + <stop + id="stop3173" + offset="1" + style="stop-color:#ff0000;stop-opacity:0;" /> + </linearGradient> + <linearGradient + id="linearGradient2385"> + <stop + style="stop-color:#ff0000;stop-opacity:1;" + offset="0" + id="stop2387" /> + <stop + id="stop3175" + offset="0.87037039" + style="stop-color:#ff0000;stop-opacity:0.55172414;" /> + <stop + style="stop-color:#ff0000;stop-opacity:1;" + offset="1" + id="stop2389" /> + </linearGradient> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 526.18109 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="744.09448 : 526.18109 : 1" + inkscape:persp3d-origin="372.04724 : 350.78739 : 1" + id="perspective10" /> + <radialGradient + inkscape:collect="always" + xlink:href="#linearGradient2385" + id="radialGradient3163" + cx="184.85791" + cy="163.42795" + fx="184.85791" + fy="163.42795" + r="140.91121" + gradientUnits="userSpaceOnUse" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3181" + id="linearGradient3179" + x1="175.76654" + y1="316.97113" + x2="184.85791" + y2="23.016739" + gradientUnits="userSpaceOnUse" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3193" + id="linearGradient3199" + x1="204.55589" + y1="262.45413" + x2="204.55589" + y2="62.412689" + gradientUnits="userSpaceOnUse" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3193" + id="linearGradient3203" + gradientUnits="userSpaceOnUse" + x1="175.13184" + y1="259.03506" + x2="226.90887" + y2="65.800499" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3193" + id="linearGradient3211" + gradientUnits="userSpaceOnUse" + x1="204.55589" + y1="262.45413" + x2="204.55589" + y2="62.412689" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3193" + id="linearGradient3213" + gradientUnits="userSpaceOnUse" + x1="204.55589" + y1="262.45413" + x2="204.55589" + y2="62.412689" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3289" + id="linearGradient3287" + gradientUnits="userSpaceOnUse" + x1="224.26379" + y1="259.7438" + x2="172.07999" + y2="66.61824" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3289" + id="linearGradient3301" + gradientUnits="userSpaceOnUse" + x1="224.26379" + y1="259.7438" + x2="172.07999" + y2="66.61824" + gradientTransform="matrix(-1.1122783,-0.2980341,0.2980341,-1.1122783,376.2049,402.98248)" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3308" + id="linearGradient3306" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(-1.1122783,-0.2980341,0.2980341,-1.1122783,306.50437,364.59668)" + x1="160.2529" + y1="-5.1353641" + x2="224.82684" + y2="168.2903" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3289" + id="linearGradient3322" + gradientUnits="userSpaceOnUse" + x1="224.26379" + y1="259.7438" + x2="172.07999" + y2="66.61824" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3193" + id="linearGradient3324" + gradientUnits="userSpaceOnUse" + x1="175.13184" + y1="259.03506" + x2="226.90887" + y2="65.800499" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3308" + id="linearGradient3326" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(-1.1122783,-0.2980341,0.2980341,-1.1122783,747.63347,397.26819)" + x1="160.2529" + y1="-5.1353641" + x2="224.82684" + y2="168.2903" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3289" + id="linearGradient3336" + gradientUnits="userSpaceOnUse" + x1="224.26379" + y1="259.7438" + x2="172.07999" + y2="66.61824" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3193" + id="linearGradient3338" + gradientUnits="userSpaceOnUse" + x1="175.13184" + y1="259.03506" + x2="226.90887" + y2="65.800499" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3308" + id="linearGradient3340" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(-1.1122783,-0.2980341,0.2980341,-1.1122783,558.73494,665.96877)" + x1="160.2529" + y1="-5.1353641" + x2="224.82684" + y2="168.2903" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3289" + id="linearGradient3360" + gradientUnits="userSpaceOnUse" + x1="224.26379" + y1="259.7438" + x2="172.07999" + y2="66.61824" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3193" + id="linearGradient2641" + gradientUnits="userSpaceOnUse" + x1="175.13184" + y1="259.03506" + x2="226.90887" + y2="65.800499" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3308" + id="linearGradient3364" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(-1.1122783,-0.2980341,0.2980341,-1.1122783,558.73494,665.96877)" + x1="160.2529" + y1="-5.1353641" + x2="224.82684" + y2="168.2903" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3289" + id="linearGradient3366" + gradientUnits="userSpaceOnUse" + x1="224.26379" + y1="259.7438" + x2="172.07999" + y2="66.61824" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3193" + id="linearGradient3368" + gradientUnits="userSpaceOnUse" + x1="175.13184" + y1="259.03506" + x2="226.90887" + y2="65.800499" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3308" + id="linearGradient2646" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(-1.1122783,-0.2980341,0.2980341,-1.1122783,747.63347,397.26819)" + x1="160.2529" + y1="-5.1353641" + x2="224.82684" + y2="168.2903" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3289" + id="linearGradient3372" + gradientUnits="userSpaceOnUse" + x1="224.26379" + y1="259.7438" + x2="172.07999" + y2="66.61824" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3193" + id="linearGradient3374" + gradientUnits="userSpaceOnUse" + x1="175.13184" + y1="259.03506" + x2="226.90887" + y2="65.800499" /> + <linearGradient + y2="13.920053" + x2="6.8378897" + y1="12.625902" + x1="2.0651877" + gradientTransform="matrix(-1,0,0,1,32.04188,-2.86473)" + gradientUnits="userSpaceOnUse" + id="linearGradient2809" + xlink:href="#linearGradient4269" + inkscape:collect="always" /> + <linearGradient + y2="11.597325" + x2="7.1114841" + y1="15.912388" + x1="7.8517423" + gradientTransform="translate(0.426158,-2.762136)" + gradientUnits="userSpaceOnUse" + id="linearGradient2807" + xlink:href="#linearGradient4269" + inkscape:collect="always" /> + <linearGradient + y2="13.35532" + x2="23.888865" + y1="11.264216" + x1="31.692968" + gradientTransform="translate(-0.947018,-0.885198)" + gradientUnits="userSpaceOnUse" + id="linearGradient2805" + xlink:href="#linearGradient4183" + inkscape:collect="always" /> + <linearGradient + y2="12.115559" + x2="-0.68574232" + y1="12.115559" + x1="10.57493" + gradientTransform="translate(1.262691,-1.100752)" + gradientUnits="userSpaceOnUse" + id="linearGradient2803" + xlink:href="#linearGradient4183" + inkscape:collect="always" /> + <linearGradient + y2="10.576721" + x2="14.013638" + y1="2.7028866" + x1="15.647213" + gradientUnits="userSpaceOnUse" + id="linearGradient2801" + xlink:href="#linearGradient4183" + inkscape:collect="always" /> + <linearGradient + id="linearGradient2795"> + <stop + style="stop-color:#26b000;stop-opacity:1;" + offset="0" + id="stop2797" /> + <stop + style="stop-color:#26b000;stop-opacity:0;" + offset="1" + id="stop2799" /> + </linearGradient> + <linearGradient + id="linearGradient2789"> + <stop + id="stop2791" + offset="0" + style="stop-color:#26b000;stop-opacity:1;" /> + <stop + id="stop2793" + offset="1" + style="stop-color:#145f00;stop-opacity:1;" /> + </linearGradient> + <linearGradient + id="linearGradient2783"> + <stop + style="stop-color:#80000e;stop-opacity:1;" + offset="0" + id="stop2785" /> + <stop + style="stop-color:#b00014;stop-opacity:0;" + offset="1" + id="stop2787" /> + </linearGradient> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient4183" + id="linearGradient2781" + x1="1.0046476" + y1="12.825893" + x2="7.9239235" + y2="12.825893" + gradientUnits="userSpaceOnUse" + gradientTransform="translate(1.262691,-1.100752)" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient4183" + id="linearGradient2779" + x1="24.397505" + y1="12.535715" + x2="31.31678" + y2="12.535715" + gradientUnits="userSpaceOnUse" + gradientTransform="translate(-0.947018,-0.885198)" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient4183" + id="linearGradient2777" + x1="15.647213" + y1="2.7028866" + x2="14.013638" + y2="10.576721" + gradientUnits="userSpaceOnUse" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient4269" + id="linearGradient2775" + x1="2.0651877" + y1="12.625902" + x2="6.8378897" + y2="13.920053" + gradientUnits="userSpaceOnUse" + gradientTransform="translate(0.426158,-2.762136)" /> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient4269" + id="linearGradient2773" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(-1,0,0,1,32.04188,-2.86473)" + x1="2.0651877" + y1="12.625902" + x2="6.8378897" + y2="13.920053" /> + <linearGradient + gradientTransform="matrix(0.875025,0,0,0.875025,0.666703,0.177907)" + gradientUnits="userSpaceOnUse" + y2="22.512505" + x2="27.5625" + y1="6.7288713" + x1="16.826796" + id="linearGradient2771" + xlink:href="#linearGradient4183" + inkscape:collect="always" /> + <linearGradient + id="linearGradient2765"> + <stop + id="stop2767" + offset="0" + style="stop-color:#80000e;stop-opacity:1;" /> + <stop + id="stop2769" + offset="1" + style="stop-color:#b00014;stop-opacity:0;" /> + </linearGradient> + <linearGradient + id="linearGradient2759"> + <stop + style="stop-color:#1db000;stop-opacity:1;" + offset="0" + id="stop2761" /> + <stop + style="stop-color:#0f5f00;stop-opacity:1;" + offset="1" + id="stop2763" /> + </linearGradient> + <linearGradient + id="linearGradient2753"> + <stop + id="stop2755" + offset="0" + style="stop-color:#1db000;stop-opacity:1;" /> + <stop + id="stop2757" + offset="1" + style="stop-color:#1db000;stop-opacity:0;" /> + </linearGradient> + <linearGradient + id="linearGradient2747"> + <stop + id="stop2749" + offset="0" + style="stop-color:#ffffff;stop-opacity:0" /> + <stop + id="stop2751" + offset="1" + style="stop-color:#fcfbcb;stop-opacity:1" /> + </linearGradient> + <linearGradient + id="linearGradient3362"> + <stop + id="stop3364" + offset="0" + style="stop-color:#000000;stop-opacity:1;" /> + <stop + id="stop3366" + offset="1" + style="stop-color:#ffffff;stop-opacity:1;" /> + </linearGradient> + <linearGradient + id="linearGradient3370"> + <stop + id="stop3372" + offset="0" + style="stop-color:#d7d7d7;stop-opacity:1;" /> + <stop + id="stop3374" + offset="1" + style="stop-color:#7c7c7c;stop-opacity:1;" /> + </linearGradient> + <inkscape:perspective + id="perspective4283" + inkscape:persp3d-origin="8 : 5.3333333 : 1" + inkscape:vp_z="16 : 8 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_x="0 : 8 : 1" + sodipodi:type="inkscape:persp3d" /> + <linearGradient + gradientUnits="userSpaceOnUse" + y2="16.739393" + x2="32.578228" + y1="-0.80084854" + x1="2.965755" + id="linearGradient2439" + xlink:href="#linearGradient2433" + inkscape:collect="always" /> + <linearGradient + id="linearGradient2433" + inkscape:collect="always"> + <stop + id="stop2435" + offset="0" + style="stop-color:#008000;stop-opacity:1;" /> + <stop + id="stop2437" + offset="1" + style="stop-color:#008000;stop-opacity:0;" /> + </linearGradient> + <linearGradient + y2="10.576721" + x2="14.013638" + y1="2.7028866" + x1="15.647213" + gradientUnits="userSpaceOnUse" + id="linearGradient2734" + xlink:href="#linearGradient4183" + inkscape:collect="always" /> + <linearGradient + y2="12.115559" + x2="-0.68574232" + y1="12.115559" + x1="10.57493" + gradientTransform="translate(1.262691,-1.100752)" + gradientUnits="userSpaceOnUse" + id="linearGradient2732" + xlink:href="#linearGradient4183" + inkscape:collect="always" /> + <linearGradient + y2="13.35532" + x2="23.888865" + y1="11.264216" + x1="31.692968" + gradientTransform="translate(-0.947018,-0.885198)" + gradientUnits="userSpaceOnUse" + id="linearGradient2730" + xlink:href="#linearGradient4183" + inkscape:collect="always" /> + <linearGradient + y2="11.597325" + x2="7.1114841" + y1="15.912388" + x1="7.8517423" + gradientTransform="translate(0.426158,-2.762136)" + gradientUnits="userSpaceOnUse" + id="linearGradient2728" + xlink:href="#linearGradient4269" + inkscape:collect="always" /> + <linearGradient + y2="13.920053" + x2="6.8378897" + y1="12.625902" + x1="2.0651877" + gradientTransform="matrix(-1,0,0,1,32.04188,-2.86473)" + gradientUnits="userSpaceOnUse" + id="linearGradient2726" + xlink:href="#linearGradient4269" + inkscape:collect="always" /> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="8" + inkscape:cx="22.991745" + inkscape:cy="-5.4508769" + inkscape:document-units="px" + inkscape:current-layer="layer1" + width="32px" + height="32px" + showguides="true" + inkscape:guide-bbox="true" + inkscape:window-width="1014" + inkscape:window-height="726" + inkscape:window-x="513" + inkscape:window-y="291" + showgrid="false"> + <sodipodi:guide + orientation="vertical" + position="15.982143" + id="guide3146" /> + </sodipodi:namedview> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Calque 1" + inkscape:groupmode="layer" + id="layer1"> + <path + sodipodi:type="arc" + style="fill:url(#radialGradient4051);fill-opacity:1;stroke:none;stroke-width:5.69999981;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="path3162" + sodipodi:cx="19.285715" + sodipodi:cy="9.8571424" + sodipodi:rx="8.0357141" + sodipodi:ry="8.0357141" + d="M 27.321429,9.8571424 A 8.0357141,8.0357141 0 1 1 11.250001,9.8571424 A 8.0357141,8.0357141 0 1 1 27.321429,9.8571424 z" + transform="matrix(0.723409,0,0,0.723409,6.772732,3.51761)" /> + <g + id="g2856" + inkscape:label="Calque 1" + transform="matrix(2.1932723,0,0,2.2300726,-70.331114,24.270266)"> + <g + transform="matrix(4.3630449e-2,-7.2802504e-2,7.8718613e-2,4.2209779e-2,17.455978,-1.2908081)" + inkscape:label="Layer 1" + id="g2651"> + <g + id="g3342" + transform="matrix(0.4480735,0,0,0.4170774,98.907461,118.01666)"> + <path + transform="matrix(-1.1122783,-0.2980341,0.2980341,-1.1122783,306.50437,364.59668)" + d="M 301.02545,162.41779 A 100.0051,100.0051 0 1 1 101.01526,162.41779 A 100.0051,100.0051 0 1 1 301.02545,162.41779 z" + sodipodi:ry="100.0051" + sodipodi:rx="100.0051" + sodipodi:cy="162.41779" + sodipodi:cx="201.02036" + id="path3209" + style="opacity:1;fill:url(#linearGradient3372);fill-opacity:1;stroke:none" + sodipodi:type="arc" /> + <path + transform="matrix(0.9122383,-0.2444335,0.2444335,0.9122383,-91.758986,25.004372)" + d="M 301.02545,162.41779 A 100.0051,100.0051 0 1 1 101.01526,162.41779 A 100.0051,100.0051 0 1 1 301.02545,162.41779 z" + sodipodi:ry="100.0051" + sodipodi:rx="100.0051" + sodipodi:cy="162.41779" + sodipodi:cx="201.02036" + id="path3201" + style="opacity:0.24886876;fill:url(#linearGradient3374);fill-opacity:1;stroke:none" + sodipodi:type="arc" /> + <path + transform="matrix(-1.1122783,-0.2980341,0.2980341,-1.1122783,306.50437,364.59668)" + d="M 279.30514,162.41779 A 78.284782,79.05574 0 1 1 122.73557,162.41779 A 78.284782,79.05574 0 1 1 279.30514,162.41779 z" + sodipodi:ry="79.05574" + sodipodi:rx="78.284782" + sodipodi:cy="162.41779" + sodipodi:cx="201.02036" + id="path3295" + style="opacity:0.59728507;fill:url(#linearGradient2702);fill-opacity:1;stroke:none" + sodipodi:type="arc" /> + </g> + </g> + </g> + </g> +</svg> diff --git a/sflphone_kde/main.cpp b/sflphone_kde/main.cpp index b3c7ab7fcc029ffd08f9ff41b1920f67b63b64a9..0342788f0cc232c70b6a92316cd97a1c7ee5a10d 100644 --- a/sflphone_kde/main.cpp +++ b/sflphone_kde/main.cpp @@ -7,6 +7,7 @@ #include "SFLPhone.h" #include "AccountWizard.h" + static const char description[] = I18N_NOOP("A KDE 4 Client for SflPhone"); static const char version[] = "0.1"; diff --git a/sflphone_kde/sflphone_const.cpp b/sflphone_kde/sflphone_const.cpp index 145a90c93590cc070c34ca9952e313294c556861..6df8222b49d10577545856b875f11d79a4847992 100644 --- a/sflphone_kde/sflphone_const.cpp +++ b/sflphone_kde/sflphone_const.cpp @@ -1,19 +1,19 @@ #include "sflphone_const.h" -int getProtocoleIndex(QString protocoleName) +int getProtocolIndexByName(QString protocolName) { - if(protocoleName == (QString)"SIP") + if(protocolName == (QString)"SIP") return 0; - if(protocoleName == (QString)"IAX") + if(protocolName == (QString)"IAX") return 1; return -1; } -QString getIndexProtocole(int protocoleIndex) +QString getProtocolNameByIndex(int protocolIndex) { - if(protocoleIndex == 0) + if(protocolIndex == 0) return "SIP"; - if(protocoleIndex == 1) + if(protocolIndex == 1) return "IAX"; return "UNKNOWN PROTOCOLE INDEX"; } \ No newline at end of file diff --git a/sflphone_kde/sflphone_const.h b/sflphone_kde/sflphone_const.h index a9c91e378e74b23384d7fd87c068cd261581c232..f51a9519c330c78665a6e7a21a74cc01de9bacb2 100644 --- a/sflphone_kde/sflphone_const.h +++ b/sflphone_kde/sflphone_const.h @@ -47,6 +47,7 @@ #define ICON_INCOMING ":/images/icons/ring.svg" #define ICON_RINGING ":/images/icons/ring.svg" #define ICON_CURRENT ":/images/icons/current.svg" +#define ICON_CURRENT_REC ":/images/icons/rec_call.svg" #define ICON_DIALING ":/images/icons/dial.svg" #define ICON_HOLD ":/images/icons/hold.svg" #define ICON_FAILURE ":/images/icons/fail.svg" @@ -96,6 +97,12 @@ #define ACCOUNT_ENABLED_TRUE "TRUE" #define ACCOUNT_ENABLED_FALSE "FALSE" +#define ACCOUNT_TYPE_SIP "SIP" +#define ACCOUNT_TYPE_IAX "IAX" +#define ACCOUNT_TYPES_TAB {QString(ACCOUNT_TYPE_SIP), QString(ACCOUNT_TYPE_IAX)} + +#define ACCOUNT_MAILBOX_DEFAULT_VALUE "888" + #define ACCOUNT_STATE_REGISTERED "REGISTERED" #define ACCOUNT_STATE_UNREGISTERED "UNREGISTERED" #define ACCOUNT_STATE_TRYING "TRYING" @@ -119,11 +126,6 @@ #define CALL_STATE_CHANGE_UNHOLD_CURRENT "UNHOLD_CURRENT" #define CALL_STATE_CHANGE_UNHOLD_RECORD "UNHOLD_RECORD" -#define CALL_ITEM_CALL_NUMBER "callNumber" -#define CALL_ITEM_TRANSFER_LABEL "transferLabel" -#define CALL_ITEM_TRANSFER_NUMBER "transferNumber" -#define CALL_ITEM_ICON "icon" - #define MAX_HISTORY_CAPACITY 60 @@ -182,9 +184,10 @@ /** Desktop notifications - Time before to close the notification*/ #define __TIMEOUT_TIME 18000 // 30 secondes +/* //TODO constantes pour protocoles -int getProtocoleIndex(QString protocoleName); - -QString getIndexProtocole(int protocoleIndex); +int getProtocolIndexByName(QString protocolName); +QString getProtocolNameByIndex(int protocolIndex); +*/ #endif