diff --git a/sflphone_kde/AccountWizard.cpp b/sflphone_kde/AccountWizard.cpp index 552cc81723afc88241153d5feb86dfb76666ee2a..b332946e26b19debe395260726ec93ed42e8a09c 100644 --- a/sflphone_kde/AccountWizard.cpp +++ b/sflphone_kde/AccountWizard.cpp @@ -173,13 +173,6 @@ void AccountWizard::accept() { 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(); - //accountDetails[QString(ACCOUNT_ENABLED)] = QString(); QString & alias = accountDetails[QString(ACCOUNT_ALIAS)]; QString & server = accountDetails[QString(ACCOUNT_HOSTNAME)]; diff --git a/sflphone_kde/Call.cpp b/sflphone_kde/Call.cpp index 28cb12deaf18a5b38314b750fe08f9ad04c038c2..194ba178c1ebc0bf78abff88b520c72b949b6947 100644 --- a/sflphone_kde/Call.cpp +++ b/sflphone_kde/Call.cpp @@ -88,26 +88,50 @@ void Call::initCallItem() { qDebug() << "initCallItem"; item = new QListWidgetItem(); - item->setSizeHint(QSize(140,30)); + item->setSizeHint(QSize(140,45)); item->setFlags(Qt::ItemIsSelectable|Qt::ItemIsDragEnabled|Qt::ItemIsDropEnabled|Qt::ItemIsEnabled); itemWidget = new QWidget(); - labelIcon = new QLabel(itemWidget); + labelIcon = new QLabel(); qDebug() << "labelIcon : " << labelIcon; - labelCallNumber = new QLabel(peerPhoneNumber, itemWidget); - labelPeerName = NULL; - labelTransferPrefix = new QLabel("Transfer to : ", itemWidget); - labelTransferNumber = new QLabel(itemWidget); + labelCallNumber = new QLabel(peerPhoneNumber); + labelTransferPrefix = new QLabel(tr2i18n("Transfer to : ")); + labelTransferNumber = new QLabel(); QSpacerItem * horizontalSpacer = new QSpacerItem(16777215, 20, QSizePolicy::Preferred, QSizePolicy::Minimum); - 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(labelTransferPrefix, 1, 1, 1, 1); - layout->addWidget(labelTransferNumber, 1, 2, 1, 2); - layout->addItem(horizontalSpacer, 0, 3, 1, 3); - itemWidget->setLayout(layout); + + QHBoxLayout * mainLayout = new QHBoxLayout(); + mainLayout->setContentsMargins ( 3, 1, 2, 1); + mainLayout->setSpacing(4); + QVBoxLayout * descr = new QVBoxLayout(); + descr->setMargin(1); + descr->setSpacing(1); + QHBoxLayout * transfer = new QHBoxLayout(); + transfer->setMargin(0); + transfer->setSpacing(0); + mainLayout->addWidget(labelIcon); + qDebug() << "descr->addWidget(labelPeerName);"; + if(! peerName.isEmpty()) + { + labelPeerName = new QLabel(peerName); + descr->addWidget(labelPeerName); + } + descr->addWidget(labelCallNumber); + transfer->addWidget(labelTransferPrefix); + transfer->addWidget(labelTransferNumber); + descr->addLayout(transfer); + mainLayout->addLayout(descr); + mainLayout->addItem(horizontalSpacer); + +// QGridLayout * mainLayout = new QGridLayout(itemWidget); +// mainLayout->setMargin(3); +// mainLayout->setSpacing(3); +// mainLayout->addWidget(labelIcon, 0, 0, 2, 1); +// mainLayout->addWidget(labelCallNumber, 0, 1, 1, 2); +// mainLayout->addWidget(labelTransferPrefix, 1, 1, 1, 1); +// mainLayout->addWidget(labelTransferNumber, 1, 2, 1, 2); +// mainLayout->addItem(horizontalSpacer, 0, 3, 1, 3); + + itemWidget->setLayout(mainLayout); } void Call::setItemIcon(const QString pixmap) @@ -115,17 +139,19 @@ void Call::setItemIcon(const QString pixmap) labelIcon->setPixmap(QPixmap(pixmap)); } -void Call::setPeerName(const QString peerName) -{ - this->peerName = peerName; - if(!labelPeerName) labelPeerName = new QLabel(peerName + " : "); - labelPeerName->setText(peerName + " : "); -} +// void Call::setPeerName(const QString peerName) +// { +// qDebug() << "setPeerName(" << peerName; +// this->peerName = peerName; +// if(!labelPeerName) labelPeerName = new QLabel(peerName + " : "); +// labelPeerName->setText(peerName + " : "); +// } -Call::Call(call_state startState, QString callId, QString from, QString account) +Call::Call(call_state startState, QString callId, QString peerName, QString peerNumber, QString account) { this->callId = callId; - this->peerPhoneNumber = from; + this->peerPhoneNumber = peerNumber; + this->peerName = peerName; initCallItem(); changeCurrentState(startState); this->account = account; @@ -146,16 +172,21 @@ Call::~Call() //delete historyItemWidget; } -Call * Call::buildDialingCall(QString callId) +Call * Call::buildDialingCall(QString callId, const QString & peerName) { - Call * call = new Call(CALL_STATE_DIALING, callId); + Call * call = new Call(CALL_STATE_DIALING, callId, peerName); call->historyState = NONE; return call; } -Call * Call::buildIncomingCall(const QString & callId, const QString & from, const QString & account) +Call * Call::buildIncomingCall(const QString & callId/*, const QString & from, const QString & account*/) { - Call * call = new Call(CALL_STATE_INCOMING, callId, from, account); + CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); + MapStringString details = callManager.getCallDetails(callId).value(); + QString from = details[CALL_PEER_NUMBER]; + QString account = details[CALL_ACCOUNTID]; + QString peerName = details[CALL_PEER_NAME]; + Call * call = new Call(CALL_STATE_INCOMING, callId, peerName, from, account); call->historyState = MISSED; return call; } @@ -164,10 +195,13 @@ Call * Call::buildRingingCall(const QString & callId) { CallManagerInterface & callManager = CallManagerInterfaceSingleton::getInstance(); MapStringString details = callManager.getCallDetails(callId).value(); - //QString from = details[CALL_FROM]; +// qDebug() << "Details : " << details.keys(); + QString from = details[CALL_PEER_NUMBER]; + QString account = details[CALL_ACCOUNTID]; + QString peerName = details[CALL_PEER_NAME]; //QString from = details[CALL_ACCOUNT]; - //Call * call = new Call(CALL_STATE_RINGING, callId, from, account); - Call * call = new Call(CALL_STATE_RINGING, callId); + Call * call = new Call(CALL_STATE_RINGING, callId, peerName, from, account); +// call->setPeerName(details[CALL_PEER_NAME]); call->historyState = OUTGOING; return call; } @@ -243,7 +277,7 @@ QListWidgetItem * Call::getHistoryItem() if(historyItem == NULL && historyState != NONE) { historyItem = new QListWidgetItem(); - historyItem->setSizeHint(QSize(140,30)); + historyItem->setSizeHint(QSize(140,45)); qDebug() << "historystate = " << historyState; } return historyItem; @@ -254,22 +288,33 @@ QWidget * Call::getHistoryItemWidget() if(historyItemWidget == NULL && historyState != NONE) { historyItemWidget = new QWidget(); - labelHistoryIcon = new QLabel(historyItemWidget); + labelHistoryIcon = new QLabel(); labelHistoryIcon->setPixmap(QPixmap(historyIcons[historyState])); - labelHistoryCallNumber = new QLabel(peerPhoneNumber, historyItemWidget); - labelHistoryPeerName = NULL; - if(!peerName.isEmpty()) - labelHistoryPeerName = new QLabel(peerName + " : ", historyItemWidget); - labelHistoryTime = new QLabel(startTime->toString(Qt::LocaleDate), historyItemWidget); + labelHistoryCallNumber = new QLabel(peerPhoneNumber); + labelHistoryTime = new QLabel(startTime->toString(Qt::LocaleDate)); + QSpacerItem * horizontalSpacer = new QSpacerItem(16777215, 20, QSizePolicy::Preferred, QSizePolicy::Minimum); - QGridLayout * layout = new QGridLayout(historyItemWidget); - layout->setMargin(3); - layout->setSpacing(3); - layout->addWidget(labelHistoryIcon, 0, 0, 2, 1); - layout->addWidget(labelHistoryCallNumber, 0, 1, 1, 2); - layout->addWidget(labelHistoryTime, 1, 1, 1, 1); - layout->addItem(horizontalSpacer, 0, 3, 1, 3); - historyItemWidget->setLayout(layout); + + QHBoxLayout * mainLayout = new QHBoxLayout(); + mainLayout->setContentsMargins ( 3, 1, 2, 1); + mainLayout->setSpacing(4); + QVBoxLayout * descr = new QVBoxLayout(); + descr->setMargin(1); + descr->setSpacing(1); + descr->setMargin(0); + descr->setSpacing(1); + mainLayout->addWidget(labelHistoryIcon); + qDebug() << "descr->addWidget(labelPeerName);"; + if(! peerName.isEmpty()) + { + labelHistoryPeerName = new QLabel(peerName); + descr->addWidget(labelHistoryPeerName); + } + descr->addWidget(labelHistoryCallNumber); + descr->addWidget(labelHistoryTime); + mainLayout->addLayout(descr); + mainLayout->addItem(horizontalSpacer); + historyItemWidget->setLayout(mainLayout); } return historyItemWidget; } diff --git a/sflphone_kde/Call.h b/sflphone_kde/Call.h index 2493c40a31eca98ecca42f033aee9d2cc55b0f4a..76e798af56e49c25e244c58eaf49f63b160a4126 100644 --- a/sflphone_kde/Call.h +++ b/sflphone_kde/Call.h @@ -134,7 +134,7 @@ private: static const char * callStateIcons[11]; - Call(call_state startState, QString callId, QString from = "", QString account = ""); + Call(call_state startState, QString callId, QString peerNumber = "", QString account = "", QString peerName = ""); static daemon_call_state toDaemonCallState(const QString & stateName); @@ -158,8 +158,8 @@ public: ~Call(); void initCallItem(); - static Call * buildDialingCall(QString callId); - static Call * buildIncomingCall(const QString & callId, const QString & from, const QString & account); + static Call * buildDialingCall(QString callId, const QString & peerName); + static Call * buildIncomingCall(const QString & callId/*, const QString & from, const QString & account*/); static Call * buildRingingCall(const QString & callId); Contact * findContactForNumberInKAddressBook(QString number); @@ -180,7 +180,7 @@ public: void appendItemText(QString text); void backspaceItemText(); void setItemIcon(const QString pixmap); - void setPeerName(const QString peerName); +// void setPeerName(const QString peerName); void changeCurrentState(call_state newState); void updateItem(); diff --git a/sflphone_kde/CallList.cpp b/sflphone_kde/CallList.cpp index 480e43bd263c4de68e6df885d0616cb79040a1ee..eff568961712f3454a7145e71c9e6f59b4e78ffc 100644 --- a/sflphone_kde/CallList.cpp +++ b/sflphone_kde/CallList.cpp @@ -51,6 +51,18 @@ Call * CallList::findCallByHistoryItem(const QListWidgetItem * item) return NULL; } +Call * CallList::findCallByCallId(const QString & callId) +{ + for(int i = 0 ; i < size() ; i++) + { + if ((*calls)[i]->getCallId() == callId) + { + return (*calls)[i]; + } + } + return NULL; +} + Call * CallList::operator[](const QString & callId) { for(int i = 0 ; i < size() ; i++) @@ -80,16 +92,16 @@ int CallList::size() return calls->size(); } -Call * CallList::addDialingCall() +Call * CallList::addDialingCall(const QString & peerName) { - Call * call = Call::buildDialingCall(getAndIncCallId()); + Call * call = Call::buildDialingCall(getAndIncCallId(), peerName); calls->append(call); return call; } -Call * CallList::addIncomingCall(const QString & callId, const QString & from, const QString & account) +Call * CallList::addIncomingCall(const QString & callId/*, const QString & from, const QString & account*/) { - Call * call = Call::buildIncomingCall(callId, from, account); + Call * call = Call::buildIncomingCall(callId/*, from, account*/); calls->append(call); return call; } diff --git a/sflphone_kde/CallList.h b/sflphone_kde/CallList.h index a66c37d3611fa8c8d96030b7ef2696bcde5e0509..8b01961f0f984c75c84fa72b23fbb82be08696d7 100644 --- a/sflphone_kde/CallList.h +++ b/sflphone_kde/CallList.h @@ -20,12 +20,13 @@ public: Call * findCallByItem(const QListWidgetItem * item); Call * findCallByHistoryItem(const QListWidgetItem * item); + Call * findCallByCallId(const QString & callId); Call * operator[](const QListWidgetItem * item); Call * operator[](const QString & callId); Call * operator[](int ind); - Call * addDialingCall(); - Call * addIncomingCall(const QString & callId, const QString & from, const QString & account); + Call * addDialingCall(const QString & peerName = ""); + Call * addIncomingCall(const QString & callId/*, const QString & from, const QString & account*/); Call * addRingingCall(const QString & callId); QString getAndIncCallId(); diff --git a/sflphone_kde/sflphone_const.h b/sflphone_kde/sflphone_const.h index a559fa654901b8bee26689ef894638b5efdabd87..15c62af3adf036922d532720e339b30708e9c635 100644 --- a/sflphone_kde/sflphone_const.h +++ b/sflphone_kde/sflphone_const.h @@ -120,9 +120,10 @@ #define ACCOUNT_STATE_ERROR_CONF_STUN "ERROR_CONF_STUN" #define ACCOUNT_STATE_ERROR_EXIST_STUN "ERROR_EXIST_STUN" -#define ACCOUNT_ITEM_CHECKBOX "checkbox" -#define ACCOUNT_ITEM_LED "led" +#define CALL_PEER_NAME "PEER_NAME" +#define CALL_PEER_NUMBER "PEER_NUMBER" +#define CALL_ACCOUNTID "ACCOUNTID" #define CALL_STATE_CHANGE_HUNG_UP "HUNGUP" #define CALL_STATE_CHANGE_RINGING "RINGING" diff --git a/sflphone_kde/sflphone_kdeview.cpp b/sflphone_kde/sflphone_kdeview.cpp index 75bc2f0cb404e2cb5d05a4a8dbe5b88f9f873866..f741ca19428b2fedc6b1a979d264e33c97a36bc1 100644 --- a/sflphone_kde/sflphone_kdeview.cpp +++ b/sflphone_kde/sflphone_kdeview.cpp @@ -372,6 +372,7 @@ void sflphone_kdeView::updateWindowCallState() bool enabledActions[6]= {true,true,true,true,true,true}; QString buttonIconFiles[3] = {ICON_CALL, ICON_HANGUP, ICON_HOLD}; + QString actionTexts[5] = {tr2i18n("Call", 0), tr2i18n("Hang up", 0), tr2i18n("Hold", 0), tr2i18n("Transfer", 0), tr2i18n("Record", 0)}; bool transfer = false; //tells whether the call is in recording position bool recordActivated = false; @@ -402,6 +403,8 @@ void sflphone_kdeView::updateWindowCallState() qDebug() << "Reached CALL_STATE_INCOMING with call " << (*callList)[item]->getCallId() << ". Updating window."; buttonIconFiles[0] = ICON_ACCEPT; buttonIconFiles[1] = ICON_REFUSE; + actionTexts[0] = tr2i18n("Accept", 0); + actionTexts[0] = tr2i18n("Refuse", 0); break; case CALL_STATE_RINGING: qDebug() << "Reached CALL_STATE_RINGING with call " << (*callList)[item]->getCallId() << ". Updating window."; @@ -422,6 +425,7 @@ void sflphone_kdeView::updateWindowCallState() case CALL_STATE_HOLD: qDebug() << "Reached CALL_STATE_HOLD with call " << (*callList)[item]->getCallId() << ". Updating window."; buttonIconFiles[2] = ICON_UNHOLD; + actionTexts[2] = tr2i18n("Unhold", 0); break; case CALL_STATE_FAILURE: qDebug() << "Reached CALL_STATE_FAILURE with call " << (*callList)[item]->getCallId() << ". Updating window."; @@ -440,6 +444,7 @@ void sflphone_kdeView::updateWindowCallState() case CALL_STATE_TRANSFER: qDebug() << "Reached CALL_STATE_TRANSFER with call " << (*callList)[item]->getCallId() << ". Updating window."; buttonIconFiles[0] = ICON_EXEC_TRANSF; + actionTexts[3] = tr2i18n("Give up transfer", 0); transfer = true; recordEnabled = true; break; @@ -447,6 +452,8 @@ void sflphone_kdeView::updateWindowCallState() qDebug() << "Reached CALL_STATE_TRANSF_HOLD with call " << (*callList)[item]->getCallId() << ". Updating window."; buttonIconFiles[0] = ICON_EXEC_TRANSF; buttonIconFiles[2] = ICON_UNHOLD; + actionTexts[3] = tr2i18n("Give up transfer", 0); + actionTexts[2] = tr2i18n("Unhold", 0); transfer = true; break; case CALL_STATE_OVER: @@ -523,6 +530,12 @@ void sflphone_kdeView::updateWindowCallState() action_refuse->setIcon(QIcon(buttonIconFiles[1])); action_hold->setIcon(QIcon(buttonIconFiles[2])); + action_accept->setText(actionTexts[0]); + action_refuse->setText(actionTexts[1]); + action_hold->setText(actionTexts[2]); + action_transfer->setText(actionTexts[3]); + action_record->setText(actionTexts[4]); + action_transfer->setChecked(transfer); action_record->setChecked(recordActivated); } @@ -944,11 +957,12 @@ void sflphone_kdeView::on_action_accept_triggered() { action_history->setChecked(false); stackedWidget_screen->setCurrentWidget(page_callList); - Call * call = callList->addDialingCall(); + Call * pastCall = callList->findCallByHistoryItem(listWidget_callHistory->currentItem()); + Call * call = callList->addDialingCall(pastCall->getPeerName()); call->appendItemText(pastCall->getPeerPhoneNumber()); - if(!pastCall->getPeerName().isEmpty()) - call->setPeerName(pastCall->getPeerName()); +// if(!pastCall->getPeerName().isEmpty()) +// call->setPeerName(pastCall->getPeerName()); addCallToCallList(call); listWidget_callList->setCurrentRow(listWidget_callList->count() - 1); actionb(call, CALL_ACTION_ACCEPT); @@ -957,9 +971,9 @@ void sflphone_kdeView::on_action_accept_triggered() { action_addressBook->setChecked(false); stackedWidget_screen->setCurrentWidget(page_callList); - Call * call = callList->addDialingCall(); ContactItemWidget * w = (ContactItemWidget *) (listWidget_addressBook->itemWidget(listWidget_addressBook->currentItem())); - call->setPeerName(w->getContactName()); + Call * call = callList->addDialingCall(w->getContactName()); +// call->setPeerName(w->getContactName()); call->appendItemText(w->getContactNumber()); addCallToCallList(call); listWidget_callList->setCurrentRow(listWidget_callList->count() - 1); @@ -1081,7 +1095,7 @@ void sflphone_kdeView::on_action_mailBox_triggered() void sflphone_kdeView::on1_callStateChanged(const QString &callID, const QString &state) { qDebug() << "Signal : Call State Changed for call " << callID << " . New state : " << state; - Call * call = (*callList)[callID]; + Call * call = callList->findCallByCallId(callID); if(!call) { if(state == CALL_STATE_CHANGE_RINGING) @@ -1108,10 +1122,10 @@ void sflphone_kdeView::on1_error(MapStringString details) qDebug() << "Signal : Daemon error : " << details; } -void sflphone_kdeView::on1_incomingCall(const QString &accountID, const QString & callID, const QString &from) +void sflphone_kdeView::on1_incomingCall(const QString &accountID, const QString & callID/*, const QString &from*/) { qDebug() << "Signal : Incoming Call !"; - Call * call = callList->addIncomingCall(callID, from, accountID); + Call * call = callList->addIncomingCall(callID/*, from, accountID*/); addCallToCallList(call); listWidget_callList->setCurrentRow(listWidget_callList->count() - 1); } diff --git a/sflphone_kde/sflphone_kdeview.h b/sflphone_kde/sflphone_kdeview.h index b723765927c7fd7bb238f8175f29530438315e23..2723d1b6c3447f9b77490375258950562a0bd561 100644 --- a/sflphone_kde/sflphone_kdeview.h +++ b/sflphone_kde/sflphone_kdeview.h @@ -172,7 +172,7 @@ private slots: void on1_callStateChanged(const QString &callID, const QString &state); void on1_error(MapStringString details); - void on1_incomingCall(const QString &accountID, const QString &callID, const QString &from); + void on1_incomingCall(const QString &accountID, const QString &callID/*, const QString &from*/); 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); diff --git a/src/dbus/configurationmanager-glue.h b/src/dbus/configurationmanager-glue.h index cca98917e044f6bbf52d71dc507f2f5d6d412d21..ae5223d94299f6a28c58683b6330166916138fa9 100644 --- a/src/dbus/configurationmanager-glue.h +++ b/src/dbus/configurationmanager-glue.h @@ -520,7 +520,7 @@ public: */ virtual std::map< std::string, std::string > getAccountDetails(const std::string& accountID) = 0; virtual void setAccountDetails(const std::string& accountID, const std::map< std::string, std::string >& details) = 0; - virtual void addAccount(const std::map< std::string, std::string >& details) = 0; + virtual std::string addAccount(const std::map< std::string, std::string >& details) = 0; virtual void setAccountsOrder(const std::string& order) = 0; virtual void removeAccount(const std::string& accoundID) = 0; virtual std::vector< std::string > getAccountList() = 0; diff --git a/src/dbus/configurationmanager.cpp b/src/dbus/configurationmanager.cpp index 09be9dc26c1fcb5a9beb0d49fe32247478a98a97..91f76a3ad4c1cbda12a377cf14c4195347a70018 100644 --- a/src/dbus/configurationmanager.cpp +++ b/src/dbus/configurationmanager.cpp @@ -53,11 +53,11 @@ ConfigurationManager::sendRegister( const std::string& accountID, const int32_t& Manager::instance().sendRegister(accountID, expire); } - void + std::string ConfigurationManager::addAccount( const std::map< std::string, std::string >& details ) { _debug("ConfigurationManager::addAccount received\n"); - Manager::instance().addAccount(details); + return Manager::instance().addAccount(details); } diff --git a/src/managerimpl.cpp b/src/managerimpl.cpp index e6c6c0d6a6d3e4337160a499ce5ab25cae2c1706..8b77925a966ce60037558d17631f7d2fb5a6ccb1 100644 --- a/src/managerimpl.cpp +++ b/src/managerimpl.cpp @@ -2779,7 +2779,7 @@ std::map< std::string, std::string > ManagerImpl::getCallDetails(const CallID& c // So first we fetch the account accountid = getAccountFromCall (callID); - + _debug("%s\n",callID.c_str()); // Then the VoIP link this account is linked with (IAX2 or SIP) if ( (account=getAccount (accountid)) != 0) { link = account->getVoIPLink ();