diff --git a/sflphone_kde/Account.cpp b/sflphone_kde/Account.cpp index 4d79eb7a22084525b8677ed5c57e42dfede2ab85..3b6cc5843beb2074d9a787c143851d70bf335821 100644 --- a/sflphone_kde/Account.cpp +++ b/sflphone_kde/Account.cpp @@ -64,15 +64,15 @@ void Account::initAccountItem() item = new QListWidgetItem(); item->setSizeHint(QSize(140,25)); item->setFlags(Qt::ItemIsSelectable|Qt::ItemIsDragEnabled|Qt::ItemIsDropEnabled|Qt::ItemIsEnabled); - bool enabled = getAccountDetail(*(new QString(ACCOUNT_ENABLED))) == ACCOUNT_ENABLED_TRUE; - setItemText(getAccountDetail(*(new QString(ACCOUNT_ALIAS)))); + bool enabled = getAccountDetail(ACCOUNT_ENABLED) == ACCOUNT_ENABLED_TRUE; + setItemText(getAccountDetail(ACCOUNT_ALIAS)); itemWidget = new AccountItemWidget(); itemWidget->setEnabled(enabled); if(isNew() || !enabled) { itemWidget->setState(AccountItemWidget::Unregistered); } - else if(getAccountDetail(* new QString(ACCOUNT_STATUS)) == ACCOUNT_STATE_REGISTERED) + else if(getAccountDetail(ACCOUNT_STATUS) == ACCOUNT_STATE_REGISTERED) { itemWidget->setState(AccountItemWidget::Registered); } @@ -152,14 +152,14 @@ QListWidgetItem * Account::renewItem() AccountItemWidget * Account::getItemWidget() { delete itemWidget; - bool enabled = getAccountDetail(*(new QString(ACCOUNT_ENABLED))) == ACCOUNT_ENABLED_TRUE; + bool enabled = getAccountDetail(ACCOUNT_ENABLED) == ACCOUNT_ENABLED_TRUE; itemWidget = new AccountItemWidget(); itemWidget->setEnabled(enabled); if(isNew() || !enabled) { itemWidget->setState(AccountItemWidget::Unregistered); } - else if(getAccountDetail(* new QString(ACCOUNT_STATUS)) == ACCOUNT_STATE_REGISTERED) + else if(getAccountDetail(ACCOUNT_STATUS) == ACCOUNT_STATE_REGISTERED) { itemWidget->setState(AccountItemWidget::Registered); } @@ -177,9 +177,9 @@ QString Account::getStateName(QString & state) QColor Account::getStateColor() { - if(getAccountDetail(* new QString(ACCOUNT_STATUS)) == ACCOUNT_STATE_UNREGISTERED) + if(getAccountDetail(ACCOUNT_STATUS) == ACCOUNT_STATE_UNREGISTERED) return Qt::black; - if(getAccountDetail(* new QString(ACCOUNT_STATUS)) == ACCOUNT_STATE_REGISTERED) + if(getAccountDetail(ACCOUNT_STATUS) == ACCOUNT_STATE_REGISTERED) return Qt::darkGreen; return Qt::red; } @@ -187,9 +187,9 @@ QColor Account::getStateColor() QString Account::getStateColorName() { - if(getAccountDetail(* new QString(ACCOUNT_STATUS)) == ACCOUNT_STATE_UNREGISTERED) + if(getAccountDetail(ACCOUNT_STATUS) == ACCOUNT_STATE_UNREGISTERED) return "black"; - if(getAccountDetail(* new QString(ACCOUNT_STATUS)) == ACCOUNT_STATE_REGISTERED) + if(getAccountDetail(ACCOUNT_STATUS) == ACCOUNT_STATE_REGISTERED) return "darkGreen"; return "red"; } diff --git a/sflphone_kde/AccountList.cpp b/sflphone_kde/AccountList.cpp index 07c1d158ccbbd05684a22b72bbfa9a16c9099c41..e4f7bc822691802aa1542f207a8a47526c95285a 100644 --- a/sflphone_kde/AccountList.cpp +++ b/sflphone_kde/AccountList.cpp @@ -99,13 +99,10 @@ QVector<Account *> & AccountList::getAccounts() Account * AccountList::getAccountById(QString & id) { - qDebug() << "for " << accounts->size(); for (int i = 0; i < accounts->size(); ++i) { - qDebug() << "account " << i << " (*accounts)[i]->getAccountId() " << (*accounts)[i]; if (!(*accounts)[i]->isNew() && (*accounts)[i]->getAccountId() == id) { - qDebug() << "found "; return (*accounts)[i]; } } @@ -116,7 +113,7 @@ QVector<Account *> AccountList::getAccountByState(QString & state) { QVector<Account *> v; for (int i = 0; i < accounts->size(); ++i){ - if ((*accounts)[i]->getAccountDetail(*(new QString(ACCOUNT_STATUS))) == state) + if ((*accounts)[i]->getAccountDetail(ACCOUNT_STATUS) == state) v += (*accounts)[i]; } return v; diff --git a/sflphone_kde/CMakeLists.txt b/sflphone_kde/CMakeLists.txt index 3cc56937aa8ee699ea4fba5686a30844017953b8..875449c2b0357177561c0f978cadf39553010be9 100644 --- a/sflphone_kde/CMakeLists.txt +++ b/sflphone_kde/CMakeLists.txt @@ -27,6 +27,7 @@ SET( AccountItemWidget.cpp ActionSetAccountFirst.cpp Contact.cpp + ContactItemWidget.cpp ) SET(QtApp_RCCS resources.qrc) diff --git a/sflphone_kde/Call.cpp b/sflphone_kde/Call.cpp index c56f66285700da409878303017d1948fbe268721..28cb12deaf18a5b38314b750fe08f9ad04c038c2 100644 --- a/sflphone_kde/Call.cpp +++ b/sflphone_kde/Call.cpp @@ -4,9 +4,15 @@ #include "callmanager_interface_singleton.h" #include "SFLPhone.h" #include "sflphone_const.h" +#include "configurationmanager_interface_p.h" +#include "configurationmanager_interface_singleton.h" +#include <kabc/addressbook.h> +#include <kabc/stdaddressbook.h> +using namespace KABC; + const call_state Call::actionPerformedStateMap [11][5] = { // ACCEPT REFUSE TRANSFER HOLD RECORD @@ -57,6 +63,21 @@ const call_state Call::stateChangedStateMap [11][6] = /*ERROR */ {CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_ERROR , CALL_STATE_ERROR } }; +const function Call::stateChangedFunctionMap[11][6] = +{ +// RINGING CURRENT BUSY HOLD HUNGUP FAILURE +/*INCOMING */ {&Call::nothing , &Call::start , &Call::start , &Call::start , &Call::start , &Call::start }, +/*RINGING */ {&Call::nothing , &Call::start , &Call::start , &Call::start , &Call::start , &Call::start }, +/*CURRENT */ {&Call::nothing , &Call::nothing , &Call::nothing , &Call::nothing , &Call::nothing , &Call::nothing }, +/*DIALING */ {&Call::nothing , &Call::nothing , &Call::nothing , &Call::nothing , &Call::nothing , &Call::nothing }, +/*HOLD */ {&Call::nothing , &Call::nothing , &Call::nothing , &Call::nothing , &Call::nothing , &Call::nothing }, +/*FAILURE */ {&Call::nothing , &Call::nothing , &Call::nothing , &Call::nothing , &Call::nothing , &Call::nothing }, +/*BUSY */ {&Call::nothing , &Call::nothing , &Call::nothing , &Call::nothing , &Call::nothing , &Call::nothing }, +/*TRANSFERT */ {&Call::nothing , &Call::nothing , &Call::nothing , &Call::nothing , &Call::nothing , &Call::nothing }, +/*TRANSFERT_HOLD */ {&Call::nothing , &Call::nothing , &Call::nothing , &Call::nothing , &Call::nothing , &Call::nothing }, +/*OVER */ {&Call::nothing , &Call::nothing , &Call::nothing , &Call::nothing , &Call::nothing , &Call::nothing }, +/*ERROR */ {&Call::nothing , &Call::nothing , &Call::nothing , &Call::nothing , &Call::nothing , &Call::nothing } +}; const char * Call::callStateIcons[11] = {ICON_INCOMING, ICON_RINGING, ICON_CURRENT, ICON_DIALING, ICON_HOLD, ICON_FAILURE, ICON_BUSY, ICON_TRANSFER, ICON_TRANSF_HOLD, "", ""}; @@ -73,7 +94,8 @@ void Call::initCallItem() itemWidget = new QWidget(); labelIcon = new QLabel(itemWidget); qDebug() << "labelIcon : " << labelIcon; - labelCallNumber = new QLabel(peer, itemWidget); + labelCallNumber = new QLabel(peerPhoneNumber, itemWidget); + labelPeerName = NULL; labelTransferPrefix = new QLabel("Transfer to : ", itemWidget); labelTransferNumber = new QLabel(itemWidget); QSpacerItem * horizontalSpacer = new QSpacerItem(16777215, 20, QSizePolicy::Preferred, QSizePolicy::Minimum); @@ -93,10 +115,17 @@ 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 + " : "); +} + Call::Call(call_state startState, QString callId, QString from, QString account) { this->callId = callId; - this->peer = from; + this->peerPhoneNumber = from; initCallItem(); changeCurrentState(startState); this->account = account; @@ -181,6 +210,24 @@ daemon_call_state Call::toDaemonCallState(const QString & stateName) return DAEMON_CALL_STATE_FAILURE; } + +Contact * Call::findContactForNumberInKAddressBook(QString number) +{ + AddressBook * ab = KABC::StdAddressBook::self(); + QVector<Contact *> results = QVector<Contact *>(); + AddressBook::Iterator it; + for ( it = ab->begin(); it != ab->end(); ++it ) { + for(int i = 0 ; i < it->phoneNumbers().count() ; i++) + { + if(it->phoneNumbers().at(i) == number) + { + return new Contact( *it, it->phoneNumbers().at(i).number() ); + } + } + } + return NULL; +} + QListWidgetItem * Call::getItem() { return item; @@ -195,18 +242,45 @@ QListWidgetItem * Call::getHistoryItem() { if(historyItem == NULL && historyState != NONE) { - historyItem = new QListWidgetItem(peer); + historyItem = new QListWidgetItem(); + historyItem->setSizeHint(QSize(140,30)); qDebug() << "historystate = " << historyState; - historyItem->setIcon(QIcon(historyIcons[historyState])); } return historyItem; } QWidget * Call::getHistoryItemWidget() { + if(historyItemWidget == NULL && historyState != NONE) + { + historyItemWidget = new QWidget(); + labelHistoryIcon = new QLabel(historyItemWidget); + 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); + 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); + } return historyItemWidget; } +/* +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); +*/ call_state Call::getState() const { return currentState; @@ -223,6 +297,7 @@ call_state Call::stateChanged(const QString & newStateName) daemon_call_state dcs = toDaemonCallState(newStateName); //(this->*(stateChangedFunctionMap[currentState][dcs]))(); changeCurrentState(stateChangedStateMap[currentState][dcs]); + (this->*(stateChangedFunctionMap[previousState][dcs]))(); qDebug() << "Calling stateChanged " << newStateName << " -> " << toDaemonCallState(newStateName) << " on call with state " << previousState << ". Become " << currentState; return currentState; } @@ -230,20 +305,30 @@ call_state Call::stateChanged(const QString & newStateName) call_state Call::actionPerformed(call_action action) { call_state previousState = currentState; - //execute the action associated with this transition - (this->*(actionPerformedFunctionMap[currentState][action]))(); //update the state - changeCurrentState(actionPerformedStateMap[currentState][action]); + changeCurrentState(actionPerformedStateMap[previousState][action]); + //execute the action associated with this transition + (this->*(actionPerformedFunctionMap[previousState][action]))(); qDebug() << "Calling action " << action << " on call with state " << previousState << ". Become " << currentState; //return the new state return currentState; } -QString Call::getCallId() +QString Call::getCallId() const { return callId; } +QString Call::getPeerPhoneNumber() const +{ + return peerPhoneNumber; +} + +QString Call::getPeerName() const +{ + return peerName; +} + call_state Call::getCurrentState() const { return currentState; @@ -337,7 +422,10 @@ void Call::call() qDebug() << "Calling " << number << " with account " << account << ". callId : " << callId; callManager.placeCall(account, callId, number); this->account = account; - this->peer = number; + this->peerPhoneNumber = number; + Contact * contact = findContactForNumberInKAddressBook(peerPhoneNumber); + if(contact) this->peerName = contact->getNickName(); + this->startTime = new QDateTime(QDateTime::currentDateTime()); this->historyState = OUTGOING; } else @@ -380,8 +468,15 @@ void Call::setRecord() recording = !recording; } +void Call::start() +{ + qDebug() << "Starting call. callId : " << callId; + this->startTime = new QDateTime(QDateTime::currentDateTime()); +} + void Call::appendItemText(QString text) { + ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); QLabel * editNumber; switch(currentState) { @@ -392,6 +487,15 @@ void Call::appendItemText(QString text) case CALL_STATE_DIALING: editNumber = labelCallNumber; break; + case CALL_STATE_CURRENT: + //TODO replace account string by an Account instance and handle damn pointers to avoid detruction of Accounts + //if(peer == account->getAccountDetail(ACCOUNT_MAILBOX)) + if(peerPhoneNumber == configurationManager.getAccountDetails(account).value()[ACCOUNT_MAILBOX]) + { + text = QString(QChar(0x9A)); + } + editNumber = labelCallNumber; + break; default: qDebug() << "Type key on call not editable. Doing nothing."; return; diff --git a/sflphone_kde/Call.h b/sflphone_kde/Call.h index 347ddc673c6c81402f0208ea406cc21e4fb8bd1b..2493c40a31eca98ecca42f033aee9d2cc55b0f4a 100644 --- a/sflphone_kde/Call.h +++ b/sflphone_kde/Call.h @@ -7,6 +7,8 @@ #include <QtGui/QLabel> #include <QtGui/QWidget> +#include "Contact.h" + /** @enum call_state_t * This enum have all the states a call can take. */ @@ -21,11 +23,11 @@ typedef enum /** Call which numbers are being added by the user */ CALL_STATE_DIALING, /** Call is on hold */ - CALL_STATE_HOLD, + CALL_STATE_HOLD, /** Call has failed */ - CALL_STATE_FAILURE, + CALL_STATE_FAILURE, /** Call is busy */ - CALL_STATE_BUSY, + CALL_STATE_BUSY, /** Call is being transfered. During this state, the user can enter the new number. */ CALL_STATE_TRANSFER, /** Call is on hold for transfer */ @@ -46,13 +48,13 @@ typedef enum /** Call to which the user can speak and hear */ DAEMON_CALL_STATE_CURRENT, /** Call is busy */ - DAEMON_CALL_STATE_BUSY, + DAEMON_CALL_STATE_BUSY, /** Call is on hold */ - DAEMON_CALL_STATE_HOLD, + DAEMON_CALL_STATE_HOLD, /** Call is over */ - DAEMON_CALL_STATE_HUNG_UP, + DAEMON_CALL_STATE_HUNG_UP, /** Call has failed */ - DAEMON_CALL_STATE_FAILURE + DAEMON_CALL_STATE_FAILURE } daemon_call_state; /** @enum call_action @@ -97,24 +99,34 @@ private: QString account; QString callId; - QString peer; + QString peerPhoneNumber; + QString peerName; history_state historyState; QDateTime * startTime; QDateTime * stopTime; + QListWidgetItem * item; QWidget * itemWidget; QLabel * labelIcon; + QLabel * labelPeerName; QLabel * labelCallNumber; QLabel * labelTransferPrefix; QLabel * labelTransferNumber; QListWidgetItem * historyItem; QWidget * historyItemWidget; + QLabel * labelHistoryIcon; + QLabel * labelHistoryPeerName; + QLabel * labelHistoryCallNumber; + QLabel * labelHistoryTime; + //Automate attributes static const call_state actionPerformedStateMap [11][5]; static const function actionPerformedFunctionMap [11][5]; static const call_state stateChangedStateMap [11][6]; + static const function stateChangedFunctionMap [11][6]; + static const char * historyIcons[3]; call_state currentState; @@ -139,6 +151,8 @@ private: void unhold(); void switchRecord(); void setRecord(); + + void start(); public: @@ -147,12 +161,17 @@ public: static Call * buildDialingCall(QString callId); static Call * buildIncomingCall(const QString & callId, const QString & from, const QString & account); static Call * buildRingingCall(const QString & callId); + Contact * findContactForNumberInKAddressBook(QString number); + QListWidgetItem * getItem(); QWidget * getItemWidget(); QListWidgetItem * getHistoryItem(); QWidget * getHistoryItemWidget(); call_state getState() const; - QString getCallId(); + QString getCallId() const; + QString getPeerPhoneNumber() const; + QString getPeerName() const; + call_state stateChanged(const QString & newState); call_state actionPerformed(call_action action); call_state getCurrentState() const; @@ -161,6 +180,7 @@ public: void appendItemText(QString text); void backspaceItemText(); void setItemIcon(const QString pixmap); + 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 a5d0736299ac8c93e7e15cd9606777f408c447d8..480e43bd263c4de68e6df885d0616cb79040a1ee 100644 --- a/sflphone_kde/CallList.cpp +++ b/sflphone_kde/CallList.cpp @@ -27,7 +27,7 @@ Call * CallList::operator[](const QListWidgetItem * item) return NULL; } -Call * CallList::getCallByItem(const QListWidgetItem * item) +Call * CallList::findCallByItem(const QListWidgetItem * item) { for(int i = 0 ; i < size() ; i++) { @@ -39,6 +39,18 @@ Call * CallList::getCallByItem(const QListWidgetItem * item) return NULL; } +Call * CallList::findCallByHistoryItem(const QListWidgetItem * item) +{ + for(int i = 0 ; i < size() ; i++) + { + if ((*calls)[i]->getHistoryItem() == item) + { + return (*calls)[i]; + } + } + return NULL; +} + Call * CallList::operator[](const QString & callId) { for(int i = 0 ; i < size() ; i++) diff --git a/sflphone_kde/CallList.h b/sflphone_kde/CallList.h index 8ac1c7898c714936573099ef3253ac45e9d98eca..a66c37d3611fa8c8d96030b7ef2696bcde5e0509 100644 --- a/sflphone_kde/CallList.h +++ b/sflphone_kde/CallList.h @@ -18,7 +18,8 @@ public: CallList(); ~CallList(); - Call * getCallByItem(const QListWidgetItem * item); + Call * findCallByItem(const QListWidgetItem * item); + Call * findCallByHistoryItem(const QListWidgetItem * item); Call * operator[](const QListWidgetItem * item); Call * operator[](const QString & callId); Call * operator[](int ind); diff --git a/sflphone_kde/ConfigDialog.cpp b/sflphone_kde/ConfigDialog.cpp index 67ef38faaeaa84c5502dae0a89004a6581b93832..7e5eefee45cb2d9c9ff10272ec0a2eaff9c404f3 100644 --- a/sflphone_kde/ConfigDialog.cpp +++ b/sflphone_kde/ConfigDialog.cpp @@ -11,6 +11,7 @@ #include "sflphone_const.h" #include "metatypes.h" #include "configurationmanager_interface_singleton.h" +#include "configurationmanager_interface_p.h" AccountList * ConfigurationDialog::accountList; @@ -153,6 +154,11 @@ void ConfigurationDialog::loadOptions() //pulseaudio settings checkBox_pulseAudioVolumeAlter->setCheckState(configurationManager.getPulseAppVolumeControl() ? Qt::Checked : Qt::Unchecked); + ////////////////////// + ////Record settings//// + ////////////////////// + + urlcomborequester_destinationFolder->setUrl(KUrl::fromPath(configurationManager.getRecordPath())); } @@ -307,12 +313,12 @@ void ConfigurationDialog::loadAccount(QListWidgetItem * item) Account * account = accountList->getAccountByItem(item); if(! account ) { qDebug() << "Attempting to load details of an unexisting account"; return; } - edit1_alias->setText( account->getAccountDetail(*(new QString(ACCOUNT_ALIAS)))); + edit1_alias->setText( account->getAccountDetail(ACCOUNT_ALIAS)); 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)); + QString accountName = account->getAccountDetail(ACCOUNT_TYPE); int protocolIndex = protocolsList->indexOf(accountName); delete protocolsList; diff --git a/sflphone_kde/ConfigDialog.h b/sflphone_kde/ConfigDialog.h index d9e36e32b0e5a6267104ef7505ef1a18227587a7..3ee92bc295a7552ed37feec61d715ae797e5671e 100644 --- a/sflphone_kde/ConfigDialog.h +++ b/sflphone_kde/ConfigDialog.h @@ -8,7 +8,6 @@ #include <QErrorMessage> #include "ui_ConfigDialog.h" -#include "configurationmanager_interface_p.h" #include "AccountList.h" #include "sflphone_kdeview.h" diff --git a/sflphone_kde/Contact.cpp b/sflphone_kde/Contact.cpp index e0f6ebdef89b75cde9e34c1dd5b2b52be0fe132a..3e6b955fac1bd67ff0e9ac44c8ecfc3cf37442bd 100644 --- a/sflphone_kde/Contact.cpp +++ b/sflphone_kde/Contact.cpp @@ -20,13 +20,19 @@ ***************************************************************************/ #include "Contact.h" +#include <QtCore/QDebug> + +#include "ContactItemWidget.h" +#include "sflphone_const.h" + + Contact::Contact(Addressee addressee, QString number) { this->firstName = addressee.name(); this->secondName = addressee.familyName(); this->nickName = addressee.nickName(); this->phoneNumber = number; - this->photo = addressee.photo().url(); + this->photo = new Picture(addressee.photo()); initItem(); } @@ -38,10 +44,35 @@ Contact::~Contact() void Contact::initItem() { - this->item = new QListWidgetItem(phoneNumber); - this->itemWidget = new QWidget(); + this->item = new QListWidgetItem(); + this->item->setSizeHint(QSize(140,CONTACT_ITEM_HEIGHT)); + this->itemWidget = new ContactItemWidget(this); +} + +QString Contact::getPhoneNumber() const +{ + return phoneNumber; +} + +QString Contact::getNickName() const +{ + return nickName; } +QString Contact::getFirstName() const +{ + return firstName; +} + +QString Contact::getSecondName() const +{ + return secondName; +} + +const Picture * Contact::getPhoto() const +{ + return photo; +} //TODO QListWidgetItem * Contact::getItem() diff --git a/sflphone_kde/Contact.h b/sflphone_kde/Contact.h index ccf892ca4b4294672a4b407b6bf302eefa5103d7..62dbf398628d7b85d1b30bf5b8ff4601649cf641 100644 --- a/sflphone_kde/Contact.h +++ b/sflphone_kde/Contact.h @@ -25,6 +25,7 @@ #include <QtGui/QWidget> #include <kabc/addressee.h> +#include <kabc/picture.h> using namespace KABC; @@ -39,7 +40,7 @@ private: QString secondName; QString nickName; QString phoneNumber; - QString photo; + Picture * photo; private: void initItem(); @@ -49,6 +50,12 @@ public: ~Contact(); + QString getPhoneNumber() const; + QString getNickName() const; + QString getFirstName() const; + QString getSecondName() const; + const Picture * getPhoto() const; + QListWidgetItem * getItem(); QWidget * getItemWidget(); diff --git a/sflphone_kde/ContactItemWidget.cpp b/sflphone_kde/ContactItemWidget.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ff1f848193d170b254d0198a3a01192458282d43 --- /dev/null +++ b/sflphone_kde/ContactItemWidget.cpp @@ -0,0 +1,95 @@ +/*************************************************************************** + * Copyright (C) 2009 by Savoir-Faire Linux * + * Author : Jérémy Quentin * + * jeremy.quentin@savoirfairelinux.com * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#include "ContactItemWidget.h" + +#include <QtCore/QString> +#include <QtGui/QVBoxLayout> +#include <QtCore/QDebug> +#include <QtGui/QSpacerItem> + +#include "sflphone_const.h" + +ContactItemWidget::ContactItemWidget(const Contact * contact, QWidget *parent) + : QWidget(parent) +{ + if(!contact->getNickName().isEmpty()) + { + contactName = new QLabel(contact->getNickName()); + } + else + { + contactName = new QLabel(contact->getFirstName()); + } + if(!contact->getPhoto()->isEmpty()) + { + QPixmap pixmap; + if(contact->getPhoto()->isIntern()) + { + contactPhoto = new QLabel(); + pixmap = QPixmap::fromImage(contact->getPhoto()->data()); + } + else + { + contactPhoto = new QLabel(); + pixmap = QPixmap(contact->getPhoto()->url()); + } + if(pixmap.height() > pixmap.width()) + contactPhoto->setPixmap(pixmap.scaledToHeight(CONTACT_ITEM_HEIGHT-4)); + else + contactPhoto->setPixmap(pixmap.scaledToWidth(CONTACT_ITEM_HEIGHT-4)); + } + else + { + contactPhoto = new QLabel(); + contactPhoto->setMinimumSize(CONTACT_ITEM_HEIGHT-4, 0); + } + contactNumber = new QLabel(contact->getPhoneNumber()); + QSpacerItem * horizontalSpacer = new QSpacerItem(16777215, 20, QSizePolicy::Preferred, QSizePolicy::Minimum); + QHBoxLayout * hlayout = new QHBoxLayout(this); + QVBoxLayout * vlayout = new QVBoxLayout(); + hlayout->setMargin(1); + hlayout->setSpacing(4); + vlayout->setMargin(1); + vlayout->setSpacing(2); + vlayout->addWidget(contactName); + vlayout->addWidget(contactNumber); + hlayout->addWidget(contactPhoto); + hlayout->addLayout(vlayout); + hlayout->addItem(horizontalSpacer); + this->setLayout(hlayout); +} + + +ContactItemWidget::~ContactItemWidget() +{ +} + + +QString ContactItemWidget::getContactName() +{ + return contactName->text(); +} + +QString ContactItemWidget::getContactNumber() +{ + return contactNumber->text(); +} + diff --git a/sflphone_kde/ContactItemWidget.h b/sflphone_kde/ContactItemWidget.h new file mode 100644 index 0000000000000000000000000000000000000000..4ea38c5a79132a522548131f07efe4abfc64d090 --- /dev/null +++ b/sflphone_kde/ContactItemWidget.h @@ -0,0 +1,50 @@ +/*************************************************************************** + * Copyright (C) 2009 by Savoir-Faire Linux * + * Author : Jérémy Quentin * + * jeremy.quentin@savoirfairelinux.com * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef CONTACTITEMWIDGET_H +#define CONTACTITEMWIDGET_H + +#include <QWidget> +#include <QtGui/QLabel> +#include "Contact.h" + +/** + @author Jérémy Quentin <jeremy.quentin@gmail.com> +*/ +class ContactItemWidget : public QWidget +{ +Q_OBJECT + +private: + QLabel * contactName; + QLabel * contactNumber; + QLabel * contactPhoto; + +public: + ContactItemWidget(const Contact * contact, QWidget *parent = 0); + + ~ContactItemWidget(); + + QString getContactName(); + QString getContactNumber(); + +}; + +#endif diff --git a/sflphone_kde/SFLPhone.cpp b/sflphone_kde/SFLPhone.cpp index 207f510bfe66bd036177a9d10d00928d28251139..e000ab2491f5c735a7139f25ea03b56f6a3b31e3 100644 --- a/sflphone_kde/SFLPhone.cpp +++ b/sflphone_kde/SFLPhone.cpp @@ -1,32 +1,43 @@ #include "SFLPhone.h" - +#include <KApplication> #include <KStandardAction> +#include <KMenuBar> +#include <KMenu> +#include <KAction> +#include <KToolBar> +#include <QtGui/QStatusBar> +#include <KActionCollection> + +#include "sflphone_const.h" + SFLPhone::SFLPhone(QWidget *parent) - : KMainWindow(parent), + : KXmlGuiWindow(parent), view(new sflphone_kdeView(this)) { // accept dnd - setAcceptDrops(true); + setAcceptDrops(true); // tell the KXmlGuiWindow that this is indeed the main widget - setCentralWidget(view); + setCentralWidget(view); // then, setup our actions - setupActions(); + // add a status bar -// statusBar()->show(); +// statusBar()->show(); // a call to KXmlGuiWindow::setupGUI() populates the GUI // with actions, using KXMLGUI. // It also applies the saved mainwindow settings, if any, and ask the // mainwindow to automatically save settings if changed: window size, // toolbar position, icon size, etc. -// setupGUI(); - + + setupActions(); + createGUI("/home/jquentin/sflphone/sflphone_kde/sflphone_kdeui.rc"); + setWindowIcon(QIcon(ICON_SFLPHONE)); } SFLPhone::~SFLPhone() @@ -35,15 +46,100 @@ SFLPhone::~SFLPhone() void SFLPhone::setupActions() { -// KStandardAction::openNew(this, SLOT(fileNew()), actionCollection()); -// KStandardAction::quit(qApp, SLOT(quit()), actionCollection()); + qDebug() << "setupActions"; +// KStandardAction::openNew(this, SLOT(fileNew()), actionCollection()); +// KStandardAction::quit(qApp, SLOT(quit()), actionCollection()); -// KStandardAction::preferences(this, SLOT(optionsPreferences()), actionCollection()); +// KStandardAction::preferences(this, SLOT(optionsPreferences()), actionCollection()); - // custom menu and menu item - the slot is in the class testkde4appfwView -// KAction *custom = new KAction(KIcon("colorize"), i18n("Swi&tch Colors"), this); -// actionCollection()->addAction( QLatin1String("switch_action"), custom ); -// connect(custom, SIGNAL(triggered(bool)), view, SLOT(switchColors())); +// custom menu and menu item - the slot is in the class testkde4appfwView +// KAction *custom = new KAction(KIcon("colorize"), i18n("Swi&tch Colors"), this); +// actionCollection()->addAction( QLatin1String("switch_action"), custom ); +// connect(custom, SIGNAL(triggered(bool)), view, SLOT(switchColors())); +// KAction * action_quit = KStandardAction::quit(qApp, SLOT(closeAllWindows()), menu_Actions); +// menu_Actions->addAction(action_quit); + + actionCollection()->addAction("action_accept", view->action_accept); + actionCollection()->addAction("action_refuse", view->action_refuse); + actionCollection()->addAction("action_hold", view->action_hold); + actionCollection()->addAction("action_transfer", view->action_transfer); + actionCollection()->addAction("action_record", view->action_record); + actionCollection()->addAction("action_history", view->action_history); + actionCollection()->addAction("action_addressBook", view->action_addressBook); + actionCollection()->addAction("action_mailBox", view->action_mailBox); + KAction * action_quit = KStandardAction::quit(qApp, SLOT(closeAllWindows()), 0); + actionCollection()->addAction("action_quit", action_quit); + + //KMenu * menu_Actions = new KMenu(tr2i18n("&Actions")); + //actionCollection()->addMenu("Actions", menu_Actions); + //menu_Actions->setObjectName(QString::fromUtf8("menu_Actions")); +// menu_Actions->addAction(view->action_accept); +// menu_Actions->addAction(view->action_refuse); +// menu_Actions->addAction(view->action_hold); +// menu_Actions->addAction(view->action_transfer); +// menu_Actions->addAction(view->action_record); +// menu_Actions->addSeparator(); +// menu_Actions->addAction(view->action_history); +// menu_Actions->addAction(view->action_addressBook); +// menu_Actions->addSeparator(); +// menu_Actions->addAction(view->action_mailBox); +// menu_Actions->addSeparator(); +// KAction * action_quit = KStandardAction::quit(qApp, SLOT(closeAllWindows()), 0); +// menu_Actions->addAction(action_quit); +// qDebug() << "menuBar()->addMenu(menu_Actions) : " << menuBar()->addMenu(menu_Actions); + //menuBar()->addMenu(menu_Actions); + + actionCollection()->addAction("action_displayVolumeControls", view->action_displayVolumeControls); + actionCollection()->addAction("action_displayDialpad", view->action_displayDialpad); + actionCollection()->addAction("action_configureAccounts", view->action_configureAccounts); + actionCollection()->addAction("action_configureAudio", view->action_configureAudio); + actionCollection()->addAction("action_configureSflPhone", view->action_configureSflPhone); + actionCollection()->addAction("action_accountCreationWizard", view->action_accountCreationWizard); + +// KMenu * menu_Configure = new KMenu(tr2i18n("&Settings")); +// menu_Configure->setObjectName(QString::fromUtf8("menu_Configure")); +// menu_Configure->addAction(view->action_displayVolumeControls); +// menu_Configure->addAction(view->action_displayDialpad); +// menu_Configure->addSeparator(); +// menu_Configure->addAction(view->action_configureAccounts); +// menu_Configure->addAction(view->action_configureAudio); +// menu_Configure->addAction(view->action_configureSflPhone); +// menu_Configure->addSeparator(); +// menu_Configure->addAction(view->action_accountCreationWizard); +// menuBar()->addMenu(menu_Configure); + + QStatusBar * statusbar = new QStatusBar(this); + statusbar->setObjectName(QString::fromUtf8("statusbar")); + this->setStatusBar(statusbar); + + QToolBar * toolbar = new QToolBar(this); + this->addToolBar(Qt::TopToolBarArea, toolbar); + toolbar->addAction(view->action_accept); + toolbar->addAction(view->action_refuse); + toolbar->addAction(view->action_hold); + toolbar->addAction(view->action_transfer); + toolbar->addAction(view->action_record); + toolbar->addSeparator(); + toolbar->addAction(view->action_history); + toolbar->addAction(view->action_addressBook); + toolbar->addSeparator(); + toolbar->addAction(view->action_mailBox); + + } +bool SFLPhone::queryClose() +{ + qDebug() << "queryClose : " << view->listWidget_callList->count() << " calls open."; + if(view->listWidget_callList->count() > 0) + { + qDebug() << "Attempting to quit when still having some calls open."; + view->getErrorWindow()->showMessage(tr2i18n("You still have some calls open. Please close all calls before quitting.", 0)); + return false; + } + return true; +} + + + diff --git a/sflphone_kde/SFLPhone.h b/sflphone_kde/SFLPhone.h index 37feff3dd85dd0d5fbbdfd42f05efa6a6acc5b4b..ff7aeea15f69fa436592c2da4d0705544e80be93 100644 --- a/sflphone_kde/SFLPhone.h +++ b/sflphone_kde/SFLPhone.h @@ -19,7 +19,7 @@ class ConfigurationDialog; class sflphone_kdeView; -class SFLPhone : public KMainWindow +class SFLPhone : public KXmlGuiWindow { Q_OBJECT @@ -27,12 +27,14 @@ Q_OBJECT private: sflphone_kdeView * view; - +protected: + virtual bool queryClose(); public: SFLPhone(QWidget *parent = 0); ~SFLPhone(); void setupActions(); + }; diff --git a/sflphone_kde/icons/application-exit.png b/sflphone_kde/icons/application-exit.png new file mode 100644 index 0000000000000000000000000000000000000000..dd76354c4a49d07e81d9e701164cdc2caa439a47 Binary files /dev/null and b/sflphone_kde/icons/application-exit.png differ diff --git a/sflphone_kde/main.cpp b/sflphone_kde/main.cpp index 37f6090144cbac4dc8553381e2e269a147e2043f..781cb360c46c710dc578d4b2af0abe790d81f856 100644 --- a/sflphone_kde/main.cpp +++ b/sflphone_kde/main.cpp @@ -1,6 +1,9 @@ #include <QApplication> #include <QtCore/QString> #include <QtGui/QCursor> +#include <QtGui/QMenu> +#include <QtGui/QMenuBar> +#include <QtGui/QAction> #include <kapplication.h> #include <kcmdlineargs.h> #include <kaboutdata.h> @@ -38,6 +41,7 @@ int main(int argc, char **argv) { InstanceInterface & instance = InstanceInterfaceSingleton::getInstance(); instance.Register(getpid(), APP_NAME); + KAboutData about( "sflphone_kde", 0, @@ -56,15 +60,27 @@ int main(int argc, char **argv) //options.add("+[URL]", ki18n( "Document to open" )); KCmdLineArgs::addCmdLineOptions(options); KApplication app; - + + SFLPhone * fenetre = new SFLPhone(); + QString locale = QLocale::system().name(); QTranslator translator; translator.load(QString("config_") + locale); app.installTranslator(&translator); - SFLPhone * fenetre = new SFLPhone(); - + /* + QApplication app(argc,argv); + // + QMainWindow * fenetre = new QMainWindow(); + QMenu * menu = new QMenu("menubb",0); + fenetre->menuBar()->addMenu(menu); + //QMenu * menu = fenetre->menuBar()->addMenu("menu"); + QAction * action = new QAction("actioncc", 0); + action->setText("actionbb"); + menu->addAction(action); + //fenetre->menuBar()->addMenu("menu"); +*/ fenetre->move(QCursor::pos().x() - fenetre->geometry().width()/2, QCursor::pos().y() - fenetre->geometry().height()/2); fenetre->show(); diff --git a/sflphone_kde/resources.qrc b/sflphone_kde/resources.qrc index c2032d4914877f9f83f2408d230df5d86772e11d..0451ab29d4739f1d343869292952821aac605106 100644 --- a/sflphone_kde/resources.qrc +++ b/sflphone_kde/resources.qrc @@ -1,5 +1,6 @@ <RCC> <qresource prefix="images" > + <file>icons/application-exit.png</file> <file>icons/office-address-book.png</file> <file>icons/x-office-address-book.png</file> <file>icons/add.png</file> @@ -16,6 +17,7 @@ <file>icons/history2.svg</file> <file>icons/history.svg</file> <file>icons/hold.svg</file> + <file>icons/application-exit.png</file> <file>icons/icon_accept.svg</file> <file>icons/icon_call.svg</file> <file>icons/icon_dialpad_off.svg</file> diff --git a/sflphone_kde/sflphone-qt.ui b/sflphone_kde/sflphone-qt.ui deleted file mode 100644 index 90de398ffbd282a479352da2449dbe4ddd2c665f..0000000000000000000000000000000000000000 --- a/sflphone_kde/sflphone-qt.ui +++ /dev/null @@ -1,579 +0,0 @@ -<ui version="4.0" > - <class>SFLPhone</class> - <widget class="QMainWindow" name="SFLPhone" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>384</width> - <height>366</height> - </rect> - </property> - <property name="windowTitle" > - <string>SFLPhone</string> - </property> - <property name="windowIcon" > - <iconset resource="resources.qrc" > - <normaloff>:/images/icons/sflphone.png</normaloff>:/images/icons/sflphone.png</iconset> - </property> - <widget class="QWidget" name="centralwidget" > - <layout class="QVBoxLayout" name="verticalLayout" > - <property name="sizeConstraint" > - <enum>QLayout::SetDefaultConstraint</enum> - </property> - <item> - <widget class="QStackedWidget" name="stackedWidget_screen" > - <property name="currentIndex" > - <number>0</number> - </property> - <widget class="QWidget" name="page_callList" > - <layout class="QHBoxLayout" name="horizontalLayout_3" > - <item> - <widget class="QListWidget" name="listWidget_callList" /> - </item> - </layout> - </widget> - <widget class="QWidget" name="page_callHistory" > - <layout class="QVBoxLayout" name="verticalLayout_3" > - <item> - <widget class="QListWidget" name="listWidget_callHistory" /> - </item> - <item> - <widget class="QLineEdit" name="lineEdit_searchHistory" /> - </item> - </layout> - </widget> - <widget class="QWidget" name="page_addressBook" > - <layout class="QVBoxLayout" name="verticalLayout_5" > - <item> - <widget class="QListWidget" name="listWidget_addressBook" /> - </item> - <item> - <widget class="QLineEdit" name="lineEdit_addressBook" /> - </item> - </layout> - </widget> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout" > - <property name="spacing" > - <number>0</number> - </property> - <item> - <widget class="QWidget" native="1" name="widget_recVol" > - <property name="layoutDirection" > - <enum>Qt::RightToLeft</enum> - </property> - <layout class="QVBoxLayout" name="verticalLayout_4" > - <property name="spacing" > - <number>0</number> - </property> - <property name="margin" > - <number>0</number> - </property> - <item> - <widget class="QSlider" name="slider_recVol" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Expanding" hsizetype="Fixed" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize" > - <size> - <width>0</width> - <height>50</height> - </size> - </property> - <property name="layoutDirection" > - <enum>Qt::RightToLeft</enum> - </property> - <property name="autoFillBackground" > - <bool>false</bool> - </property> - <property name="maximum" > - <number>100</number> - </property> - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="invertedAppearance" > - <bool>false</bool> - </property> - <property name="invertedControls" > - <bool>false</bool> - </property> - <property name="tickPosition" > - <enum>QSlider::NoTicks</enum> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="toolButton_recVol" > - <property name="text" > - <string>...</string> - </property> - <property name="icon" > - <iconset> - <normaloff>:/Images/mic_75.svg</normaloff>:/Images/mic_75.svg</iconset> - </property> - <property name="checkable" > - <bool>true</bool> - </property> - </widget> - </item> - </layout> - <zorder>toolButton_recVol</zorder> - <zorder>slider_recVol</zorder> - </widget> - </item> - <item> - <widget class="QWidget" native="1" name="widget_dialpad" > - <layout class="QGridLayout" name="gridLayout" > - <item row="0" column="1" > - <widget class="QPushButton" name="pushButton_1" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Expanding" hsizetype="Expanding" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>1</string> - </property> - </widget> - </item> - <item row="0" column="2" > - <widget class="QPushButton" name="pushButton_2" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Expanding" hsizetype="Expanding" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>2</string> - </property> - <property name="shortcut" > - <string>2</string> - </property> - </widget> - </item> - <item row="0" column="3" > - <widget class="QPushButton" name="pushButton_3" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Expanding" hsizetype="Expanding" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>3</string> - </property> - </widget> - </item> - <item row="1" column="1" > - <widget class="QPushButton" name="pushButton_4" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Expanding" hsizetype="Expanding" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>4</string> - </property> - </widget> - </item> - <item row="1" column="2" > - <widget class="QPushButton" name="pushButton_5" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Expanding" hsizetype="Expanding" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>5</string> - </property> - </widget> - </item> - <item row="1" column="3" > - <widget class="QPushButton" name="pushButton_6" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Expanding" hsizetype="Expanding" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>6</string> - </property> - </widget> - </item> - <item row="2" column="1" > - <widget class="QPushButton" name="pushButton_7" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Expanding" hsizetype="Expanding" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>7</string> - </property> - </widget> - </item> - <item row="2" column="2" > - <widget class="QPushButton" name="pushButton_8" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Expanding" hsizetype="Expanding" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>8</string> - </property> - </widget> - </item> - <item row="2" column="3" > - <widget class="QPushButton" name="pushButton_9" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Expanding" hsizetype="Expanding" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>9</string> - </property> - </widget> - </item> - <item row="3" column="1" > - <widget class="QPushButton" name="pushButton_etoile" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Expanding" hsizetype="Expanding" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>*</string> - </property> - </widget> - </item> - <item row="3" column="2" > - <widget class="QPushButton" name="pushButton_0" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Expanding" hsizetype="Expanding" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>0</string> - </property> - </widget> - </item> - <item row="3" column="3" > - <widget class="QPushButton" name="pushButton_diese" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Expanding" hsizetype="Expanding" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>#</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QWidget" native="1" name="widget_sndVol" > - <layout class="QVBoxLayout" name="verticalLayout_2" > - <property name="spacing" > - <number>0</number> - </property> - <property name="margin" > - <number>0</number> - </property> - <item> - <widget class="QSlider" name="slider_sndVol" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Expanding" hsizetype="Fixed" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize" > - <size> - <width>0</width> - <height>50</height> - </size> - </property> - <property name="layoutDirection" > - <enum>Qt::LeftToRight</enum> - </property> - <property name="autoFillBackground" > - <bool>false</bool> - </property> - <property name="maximum" > - <number>100</number> - </property> - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="tickPosition" > - <enum>QSlider::NoTicks</enum> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="toolButton_sndVol" > - <property name="text" > - <string>...</string> - </property> - <property name="icon" > - <iconset> - <normaloff>:/Images/speaker_75.svg</normaloff>:/Images/speaker_75.svg</iconset> - </property> - <property name="checkable" > - <bool>true</bool> - </property> - <property name="checked" > - <bool>false</bool> - </property> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - <widget class="QMenuBar" name="menubar" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>384</width> - <height>25</height> - </rect> - </property> - <widget class="QMenu" name="menu_Actions" > - <property name="title" > - <string>&Actions</string> - </property> - <addaction name="action_accept" /> - <addaction name="action_refuse" /> - <addaction name="action_hold" /> - <addaction name="action_transfer" /> - <addaction name="action_record" /> - <addaction name="separator" /> - <addaction name="action_history" /> - <addaction name="action_addressBook" /> - <addaction name="separator" /> - <addaction name="action_mailBox" /> - <addaction name="separator" /> - </widget> - <widget class="QMenu" name="menu_Configure" > - <property name="title" > - <string>&Configure</string> - </property> - <addaction name="action_displayVolumeControls" /> - <addaction name="action_displayDialpad" /> - <addaction name="separator" /> - <addaction name="action_configureAccounts" /> - <addaction name="action_configureAudio" /> - <addaction name="action_configureSflPhone" /> - <addaction name="separator" /> - <addaction name="action_accountCreationWizard" /> - </widget> - <addaction name="menu_Actions" /> - <addaction name="menu_Configure" /> - </widget> - <widget class="QStatusBar" name="statusbar" /> - <widget class="QToolBar" name="toolBar" > - <property name="windowTitle" > - <string>toolBar</string> - </property> - <attribute name="toolBarArea" > - <enum>TopToolBarArea</enum> - </attribute> - <attribute name="toolBarBreak" > - <bool>false</bool> - </attribute> - <addaction name="action_accept" /> - <addaction name="action_refuse" /> - <addaction name="action_hold" /> - <addaction name="action_transfer" /> - <addaction name="action_record" /> - <addaction name="separator" /> - <addaction name="action_history" /> - <addaction name="action_addressBook" /> - <addaction name="separator" /> - <addaction name="action_mailBox" /> - </widget> - <action name="action_accept" > - <property name="icon" > - <iconset resource="resources.qrc" > - <normaloff>:/images/icons/call.svg</normaloff>:/images/icons/call.svg</iconset> - </property> - <property name="text" > - <string>&Pick up</string> - </property> - </action> - <action name="action_refuse" > - <property name="icon" > - <iconset resource="resources.qrc" > - <normaloff>:/images/icons/hang_up.svg</normaloff>:/images/icons/hang_up.svg</iconset> - </property> - <property name="text" > - <string>&Hang up</string> - </property> - </action> - <action name="action_hold" > - <property name="icon" > - <iconset resource="resources.qrc" > - <normaloff>:/images/icons/hold.svg</normaloff>:/images/icons/hold.svg</iconset> - </property> - <property name="text" > - <string>H&old</string> - </property> - </action> - <action name="action_transfer" > - <property name="checkable" > - <bool>true</bool> - </property> - <property name="icon" > - <iconset resource="resources.qrc" > - <normaloff>:/images/icons/transfert.svg</normaloff>:/images/icons/transfert.svg</iconset> - </property> - <property name="text" > - <string>&Transfer</string> - </property> - </action> - <action name="action_history" > - <property name="checkable" > - <bool>true</bool> - </property> - <property name="icon" > - <iconset resource="resources.qrc" > - <normaloff>:/images/icons/history2.svg</normaloff>:/images/icons/history2.svg</iconset> - </property> - <property name="text" > - <string>H&istory</string> - </property> - </action> - <action name="action_mailBox" > - <property name="icon" > - <iconset resource="resources.qrc" > - <normaloff>:/images/icons/mailbox.svg</normaloff>:/images/icons/mailbox.svg</iconset> - </property> - <property name="text" > - <string>&Mailbox</string> - </property> - </action> - <action name="action_configureAccounts" > - <property name="icon" > - <iconset> - <normaloff>:/Images/stock_person.svg</normaloff>:/Images/stock_person.svg</iconset> - </property> - <property name="text" > - <string>Configure &accounts</string> - </property> - </action> - <action name="action_configureAudio" > - <property name="icon" > - <iconset> - <normaloff>:/Images/icon_volume.svg</normaloff>:/Images/icon_volume.svg</iconset> - </property> - <property name="text" > - <string>Configure a&udio</string> - </property> - </action> - <action name="action_configureSflPhone" > - <property name="icon" > - <iconset> - <normaloff>:/Images/sflphone.png</normaloff>:/Images/sflphone.png</iconset> - </property> - <property name="text" > - <string>&Configure SFLPhone</string> - </property> - </action> - <action name="action_displayVolumeControls" > - <property name="checkable" > - <bool>true</bool> - </property> - <property name="checked" > - <bool>true</bool> - </property> - <property name="icon" > - <iconset> - <normaloff>:/Images/icon_volume.svg</normaloff>:/Images/icon_volume.svg</iconset> - </property> - <property name="text" > - <string>Display &volume bars</string> - </property> - </action> - <action name="action_About" > - <property name="text" > - <string>&About</string> - </property> - </action> - <action name="action_displayDialpad" > - <property name="checkable" > - <bool>true</bool> - </property> - <property name="checked" > - <bool>true</bool> - </property> - <property name="icon" > - <iconset> - <normaloff>:/Images/icon_dialpad.svg</normaloff>:/Images/icon_dialpad.svg</iconset> - </property> - <property name="text" > - <string>Display &dialpad</string> - </property> - </action> - <action name="action_record" > - <property name="checkable" > - <bool>true</bool> - </property> - <property name="icon" > - <iconset resource="resources.qrc" > - <normaloff>:/images/icons/del_off.png</normaloff>:/images/icons/del_off.png</iconset> - </property> - <property name="text" > - <string>&Record</string> - </property> - </action> - <action name="action_accountCreationWizard" > - <property name="text" > - <string>Account creation &wizard</string> - </property> - </action> - <action name="action_addressBook" > - <property name="checkable" > - <bool>true</bool> - </property> - <property name="icon" > - <iconset resource="resources.qrc" > - <normaloff>:/images/icons/x-office-address-book.png</normaloff>:/images/icons/x-office-address-book.png</iconset> - </property> - <property name="text" > - <string>Address book</string> - </property> - </action> - </widget> - <resources> - <include location="resources.qrc" /> - </resources> - <connections/> -</ui> diff --git a/sflphone_kde/sflphone_const.h b/sflphone_kde/sflphone_const.h index 9b0afdff3f6eb972030c8c3b47a6a159e6ead091..a559fa654901b8bee26689ef894638b5efdabd87 100644 --- a/sflphone_kde/sflphone_const.h +++ b/sflphone_kde/sflphone_const.h @@ -11,7 +11,7 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -45,6 +45,7 @@ #define PAGE_ACCOUNTS 2 #define PAGE_AUDIO 3 +#define CONTACT_ITEM_HEIGHT 40 #define ICON_INCOMING ":/images/icons/ring.svg" #define ICON_RINGING ":/images/icons/ring.svg" @@ -80,6 +81,10 @@ #define ICON_HISTORY_OUTGOING ":/images/icons/outgoing.svg" #define ICON_HISTORY_MISSED ":/images/icons/missed.svg" +#define ICON_QUIT ":/images/icons/application-exit.png" + +#define ICON_SFLPHONE ":/images/icons/sflphone.png" + #define RECORD_DEVICE "mic" #define SOUND_DEVICE "speaker" diff --git a/sflphone_kde/sflphone_kdeui.rc b/sflphone_kde/sflphone_kdeui.rc index 406bccc6b93b063f9adfbaffff3d771b1ebf8e7c..291817af5d2f8d8e1bae50704b8de5c326653f0e 100644 --- a/sflphone_kde/sflphone_kdeui.rc +++ b/sflphone_kde/sflphone_kdeui.rc @@ -1,8 +1,38 @@ -<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> -<kpartgui name="KApp4" version="1"> -<MenuBar> - <Menu name="move"><text>&Move</text> - <Action name="switch_action" /> - </Menu> -</MenuBar> -</kpartgui> +<?xml version="1.0" encoding="UTF-8"?> +<gui name="tutorial3" + version="1" + xmlns="http://www.kde.org/standards/kxmlgui/1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.kde.org/standards/kxmlgui/1.0 + http://www.kde.org/standards/kxmlgui/1.0/kxmlgui.xsd" > + + <MenuBar> + <Menu name="Actions" > + <text>Actions</text> + <Action name="action_accept" /> + <Action name="action_refuse" /> + <Action name="action_hold" /> + <Action name="action_transfer" /> + <Action name="action_record" /> + <Separator /> + <Action name="action_history" /> + <Action name="action_addressBook" /> + <Separator /> + <Action name="action_mailBox" /> + <Separator /> + <Action name="action_quit" /> + </Menu> + <Menu name="Settings" > + <text>Settings</text> + <Action name="action_displayVolumeControls" /> + <Action name="action_displayDialpad" /> + <Separator /> + <Action name="action_configureAccounts" /> + <Action name="action_configureAudio" /> + <Action name="action_configureSflPhone" /> + <Separator /> + <Action name="action_accountCreationWizard" /> + </Menu> + </MenuBar> + +</gui> \ No newline at end of file diff --git a/sflphone_kde/sflphone_kdeview.cpp b/sflphone_kde/sflphone_kdeview.cpp index 093fb377f192e49e9421912650d35c3ef07aede0..75bc2f0cb404e2cb5d05a4a8dbe5b88f9f873866 100644 --- a/sflphone_kde/sflphone_kdeview.cpp +++ b/sflphone_kde/sflphone_kdeview.cpp @@ -24,6 +24,7 @@ #include <klocale.h> #include <QtGui/QLabel> #include <QtGui/QContextMenuEvent> +#include <QtGui/QMenu> #include <kstandardaction.h> #include <kactioncollection.h> @@ -34,11 +35,13 @@ #include "callmanager_interface_singleton.h" #include "instance_interface_singleton.h" #include "ActionSetAccountFirst.h" +#include "ContactItemWidget.h" #include <kabc/addressbook.h> #include <kabc/stdaddressbook.h> #include <kabc/addresseelist.h> +//#include <kabc/ldapclient.h> using namespace KABC; @@ -47,20 +50,8 @@ ConfigurationDialog * sflphone_kdeView::configDialog; sflphone_kdeView::sflphone_kdeView(QWidget *parent) { - //ui_sflphone_kdeview_base.setupUi(this); - setupUi(this); - - AddressBook * ab = KABC::StdAddressBook::self(); - - AddresseeList results = ab->findByEmail("savoir"); - for(int i = 0 ; i < results.count() ; i++) - { - qDebug() << results[i].name(); - } - - errorWindow = new QErrorMessage(this); callList = new CallList(); @@ -84,14 +75,8 @@ sflphone_kdeView::sflphone_kdeView(QWidget *parent) connect(&callManager, SIGNAL(volumeChanged(const QString &, double)), this, SLOT(on1_volumeChanged(const QString &, double))); - //QDBusConnection::sessionBus().connect("org.sflphone.SFLphone", "/org/sflphone/SFLphone/CallManager", "org.sflphone.SFLphone.CallManager", "incomingCall", - // this, SLOT(on_incomingCall(const QString &accountID, const QString &callID, const QString &from))); - loadWindow(); - setupActions(); - - setAutoFillBackground(true); } sflphone_kdeView::~sflphone_kdeView() @@ -104,30 +89,14 @@ sflphone_kdeView::~sflphone_kdeView() instance.Unregister(getpid()); } -void sflphone_kdeView::setupActions() -{ - qDebug() << "setupActions"; -// KAction * action_quit = KStandardAction::quit(qApp, SLOT(closeAllWindows()), menu_Actions); -// menu_Actions->addAction(action_quit); -} -bool sflphone_kdeView::queryClose() -{ - qDebug() << "queryClose : " << listWidget_callList->count() << " calls open."; - if(listWidget_callList->count() > 0) - { - qDebug() << "Attempting to quit when still having some calls open."; - errorWindow->showMessage(tr2i18n("You still have some calls open. Please close all calls before quitting.", 0)); - return false; - } - return true; -} + void sflphone_kdeView::loadWindow() { ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); - //action_displayVolumeControls->setChecked(configurationManager.getVolumeControls()); - //action_displayDialpad->setChecked(configurationManager.getDialpad()); + action_displayVolumeControls->setChecked(configurationManager.getVolumeControls()); + action_displayDialpad->setChecked(configurationManager.getDialpad()); updateWindowCallState(); updateRecordButton(); updateVolumeButton(); @@ -159,6 +128,10 @@ AccountList * sflphone_kdeView::getAccountList() return configDialog->getAccountList(); } +QErrorMessage * sflphone_kdeView::getErrorWindow() +{ + return errorWindow; +} void sflphone_kdeView::addCallToCallList(Call * call) { @@ -209,7 +182,7 @@ void sflphone_kdeView::typeString(QString str) addCallToCallList(call); listWidget_callList->setCurrentRow(listWidget_callList->count() - 1); } - callList->getCallByItem(listWidget_callList->currentItem())->appendItemText(str); + callList->findCallByItem(listWidget_callList->currentItem())->appendItemText(str); } if(stackedWidget_screen->currentWidget() == page_callHistory) { @@ -236,7 +209,7 @@ void sflphone_kdeView::backspace() } else { - Call * call = callList->getCallByItem(listWidget_callList->currentItem()); + Call * call = callList->findCallByItem(listWidget_callList->currentItem()); if(!call) { qDebug() << "Error : Backspace on unexisting call."; @@ -268,6 +241,94 @@ void sflphone_kdeView::backspace() } } +void sflphone_kdeView::escape() +{ + qDebug() << "escape"; + if(stackedWidget_screen->currentWidget() == page_callList ) + { + qDebug() << "In call list."; + QListWidgetItem * item = listWidget_callList->currentItem(); + if(!item) + { + qDebug() << "Escape when no item is selected. Doing nothing."; + } + else + { + Call * call = callList->findCallByItem(listWidget_callList->currentItem()); + if(!call) + { + qDebug() << "Error : Escape on unexisting call."; + } + else + { + int state = call->getState(); + if(state == CALL_STATE_TRANSFER || state == CALL_STATE_TRANSF_HOLD) + { + actionb(call, CALL_ACTION_TRANSFER); + } + else + { + actionb(call, CALL_ACTION_REFUSE); + } + } + } + } + if(stackedWidget_screen->currentWidget() == page_callHistory) + { + qDebug() << "In call history."; + lineEdit_searchHistory->clear(); + } + if(stackedWidget_screen->currentWidget() == page_addressBook) + { + qDebug() << "In address book."; + lineEdit_addressBook->clear(); + } +} + +void sflphone_kdeView::enter() +{ + qDebug() << "enter"; + if(stackedWidget_screen->currentWidget() == page_callList ) + { + qDebug() << "In call list."; + QListWidgetItem * item = listWidget_callList->currentItem(); + if(!item) + { + qDebug() << "Enter when no item is selected. Doing nothing."; + } + else + { + Call * call = callList->findCallByItem(listWidget_callList->currentItem()); + if(!call) + { + qDebug() << "Error : Enter on unexisting call."; + } + else + { + int state = call->getState(); + if(state == CALL_STATE_INCOMING || state == CALL_STATE_DIALING || state == CALL_STATE_TRANSFER || state == CALL_STATE_TRANSF_HOLD) + { + actionb(call, CALL_ACTION_ACCEPT); + } + else + { + qDebug() << "Enter when call selected not in appropriate state. Doing nothing."; + } + } + } + } + if(stackedWidget_screen->currentWidget() == page_callHistory) + { + qDebug() << "In call history."; + lineEdit_searchHistory->clear(); + } + if(stackedWidget_screen->currentWidget() == page_addressBook) + { + qDebug() << "In address book."; + lineEdit_addressBook->clear(); + } +} + void sflphone_kdeView::actionb(Call * call, call_action action) { try @@ -284,7 +345,7 @@ void sflphone_kdeView::actionb(Call * call, call_action action) void sflphone_kdeView::action(QListWidgetItem * item, call_action action) { - actionb(callList->getCallByItem(item), action); + actionb(callList->findCallByItem(item), action); } /******************************************* @@ -450,20 +511,20 @@ void sflphone_kdeView::updateWindowCallState() enabledActions[1] = true; } } -// action_accept->setEnabled(enabledActions[0]); -// action_refuse->setEnabled(enabledActions[1]); -// action_hold->setEnabled(enabledActions[2]); -// action_transfer->setEnabled(enabledActions[3]); -// action_record->setEnabled(enabledActions[4]); -// action_mailBox->setEnabled(enabledActions[5]); + action_accept->setEnabled(enabledActions[0]); + action_refuse->setEnabled(enabledActions[1]); + action_hold->setEnabled(enabledActions[2]); + action_transfer->setEnabled(enabledActions[3]); + action_record->setEnabled(enabledActions[4]); + action_mailBox->setEnabled(enabledActions[5]); -// action_record->setIcon(QIcon(recordEnabled ? ICON_REC_DEL_ON : ICON_REC_DEL_OFF)); -// action_accept->setIcon(QIcon(buttonIconFiles[0])); -// action_refuse->setIcon(QIcon(buttonIconFiles[1])); -// action_hold->setIcon(QIcon(buttonIconFiles[2])); + action_record->setIcon(QIcon(recordEnabled ? ICON_REC_DEL_ON : ICON_REC_DEL_OFF)); + action_accept->setIcon(QIcon(buttonIconFiles[0])); + action_refuse->setIcon(QIcon(buttonIconFiles[1])); + action_hold->setIcon(QIcon(buttonIconFiles[2])); -// action_transfer->setChecked(transfer); -// action_record->setChecked(recordActivated); + action_transfer->setChecked(transfer); + action_record->setChecked(recordActivated); } void sflphone_kdeView::updateSearchHistory() @@ -496,9 +557,6 @@ void sflphone_kdeView::updateCallHistory() { qDebug() << "call->getItem()->text()=" << call->getHistoryItem()->text() << " contains textSearched=" << textSearched; addCallToCallHistory(call); - //QListWidgetItem * historyItem = call->getHistoryItem(); - //listWidget_callHistory->addItem(historyItem); - //listWidget_callHistory->setItemWidget(historyItem, call->getHistoryItemWidget()); } } } @@ -531,10 +589,8 @@ QVector<Contact *> sflphone_kdeView::findContactsInKAddressBook(QString textSear QVector<Contact *> results = QVector<Contact *>(); AddressBook::Iterator it; for ( it = ab->begin(); it != ab->end(); ++it ) { - //kDebug(5700) << "UID=" << (*it).uid(); - if(it->name().contains(textSearched, Qt::CaseInsensitive) || it->familyName().contains(textSearched, Qt::CaseInsensitive) || it->nickName().contains(textSearched, Qt::CaseInsensitive)) + if(it->name().contains(textSearched, Qt::CaseInsensitive) || it->nickName().contains(textSearched, Qt::CaseInsensitive)) { - for(int i = 0 ; i < it->phoneNumbers().count() ; i++) { if(phoneNumberTypeDisplayed(it->phoneNumbers().at(i).type())) @@ -758,7 +814,7 @@ void sflphone_kdeView::on_listWidget_callList_itemChanged() void sflphone_kdeView::on_listWidget_callList_itemDoubleClicked(QListWidgetItem * item) { qDebug() << "on_listWidget_callList_itemDoubleClicked"; - Call * call = callList->getCallByItem(item); + Call * call = callList->findCallByItem(item); call_state state = call->getCurrentState(); switch(state) { @@ -776,13 +832,13 @@ void sflphone_kdeView::on_listWidget_callList_itemDoubleClicked(QListWidgetItem void sflphone_kdeView::contextMenuEvent(QContextMenuEvent *event) { -/* QMenu menu(this); + 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 + //TODO accounts to choose menu.addSeparator(); QVector<Account *> accounts = registeredAccounts(); for (int i = 0 ; i < accounts.size() ; i++) @@ -800,7 +856,7 @@ void sflphone_kdeView::contextMenuEvent(QContextMenuEvent *event) menu.addAction(action); } menu.exec(event->globalPos()); - */ + } void sflphone_kdeView::setAccountFirst(Account * account) @@ -853,34 +909,58 @@ void sflphone_kdeView::on_action_accept_triggered() if(stackedWidget_screen->currentWidget() == page_callList) { QListWidgetItem * item = listWidget_callList->currentItem(); - if(!item || (*callList)[item]->getState() == CALL_STATE_RINGING || (*callList)[item]->getState() == CALL_STATE_CURRENT || (*callList)[item]->getState() == CALL_STATE_HOLD || (*callList)[item]->getState() == CALL_STATE_BUSY) + if(!item) { - qDebug() << "Calling when no item is selected or item currently ringing, current, hold or busy. Opening an item."; + qDebug() << "Calling when no item is selected. Opening an item."; Call * call = callList->addDialingCall(); addCallToCallList(call); listWidget_callList->setCurrentRow(listWidget_callList->count() - 1); } else { - action(item, CALL_ACTION_ACCEPT); + Call * call = callList->findCallByItem(item); + if(!call) + { + qDebug() << "Error : Accept triggered on unexisting call."; + } + else + { + int state = call->getState(); + if(state == CALL_STATE_RINGING || state == CALL_STATE_CURRENT || state == CALL_STATE_HOLD || state == CALL_STATE_BUSY) + { + qDebug() << "Calling when item currently ringing, current, hold or busy. Opening an item."; + Call * call = callList->addDialingCall(); + addCallToCallList(call); + listWidget_callList->setCurrentRow(listWidget_callList->count() - 1); + } + else + { + actionb(call, CALL_ACTION_ACCEPT); + } + } } } if(stackedWidget_screen->currentWidget() == page_callHistory) { -// action_history->setChecked(false); + action_history->setChecked(false); stackedWidget_screen->setCurrentWidget(page_callList); Call * call = callList->addDialingCall(); - call->appendItemText(listWidget_callHistory->currentItem()->text()); + Call * pastCall = callList->findCallByHistoryItem(listWidget_callHistory->currentItem()); + call->appendItemText(pastCall->getPeerPhoneNumber()); + if(!pastCall->getPeerName().isEmpty()) + call->setPeerName(pastCall->getPeerName()); addCallToCallList(call); listWidget_callList->setCurrentRow(listWidget_callList->count() - 1); actionb(call, CALL_ACTION_ACCEPT); } if(stackedWidget_screen->currentWidget() == page_addressBook) { -// action_addressBook->setChecked(false); + action_addressBook->setChecked(false); stackedWidget_screen->setCurrentWidget(page_callList); Call * call = callList->addDialingCall(); - call->appendItemText(listWidget_addressBook->currentItem()->text()); + ContactItemWidget * w = (ContactItemWidget *) (listWidget_addressBook->itemWidget(listWidget_addressBook->currentItem())); + call->setPeerName(w->getContactName()); + call->appendItemText(w->getContactNumber()); addCallToCallList(call); listWidget_callList->setCurrentRow(listWidget_callList->count() - 1); actionb(call, CALL_ACTION_ACCEPT); @@ -954,7 +1034,7 @@ void sflphone_kdeView::on_action_history_triggered(bool checked) { if(checked == true) { -// action_addressBook->setChecked(false); + action_addressBook->setChecked(false); stackedWidget_screen->setCurrentWidget(page_callHistory); } else @@ -969,7 +1049,7 @@ void sflphone_kdeView::on_action_addressBook_triggered(bool checked) if(checked == true) { -// action_history->setChecked(false); + action_history->setChecked(false); stackedWidget_screen->setCurrentWidget(page_addressBook); } else diff --git a/sflphone_kde/sflphone_kdeview.h b/sflphone_kde/sflphone_kdeview.h index 736a0049b87fdd927013806992f658f97392a1f4..b723765927c7fd7bb238f8175f29530438315e23 100644 --- a/sflphone_kde/sflphone_kdeview.h +++ b/sflphone_kde/sflphone_kdeview.h @@ -49,6 +49,7 @@ class ConfigurationDialog; * @author Jérémy Quentin <jeremy.quentin@gmail.com> * @version 0.1 */ + class sflphone_kdeView : public QWidget, public Ui::SFLPhone { @@ -64,7 +65,6 @@ private: protected: void contextMenuEvent(QContextMenuEvent *event); - virtual bool queryClose(); public: sflphone_kdeView(QWidget *parent); @@ -77,6 +77,7 @@ public: static AccountList * getAccountList(); QVector<Contact *> findContactsInKAddressBook(QString textSearched); bool phoneNumberTypeDisplayed(int type); + QErrorMessage * getErrorWindow(); private slots: //void typeChar(QChar c); @@ -84,7 +85,6 @@ private slots: void backspace(); void actionb(Call * call, call_action action); void action(QListWidgetItem * item, call_action action); - void setupActions(); void addCallToCallList(Call * call); void addCallToCallHistory(Call * call); @@ -103,11 +103,14 @@ private slots: void updateVolumeControls(); void updateDialpad(); + void escape(); + void enter(); + virtual void keyPressEvent(QKeyEvent *event) { int key = event->key(); if(key == Qt::Key_Escape) - on_action_refuse_triggered(); + escape(); else if(key == Qt::Key_Return || key == Qt::Key_Enter) on_action_accept_triggered(); else if(key == Qt::Key_Backspace) diff --git a/sflphone_kde/sflphone_kdeview_base.ui b/sflphone_kde/sflphone_kdeview_base.ui index 109c734937941e62a08a890ff2160c1837d6dbb9..e98d6ff784a1ae64389f19d39bcdb768087f8207 100644 --- a/sflphone_kde/sflphone_kdeview_base.ui +++ b/sflphone_kde/sflphone_kdeview_base.ui @@ -5,8 +5,8 @@ <rect> <x>0</x> <y>0</y> - <width>310</width> - <height>390</height> + <width>391</width> + <height>349</height> </rect> </property> <property name="windowTitle" > @@ -348,12 +348,160 @@ </layout> </item> </layout> - <action name="action_Pick_up" > + <action name="action_accept" > + <property name="icon" > + <iconset resource="resources.qrc" > + <normaloff>:/images/icons/call.svg</normaloff>:/images/icons/call.svg</iconset> + </property> <property name="text" > <string>&Pick up</string> </property> </action> + <action name="action_refuse" > + <property name="icon" > + <iconset resource="resources.qrc" > + <normaloff>:/images/icons/hang_up.svg</normaloff>:/images/icons/hang_up.svg</iconset> + </property> + <property name="text" > + <string>&Hang up</string> + </property> + </action> + <action name="action_hold" > + <property name="icon" > + <iconset resource="resources.qrc" > + <normaloff>:/images/icons/hold.svg</normaloff>:/images/icons/hold.svg</iconset> + </property> + <property name="text" > + <string>H&old</string> + </property> + </action> + <action name="action_transfer" > + <property name="checkable" > + <bool>true</bool> + </property> + <property name="icon" > + <iconset resource="resources.qrc" > + <normaloff>:/images/icons/transfert.svg</normaloff>:/images/icons/transfert.svg</iconset> + </property> + <property name="text" > + <string>&Transfer</string> + </property> + </action> + <action name="action_history" > + <property name="checkable" > + <bool>true</bool> + </property> + <property name="icon" > + <iconset resource="resources.qrc" > + <normaloff>:/images/icons/history2.svg</normaloff>:/images/icons/history2.svg</iconset> + </property> + <property name="text" > + <string>H&istory</string> + </property> + </action> + <action name="action_mailBox" > + <property name="icon" > + <iconset resource="resources.qrc" > + <normaloff>:/images/icons/mailbox.svg</normaloff>:/images/icons/mailbox.svg</iconset> + </property> + <property name="text" > + <string>&Mailbox</string> + </property> + </action> + <action name="action_configureAccounts" > + <property name="icon" > + <iconset resource="resources.qrc" > + <normaloff>:/images/icons/stock_person.svg</normaloff>:/images/icons/stock_person.svg</iconset> + </property> + <property name="text" > + <string>Configure &accounts</string> + </property> + </action> + <action name="action_configureAudio" > + <property name="icon" > + <iconset resource="resources.qrc" > + <normaloff>:/images/icons/icon_volume.svg</normaloff>:/images/icons/icon_volume.svg</iconset> + </property> + <property name="text" > + <string>Configure a&udio</string> + </property> + </action> + <action name="action_configureSflPhone" > + <property name="icon" > + <iconset resource="resources.qrc" > + <normaloff>:/images/icons/sflphone.png</normaloff>:/images/icons/sflphone.png</iconset> + </property> + <property name="text" > + <string>&Configure SFLPhone</string> + </property> + </action> + <action name="action_displayVolumeControls" > + <property name="checkable" > + <bool>true</bool> + </property> + <property name="checked" > + <bool>true</bool> + </property> + <property name="icon" > + <iconset resource="resources.qrc" > + <normaloff>:/images/icons/icon_volume_off.svg</normaloff>:/images/icons/icon_volume_off.svg</iconset> + </property> + <property name="text" > + <string>Display &volume bars</string> + </property> + </action> + <action name="action_About" > + <property name="text" > + <string>&About</string> + </property> + </action> + <action name="action_displayDialpad" > + <property name="checkable" > + <bool>true</bool> + </property> + <property name="checked" > + <bool>true</bool> + </property> + <property name="icon" > + <iconset resource="resources.qrc" > + <normaloff>:/images/icons/icon_dialpad.svg</normaloff>:/images/icons/icon_dialpad.svg</iconset> + </property> + <property name="text" > + <string>Display &dialpad</string> + </property> + </action> + <action name="action_record" > + <property name="checkable" > + <bool>true</bool> + </property> + <property name="icon" > + <iconset resource="resources.qrc" > + <normaloff>:/images/icons/del_off.png</normaloff>:/images/icons/del_off.png</iconset> + </property> + <property name="text" > + <string>&Record</string> + </property> + </action> + <action name="action_accountCreationWizard" > + <property name="text" > + <string>Account creation &wizard</string> + </property> + </action> + <action name="action_addressBook" > + <property name="checkable" > + <bool>true</bool> + </property> + <property name="icon" > + <iconset resource="resources.qrc" > + <normaloff>:/images/icons/x-office-address-book.png</normaloff>:/images/icons/x-office-address-book.png</iconset> + </property> + <property name="text" > + <string>Address book</string> + </property> + </action> </widget> - <resources/> + <resources> + <include location="resources.qrc" /> + </resources> <connections/> </ui>