diff --git a/kde/src/CallView.cpp b/kde/src/CallView.cpp index 03f6842a7f875a87f79181db6408a82d35bddf96..1310ca25381f88a6e5309c86952713ec0ccfa822 100644 --- a/kde/src/CallView.cpp +++ b/kde/src/CallView.cpp @@ -272,11 +272,8 @@ bool CallView::phoneNumberToCall(QTreeWidgetItem *parent, int index, const QMime if (!QString(encodedPhoneNumber).isEmpty()) { Contact* contact = AkonadiBackend::getInstance()->getContactByPhone(encodedPhoneNumber); QString name; - if (contact) - name = contact->getFormattedName(); - else - name = i18n("Unknown"); - Call* call2 = SFLPhone::model()->addDialingCall(name, SFLPhone::model()->getCurrentAccountId()); + name = (contact)?contact->getFormattedName():i18n("Unknown"); + Call* call2 = SFLPhone::model()->addDialingCall(name, SFLPhone::model()->getCurrentAccount()); call2->appendText(QString(encodedPhoneNumber)); if (!parent) { //Dropped on free space diff --git a/kde/src/SFLPhoneView.cpp b/kde/src/SFLPhoneView.cpp index cda5c0d4afdcc3c067ee39df8c6257ac3f004669..a826334eb282f80843f36170d1ddd1b677f27cf4 100755 --- a/kde/src/SFLPhoneView.cpp +++ b/kde/src/SFLPhoneView.cpp @@ -278,7 +278,7 @@ void SFLPhoneView::action(Call* call, call_action action) bool SFLPhoneView::selectCallPhoneNumber(Call* call2,Contact* contact) { if (contact->getPhoneNumbers().count() == 1) { - call2 = SFLPhone::model()->addDialingCall(contact->getFormattedName(), SFLPhone::model()->getCurrentAccountId()); + call2 = SFLPhone::model()->addDialingCall(contact->getFormattedName(), SFLPhone::model()->getCurrentAccount()); call2->appendText(contact->getPhoneNumbers()[0]->getNumber()); } else if (contact->getPhoneNumbers().count() > 1) { @@ -291,7 +291,7 @@ bool SFLPhoneView::selectCallPhoneNumber(Call* call2,Contact* contact) } QString result = QInputDialog::getItem (this, i18n("Select phone number"), i18n("This contact have many phone number, please select the one you wish to call"), list, 0, false, &ok); if (ok) { - call2 = SFLPhone::model()->addDialingCall(contact->getFormattedName(), SFLPhone::model()->getCurrentAccountId()); + call2 = SFLPhone::model()->addDialingCall(contact->getFormattedName(), SFLPhone::model()->getCurrentAccount()); call2->appendText(map[result]); } else { diff --git a/kde/src/klib/dataengine/sflphoneService.cpp b/kde/src/klib/dataengine/sflphoneService.cpp index 952dd4905f4f3a7d2ab00c810503f663884aa98f..0cd5d591b0b5bd3037e7e41bfbd2d547534a8d1c 100644 --- a/kde/src/klib/dataengine/sflphoneService.cpp +++ b/kde/src/klib/dataengine/sflphoneService.cpp @@ -21,6 +21,7 @@ #include "sflphoneService.h" #include "../../lib/Call.h" +#include "../../lib/Account.h" /***************************************************************************** * * @@ -31,8 +32,8 @@ ///Constructor CallJob::CallJob(QObject* parent, const QString& operation, const QVariantMap& parameters) : Plasma::ServiceJob("", operation, parameters, parent) - , m_AccountId ( parameters[ "AccountId" ].toString() ) - , m_Number ( parameters[ "Number" ].toString() ) + , m_pAccount ( Account::buildExistingAccountFromId(parameters[ "AccountId" ].toString() )) + , m_Number ( parameters[ "Number" ].toString() ) { } @@ -40,7 +41,7 @@ CallJob::CallJob(QObject* parent, const QString& operation, const QVariantMap& p ///Make a call void CallJob::start() { - Call* call = SFLPhoneEngine::getModel()->addDialingCall(m_Number,m_AccountId); + Call* call = SFLPhoneEngine::getModel()->addDialingCall(m_Number,m_pAccount); call->setCallNumber(m_Number); call->actionPerformed(CALL_ACTION_ACCEPT); } diff --git a/kde/src/klib/dataengine/sflphoneService.h b/kde/src/klib/dataengine/sflphoneService.h index b73d5078cf4451df57ca8010c3a66a7fdb62a2df..b5004f863d71320eb664d908e59d0821bb15ab6b 100644 --- a/kde/src/klib/dataengine/sflphoneService.h +++ b/kde/src/klib/dataengine/sflphoneService.h @@ -31,6 +31,8 @@ using namespace Plasma; +class Account; + ///@class SFLPhoneService RPC between the plasmoid and the library class SFLPhoneService : public Plasma::Service { @@ -54,8 +56,8 @@ public: void start(); private: - QString m_AccountId; - QString m_Number ; + Account* m_pAccount; + QString m_Number ; }; ///@class DTMFJob Play a sound when called diff --git a/kde/src/lib/CallModel.cpp b/kde/src/lib/CallModel.cpp index 93afb2757407c32316b2c48af639a1cb25aa6b7d..e5184f86fb457ad698e1730224d1a5f730d40ca1 100644 --- a/kde/src/lib/CallModel.cpp +++ b/kde/src/lib/CallModel.cpp @@ -34,13 +34,13 @@ CallModelBase::CallModelBase(QObject* parent) : QObject(parent) //SLOTS // SENDER SIGNAL RECEIVER SLOT / - /**/connect(&callManager, SIGNAL( callStateChanged (const QString &, const QString & ) ), this , SLOT( callStateChanged ( const QString &, const QString & ) ) ); - /**/connect(&callManager, SIGNAL( incomingCall (const QString &, const QString &, const QString & ) ), this , SLOT( incomingCall ( const QString &, const QString & ) ) ); - /**/connect(&callManager, SIGNAL( conferenceCreated (const QString & ) ), this , SLOT( incomingConference( const QString & ) ) ); - /**/connect(&callManager, SIGNAL( conferenceChanged (const QString &, const QString & ) ), this , SLOT( changingConference( const QString &, const QString & ) ) ); - /**/connect(&callManager, SIGNAL( conferenceRemoved (const QString & ) ), this , SLOT( conferenceRemoved ( const QString & ) ) ); - /**/connect(&callManager, SIGNAL( voiceMailNotify (const QString &, int ) ), this , SLOT( voiceMailNotify ( const QString &, int ) ) ); - /**/connect(&callManager, SIGNAL( volumeChanged (const QString &, double ) ), this , SLOT( volumeChanged ( const QString &, double ) ) ); + /**/connect(&callManager, SIGNAL( callStateChanged (const QString &, const QString & ) ), this , SLOT( callStateChanged ( const QString &, const QString & ) ) ); + /**/connect(&callManager, SIGNAL( incomingCall (const QString &, const QString &, const QString & ) ), this , SLOT( incomingCall ( const QString &, const QString & ) ) ); + /**/connect(&callManager, SIGNAL( conferenceCreated (const QString & ) ), this , SLOT( incomingConference ( const QString & ) ) ); + /**/connect(&callManager, SIGNAL( conferenceChanged (const QString &, const QString & ) ), this , SLOT( changingConference ( const QString &, const QString & ) ) ); + /**/connect(&callManager, SIGNAL( conferenceRemoved (const QString & ) ), this , SLOT( conferenceRemovedSlot ( const QString & ) ) ); + /**/connect(&callManager, SIGNAL( voiceMailNotify (const QString &, int ) ), this , SLOT( voiceMailNotifySlot ( const QString &, int ) ) ); + /**/connect(&callManager, SIGNAL( volumeChanged (const QString &, double ) ), this , SLOT( volumeChangedSlot ( const QString &, double ) ) ); /* */ connect(HistoryModel::self(),SIGNAL(newHistoryCall(Call*)),this,SLOT(addPrivateCall(Call*))); @@ -111,7 +111,7 @@ void CallModelBase::incomingCall(const QString & accountID, const QString & call void CallModelBase::incomingConference(const QString &confID) { Call* conf = addConference(confID); - qDebug() << "---------------Adding conference" << conf << confID << "---------------"; + qDebug() << "Adding conference" << conf << confID; emit conferenceCreated(conf); } @@ -131,7 +131,7 @@ void CallModelBase::changingConference(const QString &confID, const QString &sta } ///When a conference is removed -void CallModelBase::conferenceRemoved(const QString &confId) +void CallModelBase::conferenceRemovedSlot(const QString &confId) { Call* conf = getCall(confId); emit aboutToRemoveConference(conf); @@ -140,14 +140,14 @@ void CallModelBase::conferenceRemoved(const QString &confId) } ///When a new voice mail is available -void CallModelBase::voiceMailNotify(const QString &accountID, int count) +void CallModelBase::voiceMailNotifySlot(const QString &accountID, int count) { qDebug() << "Signal : VoiceMail Notify ! " << count << " new voice mails for account " << accountID; emit voiceMailNotify(accountID,count); } ///When the daemon change the volume -void CallModelBase::volumeChanged(const QString & device, double value) +void CallModelBase::volumeChangedSlot(const QString & device, double value) { emit volumeChanged(device,value); } diff --git a/kde/src/lib/CallModel.h b/kde/src/lib/CallModel.h index d6c67d987052b87197d580aef9f4374061eacebf..06fcf3b7ba87be2639386a59428115481cc963e2 100644 --- a/kde/src/lib/CallModel.h +++ b/kde/src/lib/CallModel.h @@ -65,13 +65,13 @@ public: static AccountList* getAccountList ( ); public slots: - void callStateChanged ( const QString& callID , const QString &state ); - void incomingCall ( const QString& accountID , const QString & callID ); - void incomingConference ( const QString& confID ); - void changingConference ( const QString& confID , const QString &state ); - void conferenceRemoved ( const QString& confId ); - void voiceMailNotify ( const QString& accountID , int count ); - void volumeChanged ( const QString& device , double value ); + void callStateChanged ( const QString& callID , const QString &state ); + void incomingCall ( const QString& accountID , const QString & callID ); + void incomingConference ( const QString& confID ); + void changingConference ( const QString& confID , const QString &state ); + void conferenceRemovedSlot ( const QString& confId ); + void voiceMailNotifySlot ( const QString& accountID , int count ); + void volumeChangedSlot ( const QString& device , double value ); protected: static CallMap m_sActiveCalls; @@ -119,14 +119,14 @@ class LIB_EXPORT CallModel : public CallModelBase { static void destroy ( ); //Call related - virtual Call* addCall ( Call* call , Call* parent =0 ); - Call* addDialingCall ( const QString& peerName="", QString account="" ); - Call* addIncomingCall ( const QString& callId ); - Call* addRingingCall ( const QString& callId ); - static QString generateCallId ( ); - void removeCall ( Call* call ); - void attendedTransfer ( Call* toTransfer , Call* target ); - void transfer ( Call* toTransfer , QString target ); + virtual Call* addCall ( Call* call , Call* parent =0 ); + Call* addDialingCall ( const QString& peerName="", Account* account=nullptr ); + Call* addIncomingCall ( const QString& callId ); + Call* addRingingCall ( const QString& callId ); + static QString generateCallId ( ); + void removeCall ( Call* call ); + void attendedTransfer ( Call* toTransfer , Call* target ); + void transfer ( Call* toTransfer , QString target ); virtual bool selectItem(Call* item) { Q_UNUSED(item); return false;} diff --git a/kde/src/lib/CallModel.hpp b/kde/src/lib/CallModel.hpp index 6d2daa8f3e20298c48e557b4c0c847ff7f74cf5f..fb0f342d542d1343a7e0148e4dfaf9a8f6c93e6c 100644 --- a/kde/src/lib/CallModel.hpp +++ b/kde/src/lib/CallModel.hpp @@ -210,14 +210,11 @@ CALLMODEL_TEMPLATE Call* CALLMODEL_T::addCallCommon(Call* call) } //addCallCommon ///Create a new dialing call from peer name and the account ID -CALLMODEL_TEMPLATE Call* CALLMODEL_T::addDialingCall(const QString& peerName, QString account) +CALLMODEL_TEMPLATE Call* CALLMODEL_T::addDialingCall(const QString& peerName, Account* account) { - QString account2 = account; - if (account2.isEmpty()) { - account2 = getCurrentAccountId(); - } + Account* acc = (account)?account:getCurrentAccount(); - Call* call = Call::buildDialingCall(generateCallId(), peerName, account2); + Call* call = Call::buildDialingCall(generateCallId(), peerName, acc->getAccountId()); return addCallCommon(call); } //addDialingCall diff --git a/kde/src/widgets/ContactItemWidget.cpp b/kde/src/widgets/ContactItemWidget.cpp index 1cade1ef2cdac72368dbdcc76588b586dd24f469..d3f2cf0c08d1290d4b9ece728af0123313c757b0 100644 --- a/kde/src/widgets/ContactItemWidget.cpp +++ b/kde/src/widgets/ContactItemWidget.cpp @@ -336,7 +336,7 @@ void ContactItemWidget::callAgain() bool ok; QString number = showNumberSelector(ok); if (ok) { - Call* call = SFLPhone::model()->addDialingCall(m_pContactKA->getFormattedName(), SFLPhone::app()->model()->getCurrentAccountId()); + Call* call = SFLPhone::model()->addDialingCall(m_pContactKA->getFormattedName(), SFLPhone::app()->model()->getCurrentAccount()); call->setCallNumber(number); call->setPeerName(m_pContactKA->getFormattedName()); call->actionPerformed(CALL_ACTION_ACCEPT); diff --git a/kde/src/widgets/HistoryDock.cpp b/kde/src/widgets/HistoryDock.cpp index d11cb8f110fbaf94a156274ab6cd0f19926d88bc..c6e989f976b9f17ae08e3706c63c1efb46458cb6 100644 --- a/kde/src/widgets/HistoryDock.cpp +++ b/kde/src/widgets/HistoryDock.cpp @@ -429,7 +429,7 @@ void HistoryDock::keyPressEvent(QKeyEvent* event) { if (m_pItemView->selectedItems()[0] && m_pItemView->itemWidget(m_pItemView->selectedItems()[0],0)) { QNumericTreeWidgetItem* item = dynamic_cast<QNumericTreeWidgetItem*>(m_pItemView->selectedItems()[0]); if (item) { - SFLPhone::model()->addDialingCall(item->widget->getName(), SFLPhone::app()->model()->getCurrentAccountId())->setCallNumber(item->widget->getPhoneNumber()); + SFLPhone::model()->addDialingCall(item->widget->getName(), SFLPhone::app()->model()->getCurrentAccount())->setCallNumber(item->widget->getPhoneNumber()); } } } diff --git a/kde/src/widgets/HistoryTreeItem.cpp b/kde/src/widgets/HistoryTreeItem.cpp index d4510e180c4ad1c7769547e461a94c5113a1ff31..a0471e44158a44ab0a6d0e8b30ef04f2886f11c3 100644 --- a/kde/src/widgets/HistoryTreeItem.cpp +++ b/kde/src/widgets/HistoryTreeItem.cpp @@ -248,7 +248,7 @@ void HistoryTreeItem::callAgain() if (m_pItemCall) { kDebug() << "Calling "<< m_pItemCall->getPeerPhoneNumber(); } - Call* call = SFLPhone::model()->addDialingCall(getName(), SFLPhone::app()->model()->getCurrentAccountId()); + Call* call = SFLPhone::model()->addDialingCall(getName(), SFLPhone::app()->model()->getCurrentAccount()); call->setCallNumber(m_PhoneNumber); call->setPeerName(m_pPeerNameL->text()); call->actionPerformed(CALL_ACTION_ACCEPT);