From f932bece4bd19d0ce75fce105372c19a6cd9859e Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage <emmanuel.lepage@savoirfairelinux.com> Date: Fri, 18 May 2012 14:12:25 -0400 Subject: [PATCH] [ #11255 ] Code polishing --- kde/src/AccountListModel.cpp | 8 +- kde/src/AccountView.cpp | 4 +- kde/src/AccountWizard.cpp | 138 ++++----- kde/src/ActionSetAccountFirst.cpp | 3 +- kde/src/CallView.cpp | 54 ++-- kde/src/CallView.h | 19 +- kde/src/Codec.cpp | 20 +- kde/src/SFLPhone.cpp | 93 +++--- kde/src/SFLPhone.h | 4 +- kde/src/SFLPhoneView.cpp | 17 +- kde/src/conf/ConfigurationDialog.cpp | 2 +- kde/src/conf/dlgaccounts.cpp | 32 +-- kde/src/conf/dlgaddressbook.cpp | 2 +- kde/src/klib/AkonadiBackend.cpp | 12 +- kde/src/klib/ConfigurationSkeleton.cpp | 133 ++++----- kde/src/klib/HelperFunctions.cpp | 1 + kde/src/klib/SortableDockCommon.h | 8 +- kde/src/klib/SortableDockCommon.hpp | 10 +- kde/src/klib/dataengine/sflphonEngine.cpp | 298 +++++++++++--------- kde/src/klib/dataengine/sflphonEngine.h | 70 +++-- kde/src/klib/dataengine/sflphoneService.cpp | 156 ++++++++-- kde/src/klib/dataengine/sflphoneService.h | 105 ++----- kde/src/lib/Account.cpp | 6 +- kde/src/lib/AccountList.cpp | 8 +- kde/src/lib/Call.cpp | 19 +- kde/src/lib/CallModel.hpp | 31 +- kde/src/lib/ContactBackend.cpp | 2 + kde/src/lib/sflphone_const.h | 178 +++--------- kde/src/widgets/AccountItemWidget.cpp | 8 +- kde/src/widgets/AccountItemWidget.h | 9 +- kde/src/widgets/BookmarkDock.cpp | 6 +- kde/src/widgets/BookmarkDock.h | 2 +- kde/src/widgets/CallTreeItem.cpp | 8 +- kde/src/widgets/CallTreeItem.h | 25 +- kde/src/widgets/CategoryDrawer.h | 6 +- kde/src/widgets/ContactDock.cpp | 21 +- kde/src/widgets/ContactDock.h | 2 +- kde/src/widgets/ContactItemWidget.cpp | 8 +- kde/src/widgets/Dialpad.cpp | 2 +- kde/src/widgets/HistoryDock.cpp | 19 +- kde/src/widgets/HistoryTreeItem.cpp | 19 +- 41 files changed, 778 insertions(+), 790 deletions(-) diff --git a/kde/src/AccountListModel.cpp b/kde/src/AccountListModel.cpp index 9c926b1794..82d53a0500 100755 --- a/kde/src/AccountListModel.cpp +++ b/kde/src/AccountListModel.cpp @@ -28,6 +28,12 @@ //SFLPhone #include "conf/ConfigAccountList.h" +//Qt +#include <QtGui/QIcon> + +//KDE +#include <KLed> + ///Constructor AccountListModel::AccountListModel(QObject *parent) : QAbstractListModel(parent) @@ -68,7 +74,7 @@ QVariant AccountListModel::data ( const QModelIndex& index, int role) const return QVariant(QIcon(ICON_ACCOUNT_LED_RED)); } return QVariant(); -} +} //data ///Flags for "index" Qt::ItemFlags AccountListModel::flags(const QModelIndex & index) const diff --git a/kde/src/AccountView.cpp b/kde/src/AccountView.cpp index 0e20a83ffc..03a3aa48b2 100644 --- a/kde/src/AccountView.cpp +++ b/kde/src/AccountView.cpp @@ -67,7 +67,7 @@ void AccountView::initItemWidget() else m_pWidget->setState(AccountItemWidget::NotWorking); connect(m_pWidget, SIGNAL(checkStateChanged(bool)), this, SLOT(setEnabled(bool))); -} +} //initItemWidget /***************************************************************************** @@ -167,4 +167,4 @@ void AccountView::updateState() m_pWidget->setState(AccountItemWidget::NotWorking); } } -} +} //updateState diff --git a/kde/src/AccountWizard.cpp b/kde/src/AccountWizard.cpp index a44c687ca0..291d3808e5 100755 --- a/kde/src/AccountWizard.cpp +++ b/kde/src/AccountWizard.cpp @@ -19,25 +19,28 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * **************************************************************************/ +//Unix #include <unistd.h> -#include "AccountWizard.h" -#include <QVBoxLayout> -#include <QFormLayout> -#include "lib/sflphone_const.h" -#include "lib/configurationmanager_interface_singleton.h" -#include <QLabel> -#include <QRadioButton> -#include <QLineEdit> -#include <QCheckBox> - -#include <klocale.h> - #include <netdb.h> +//Qt +#include <QtGui/QVBoxLayout> +#include <QtGui/QFormLayout> +#include <QtGui/QLabel> +#include <QtGui/QRadioButton> +#include <QtGui/QLineEdit> +#include <QtGui/QCheckBox> + //KDE +#include <KLocale> #include <KDebug> +//SFLphone +#include "AccountWizard.h" +#include "lib/sflphone_const.h" +#include "lib/configurationmanager_interface_singleton.h" +//Define #define FIELD_SFL_ACCOUNT "SFL" #define FIELD_OTHER_ACCOUNT "OTHER" #define FIELD_SIP_ACCOUNT "SIP" @@ -64,9 +67,10 @@ #define SFL_ACCOUNT_HOST "sip.sflphone.org" /*************************************************************************** + * * * Global functions for creating an account on sflphone.org * * * - ***************************************************************************/ + **************************************************************************/ typedef struct { bool success ; @@ -81,9 +85,9 @@ int sendRequest(QString host, int port, QString req, QString & ret) int s; struct sockaddr_in servSockAddr; struct hostent *servHostEnt; - long int length=0; - long int status=0; - int i=0; + long int length = 0; + long int status = 0; + int i = 0; FILE *f; char buf[1024]; @@ -237,16 +241,16 @@ void AccountWizard::accept() if(acc.success) { ret += i18n("This assistant is now finished.") + "\n"; - field( FIELD_SIP_ALIAS ) = QString(acc.user) + "@" + SFL_ACCOUNT_HOST; - field( FIELD_SIP_VOICEMAIL ) = QString(); - field( FIELD_SIP_SERVER ) = QString(SFL_ACCOUNT_HOST); - field( FIELD_SIP_PASSWORD ) = QString(acc.passwd); - field( FIELD_SIP_USER ) = QString(acc.user); - - protocol = QString( ACCOUNT_TYPE_SIP ); - server = QString( SFL_ACCOUNT_HOST ); - password = QString( acc.passwd ); - user = QString( acc.user ); + field( FIELD_SIP_ALIAS ) = QString( acc.user) + "@" + SFL_ACCOUNT_HOST; + field( FIELD_SIP_VOICEMAIL ) = QString( ); + field( FIELD_SIP_SERVER ) = QString( SFL_ACCOUNT_HOST ); + field( FIELD_SIP_PASSWORD ) = QString( acc.passwd ); + field( FIELD_SIP_USER ) = QString( acc.user ); + + protocol = QString( ACCOUNT_TYPE_SIP ); + server = QString( SFL_ACCOUNT_HOST ); + password = QString( acc.passwd ); + user = QString( acc.user ); enabled = QString( REGISTRATION_ENABLED_TRUE ); is_create_account = true; @@ -260,13 +264,13 @@ void AccountWizard::accept() else if(field(FIELD_SIP_ACCOUNT).toBool()) { //sip ret += i18n("This assistant is now finished.") + "\n"; - alias = field ( FIELD_SIP_ALIAS ).toString(); - enabled = QString ( REGISTRATION_ENABLED_TRUE ); - mailbox = field ( FIELD_SIP_VOICEMAIL ).toString(); - protocol = QString ( ACCOUNT_TYPE_SIP ); - server = field ( FIELD_SIP_SERVER ).toString(); - password = field ( FIELD_SIP_PASSWORD ).toString(); - user = field ( FIELD_SIP_USER ).toString(); + alias = field ( FIELD_SIP_ALIAS ).toString(); + enabled = QString ( REGISTRATION_ENABLED_TRUE ) ; + mailbox = field ( FIELD_SIP_VOICEMAIL ).toString(); + protocol = QString ( ACCOUNT_TYPE_SIP ) ; + server = field ( FIELD_SIP_SERVER ).toString(); + password = field ( FIELD_SIP_PASSWORD ).toString(); + user = field ( FIELD_SIP_USER ).toString(); is_create_account = true; is_using_sip = true; @@ -275,13 +279,13 @@ void AccountWizard::accept() else { // iax ret += i18n("This assistant is now finished.") + "\n"; - alias = field ( FIELD_IAX_ALIAS ).toString(); - enabled = QString ( REGISTRATION_ENABLED_TRUE ); - mailbox = field ( FIELD_IAX_VOICEMAIL ).toString(); - protocol = QString ( ACCOUNT_TYPE_IAX ); - server = field ( FIELD_IAX_SERVER ).toString(); - password = field ( FIELD_IAX_PASSWORD ).toString(); - user = field ( FIELD_IAX_USER ).toString(); + alias = field ( FIELD_IAX_ALIAS ).toString(); + enabled = QString ( REGISTRATION_ENABLED_TRUE ) ; + mailbox = field ( FIELD_IAX_VOICEMAIL ).toString(); + protocol = QString ( ACCOUNT_TYPE_IAX ) ; + server = field ( FIELD_IAX_SERVER ).toString(); + password = field ( FIELD_IAX_PASSWORD ).toString(); + user = field ( FIELD_IAX_USER ).toString(); is_create_account = true; is_using_sip = false; @@ -301,7 +305,7 @@ void AccountWizard::accept() if(field(FIELD_ZRTP_ENABLED).toBool()) { srtp_enabled = QString( REGISTRATION_ENABLED_TRUE ); - key_exchange = QString( ZRTP ); + key_exchange = QString( ZRTP ); zrtp_display_sas = QString( REGISTRATION_ENABLED_TRUE ); zrtp_not_supp_warning = QString( REGISTRATION_ENABLED_TRUE ); zrtp_hello_hash = QString( REGISTRATION_ENABLED_TRUE ); @@ -341,8 +345,8 @@ void AccountWizard::accept() WizardIntroPage::WizardIntroPage(QWidget *parent) : QWizardPage(parent) { - setTitle(i18n("Account creation wizard")); - setSubTitle(i18n("Welcome to the Account creation wizard of SFLphone!")); + setTitle (i18n( "Account creation wizard" ) ); + setSubTitle(i18n( "Welcome to the Account creation wizard of SFLphone!" ) ); introLabel = new QLabel(i18n("This installation wizard will help you configure an account.")); introLabel->setWordWrap(true); @@ -375,8 +379,8 @@ WizardAccountAutoManualPage::WizardAccountAutoManualPage(QWidget *parent) setTitle(i18n("Account")); setSubTitle(i18n("Please select one of the following options")); - radioButton_SFL = new QRadioButton(i18n("Create a free SIP/IAX2 account on sflphone.org")); - radioButton_manual = new QRadioButton(i18n("Register an existing SIP or IAX2 account")); + radioButton_SFL = new QRadioButton( i18n("Create a free SIP/IAX2 account on sflphone.org" ) ); + radioButton_manual = new QRadioButton( i18n("Register an existing SIP or IAX2 account" ) ); radioButton_SFL->setChecked(true); registerField( FIELD_SFL_ACCOUNT , radioButton_SFL ); @@ -407,7 +411,8 @@ int WizardAccountAutoManualPage::nextId() const /*************************************************************************** * Class WizardAccountTypePage * * Page in which user choses between SIP and IAX account. * - ***************************************************************************/ + **************************************************************************/ + ///The third page WizardAccountTypePage::WizardAccountTypePage(QWidget *parent) : QWizardPage(parent) @@ -453,23 +458,23 @@ int WizardAccountTypePage::nextId() const WizardAccountEmailAddressPage::WizardAccountEmailAddressPage(QWidget *parent) : QWizardPage(parent) { - setTitle(i18n("Optional email address")); - setSubTitle(i18n("This email address will be used to send your voicemail messages.")); + setTitle( i18n( "Optional email address" )); + setSubTitle(i18n( "This email address will be used to send your voicemail messages." )); - label_emailAddress = new QLabel(i18n("Email address")); - lineEdit_emailAddress = new QLineEdit(); - label_enableZrtp = new QLabel(i18n("Secure with ZRTP")); - checkBox_enableZrtp = new QCheckBox(); + label_emailAddress = new QLabel ( i18n("Email address") ); + lineEdit_emailAddress = new QLineEdit ( ); + label_enableZrtp = new QLabel ( i18n("Secure with ZRTP") ); + checkBox_enableZrtp = new QCheckBox ( ); registerField( FIELD_EMAIL_ADDRESS , lineEdit_emailAddress ); registerField( FIELD_ZRTP_ENABLED , checkBox_enableZrtp ); QFormLayout *layout = new QFormLayout; - layout->setWidget(0 , QFormLayout::LabelRole , label_emailAddress ); - layout->setWidget(0 , QFormLayout::FieldRole , lineEdit_emailAddress ); - layout->setWidget(1 , QFormLayout::LabelRole , label_enableZrtp ); - layout->setWidget(1 , QFormLayout::FieldRole , checkBox_enableZrtp ); + layout->setWidget( 0 , QFormLayout::LabelRole , label_emailAddress ); + layout->setWidget( 0 , QFormLayout::FieldRole , lineEdit_emailAddress ); + layout->setWidget( 1 , QFormLayout::LabelRole , label_enableZrtp ); + layout->setWidget( 1 , QFormLayout::FieldRole , checkBox_enableZrtp ); setLayout(layout); } @@ -477,10 +482,10 @@ WizardAccountEmailAddressPage::WizardAccountEmailAddressPage(QWidget *parent) ///Email page destructor WizardAccountEmailAddressPage::~WizardAccountEmailAddressPage() { - delete label_emailAddress; + delete label_emailAddress ; delete lineEdit_emailAddress; - delete label_enableZrtp; - delete checkBox_enableZrtp; + delete label_enableZrtp ; + delete checkBox_enableZrtp ; } /// @@ -639,12 +644,12 @@ int WizardAccountIAXFormPage::nextId() const WizardAccountStunPage::WizardAccountStunPage(QWidget *parent) : QWizardPage(parent) { - setTitle(i18n("Network Address Translation (NAT)")); - setSubTitle(i18n("You should probably enable this if you are behind a firewall.")); + setTitle( i18n( "Network Address Translation (NAT)" ) ); + setSubTitle(i18n( "You should probably enable this if you are behind a firewall.") ); - checkBox_enableStun = new QCheckBox(i18n("Enable STUN")); - label_StunServer = new QLabel(i18n("Stun Server")); - lineEdit_StunServer = new QLineEdit(); + checkBox_enableStun = new QCheckBox( i18n("Enable STUN") ); + label_StunServer = new QLabel ( i18n("Stun Server") ); + lineEdit_StunServer = new QLineEdit( ); lineEdit_StunServer->setDisabled(true); registerField(FIELD_SIP_ENABLE_STUN, checkBox_enableStun); @@ -680,8 +685,8 @@ int WizardAccountStunPage::nextId() const WizardAccountConclusionPage::WizardAccountConclusionPage(QWidget *parent) : QWizardPage(parent) { - setTitle(i18n("This assistant is now finished.")); - setSubTitle(i18n("After checking the settings you chose, click \"Finish\" to create the account.")); + setTitle( i18n( "This assistant is now finished.")); + setSubTitle(i18n( "After checking the settings you chose, click \"Finish\" to create the account.")); QVBoxLayout *layout = new QVBoxLayout; setLayout(layout); @@ -689,6 +694,7 @@ WizardAccountConclusionPage::WizardAccountConclusionPage(QWidget *parent) WizardAccountConclusionPage::~WizardAccountConclusionPage() { + } int WizardAccountConclusionPage::nextId() const diff --git a/kde/src/ActionSetAccountFirst.cpp b/kde/src/ActionSetAccountFirst.cpp index d5cc6d71ce..7138b801a5 100755 --- a/kde/src/ActionSetAccountFirst.cpp +++ b/kde/src/ActionSetAccountFirst.cpp @@ -31,8 +31,7 @@ ActionSetAccountFirst::ActionSetAccountFirst(Account* account, QObject *parent) { setCheckable(true); this->account = account; - connect(this, SIGNAL(triggered()), - this, SLOT(emitSetFirst())); + connect(this, SIGNAL(triggered()), this, SLOT(emitSetFirst())); } ///Destructor diff --git a/kde/src/CallView.cpp b/kde/src/CallView.cpp index de0b5dfc42..b28546b530 100644 --- a/kde/src/CallView.cpp +++ b/kde/src/CallView.cpp @@ -53,26 +53,30 @@ CallView::CallView(QWidget* parent) : QTreeWidget(parent),m_pActiveOverlay(0),m_ //Widget part setAcceptDrops(true); setDragEnabled(true); - setAnimated(true); + setAnimated (true); CallTreeItemDelegate *delegate = new CallTreeItemDelegate(); setItemDelegate(delegate); setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding)); - m_pTransferOverlay = new CallViewOverlay(this); + QString image = "<img width=100 height=100 src='"+KStandardDirs::locate("data","sflphone-client-kde/transferarraw.png")+"' />"; + + m_pTransferOverlay = new CallViewOverlay ( this ); + m_pTransferB = new QPushButton ( m_pTransferOverlay ); + m_pTransferLE = new KLineEdit ( m_pTransferOverlay ); + QGridLayout* gl = new QGridLayout ( m_pTransferOverlay ); + QLabel* lblImg = new QLabel ( image ); + m_pTransferOverlay->setVisible(false); m_pTransferOverlay->resize(size()); - QLabel* lblImg = new QLabel("<img width=100 height=100 src='"+KStandardDirs::locate("data","sflphone-client-kde/transferarraw.png")+"' />"); m_pTransferOverlay->setCornerWidget(lblImg); - m_pTransferB = new QPushButton(m_pTransferOverlay); - m_pTransferLE = new KLineEdit(m_pTransferOverlay); m_pTransferB->setText("Transfer"); m_pTransferB->setMaximumSize(70,9000); - QGridLayout* gl = new QGridLayout(m_pTransferOverlay); - gl->addItem(new QSpacerItem(0,0,QSizePolicy::Expanding,QSizePolicy::Minimum),0,0,1,3); - gl->addWidget(m_pTransferLE,1,1,1,2); - gl->addWidget(m_pTransferB,1,4,1,2); - gl->addItem(new QSpacerItem(0,0,QSizePolicy::Expanding,QSizePolicy::Minimum),2,0,1,3); + + gl->addItem (new QSpacerItem(0,0,QSizePolicy::Expanding,QSizePolicy::Minimum), 0 , 0 , 1 , 3 ); + gl->addWidget(m_pTransferLE , 1 , 1 , 1 , 2 ); + gl->addWidget(m_pTransferB , 1 , 4 , 1 , 2 ); + gl->addItem (new QSpacerItem(0,0,QSizePolicy::Expanding,QSizePolicy::Minimum), 2 , 0 , 1 , 3 ); //User Interface even // SENDER SIGNAL RECEIVER SLOT / @@ -87,7 +91,7 @@ CallView::CallView(QWidget* parent) : QTreeWidget(parent),m_pActiveOverlay(0),m_ /**/connect(m_pTransferLE , SIGNAL(returnPressed() ) , this, SLOT( transfer()) ); /* */ -} +} //CallView /***************************************************************************** @@ -209,7 +213,7 @@ bool CallView::callToCall(QTreeWidgetItem *parent, int index, const QMimeData *d return true; } return false; -} +} //callToCall ///A string containing a call number is dropped on a call bool CallView::phoneNumberToCall(QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action) @@ -246,7 +250,7 @@ bool CallView::phoneNumberToCall(QTreeWidgetItem *parent, int index, const QMime } } return false; -} +} //phoneNumberToCall ///A contact ID is dropped on a call bool CallView::contactToCall(QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action) @@ -282,7 +286,7 @@ bool CallView::contactToCall(QTreeWidgetItem *parent, int index, const QMimeData } } return false; -} +} //contactToCall ///Action performed when an item is dropped on the TreeView bool CallView::dropMimeData(QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action) @@ -307,7 +311,7 @@ bool CallView::dropMimeData(QTreeWidgetItem *parent, int index, const QMimeData contactToCall(parent, index, data, action); } return false; -} +} //dropMimeData ///Encode data to be tranported during the drag n' drop operation QMimeData* CallView::mimeData( const QList<QTreeWidgetItem *> items) const @@ -333,7 +337,7 @@ QMimeData* CallView::mimeData( const QList<QTreeWidgetItem *> items) const //TODO Comment this line if you don't want to see ugly artefact, but the caller details will not be visible while dragged items[0]->setText(0, SFLPhone::model()->getCall(items[0])->getPeerName() + "\n" + SFLPhone::model()->getCall(items[0])->getPeerPhoneNumber()); return mimeData; -} +} //mimeData /***************************************************************************** @@ -405,7 +409,7 @@ void CallView::hideOverlay() m_pCallPendingTransfer = 0; m_pTransferLE->clear(); -} +} //hideOverlay ///Be sure the size of the overlay stay the same void CallView::resizeEvent (QResizeEvent *e) @@ -485,7 +489,7 @@ QTreeWidgetItem* CallView::extractItem(QTreeWidgetItem* item) } else return takeTopLevelItem(indexOfTopLevelItem(item)); -} +} //extractItem ///Convenience wrapper around insertItem(QTreeWidgetItem*, QTreeWidgetItem*) CallTreeItem* CallView::insertItem(QTreeWidgetItem* item, Call* parent) @@ -519,7 +523,7 @@ CallTreeItem* CallView::insertItem(QTreeWidgetItem* item, QTreeWidgetItem* paren expandAll(); return callItem; -} +} //insertItem ///Remove a call from the interface void CallView::destroyCall(Call* toDestroy) @@ -543,7 +547,7 @@ void CallView::destroyCall(Call* toDestroy) } else kDebug() << "Call not found"; -} +} //destroyCall /// @todo Remove the text partially covering the TreeView item widget when it is being dragged, a beter implementation is needed void CallView::clearArtefact(QTreeWidgetItem* item) @@ -575,7 +579,7 @@ void CallView::itemDoubleClicked(QTreeWidgetItem* item, int column) { default: kDebug() << "Double clicked an item with no action on double click."; } -} +} //itemDoubleClicked void CallView::itemClicked(QTreeWidgetItem* item, int column) { Q_UNUSED(column) @@ -614,7 +618,7 @@ Call* CallView::addConference(Call* conf) Q_ASSERT_X(confItem->childCount() == 0, "add conference","Conference created, but without any participants"); return newConf; -} +} //addConference ///Executed when the daemon signal a modification in an existing conference. Update the call list and update the TreeView bool CallView::conferenceChanged(Call* conf) @@ -647,7 +651,7 @@ bool CallView::conferenceChanged(Call* conf) Q_ASSERT_X(SFLPhone::model()->getIndex(conf)->childCount() == 0,"changind conference","A conference can't have no participants"); return true; -} +} //conferenceChanged ///Remove a conference from the model and the TreeView void CallView::conferenceRemoved(Call* conf) @@ -665,7 +669,7 @@ void CallView::conferenceRemoved(Call* conf) else { kDebug() << "Conference not found"; } -} +} //conferenceRemoved ///Clear the list of old calls //TODO Clear them from the daemon void CallView::clearHistory() @@ -717,7 +721,7 @@ void CallViewOverlay::setVisible(bool enabled) { } m_enabled = enabled; QWidget::setVisible(enabled); -} +} //setVisible ///How to paint the overlay void CallViewOverlay::paintEvent(QPaintEvent* event) { diff --git a/kde/src/CallView.h b/kde/src/CallView.h index d7fa765bfa..e5e8f121b1 100644 --- a/kde/src/CallView.h +++ b/kde/src/CallView.h @@ -83,22 +83,33 @@ class CallView : public QTreeWidget { Q_OBJECT public: CallView ( QWidget* parent = 0 ); + + //Getters Call* getCurrentItem ( ); QWidget* getWidget ( ); + bool haveOverlay ( ); + virtual QMimeData* mimeData ( const QList<QTreeWidgetItem *> items ) const; + + //Setters void setTitle ( const QString& title ); + + //Mutator bool selectItem ( Call* item ); bool removeItem ( Call* item ); bool dropMimeData ( QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action ); - virtual QMimeData* mimeData ( const QList<QTreeWidgetItem *> items ) const; - bool haveOverlay(); + bool callToCall ( QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action ); + bool phoneNumberToCall ( QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action ); + bool contactToCall ( QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action ); private: + //Mutator QTreeWidgetItem* extractItem ( const QString& callId ); QTreeWidgetItem* extractItem ( QTreeWidgetItem* item ); CallTreeItem* insertItem ( QTreeWidgetItem* item, QTreeWidgetItem* parent=0 ); CallTreeItem* insertItem ( QTreeWidgetItem* item, Call* parent ); void clearArtefact ( QTreeWidgetItem* item ); + //Attributes QPushButton* m_pTransferB; KLineEdit* m_pTransferLE; CallViewOverlay* m_pTransferOverlay; @@ -106,13 +117,11 @@ class CallView : public QTreeWidget { Call* m_pCallPendingTransfer; protected: + //Reimlementation virtual void dragEnterEvent ( QDragEnterEvent *e ); virtual void dragMoveEvent ( QDragMoveEvent *e ); virtual void dragLeaveEvent ( QDragLeaveEvent *e ); virtual void resizeEvent ( QResizeEvent *e ); - bool callToCall ( QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action ); - bool phoneNumberToCall ( QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action ); - bool contactToCall ( QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action ); public slots: void destroyCall ( Call* toDestroy); diff --git a/kde/src/Codec.cpp b/kde/src/Codec.cpp index 3b4142ff77..797e36cb38 100755 --- a/kde/src/Codec.cpp +++ b/kde/src/Codec.cpp @@ -34,12 +34,12 @@ Codec::Codec(int payload, bool enabled) { ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); QStringList details = configurationManager.getAudioCodecDetails(payload); - m_Payload = QString::number(payload); - m_Enabled = enabled; - m_Name = details[CODEC_NAME]; - m_Frequency = details[CODEC_SAMPLE_RATE]; - m_Bitrate = details[CODEC_BIT_RATE]; - m_Bandwidth = details[CODEC_BANDWIDTH]; + m_Payload = QString::number(payload) ; + m_Enabled = enabled ; + m_Name = details[ CODEC_NAME ]; + m_Frequency = details[ CODEC_SAMPLE_RATE ]; + m_Bitrate = details[ CODEC_BIT_RATE ]; + m_Bandwidth = details[ CODEC_BANDWIDTH ]; } @@ -95,13 +95,13 @@ bool Codec::isEnabled() const ///Set the payload void Codec::setPayload(const QString& payload) { - m_Payload = payload; + m_Payload = payload; } ///Set the codec name void Codec::setName(const QString& name) { - m_Name = name; + m_Name = name; } ///Set the frequency @@ -113,7 +113,7 @@ void Codec::setFrequency(const QString& frequency) ///Set the bitrate void Codec::setBitrate(const QString& bitrate) { - m_Bitrate = bitrate; + m_Bitrate = bitrate; } ///Set the bandwidth @@ -125,5 +125,5 @@ void Codec::setBandwidth(const QString& bandwidth) ///Make this cedec enabled void Codec::setEnabled(bool enabled) { - m_Enabled = enabled; + m_Enabled = enabled; } diff --git a/kde/src/SFLPhone.cpp b/kde/src/SFLPhone.cpp index adaf9693d8..1c6ab61784 100755 --- a/kde/src/SFLPhone.cpp +++ b/kde/src/SFLPhone.cpp @@ -56,14 +56,12 @@ #include "widgets/BookmarkDock.h" #include "klib/ConfigurationSkeleton.h" -SFLPhone* SFLPhone::m_sApp = NULL; +SFLPhone* SFLPhone::m_sApp = NULL; TreeWidgetCallModel* SFLPhone::m_pModel = NULL; ///Constructor SFLPhone::SFLPhone(QWidget *parent) - : KXmlGuiWindow(parent), - m_pInitialized(false), - m_pView(new SFLPhoneView(this)) + : KXmlGuiWindow(parent), m_pInitialized(false), m_pView(new SFLPhoneView(this)) { setupActions(); m_sApp = this; @@ -78,10 +76,10 @@ SFLPhone::~SFLPhone() ///Init everything bool SFLPhone::initialize() { - if ( m_pInitialized ) { - kDebug() << "Already initialized."; - return false; - } + if ( m_pInitialized ) { + kDebug() << "Already initialized."; + return false; + } ConfigurationSkeleton::self(); @@ -89,22 +87,22 @@ bool SFLPhone::initialize() CallModel<CallTreeItem*,QTreeWidgetItem*>* histoModel = new CallModel<CallTreeItem*,QTreeWidgetItem*>(CallModel<CallTreeItem*,QTreeWidgetItem*>::History); histoModel->initHistory(); - ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); - // accept dnd - setAcceptDrops(true); + ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); + // accept dnd + setAcceptDrops(true); m_pContactCD = new ContactDock(this); addDockWidget(Qt::TopDockWidgetArea,m_pContactCD); - // tell the KXmlGuiWindow that this is indeed the main widget - m_pCentralDW = new QDockWidget(this); - m_pCentralDW->setObjectName ( "callDock" ); - m_pCentralDW->setSizePolicy ( QSizePolicy::Expanding,QSizePolicy::Expanding ); - m_pCentralDW->setWidget ( m_pView ); - m_pCentralDW->setWindowTitle ( i18n("Call") ); - m_pCentralDW->setFeatures ( QDockWidget::NoDockWidgetFeatures ); - m_pView->setSizePolicy ( QSizePolicy::Expanding,QSizePolicy::Expanding ); - m_pCentralDW->setStyleSheet ( "\ + // tell the KXmlGuiWindow that this is indeed the main widget + m_pCentralDW = new QDockWidget(this); + m_pCentralDW->setObjectName ( "callDock" ); + m_pCentralDW->setSizePolicy ( QSizePolicy::Expanding,QSizePolicy::Expanding ); + m_pCentralDW->setWidget ( m_pView ); + m_pCentralDW->setWindowTitle ( i18n("Call") ); + m_pCentralDW->setFeatures ( QDockWidget::NoDockWidgetFeatures ); + m_pView->setSizePolicy ( QSizePolicy::Expanding,QSizePolicy::Expanding ); + m_pCentralDW->setStyleSheet ( "\ QDockWidget::title {\ margin:0px;\ padding:0px;\ @@ -112,48 +110,49 @@ bool SFLPhone::initialize() max-height:0px;\ }\ \ - "); + "); - m_pCentralDW->setTitleBarWidget(new QWidget()); - m_pCentralDW->setContentsMargins(0,0,0,0); - m_pView->setContentsMargins(0,0,0,0); + m_pCentralDW->setTitleBarWidget(new QWidget()); + m_pCentralDW->setContentsMargins(0,0,0,0); + m_pView->setContentsMargins (0,0,0,0); - addDockWidget(Qt::TopDockWidgetArea,m_pCentralDW); + addDockWidget(Qt::TopDockWidgetArea,m_pCentralDW); - m_pHistoryDW = new HistoryDock(this); - m_pBookmarkDW = new BookmarkDock(this); - addDockWidget( Qt::TopDockWidgetArea,m_pHistoryDW ); - addDockWidget( Qt::TopDockWidgetArea,m_pBookmarkDW ); - tabifyDockWidget(m_pBookmarkDW,m_pHistoryDW); + m_pHistoryDW = new HistoryDock ( this ); + m_pBookmarkDW = new BookmarkDock ( this ); + m_pStatusBarWidget = new QLabel ( ); + m_pTrayIcon = new SFLPhoneTray ( this->windowIcon(), this ); + + addDockWidget( Qt::TopDockWidgetArea,m_pHistoryDW ); + addDockWidget( Qt::TopDockWidgetArea,m_pBookmarkDW ); + tabifyDockWidget(m_pBookmarkDW,m_pHistoryDW); - setWindowIcon(QIcon(ICON_SFLPHONE)); - setWindowTitle(i18n("SFLphone")); + setWindowIcon (QIcon(ICON_SFLPHONE) ); + setWindowTitle(i18n("SFLphone") ); - setupActions(); + setupActions(); - m_pStatusBarWidget = new QLabel(); - statusBar()->addWidget(m_pStatusBarWidget); + statusBar()->addWidget(m_pStatusBarWidget); - m_pTrayIcon = new SFLPhoneTray(this->windowIcon(), this); - m_pTrayIcon->show(); + m_pTrayIcon->show(); - m_pIconChanged = false; - setObjectNames(); - QMetaObject::connectSlotsByName(this); - m_pView->loadWindow(); + setObjectNames(); + QMetaObject::connectSlotsByName(this); + m_pView->loadWindow(); - move(QCursor::pos().x() - geometry().width()/2, QCursor::pos().y() - geometry().height()/2); - show(); + move(QCursor::pos().x() - geometry().width()/2, QCursor::pos().y() - geometry().height()/2); + show(); - if(configurationManager.getAccountList().value().isEmpty()) { + if(configurationManager.getAccountList().value().isEmpty()) { (new AccountWizard())->show(); - } + } - m_pInitialized = true; + m_pIconChanged = false; + m_pInitialized = true ; - return true; + return true; } ///Setup evry actions diff --git a/kde/src/SFLPhone.h b/kde/src/SFLPhone.h index c8a7cd3386..9af66c2c8d 100755 --- a/kde/src/SFLPhone.h +++ b/kde/src/SFLPhone.h @@ -127,8 +127,8 @@ public: static TreeWidgetCallModel* model (); SFLPhoneView* view (); - ContactDock* contactDock(); - HistoryDock* historyDock(); + ContactDock* contactDock (); + HistoryDock* historyDock (); BookmarkDock* bookmarkDock(); private slots: diff --git a/kde/src/SFLPhoneView.cpp b/kde/src/SFLPhoneView.cpp index 88309f36ac..2707a24d6b 100755 --- a/kde/src/SFLPhoneView.cpp +++ b/kde/src/SFLPhoneView.cpp @@ -55,8 +55,7 @@ ///Constructor SFLPhoneView::SFLPhoneView(QWidget *parent) - : QWidget(parent), - wizard(0), errorWindow(0) + : QWidget(parent), wizard(0), errorWindow(0) { setupUi(this); @@ -161,7 +160,7 @@ void SFLPhoneView::typeString(QString str) if(!currentCall && candidate) { candidate->appendText(str); } -} +} //typeString ///Called when a backspace is detected void SFLPhoneView::backspace() @@ -199,7 +198,7 @@ void SFLPhoneView::escape() action(call, CALL_ACTION_REFUSE); } } -} +} //escape ///Called when enter is detected void SFLPhoneView::enter() @@ -227,7 +226,7 @@ void SFLPhoneView::enter() * * ****************************************************************************/ -/// +///Change call state void SFLPhoneView::action(Call* call, call_action action) { if(! call) { @@ -242,7 +241,7 @@ void SFLPhoneView::action(Call* call, call_action action) } updateWindowCallState(); } -} +} //action ///Select a phone number when calling using a contact bool SFLPhoneView::selectCallPhoneNumber(Call* call2,Contact* contact) @@ -274,7 +273,7 @@ bool SFLPhoneView::selectCallPhoneNumber(Call* call2,Contact* contact) return false; } return true; -} +} //selectCallPhoneNumber /***************************************************************************** * * @@ -386,7 +385,7 @@ void SFLPhoneView::updateWindowCallState() emit recordCheckStateChangeAsked ( recordActivated ); kDebug() << "Window updated."; -} +} //updateWindowCallState ///Deprecated? int SFLPhoneView::phoneNumberTypesDisplayed() @@ -704,7 +703,7 @@ void SFLPhoneView::accept() action(call, CALL_ACTION_ACCEPT); } } -} +} //accept ///Refuse call void SFLPhoneView::refuse() diff --git a/kde/src/conf/ConfigurationDialog.cpp b/kde/src/conf/ConfigurationDialog.cpp index 62804f5869..134a785f16 100755 --- a/kde/src/conf/ConfigurationDialog.cpp +++ b/kde/src/conf/ConfigurationDialog.cpp @@ -57,7 +57,7 @@ ConfigurationDialog::ConfigurationDialog(SFLPhoneView *parent) connect(this, SIGNAL(okClicked()), this, SLOT(applyCustomSettings())); connect(dlgGeneral, SIGNAL(clearCallHistoryAsked()), this, SIGNAL(clearCallHistoryAsked())); -} +} //ConfigurationDialog ConfigurationDialog::~ConfigurationDialog() diff --git a/kde/src/conf/dlgaccounts.cpp b/kde/src/conf/dlgaccounts.cpp index face5dfb8a..7e69292d1a 100755 --- a/kde/src/conf/dlgaccounts.cpp +++ b/kde/src/conf/dlgaccounts.cpp @@ -68,7 +68,7 @@ Private_AddCodecDialog::Private_AddCodecDialog(QList< StringHash > itemList, QSt resize(550,300); connect(this, SIGNAL(okClicked()), this, SLOT(emitNewCodec())); -} +} //Private_AddCodecDialog void Private_AddCodecDialog::emitNewCodec() { if (codecTable->currentRow() >= 0) @@ -141,7 +141,7 @@ DlgAccounts::DlgAccounts(KConfigDialog* parent) //Disable control connect(radioButton_pa_same_as_local, SIGNAL(clicked(bool)) , this , SLOT(enablePublished())); connect(radioButton_pa_custom, SIGNAL(clicked(bool)) , this , SLOT(enablePublished())); -} +} //DlgAccounts void DlgAccounts::saveAccountList() { @@ -185,7 +185,7 @@ void DlgAccounts::saveAccountList() } configurationManager.setAccountsOrder(accountList->getOrderedList()); connectAccountsChangedSignal(); -} +} //saveAccountList void DlgAccounts::connectAccountsChangedSignal() { @@ -273,7 +273,7 @@ void DlgAccounts::saveAccount(QListWidgetItem * item) kDebug() << "Account codec have been saved" << _codecList << account->getAccountDetail(ACCOUNT_ID); saveCredential(account->getAccountDetail(ACCOUNT_ID)); -} +} //saveAccount void DlgAccounts::loadAccount(QListWidgetItem * item) { @@ -429,7 +429,7 @@ void DlgAccounts::loadAccount(QListWidgetItem * item) updateStatusLabel(account); enablePublished(); frame2_editAccounts->setEnabled(true); -} +} //loadAccount void DlgAccounts::loadAccountList() { @@ -483,7 +483,7 @@ void DlgAccounts::on_button_accountUp_clicked() listWidget_accountList->insertItem ( currentRow - 1 , item ); listWidget_accountList->setItemWidget ( item, widget ); listWidget_accountList->setCurrentItem ( item ); -} +} //on_button_accountUp_clicked void DlgAccounts::on_button_accountDown_clicked() { @@ -499,7 +499,7 @@ void DlgAccounts::on_button_accountDown_clicked() listWidget_accountList->insertItem ( currentRow + 1 , item ); listWidget_accountList->setItemWidget ( item, widget ); listWidget_accountList->setCurrentItem ( item ); -} +} //on_button_accountDown_clicked void DlgAccounts::on_button_accountAdd_clicked() { @@ -513,7 +513,7 @@ void DlgAccounts::on_button_accountAdd_clicked() listWidget_accountList->setCurrentRow(r); frame2_editAccounts->setEnabled(true); } -} +} //on_button_accountAdd_clicked void DlgAccounts::on_button_accountRemove_clicked() { @@ -632,7 +632,7 @@ void DlgAccounts::loadCodecList() codecList[i]["alias"] = codecList[i]["name"] + " (" + codecList[i]["frequency"] + ")"; } } -} +} //loadCodecList void DlgAccounts::codecClicked(const QModelIndex& model) @@ -648,7 +648,7 @@ void DlgAccounts::codecClicked(const QModelIndex& model) keditlistbox_codec->addButton()->setEnabled(false); else keditlistbox_codec->addButton()->setEnabled(true); -} +} //codecClicked void DlgAccounts::addCodec(QString name) { @@ -662,7 +662,7 @@ void DlgAccounts::addCodec(QString name) accountListHasChanged = true; emit updateButtons(); } -} +} //addCodec void DlgAccounts::codecChanged() { @@ -701,7 +701,7 @@ void DlgAccounts::updateCombo(int value) checkbox_ZTRP_send_hello->setVisible ( false ); break; } -} +} //updateCombo void DlgAccounts::loadCredentails(QString accountId) { @@ -721,7 +721,7 @@ void DlgAccounts::loadCredentails(QString accountId) { credentialList << data; list_credential->addItem(newItem); } -} +} //loadCredentails void DlgAccounts::saveCredential(QString accountId) { ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); @@ -737,7 +737,7 @@ void DlgAccounts::saveCredential(QString accountId) { toReturn << credentialData; } configurationManager.setCredentials(accountId,toReturn); -} +} //saveCredential void DlgAccounts::addCredential() { QListWidgetItem* newItem = new QListWidgetItem(); @@ -747,7 +747,7 @@ void DlgAccounts::addCredential() { selectCredential(newItem,list_credential->currentItem()); list_credential->addItem(newItem); list_credential->setCurrentItem(newItem); -} +} //addCredential void DlgAccounts::selectCredential(QListWidgetItem* item, QListWidgetItem* previous) { if (previous) { @@ -763,7 +763,7 @@ void DlgAccounts::selectCredential(QListWidgetItem* item, QListWidgetItem* previ edit_credential_realm->setEnabled ( true ); edit_credential_auth->setEnabled ( true ); edit_credential_password->setEnabled ( true ); -} +} //selectCredential void DlgAccounts::removeCredential() { list_credential->takeItem(list_credential->currentRow()); diff --git a/kde/src/conf/dlgaddressbook.cpp b/kde/src/conf/dlgaddressbook.cpp index 7bf693468a..cd6666a2d6 100755 --- a/kde/src/conf/dlgaddressbook.cpp +++ b/kde/src/conf/dlgaddressbook.cpp @@ -48,7 +48,7 @@ DlgAddressBook::DlgAddressBook(QWidget *parent) i->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled); i->setCheckState((list.indexOf(m_mNumbertype.key(i)) != -1)?Qt::Checked:Qt::Unchecked); } -} +} //DlgAddressBook DlgAddressBook::~DlgAddressBook() { diff --git a/kde/src/klib/AkonadiBackend.cpp b/kde/src/klib/AkonadiBackend.cpp index babae9dddc..8ea7bb4b64 100644 --- a/kde/src/klib/AkonadiBackend.cpp +++ b/kde/src/klib/AkonadiBackend.cpp @@ -71,7 +71,7 @@ AkonadiBackend::AkonadiBackend(QObject* parent) : ContactBackend(parent) Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob( Akonadi::Collection::root(), Akonadi::CollectionFetchJob::Recursive, this ); job->fetchScope().setContentMimeTypes( QStringList() << "text/directory" ); connect( job, SIGNAL( collectionsReceived( const Akonadi::Collection::List& ) ), this, SLOT( collectionsReceived( const Akonadi::Collection::List& ) ) ); -} +} //AkonadiBackend ///Destructor AkonadiBackend::~AkonadiBackend() @@ -108,7 +108,7 @@ Contact* AkonadiBackend::getContactByPhone(const QString& phoneNumber,bool resol } } return nullptr; -} +} //getContactByPhone ///Find contact by UID Contact* AkonadiBackend::getContactByUid(const QString& uid) @@ -175,7 +175,7 @@ ContactList AkonadiBackend::update(Akonadi::Collection collection) m_pContacts = m_ContactByUid.values(); } return m_ContactByUid.values(); -} +} //update ///Edit backend value using an updated frontend contact void AkonadiBackend::editContact(Contact* contact,QWidget* parent) @@ -192,7 +192,7 @@ void AkonadiBackend::editContact(Contact* contact,QWidget* parent) KDialog* dlg = new KDialog(parent); dlg->setMainWidget(editor); dlg->exec(); -} +} //editContact ///Add a new contact void AkonadiBackend::addNewContact(Contact* contact,QWidget* parent) @@ -241,7 +241,7 @@ void AkonadiBackend::addNewContact(Contact* contact,QWidget* parent) kDebug() << "Unable to save new contact to storage"; return; } -} +} //addNewContact ///Implement virtual pure method void AkonadiBackend::editContact(Contact* contact) @@ -296,7 +296,7 @@ QString AkonadiBackend::getUserFromPhone(QString phoneNumber) } } return phoneNumber; -} +} //getUserFromPhone ///Return the domaine of an URI (<sip:12345@exemple.com>) QString AkonadiBackend::getHostNameFromPhone(QString phoneNumber) diff --git a/kde/src/klib/ConfigurationSkeleton.cpp b/kde/src/klib/ConfigurationSkeleton.cpp index 26bf996337..490bb7cb40 100755 --- a/kde/src/klib/ConfigurationSkeleton.cpp +++ b/kde/src/klib/ConfigurationSkeleton.cpp @@ -26,6 +26,9 @@ //KDE #include <KDebug> +ConfigurationSkeleton * ConfigurationSkeleton::instance = NULL; + +///Constructor ConfigurationSkeleton::ConfigurationSkeleton() : ConfigurationSkeletonBase() { @@ -34,8 +37,12 @@ ConfigurationSkeleton::ConfigurationSkeleton() readConfig(); } -ConfigurationSkeleton * ConfigurationSkeleton::instance = NULL; +///Destructor +ConfigurationSkeleton::~ConfigurationSkeleton() +{ +} +///Signleton ConfigurationSkeleton * ConfigurationSkeleton::self() { if(instance == NULL) @@ -43,34 +50,21 @@ ConfigurationSkeleton * ConfigurationSkeleton::self() return instance; } - -ConfigurationSkeleton::~ConfigurationSkeleton() -{ -} - -// CodecListModel * ConfigurationSkeleton::getCodecListModel() -// { -// return codecListModel; -// } - +///Read the config and override some variable using deamon defaults void ConfigurationSkeleton::readConfig() { //ConfigurationSkeleton::readConfig(); kDebug() << "Reading config"; - ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); + ConfigurationManagerInterface& configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); - //////////////////////// - ////General settings//// - //////////////////////// + //General settings //Call history settings //setEnableHistory(true); setHistoryMax(configurationManager.getHistoryLimit()); - //////////////////////// - ////Display settings//// - //////////////////////// + //Display settings //Notification settings //setNotifOnCalls(true); @@ -80,16 +74,9 @@ void ConfigurationSkeleton::readConfig() //setDisplayOnStart(true); //setDisplayOnCalls(true); - ///////////////////////// - ////Accounts settings//// - ///////////////////////// + //Accounts settings -// loadAccountList(); - - - ////////////////////// - ////Audio settings//// - ////////////////////// + //Audio settings //Audio Interface settings QString audioManager = configurationManager.getAudioManager(); @@ -128,21 +115,17 @@ void ConfigurationSkeleton::readConfig() //if(!ok) kDebug() << "outputDevice is not a number"; //setAlsaOutputDevice(outputDevice); - ///////////////////////////// - ////Address book settings//// - ///////////////////////////// + //Address book settings MapStringInt addressBookSettings = configurationManager.getAddressbookSettings().value(); setEnableAddressBook(addressBookSettings[ADDRESSBOOK_ENABLE]); -// setMaxResults(addressBookSettings[ADDRESSBOOK_MAX_RESULTS]); -// setDisplayPhoto(addressBookSettings[ADDRESSBOOK_DISPLAY_CONTACT_PHOTO]); -// setBusiness(addressBookSettings[ADDRESSBOOK_DISPLAY_BUSINESS]); -// setMobile(addressBookSettings[ADDRESSBOOK_DISPLAY_MOBILE]); -// setHome(addressBookSettings[ADDRESSBOOK_DISPLAY_HOME]); + //setMaxResults(addressBookSettings[ADDRESSBOOK_MAX_RESULTS]); + //setDisplayPhoto(addressBookSettings[ADDRESSBOOK_DISPLAY_CONTACT_PHOTO]); + //setBusiness(addressBookSettings[ADDRESSBOOK_DISPLAY_BUSINESS]); + //setMobile(addressBookSettings[ADDRESSBOOK_DISPLAY_MOBILE]); + //setHome(addressBookSettings[ADDRESSBOOK_DISPLAY_HOME]); - ///////////////////////////// - ///////Hooks settings//////// - ///////////////////////////// + //Hooks settings MapStringString hooksSettings = configurationManager.getHookSettings().value(); setAddPrefix(hooksSettings[HOOKS_ENABLED]=="1"); @@ -162,9 +145,7 @@ void ConfigurationSkeleton::writeConfig() ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); - //////////////////////// - ////General settings//// - //////////////////////// + //General settings kDebug() << "Writing General settings"; @@ -174,16 +155,13 @@ void ConfigurationSkeleton::writeConfig() //} configurationManager.setHistoryLimit(historyMax()); - - //////////////////////// - ////Display settings//// - //////////////////////// + //Display settings kDebug() << "Writing Display settings"; //Notification settings //if(notifOnCalls() != configurationManager.getNotify()) configurationManager.setNotify(); -// if(notifOnMessages() != configurationManager.getMailNotify()) configurationManager.setMailNotify(); + // if(notifOnMessages() != configurationManager.getMailNotify()) configurationManager.setMailNotify(); //configurationManager.setMailNotify(notifOnMessages()); //Window display settings @@ -191,30 +169,26 @@ void ConfigurationSkeleton::writeConfig() //if(displayOnStart() == configurationManager.isStartHidden()) configurationManager.startHidden(); //if(displayOnCalls() != configurationManager.popupMode()) configurationManager.switchPopupMode(); - ///////////////////////// - ////Accounts settings//// - ///////////////////////// + //Accounts settings kDebug() << "Writing Accounts settings"; -// saveAccountList(); + // saveAccountList(); - ////////////////////// - ////Audio settings//// - ////////////////////// + //Audio settings kDebug() << "Writing Audio settings"; //Audio Interface settings -// int prevManager = configurationManager.getAudioManager(); -// int newManager = interface(); -// if(prevManager != newManager) { -// configurationManager.setAudioManager(newManager); -// } + // int prevManager = configurationManager.getAudioManager(); + // int newManager = interface(); + // if(prevManager != newManager) { + // configurationManager.setAudioManager(newManager); + // } //ringtones settings -// if(enableRingtones() != configurationManager.isRingtoneEnabled()) configurationManager.ringtoneEnabled(); -// configurationManager.setRingtoneChoice(ringtone()); + // if(enableRingtones() != configurationManager.isRingtoneEnabled()) configurationManager.ringtoneEnabled(); + // configurationManager.setRingtoneChoice(ringtone()); //codecs settings //kDebug() << "activeCodecList = " << activeCodecList(); @@ -222,42 +196,35 @@ void ConfigurationSkeleton::writeConfig() //alsa settings -// if(prevManager == CONST_ALSA && newManager == EnumInterface::ALSA) { -// kDebug() << "setting alsa settings"; -// configurationManager.setOutputAudioPlugin(alsaPlugin()); -// configurationManager.setAudioInputDevice(alsaInputDevice()); -// configurationManager.setAudioOutputDevice(alsaOutputDevice()); -// } - + // if(prevManager == CONST_ALSA && newManager == EnumInterface::ALSA) { + // kDebug() << "setting alsa settings"; + // configurationManager.setOutputAudioPlugin(alsaPlugin()); + // configurationManager.setAudioInputDevice(alsaInputDevice()); + // configurationManager.setAudioOutputDevice(alsaOutputDevice()); + // } - /////////////////////// - ////Record settings//// - /////////////////////// + //Record settings kDebug() << "Writing Record settings"; -// QString destination = destinationFolder(); -// configurationManager.setRecordPath(destination); + // QString destination = destinationFolder(); + // configurationManager.setRecordPath(destination); - ///////////////////////////// - ////Address Book settings//// - ///////////////////////////// + //Address Book settings kDebug() << "Writing Address Book settings"; MapStringInt addressBookSettings = MapStringInt(); addressBookSettings[ADDRESSBOOK_ENABLE] = enableAddressBook(); -// addressBookSettings[ADDRESSBOOK_MAX_RESULTS] = maxResults(); -// addressBookSettings[ADDRESSBOOK_DISPLAY_CONTACT_PHOTO] = displayPhoto(); -// addressBookSettings[ADDRESSBOOK_DISPLAY_BUSINESS] = business(); -// addressBookSettings[ADDRESSBOOK_DISPLAY_MOBILE] = mobile(); -// addressBookSettings[ADDRESSBOOK_DISPLAY_HOME] = home(); + // addressBookSettings[ADDRESSBOOK_MAX_RESULTS] = maxResults(); + // addressBookSettings[ADDRESSBOOK_DISPLAY_CONTACT_PHOTO] = displayPhoto(); + // addressBookSettings[ADDRESSBOOK_DISPLAY_BUSINESS] = business(); + // addressBookSettings[ADDRESSBOOK_DISPLAY_MOBILE] = mobile(); + // addressBookSettings[ADDRESSBOOK_DISPLAY_HOME] = home(); configurationManager.setAddressbookSettings(addressBookSettings); - ///////////////////////////// - ///////Hooks settings//////// - ///////////////////////////// + //Hooks settings kDebug() << "Writing Hooks settings"; diff --git a/kde/src/klib/HelperFunctions.cpp b/kde/src/klib/HelperFunctions.cpp index 4a3cdb50e4..24a539d6c4 100644 --- a/kde/src/klib/HelperFunctions.cpp +++ b/kde/src/klib/HelperFunctions.cpp @@ -27,6 +27,7 @@ //SFLPhone #include "../lib/Contact.h" +///Transform a contact list to a [QString][QString][QVariant] hash ContactHash HelperFunctions::toHash(QList<Contact*> contacts) { QHash<QString,QHash<QString,QVariant> > hash; for (int i=0;i<contacts.size();i++) { diff --git a/kde/src/klib/SortableDockCommon.h b/kde/src/klib/SortableDockCommon.h index 20c31dde0a..789fe935a4 100644 --- a/kde/src/klib/SortableDockCommon.h +++ b/kde/src/klib/SortableDockCommon.h @@ -45,7 +45,7 @@ enum ContactSortingMode { Organisation , Recently_used , Group , - Department + Department , }; ///@enum HistorySortingMode @@ -53,7 +53,7 @@ enum HistorySortingMode { Date = 0, Name2 = 1, Popularity = 2, - Length = 3 + Length = 3, }; template <typename CallWidget = QWidget*, typename Index = QModelIndex*> @@ -70,8 +70,8 @@ class LIB_EXPORT SortableDockCommon { protected: SortableDockCommon(); //Helpers - static QString timeToHistoryCategory ( QDate date ); - static QHash<Contact*, QDateTime> getContactListByTime ( /*ContactList list*/ ); + static QString timeToHistoryCategory ( QDate date ); + static QHash<Contact*, QDateTime> getContactListByTime ( ); //Attributes static QStringList m_slHistoryConst; diff --git a/kde/src/klib/SortableDockCommon.hpp b/kde/src/klib/SortableDockCommon.hpp index 608ecf4bb4..b6b18874a0 100644 --- a/kde/src/klib/SortableDockCommon.hpp +++ b/kde/src/klib/SortableDockCommon.hpp @@ -40,9 +40,7 @@ CALLMODEL_TEMPLATE StaticEventHandler* SORTABLE_T::m_spEvHandler = new StaticEve CALLMODEL_TEMPLATE SORTABLE_T::SortableDockCommon() { - /*if (not m_spEvHandler) { - m_spEvHandler = new StaticEventHandler(0,&(SORTABLE_T::m_slHistoryConst)); - }*/ + } @@ -106,7 +104,7 @@ CALLMODEL_TEMPLATE QHash<Contact*, QDateTime> SORTABLE_T::getContactListByTime(/ } } return toReturn; -} +} //getContactListByTime CALLMODEL_TEMPLATE void SORTABLE_T::setHistoryCategory(QList<Call*>& calls,HistorySortingMode mode) { @@ -164,7 +162,7 @@ CALLMODEL_TEMPLATE void SORTABLE_T::setHistoryCategory(QList<Call*>& calls,Histo default: break; } -} +} //setHistoryCategory CALLMODEL_TEMPLATE void SORTABLE_T::setContactCategory(QList<Contact*> contacts,ContactSortingMode mode) { @@ -206,7 +204,7 @@ CALLMODEL_TEMPLATE void SORTABLE_T::setContactCategory(QList<Contact*> contacts, } } } -} +} //setContactCategory ///Return the identity of the call caller, try to return something usefull CALLMODEL_TEMPLATE QString SORTABLE_T::getIdentity(Call* item) diff --git a/kde/src/klib/dataengine/sflphonEngine.cpp b/kde/src/klib/dataengine/sflphonEngine.cpp index 33d74bb8b0..68ef8dd3df 100644 --- a/kde/src/klib/dataengine/sflphonEngine.cpp +++ b/kde/src/klib/dataengine/sflphonEngine.cpp @@ -20,8 +20,11 @@ #include "sflphonEngine.h" +//KDE #include <Plasma/DataContainer> +#include <Plasma/Service> +//SFLPhone #include "../../lib/Call.h" #include "../../lib/Account.h" #include "../../lib/AccountList.h" @@ -34,10 +37,20 @@ #include "../../klib/AkonadiBackend.h" #include "../../klib/HelperFunctions.h" #include "../../klib/ConfigurationSkeleton.h" -#include "sflphoneService.h"> +#include "../../lib/CallModel.h" +#include "sflphoneService.h" +//Static CallModel<>* SFLPhoneEngine::m_pModel = NULL; + +/***************************************************************************** + * * + * Constructor * + * * + ****************************************************************************/ + +///Constructor SFLPhoneEngine::SFLPhoneEngine(QObject* parent, const QVariantList& args) : Plasma::DataEngine(parent, args) { @@ -48,137 +61,152 @@ SFLPhoneEngine::SFLPhoneEngine(QObject* parent, const QVariantList& args) m_pModel->initHistory(); } - //CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance(); - - connect(m_pModel , SIGNAL( callStateChanged(Call*)) , this , SLOT(callStateChangedSignal(Call*) )); - connect(m_pModel , SIGNAL( callAdded(Call*)) , this , SLOT(callStateChangedSignal(Call*) )); - connect(m_pModel , SIGNAL( callStateChanged(Call*)) , this , SLOT(callStateChangedSignal(Call*) )); - //connect(&callManager , SIGNAL( incomingCall(Call*)) , this , SLOT(incomingCallSignal(Call*) )); - //connect(&callManager , SIGNAL( conferenceCreated(Call*)) , this , SLOT(conferenceCreatedSignal(Call*) )); - //connect(&callManager , SIGNAL( conferenceChanged(Call*)) , this , SLOT(conferenceChangedSignal(Call*) )); - connect(AkonadiBackend::getInstance(), SIGNAL( collectionChanged()) , this , SLOT(updateCollection() )); + /* SOURCE SIGNAL DESTINATION SLOT */ + /**/connect(m_pModel , SIGNAL( callStateChanged(Call*)) , this , SLOT( callStateChangedSignal(Call*) )); + /**/connect(m_pModel , SIGNAL( callAdded(Call*)) , this , SLOT( callStateChangedSignal(Call*) )); + /**/connect(m_pModel , SIGNAL( callStateChanged(Call*)) , this , SLOT( callStateChangedSignal(Call*) )); + /**/connect(AkonadiBackend::getInstance(), SIGNAL( collectionChanged()) , this , SLOT( updateCollection() )); + /* */ + } + +/***************************************************************************** + * * + * Dateengine internal * + * * + ****************************************************************************/ + +///Fill a source only when it is called for the first time, then do it asyncroniously bool SFLPhoneEngine::sourceRequestEvent(const QString &name) { - if ( name == "history" ) { - updateHistory(); - } - else if ( name == "calls" ) { - updateCallList(); - } - else if ( name == "conferences" ) { - updateConferenceList(); - } - else if ( name == "info" ) { - updateInfo(); - } - else if ( name == "accounts" ) { - updateAccounts(); - } - else if ( name == "contacts" ) { - updateContacts(); - } - else if ( name == "bookmark" ) { - updateBookmarkList(); - } - else if ( name.left(7) == "Number:" ) { - generateNumberList(name); - } + /* SOURCE CALLBACK */ + if ( name == "history" ) { updateHistory(); } + else if ( name == "calls" ) { updateCallList(); } + else if ( name == "conferences" ) { updateConferenceList(); } + else if ( name == "info" ) { updateInfo(); } + else if ( name == "accounts" ) { updateAccounts(); } + else if ( name == "contacts" ) { updateContacts(); } + else if ( name == "bookmark" ) { updateBookmarkList(); } + else if ( name.left(7) == "Number:" ) { generateNumberList(name); } + /* */ + return true;//updateSourceEvent(name); } +///Not used bool SFLPhoneEngine::updateSourceEvent(const QString &name) { Q_UNUSED(name) return true; } +///List all default valid sources, more can be requested dynamically QStringList SFLPhoneEngine::sources() const { QStringList toReturn; toReturn << "calls" << "history" << "conferences" << "info" << "accounts" << "contacts" << "bookmark"; return toReturn; } +///Return the service used for RPC Plasma::Service* SFLPhoneEngine::serviceForSource(const QString &source) { if (source != "calls") { return 0; } - SFLPhoneService *service = new SFLPhoneService(this); + SFLPhoneService* service = new SFLPhoneService(this); service->setParent(this); return service; } +/***************************************************************************** + * * + * Getters * + * * + ****************************************************************************/ + +///Transform a backend state into a translated string QString SFLPhoneEngine::getCallStateName(call_state state) { - if (state == CALL_STATE_INCOMING) { - return I18N_NOOP("Ringing (in)"); - } else if (state == CALL_STATE_RINGING) { - return I18N_NOOP("Ringing (out)"); - } else if (state == CALL_STATE_CURRENT) { - return I18N_NOOP("Talking"); - } else if (state == CALL_STATE_DIALING) { - return I18N_NOOP("Dialing"); - } else if (state == CALL_STATE_HOLD) { - return I18N_NOOP("Hold"); - } else if (state == CALL_STATE_FAILURE) { - return I18N_NOOP("Failed"); - } else if (state == CALL_STATE_BUSY) { - return I18N_NOOP("Busy"); - } else if (state == CALL_STATE_TRANSFER) { - return I18N_NOOP("Transfer"); - } else if (state == CALL_STATE_TRANSF_HOLD) { - return I18N_NOOP("Transfer hold"); - } else if (state == CALL_STATE_OVER) { - return I18N_NOOP("Over"); - } else if (state == CALL_STATE_ERROR) { - return I18N_NOOP("Error"); - } + /* STATE I18N NAME */ + /**/if ( state == CALL_STATE_INCOMING ) { return I18N_NOOP( "Ringing (in)" ); } + /**/else if ( state == CALL_STATE_RINGING ) { return I18N_NOOP( "Ringing (out)" ); } + /**/else if ( state == CALL_STATE_CURRENT ) { return I18N_NOOP( "Talking" ); } + /**/else if ( state == CALL_STATE_DIALING ) { return I18N_NOOP( "Dialing" ); } + /**/else if ( state == CALL_STATE_HOLD ) { return I18N_NOOP( "Hold" ); } + /**/else if ( state == CALL_STATE_FAILURE ) { return I18N_NOOP( "Failed" ); } + /**/else if ( state == CALL_STATE_BUSY ) { return I18N_NOOP( "Busy" ); } + /**/else if ( state == CALL_STATE_TRANSFER ) { return I18N_NOOP( "Transfer" ); } + /**/else if ( state == CALL_STATE_TRANSF_HOLD ) { return I18N_NOOP( "Transfer hold" ); } + /**/else if ( state == CALL_STATE_OVER ) { return I18N_NOOP( "Over" ); } + /**/else if ( state == CALL_STATE_ERROR ) { return I18N_NOOP( "Error" ); } + /* */ return ""; } +///Return the model +CallModel<>* SFLPhoneEngine::getModel() +{ + return m_pModel; +} + + +/***************************************************************************** + * * + * Callbacks * + * * + ****************************************************************************/ + +///Load/Update history void SFLPhoneEngine::updateHistory() { CallList list = m_pModel->getHistory().values(); setHistoryCategory(list,HistorySortingMode::Date); foreach (Call* oldCall, list) { - historyCall[oldCall->getCallId()][ "peerName" ] = oldCall->getPeerName(); - historyCall[oldCall->getCallId()][ "peerNumber" ] = oldCall->getPeerPhoneNumber(); - historyCall[oldCall->getCallId()][ "length" ] = oldCall->getStopTimeStamp().toInt() - oldCall->getStartTimeStamp().toInt(); - historyCall[oldCall->getCallId()][ "date" ] = oldCall->getStopTimeStamp(); - historyCall[oldCall->getCallId()][ "id" ] = oldCall->getCallId(); + HashStringString current; + /* KEY VALUE */ + /**/current[ "peerName" ] = oldCall->getPeerName () ; + /**/current[ "peerNumber" ] = oldCall->getPeerPhoneNumber() ; + /**/current[ "length" ] = oldCall->getStopTimeStamp ().toInt() - oldCall->getStartTimeStamp().toInt(); + /**/current[ "date" ] = oldCall->getStopTimeStamp () ; + /**/current[ "id" ] = oldCall->getCallId () ; + /* */ if (oldCall->property("section").isValid()) - historyCall[oldCall->getCallId()][ "section" ] = oldCall->property("section"); - setData("history", oldCall->getCallId() , historyCall[oldCall->getCallId()]); + current[ "section" ] = oldCall->property("section"); + setData("history", oldCall->getCallId() , current); } } +///Load/Update calllist void SFLPhoneEngine::updateCallList() { - QHash<QString,QVariant> test; - test[ "peerName" ] = ""; - test[ "peerNumber" ] = ""; - test[ "stateName" ] = ""; - test[ "state" ] = ""; - test[ "id" ] = ""; - setData("calls", "fake",test ); + //As of KDE 4.8, an empty source is ignored, adding an invisible entry + QStringList keys = {"peerName","peerNumber","stateName","state","id"}; + QHash<QString,QVariant> fake; + foreach (QString key, keys) { + fake[key] = ""; + } + setData("calls", "fake",fake ); removeAllData("calls"); foreach (Call* call, m_pModel->getCalls()) { if ((!m_pModel->isConference(call)) && (call->getState() != CALL_STATE_OVER)) { - currentCall[call->getCallId()][ "peerName" ] = call->getPeerName(); - currentCall[call->getCallId()][ "peerNumber" ] = call->getPeerPhoneNumber(); - currentCall[call->getCallId()][ "stateName" ] = getCallStateName(call->getState()); - currentCall[call->getCallId()][ "state" ] = call->getState(); - currentCall[call->getCallId()][ "id" ] = call->getCallId(); - setData("calls", call->getCallId(), currentCall[call->getCallId()]); + HashStringString current; + /* KEY VALUE */ + /**/current[ "peerName" ] = call->getPeerName ( ); + /**/current[ "peerNumber" ] = call->getPeerPhoneNumber ( ); + /**/current[ "stateName" ] = getCallStateName ( call->getState() ); + /**/current[ "state" ] = call->getState ( ); + /**/current[ "id" ] = call->getCallId ( ); + /* */ + setData("calls", call->getCallId(), current); } } } +///Load/Update bookmark list void SFLPhoneEngine::updateBookmarkList() { removeAllData("bookmark"); @@ -187,16 +215,14 @@ void SFLPhoneEngine::updateBookmarkList() for (;i < ((cl.size() < 10)?cl.size():10);i++) { QHash<QString,QVariant> pop; Contact* cont = AkonadiBackend::getInstance()->getContactByPhone(cl[i],true); - if (cont) { - pop["peerName" ] = cont->getFormattedName(); - } - else { - pop["peerName" ] = cl[i]; - } - pop["peerNumber" ] = cl[i] ; - pop["section" ] = "Popular" ; - pop["listPriority" ] = 1000 ; - pop["id" ] = i ; + /* KEY VALUE */ + /**/pop["peerName" ] = (cont)?cont->getFormattedName():cl[i]; + /**/pop["peerNumber" ] = cl[i] ; + /**/pop["section" ] = "Popular" ; + /**/pop["listPriority" ] = 1000 ; + /**/pop["id" ] = i ; + /* */ + setData("bookmark", QString::number(i), pop); } @@ -204,40 +230,47 @@ void SFLPhoneEngine::updateBookmarkList() foreach (QString nb, ConfigurationSkeleton::bookmarkList()) { i++; QHash<QString,QVariant> pop; - pop["peerName" ] = "TODO" ; - pop["peerNumber" ] = nb ; - pop["section" ] = "1" ; - pop["listPriority" ] = 0 ; - pop["id" ] = i ; + /* KEY VALUE */ + /**/pop["peerName" ] = "TODO" ; + /**/pop["peerNumber" ] = nb ; + /**/pop["section" ] = "1" ; + /**/pop["listPriority" ] = 0 ; + /**/pop["id" ] = i ; + /* */ + setData("bookmark", QString::number(i), pop); } } +///Load/Update conference list (TODO) void SFLPhoneEngine::updateConferenceList() { - foreach (Call* call, m_pModel->getCalls()) { + /*foreach (Call* call, m_pModel->getCalls()) { if (m_pModel->isConference(call)) { CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance(); currentConferences[call->getConfId()] = callManager.getParticipantList(call->getConfId()); setData("conferences", call->getConfId(), currentConferences[call->getConfId()]); } - } + }*/ } +///Update contact collection void SFLPhoneEngine::updateCollection() { typedef QHash<QString,QVariant> SerializedContact; ContactList list = AkonadiBackend::getInstance()->update(); + if (!list.size()) return; + ContactHash hash = HelperFunctions::toHash(list); foreach (SerializedContact cont, hash) { if (!m_hContacts[hash.key(cont)].size()) { m_hContacts[hash.key(cont)] = cont; } - // } + removeAllData("contacts"); int i=0; foreach (SerializedContact cont, m_hContacts) { @@ -245,41 +278,50 @@ void SFLPhoneEngine::updateCollection() setData("contacts", QString::number(i), QVariant(cont)); i++; } + updateBookmarkList(); } +///Dummy implementation of the contact list (TOREMOVE) void SFLPhoneEngine::updateContacts() { - QHash<QString,QVariant> test; - test[ "nickName" ] = ""; - test[ "firstName" ] = ""; - test[ "secondName" ] = ""; - test[ "formattedName" ] = ""; - test[ "organization" ] = ""; - test[ "Uid" ] = ""; - test[ "preferredEmail" ] = ""; - test[ "type" ] = ""; - test[ "group" ] = ""; - test[ "department" ] = ""; - setData("contacts", "fake",test ); + //As of KDE 4.8, an empty source is ignored, adding an invisible entry + QStringList keys = {"nickName","firstName" ,"secondName","formattedName","organization", + "Uid" ,"preferredEmail","type" ,"group" ,"department" }; + + QHash<QString,QVariant> fake; + foreach(QString key,keys) { + fake[key]=""; + } + setData("contacts", "fake",fake ); } +///Update other informations void SFLPhoneEngine::updateInfo() { setData("info", I18N_NOOP("Current_account"), m_pModel->getCurrentAccountId()); } +///Load/Update account list void SFLPhoneEngine::updateAccounts() { const QVector<Account*>& list = m_pModel->getAccountList()->getAccounts(); foreach(Account* a,list) { QHash<QString,QVariant> acc; - acc["id"] = a->getAccountId(); - acc["alias"] = a->getAccountDetail(ACCOUNT_ALIAS); + acc[ "id" ] = a->getAccountId() ; + acc[ "alias"] = a->getAccountDetail(ACCOUNT_ALIAS); setData("accounts", QString::number(rand()) , acc); } } + +/***************************************************************************** + * * + * Mutators * + * * + ****************************************************************************/ + +///Generate a number void SFLPhoneEngine::generateNumberList(QString name) { QString contactUid = name.right(name.size()-7); @@ -288,8 +330,8 @@ void SFLPhoneEngine::generateNumberList(QString name) if (cont) { foreach(Contact::PhoneNumber* num,cont->getPhoneNumbers()) { QHash<QString,QVariant> hash; - hash[ "number" ] = num->getNumber(); - hash[ "type" ] = num->getType(); + hash[ "number" ] = num->getNumber() ; + hash[ "type" ] = num->getType() ; setData(name, QString::number(rand()) , hash); } } @@ -298,30 +340,27 @@ void SFLPhoneEngine::generateNumberList(QString name) } } +/***************************************************************************** + * * + * Slots * + * * + ****************************************************************************/ + +///When call state change void SFLPhoneEngine::callStateChangedSignal(Call* call) { Q_UNUSED(call) updateCallList(); } +///When incomming call void SFLPhoneEngine::incomingCallSignal(Call* call) { Q_UNUSED(call) updateCallList(); } -void SFLPhoneEngine::conferenceCreatedSignal(Call* conf) -{ - Q_UNUSED(conf) - updateConferenceList(); -} - -void SFLPhoneEngine::conferenceChangedSignal(Call* conf) -{ - Q_UNUSED(conf) - updateConferenceList(); -} - +///When incomming messge void SFLPhoneEngine::incomingMessageSignal(const QString& accountId, const QString& message) { Q_UNUSED(accountId) @@ -329,6 +368,7 @@ void SFLPhoneEngine::incomingMessageSignal(const QString& accountId, const QStri //TODO } +///When voicemail notify void SFLPhoneEngine::voiceMailNotifySignal(const QString& accountId, int count) { Q_UNUSED(accountId) @@ -336,14 +376,4 @@ void SFLPhoneEngine::voiceMailNotifySignal(const QString& accountId, int count) //TODO } -void SFLPhoneEngine::accountChanged() -{ - -} - -CallModel<>* SFLPhoneEngine::getModel() -{ - return m_pModel; -} - K_EXPORT_PLASMA_DATAENGINE(sflphone, SFLPhoneEngine) diff --git a/kde/src/klib/dataengine/sflphonEngine.h b/kde/src/klib/dataengine/sflphonEngine.h index 98b5712ae9..bf510b6c6d 100644 --- a/kde/src/klib/dataengine/sflphonEngine.h +++ b/kde/src/klib/dataengine/sflphonEngine.h @@ -21,15 +21,24 @@ #ifndef SFLPHONEENGINE_H #define SFLPHONEENGINE_H +//Base +#include "../SortableDockCommon.h" #include <Plasma/DataEngine> -#include <Plasma/Service> + +//Qt #include <QHash> +//KDE +namespace Plasma { + class Service; +} + +//SFLPhone #include "../../lib/CallModel.h" -#include "../SortableDockCommon.h" -typedef QHash<QString,QVariant> HashStringString; -typedef QHash<QString,QHash<QString,QVariant> > ContactHash; +//Typedef +typedef QHash<QString,QVariant> HashStringString; +typedef QHash<QString,QHash<QString,QVariant> > ContactHash ; class Call; class SFLPhoneEngine : public Plasma::DataEngine,public SortableDockCommon<> @@ -37,44 +46,53 @@ class SFLPhoneEngine : public Plasma::DataEngine,public SortableDockCommon<> Q_OBJECT public: + //Constructor SFLPhoneEngine(QObject* parent, const QVariantList& args); - Plasma::Service *serviceForSource(const QString &source); - virtual QStringList sources() const; + ~SFLPhoneEngine() {}; + + //Getter + Plasma::Service* serviceForSource (const QString &source) ; + virtual QStringList sources ( ) const ; + static CallModel<>* getModel ( ) ; - static CallModel<>* getModel(); - + //Friends friend class SFLPhoneService; + protected: - bool sourceRequestEvent(const QString& name); - bool updateSourceEvent(const QString& source); + //Reimplementation + bool sourceRequestEvent(const QString& name ); + bool updateSourceEvent (const QString& source ); + private: - QHash<QString, HashStringString > historyCall ; - QHash<QString, HashStringString > currentCall ; - QHash<QString, QStringList> currentConferences ; - static CallModel<>* m_pModel ; - ContactHash m_hContacts ; + //Attributes + static CallModel<>* m_pModel ; + ContactHash m_hContacts; + + //Getter QString getCallStateName(call_state state); + + //Callback void updateHistory (); void updateCallList (); void updateAccounts (); void updateConferenceList (); void updateContacts (); void updateBookmarkList (); - void updateInfo(); - + void updateInfo (); + + //Mutator void generateNumberList(QString name); + + private slots: - void updateCollection(); - void callStateChangedSignal (Call* call); - void incomingCallSignal (Call* conf); - void conferenceCreatedSignal (Call* conf); - void conferenceChangedSignal (Call* conf); - //void conferenceRemovedSignal(const QString& confId); - void incomingMessageSignal( const QString& accountId, const QString& message ); - void voiceMailNotifySignal( const QString& accountId, int count ); - void accountChanged(); + //Slots + void updateCollection ( ); + void callStateChangedSignal (Call* call ); + void incomingCallSignal (Call* conf ); + void incomingMessageSignal ( const QString& accountId, const QString& message ); + void voiceMailNotifySignal ( const QString& accountId, int count ); }; #endif // SFLPHONEENGINE_H diff --git a/kde/src/klib/dataengine/sflphoneService.cpp b/kde/src/klib/dataengine/sflphoneService.cpp index 5452f05977..952dd4905f 100644 --- a/kde/src/klib/dataengine/sflphoneService.cpp +++ b/kde/src/klib/dataengine/sflphoneService.cpp @@ -22,37 +22,141 @@ #include "../../lib/Call.h" -SFLPhoneService::SFLPhoneService(SFLPhoneEngine *engine) +/***************************************************************************** + * * + * Jobs * + * * + ****************************************************************************/ +///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() ) +{ + +} + +///Make a call +void CallJob::start() +{ + Call* call = SFLPhoneEngine::getModel()->addDialingCall(m_Number,m_AccountId); + call->setCallNumber(m_Number); + call->actionPerformed(CALL_ACTION_ACCEPT); +} + + +///Constructor +DTMFJob::DTMFJob(QObject* parent, const QString& operation, const QVariantMap& parameters) + : Plasma::ServiceJob("", operation, parameters, parent) + , m_mStr( parameters[ "str" ].toString() ) +{ + +} + +///Play a DMTF tone +void DTMFJob::start() +{ + CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance(); + callManager.playDTMF(m_mStr); +} + + +///Constructor +HangUpJob::HangUpJob(QObject* parent, const QString& operation, const QVariantMap& parameters) + : Plasma::ServiceJob("", operation, parameters, parent) + , m_CallId( parameters[ "callid" ].toString() ) +{ + +} + +///Hang up a call +void HangUpJob::start() +{ + Call* call = SFLPhoneEngine::getModel()->getCall(m_CallId); + call->actionPerformed(CALL_ACTION_REFUSE); + call->changeCurrentState(CALL_STATE_OVER); +} + + +///Constructor +TransferJob::TransferJob(QObject* parent, const QString& operation, const QVariantMap& parameters) + : Plasma::ServiceJob("", operation, parameters, parent) + , m_CallId ( parameters[ "callid" ].toString() ) + , m_transferNumber ( parameters[ "transfernumber" ].toString() ) +{ + +} + + +///Tranfer a call +void TransferJob::start() +{ + Call* call = SFLPhoneEngine::getModel()->getCall(m_CallId); + call->setTransferNumber(m_transferNumber); + call->changeCurrentState(CALL_STATE_TRANSFER); + call->actionPerformed(CALL_ACTION_ACCEPT); + call->changeCurrentState(CALL_STATE_OVER); +} + +///Constructor +HoldJob::HoldJob(QObject* parent, const QString& operation, const QVariantMap& parameters) + : Plasma::ServiceJob("", operation, parameters, parent) + , m_CallId ( parameters[ "callid" ].toString() ) +{} + + +///Put a call on hold +void HoldJob::start() +{ + Call* call = SFLPhoneEngine::getModel()->getCall(m_CallId); + call->actionPerformed(CALL_ACTION_HOLD); +} + +///Constructor +RecordJob::RecordJob(QObject* parent, const QString& operation, const QVariantMap& parameters) + : Plasma::ServiceJob("", operation, parameters, parent) + , m_CallId ( parameters[ "callid" ].toString() ) +{ + +} + + +///Record a call +void RecordJob::start() +{ + Call* call = SFLPhoneEngine::getModel()->getCall(m_CallId); + call->actionPerformed(CALL_ACTION_RECORD); +} + + +/***************************************************************************** + * * + * Service related functions * + * * + ****************************************************************************/ + +///Constructor +SFLPhoneService::SFLPhoneService(SFLPhoneEngine *engine):m_engine(engine) { - m_engine = engine; setName("sflphone"); } +///Constructor ServiceJob *SFLPhoneService::createJob(const QString &operation, QMap<QString, QVariant> ¶meters) { - if (!m_engine) { - return 0; - } - - if (operation == "Call") { - return new CallJob(this, operation,parameters); - } - else if (operation == "DMTF") { - return new DTMFJob(this, operation,parameters); - } - else if (operation == "Transfer") { - return new TransferJob(this, operation,parameters); - } - else if (operation == "Hangup") { - return new HangUpJob(this, operation,parameters); - } - else if (operation == "Hold") { - return new HoldJob(this, operation,parameters); - } - else if (operation == "Record") { - return new RecordJob(this, operation,parameters); - } - m_engine->setData(operation, parameters["query"]); - return 0; + if (!m_engine) + return 0; + + /* RPC NAME JOB */ + /**/if (operation == "Call" ) { return new CallJob ( this, operation,parameters); } + /**/else if (operation == "DMTF" ) { return new DTMFJob ( this, operation,parameters); } + /**/else if (operation == "Transfer" ) { return new TransferJob( this, operation,parameters); } + /**/else if (operation == "Hangup" ) { return new HangUpJob ( this, operation,parameters); } + /**/else if (operation == "Hold" ) { return new HoldJob ( this, operation,parameters); } + /**/else if (operation == "Record" ) { return new RecordJob ( this, operation,parameters); } + /* */ + + m_engine->setData(operation, parameters["query"]); + return 0; } \ No newline at end of file diff --git a/kde/src/klib/dataengine/sflphoneService.h b/kde/src/klib/dataengine/sflphoneService.h index 22c5d4295e..b73d5078cf 100644 --- a/kde/src/klib/dataengine/sflphoneService.h +++ b/kde/src/klib/dataengine/sflphoneService.h @@ -31,133 +31,90 @@ using namespace Plasma; +///@class SFLPhoneService RPC between the plasmoid and the library class SFLPhoneService : public Plasma::Service { - Q_OBJECT + Q_OBJECT public: - SFLPhoneService(SFLPhoneEngine *engine); - ServiceJob *createJob(const QString &operation, QMap<QString, QVariant> ¶meters); + SFLPhoneService(SFLPhoneEngine *engine); + ServiceJob *createJob(const QString &operation, QMap<QString, QVariant> ¶meters); private: - SFLPhoneEngine *m_engine; - + SFLPhoneEngine *m_engine; }; +///@class CallJob Call using and account and a number class CallJob : public Plasma::ServiceJob { Q_OBJECT public: - CallJob(QObject* parent, const QString& operation, const QVariantMap& parameters = QVariantMap()) - : Plasma::ServiceJob("", operation, parameters, parent) - , m_AccountId ( parameters[ "AccountId" ].toString() ) - , m_Number ( parameters[ "Number" ].toString() ) - {} - - void start() - { - Call* call = SFLPhoneEngine::getModel()->addDialingCall(m_Number,m_AccountId); - call->setCallNumber(m_Number); - call->actionPerformed(CALL_ACTION_ACCEPT); - } + CallJob(QObject* parent, const QString& operation, const QVariantMap& parameters = QVariantMap()); + + void start(); private: QString m_AccountId; - QString m_Number; + QString m_Number ; }; +///@class DTMFJob Play a sound when called class DTMFJob : public Plasma::ServiceJob { Q_OBJECT public: - DTMFJob(QObject* parent, const QString& operation, const QVariantMap& parameters = QVariantMap()) - : Plasma::ServiceJob("", operation, parameters, parent) - , m_mStr( parameters[ "str" ].toString() ) - {} - - void start() - { - CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance(); - callManager.playDTMF(m_mStr); - } + DTMFJob(QObject* parent, const QString& operation, const QVariantMap& parameters = QVariantMap()); + + void start(); private: QString m_mStr; }; +///@class HangUpJob Hang up a call using an id class HangUpJob : public Plasma::ServiceJob { Q_OBJECT public: - HangUpJob(QObject* parent, const QString& operation, const QVariantMap& parameters = QVariantMap()) - : Plasma::ServiceJob("", operation, parameters, parent) - , m_CallId( parameters[ "callid" ].toString() ) - {} - - void start() - { - Call* call = SFLPhoneEngine::getModel()->getCall(m_CallId); - call->actionPerformed(CALL_ACTION_REFUSE); - call->changeCurrentState(CALL_STATE_OVER); - } + HangUpJob(QObject* parent, const QString& operation, const QVariantMap& parameters = QVariantMap()); + + void start(); private: QString m_CallId; }; +///@class TransferJob Transfer a call class TransferJob : public Plasma::ServiceJob { Q_OBJECT public: - TransferJob(QObject* parent, const QString& operation, const QVariantMap& parameters = QVariantMap()) - : Plasma::ServiceJob("", operation, parameters, parent) - , m_CallId ( parameters[ "callid" ].toString() ) - , m_transferNumber ( parameters[ "transfernumber" ].toString() ) - {} - - void start() - { - Call* call = SFLPhoneEngine::getModel()->getCall(m_CallId); - call->setTransferNumber(m_transferNumber); - call->changeCurrentState(CALL_STATE_TRANSFER); - call->actionPerformed(CALL_ACTION_ACCEPT); - call->changeCurrentState(CALL_STATE_OVER); - } + TransferJob(QObject* parent, const QString& operation, const QVariantMap& parameters = QVariantMap()); + + void start(); private: - QString m_CallId; + QString m_CallId ; QString m_transferNumber; }; +///@class HoldJob Put or remove a call from hold mode class HoldJob : public Plasma::ServiceJob { Q_OBJECT public: - HoldJob(QObject* parent, const QString& operation, const QVariantMap& parameters = QVariantMap()) - : Plasma::ServiceJob("", operation, parameters, parent) - , m_CallId ( parameters[ "callid" ].toString() ) - {} - - void start() - { - Call* call = SFLPhoneEngine::getModel()->getCall(m_CallId); - call->actionPerformed(CALL_ACTION_HOLD); - } + HoldJob(QObject* parent, const QString& operation, const QVariantMap& parameters = QVariantMap()); + + void start(); private: QString m_CallId; }; +///@class RecordJob Record a call class RecordJob : public Plasma::ServiceJob { Q_OBJECT public: - RecordJob(QObject* parent, const QString& operation, const QVariantMap& parameters = QVariantMap()) - : Plasma::ServiceJob("", operation, parameters, parent) - , m_CallId ( parameters[ "callid" ].toString() ) - {} - - void start() - { - Call* call = SFLPhoneEngine::getModel()->getCall(m_CallId); - call->actionPerformed(CALL_ACTION_RECORD); - } + RecordJob(QObject* parent, const QString& operation, const QVariantMap& parameters = QVariantMap()); + + void start(); private: QString m_CallId; }; diff --git a/kde/src/lib/Account.cpp b/kde/src/lib/Account.cpp index c93064db62..b58b14e5e2 100644 --- a/kde/src/lib/Account.cpp +++ b/kde/src/lib/Account.cpp @@ -64,7 +64,7 @@ const QString& account_state_name(const QString& s) if(s == QString(ACCOUNT_STATE_ERROR_EXIST_STUN) ) return stunServerInvalid ; return invalid ; -} +} //account_state_name ///Constructors Account::Account():m_pAccountId(NULL),m_pAccountDetails(NULL) @@ -92,7 +92,7 @@ Account* Account::buildExistingAccountFromId(const QString& _accountId) // } return a; -} +} //buildExistingAccountFromId ///Build an account from it's name / alias Account* Account::buildNewAccountFromAlias(const QString& alias) @@ -165,7 +165,7 @@ const QString& Account::getAccountDetail(const QString& param) const qDebug() << "Account details not found, there is " << m_pAccountDetails->count() << " details available"; return EMPTY_STRING; } -} +} //getAccountDetail ///Get the alias const QString& Account::getAlias() const diff --git a/kde/src/lib/AccountList.cpp b/kde/src/lib/AccountList.cpp index 070ff71f02..5a616f8c27 100644 --- a/kde/src/lib/AccountList.cpp +++ b/kde/src/lib/AccountList.cpp @@ -74,7 +74,7 @@ void AccountList::update() for (int i = 0; i < accountIds.size(); ++i) { m_pAccounts->insert(i, Account::buildExistingAccountFromId(accountIds[i])); } -} +} //update ///Update accounts void AccountList::updateAccounts() @@ -88,7 +88,7 @@ void AccountList::updateAccounts() (*m_pAccounts) += Account::buildExistingAccountFromId(accountIds[i]); } emit accountListUpdated(); -} +} //updateAccounts /***************************************************************************** @@ -174,7 +174,9 @@ Account* AccountList::firstRegisteredAccount() const return current; } else { - qDebug() << "Account " << ((current)?current->getAccountId():"") << " is not registered (" << ((current)?current->getAccountDetail(ACCOUNT_REGISTRATION_STATUS):"") << ") State:" << ((current)?current->getAccountDetail(ACCOUNT_REGISTRATION_STATUS):""); + qDebug() << "Account " << ((current)?current->getAccountId():"") << " is not registered (" + << ((current)?current->getAccountDetail(ACCOUNT_REGISTRATION_STATUS):"") << ") State:" + << ((current)?current->getAccountDetail(ACCOUNT_REGISTRATION_STATUS):""); } } return NULL; diff --git a/kde/src/lib/Call.cpp b/kde/src/lib/Call.cpp index fed5b54aee..b9982a7c90 100644 --- a/kde/src/lib/Call.cpp +++ b/kde/src/lib/Call.cpp @@ -159,7 +159,7 @@ Call* Call::buildExistingCall(QString callId) call->m_HistoryState = getHistoryStateFromDaemonCallState(details[CALL_STATE], details[CALL_TYPE]) ; return call; -} +} //buildExistingCall ///Build a call from a dialing call (a call that is about to exist) Call* Call::buildDialingCall(QString callId, const QString & peerName, QString account) @@ -182,7 +182,7 @@ Call* Call::buildIncomingCall(const QString & callId) Call* call = new Call(CALL_STATE_INCOMING, callId, peerName, from, account); call->m_HistoryState = MISSED; return call; -} +} //buildIncomingCall ///Build a rigging call (from dbus) Call* Call::buildRingingCall(const QString & callId) @@ -197,7 +197,7 @@ Call* Call::buildRingingCall(const QString & callId) Call* call = new Call(CALL_STATE_RINGING, callId, peerName, from, account); call->m_HistoryState = OUTGOING; return call; -} +} //buildRingingCall /***************************************************************************** * * @@ -255,7 +255,7 @@ history_state Call::getHistoryStateFromDaemonCallState(QString daemonCallState, return MISSED ; else return NONE ; -} +} //getHistoryStateFromDaemonCallState ///Get the start sate from the daemon state call_state Call::getStartStateFromDaemonCallState(QString daemonCallState, QString daemonCallType) @@ -276,7 +276,7 @@ call_state Call::getStartStateFromDaemonCallState(QString daemonCallState, QStri return CALL_STATE_RINGING ; else return CALL_STATE_FAILURE ; -} +} //getStartStateFromDaemonCallState /***************************************************************************** * * @@ -306,7 +306,7 @@ daemon_call_state Call::toDaemonCallState(const QString & stateName) qDebug() << "stateChanged signal received with unknown state."; return DAEMON_CALL_STATE_FAILURE ; -} +} //toDaemonCallState ///Get the time (second from 1 jan 1970) when the call ended QString Call::getStopTimeStamp() const @@ -430,7 +430,7 @@ bool Call::isSecure() const { return true; } return false; -} +} //isSecure /***************************************************************************** @@ -497,7 +497,7 @@ call_state Call::stateChanged(const QString& newStateName) qDebug() << "A conference have no call state"; return CALL_STATE_ERROR; } -} +} //stateChanged ///An acount have been performed call_state Call::actionPerformed(call_action action) @@ -515,7 +515,7 @@ call_state Call::actionPerformed(call_action action) //return the new state } return m_CurrentState; -} +} //actionPerformed /* void Call::putRecording() @@ -531,7 +531,6 @@ void Call::putRecording() ///Change the state void Call::changeCurrentState(call_state newState) { - //qDebug() << "Call state changed to: " << newState; m_CurrentState = newState; emit changed(); diff --git a/kde/src/lib/CallModel.hpp b/kde/src/lib/CallModel.hpp index a7f25155a0..3af3d1db5d 100644 --- a/kde/src/lib/CallModel.hpp +++ b/kde/src/lib/CallModel.hpp @@ -88,7 +88,6 @@ CALLMODEL_TEMPLATE CALLMODEL_T::CallModel(ModelType type) : CallModelBase(0) { Q_UNUSED(type) init(); - } ///Open the connection to the daemon and register this client @@ -105,7 +104,7 @@ CALLMODEL_TEMPLATE bool CALLMODEL_T::init() } m_sInstanceInit = true; return true; -} +} //init ///Fill the call list ///@warning This solution wont scale to multiple call or history model implementation. Some static addCall + foreach for each call would be needed if this case ever become unavoidable @@ -127,7 +126,7 @@ CALLMODEL_TEMPLATE bool CALLMODEL_T::initCall() } m_sCallInit = true; return true; -} +} //initCall ///Set how the call can find more informations about the call it receive CALLMODEL_TEMPLATE void CALLMODEL_T::initContact ( ContactBackend* be ) @@ -163,7 +162,7 @@ CALLMODEL_TEMPLATE bool CALLMODEL_T::initHistory() } m_sHistoryInit = true; return true; -} +} //initHistory /***************************************************************************** @@ -227,7 +226,7 @@ CALLMODEL_TEMPLATE Call* CALLMODEL_T::addCallCommon(Call* call) addCall(call); selectItem(call); return 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) @@ -239,7 +238,7 @@ CALLMODEL_TEMPLATE Call* CALLMODEL_T::addDialingCall(const QString& peerName, QS Call* call = Call::buildDialingCall(generateCallId(), peerName, account2); return addCallCommon(call); -} +} //addDialingCall ///Create a new incomming call when the daemon is being called CALLMODEL_TEMPLATE Call* CALLMODEL_T::addIncomingCall(const QString& callId) @@ -288,7 +287,7 @@ CALLMODEL_TEMPLATE void CALLMODEL_T::removeCall(Call* call) if (m_sPrivateCallList_index[m_sPrivateCallList_index.key(internal)] == internal) { m_sPrivateCallList_index.remove(m_sPrivateCallList_index.key(internal)); } -} +} //removeCall ///Transfer "toTransfer" to "target" and wait to see it it succeeded CALLMODEL_TEMPLATE void CALLMODEL_T::attendedTransfer(Call* toTransfer, Call* target) @@ -299,7 +298,7 @@ CALLMODEL_TEMPLATE void CALLMODEL_T::attendedTransfer(Call* toTransfer, Call* ta //TODO [Daemon] Implement this correctly toTransfer->changeCurrentState(CALL_STATE_OVER); target->changeCurrentState(CALL_STATE_OVER); -} +} //attendedTransfer ///Transfer this call to "target" number CALLMODEL_TEMPLATE void CALLMODEL_T::transfer(Call* toTransfer, QString target) @@ -309,7 +308,7 @@ CALLMODEL_TEMPLATE void CALLMODEL_T::transfer(Call* toTransfer, QString target) toTransfer->changeCurrentState(CALL_STATE_TRANSFER); toTransfer->actionPerformed(CALL_ACTION_ACCEPT); toTransfer->changeCurrentState(CALL_STATE_OVER); -} +} //transfer /***************************************************************************** * * @@ -344,7 +343,7 @@ CALLMODEL_TEMPLATE Call* CALLMODEL_T::addConference(const QString & confID) m_sPrivateCallList_callId[confID] = aNewStruct; return newConf; -} +} //addConference ///Join two call to create a conference, the conference will be created later (see addConference) CALLMODEL_TEMPLATE bool CALLMODEL_T::createConferenceFromCall(Call* call1, Call* call2) @@ -353,7 +352,7 @@ CALLMODEL_TEMPLATE bool CALLMODEL_T::createConferenceFromCall(Call* call1, Call* CallManagerInterface &callManager = CallManagerInterfaceSingleton::getInstance(); callManager.joinParticipant(call1->getCallId(),call2->getCallId()); return true; -} +} //createConferenceFromCall ///Add a new participant to a conference CALLMODEL_TEMPLATE bool CALLMODEL_T::addParticipant(Call* call2, Call* conference) @@ -367,7 +366,7 @@ CALLMODEL_TEMPLATE bool CALLMODEL_T::addParticipant(Call* call2, Call* conferenc qDebug() << "This is not a conference"; return false; } -} +} //addParticipant ///Remove a participant from a conference CALLMODEL_TEMPLATE bool CALLMODEL_T::detachParticipant(Call* call) @@ -401,7 +400,7 @@ CALLMODEL_TEMPLATE bool CALLMODEL_T::changeConference(const QString& confId, con return false; } return true; -} +} //changeConference ///Remove a conference from the model and the TreeView CALLMODEL_TEMPLATE void CALLMODEL_T::removeConference(const QString &confId) @@ -477,7 +476,7 @@ CALLMODEL_TEMPLATE const QStringList CALLMODEL_T::getNumbersByPopularity() } return cl; -} +} //getNumbersByPopularity /***************************************************************************** @@ -496,7 +495,7 @@ CALLMODEL_TEMPLATE QString CALLMODEL_T::getCurrentAccountId() else { return firstRegistered->getAccountId(); } -} +} //getCurrentAccountId ///Return the current account @@ -510,7 +509,7 @@ CALLMODEL_TEMPLATE Account* CALLMODEL_T::getCurrentAccount() qDebug() << "Returning the first account" << getAccountList()->size(); return getAccountList()->firstRegisteredAccount(); } -} +} //getCurrentAccount ///Return a list of registered accounts CALLMODEL_TEMPLATE AccountList* CALLMODEL_T::getAccountList() diff --git a/kde/src/lib/ContactBackend.cpp b/kde/src/lib/ContactBackend.cpp index f6a527d959..e9af33886c 100644 --- a/kde/src/lib/ContactBackend.cpp +++ b/kde/src/lib/ContactBackend.cpp @@ -27,11 +27,13 @@ //Qt #include <QtCore/QHash> +///Constructor ContactBackend::ContactBackend(QObject* parent) : QObject(parent) { } +///Update slot ContactList ContactBackend::update() { return update_slot(); diff --git a/kde/src/lib/sflphone_const.h b/kde/src/lib/sflphone_const.h index 83e56d3e5e..741a5faca4 100644 --- a/kde/src/lib/sflphone_const.h +++ b/kde/src/lib/sflphone_const.h @@ -65,7 +65,6 @@ #define ICON_TRANSFER ":/images/icons/transfert.svg" #define ICON_TRANSF_HOLD ":/images/icons/transfert.svg" #define ICON_CONFERENCE ":/images/icons/user-group-properties.svg" - #define ICON_CALL ":/images/icons/call.svg" #define ICON_HANGUP ":/images/icons/hang_up.svg" #define ICON_UNHOLD ":/images/icons/unhold.svg" @@ -75,34 +74,26 @@ #define ICON_REC_DEL_OFF ":/images/icons/record_disabled.svg" #define ICON_REC_DEL_ON ":/images/icons/record.svg" #define ICON_MAILBOX ":/images/icons/mailbox.svg" - #define ICON_REC_VOL_0 ":/images/icons/mic.svg" #define ICON_REC_VOL_1 ":/images/icons/mic_25.svg" #define ICON_REC_VOL_2 ":/images/icons/mic_50.svg" #define ICON_REC_VOL_3 ":/images/icons/mic_75.svg" - #define ICON_SND_VOL_0 ":/images/icons/speaker.svg" #define ICON_SND_VOL_1 ":/images/icons/speaker_25.svg" #define ICON_SND_VOL_2 ":/images/icons/speaker_50.svg" #define ICON_SND_VOL_3 ":/images/icons/speaker_75.svg" - #define ICON_SCREEN_MAIN ":/images/icons/sflphone.svg" #define ICON_SCREEN_HISTORY ":/images/icons/history2.svg" #define ICON_SCREEN_ADDRESS ":/images/icons/x-office-address-book.png" - #define ICON_DISPLAY_VOLUME_CONSTROLS ":/images/icons/icon_volume_off.svg" #define ICON_DISPLAY_DIALPAD ":/images/icons/icon_dialpad.svg" - #define ICON_HISTORY_INCOMING ":/images/icons/incoming.svg" #define ICON_HISTORY_OUTGOING ":/images/icons/outgoing.svg" #define ICON_HISTORY_MISSED ":/images/icons/missed.svg" - #define ICON_ACCOUNT_LED_RED ":/images/icons/led-red.svg" #define ICON_ACCOUNT_LED_GREEN ":/images/icons/led-green.svg" #define ICON_ACCOUNT_LED_GRAY ":/images/icons/led-gray.svg" - #define ICON_QUIT ":/images/icons/application-exit.png" - #define ICON_SFLPHONE ":/images/icons/sflphone.svg" #define ICON_TRAY_NOTIF ":/images/icons/sflphone_notif.svg" @@ -111,59 +102,8 @@ /** Account details */ -// #define ACCOUNT_ID "Account.id" -// #define ACCOUNT_TYPE "Account.type" -// #define ACCOUNT_ALIAS "Account.alias" -// #define ACCOUNT_ENABLED "Account.enable" -// #define ACCOUNT_MAILBOX "Account.mailbox" -// #define ACCOUNT_USERAGENT "Account.useragent" -// #define ACCOUNT_REGISTRATION_EXPIRE "Account.registrationExpire" -// #define ACCOUNT_SIP_STUN_SERVER "STUN.server" -// #define ACCOUNT_SIP_STUN_ENABLED "STUN.enable" -// #define ACCOUNT_DTMF_TYPE "Account.dtmfType" -// #define ACCOUNT_HOSTNAME "Account.hostname" -// #define ACCOUNT_USERNAME "Account.username" -// #define ACCOUNT_ROUTE "Account.routeset" -// #define ACCOUNT_PASSWORD "Account.password" -// #define ACCOUNT_REALM "Account.realm" -// #define ACCOUNT_KEY_EXCHANGE "SRTP.keyExchange" -// #define ACCOUNT_SRTP_ENABLED "SRTP.enable" -// #define ACCOUNT_SRTP_RTP_FALLBACK "SRTP.rtpFallback" -// #define ACCOUNT_ZRTP_DISPLAY_SAS "ZRTP.displaySAS" -// #define ACCOUNT_ZRTP_NOT_SUPP_WARNING "ZRTP.notSuppWarning" -// #define ACCOUNT_ZRTP_HELLO_HASH "ZRTP.helloHashEnable" -// #define ACCOUNT_DISPLAY_SAS_ONCE "ZRTP.displaySasOnce" -// #define KEY_EXCHANGE_NONE "0" -// #define ZRTP "1" -// #define SDES "2" /** TLS */ -// #define TLS_LISTENER_PORT "TLS.listenerPort" -// #define TLS_ENABLE "TLS.enable" -// #define TLS_PORT "TLS.port" -// #define TLS_CA_LIST_FILE "TLS.certificateListFile" -// #define TLS_CERTIFICATE_FILE "TLS.certificateFile" -// #define TLS_PRIVATE_KEY_FILE "TLS.privateKeyFile" -// #define TLS_PASSWORD "TLS.password" -// #define TLS_METHOD "TLS.method" -// #define TLS_CIPHERS "TLS.ciphers" -// #define TLS_SERVER_NAME "TLS.serverName" -// #define TLS_VERIFY_SERVER "TLS.verifyServer" -// #define TLS_VERIFY_CLIENT "TLS.verifyClient" -// #define TLS_REQUIRE_CLIENT_CERTIFICATE "TLS.requireClientCertificate" -// #define TLS_NEGOTIATION_TIMEOUT_SEC "TLS.negotiationTimeoutSec" -// #define TLS_NEGOTIATION_TIMEOUT_MSEC "TLS.negotiationTimemoutMsec" -// -// #define LOCAL_INTERFACE "Account.localInterface" -// #define PUBLISHED_SAMEAS_LOCAL "Account.publishedSameAsLocal" -// #define LOCAL_PORT "Account.localPort" -// #define PUBLISHED_PORT "Account.publishedPort" -// #define PUBLISHED_ADDRESS "Account.publishedAddress" -// -// #define REGISTRATION_STATUS "Registration.Status" -// #define REGISTRATION_STATE_CODE "Registration.code" -// #define REGISTRATION_STATE_DESCRIPTION "Registration.description" - #define IP2IP_PROFILE "IP2IP" @@ -200,6 +140,8 @@ #define CONFIG_RINGTONE_PATH "Account.ringtonePath" #define CONFIG_RINGTONE_ENABLED "Account.ringtoneEnabled" + +/**Security */ #define TLS_LISTENER_PORT "TLS.listenerPort" #define TLS_ENABLE "TLS.enable" #define TLS_PORT "TLS.port" @@ -216,6 +158,7 @@ #define TLS_NEGOTIATION_TIMEOUT_SEC "TLS.negotiationTimeoutSec" #define TLS_NEGOTIATION_TIMEOUT_MSEC "TLS.negotiationTimemoutMsec" +/**Shortcut*/ #define SHORTCUT_PICKUP "pickUp" #define SHORTCUT_HANGUP "hangUp" #define SHORTCUT_POPUP "popupWindow" @@ -223,13 +166,13 @@ #define SHORTCUT_TOGGLEHOLD "toggleHold" -#define CONFIG_ACCOUNT_HOSTNAME "Account.hostname" -#define CONFIG_ACCOUNT_USERNAME "Account.username" -#define CONFIG_ACCOUNT_ROUTESET "Account.routeset" -#define CONFIG_ACCOUNT_PASSWORD "Account.password" -#define CONFIG_ACCOUNT_REALM "Account.realm" -#define CONFIG_ACCOUNT_DEFAULT_REALM "*" -#define CONFIG_ACCOUNT_USERAGENT "Account.useragent" +#define CONFIG_ACCOUNT_HOSTNAME "Account.hostname" +#define CONFIG_ACCOUNT_USERNAME "Account.username" +#define CONFIG_ACCOUNT_ROUTESET "Account.routeset" +#define CONFIG_ACCOUNT_PASSWORD "Account.password" +#define CONFIG_ACCOUNT_REALM "Account.realm" +#define CONFIG_ACCOUNT_DEFAULT_REALM "*" +#define CONFIG_ACCOUNT_USERAGENT "Account.useragent" #define LOCAL_INTERFACE "Account.localInterface" #define PUBLISHED_SAMEAS_LOCAL "Account.publishedSameAsLocal" @@ -239,11 +182,9 @@ /** Maybe to remove **/ -// #define ACCOUNT_EXPIRE "Account.expire" -// #define ACCOUNT_STATUS "Status" -#define REGISTRATION_EXPIRE_DEFAULT 600 -#define REGISTRATION_ENABLED_TRUE "true" -#define REGISTRATION_ENABLED_FALSE "false" +#define REGISTRATION_EXPIRE_DEFAULT 600 +#define REGISTRATION_ENABLED_TRUE "true" +#define REGISTRATION_ENABLED_FALSE "false" #define ACCOUNT_TYPE_SIP "SIP" #define ACCOUNT_TYPE_IAX "IAX" #define ACCOUNT_TYPES_TAB {QString(ACCOUNT_TYPE_SIP), QString(ACCOUNT_TYPE_IAX)} @@ -286,8 +227,8 @@ #define DAEMON_CALL_STATE_INIT_CURRENT "CURRENT" #define DAEMON_CALL_STATE_INIT_HOLD "HOLD" #define DAEMON_CALL_STATE_INIT_BUSY "BUSY" -#define DAEMON_CALL_STATE_INIT_INCOMING "INCOMING" -#define DAEMON_CALL_STATE_INIT_RINGING "RINGING" +#define DAEMON_CALL_STATE_INIT_INCOMING "INCOMING" +#define DAEMON_CALL_STATE_INIT_RINGING "RINGING" #define DAEMON_CALL_STATE_INIT_INACTIVE "INACTIVE" #define DAEMON_CALL_TYPE_INCOMING "0" @@ -326,60 +267,20 @@ #define CONST_ALSA 0 #define CONST_PULSEAUDIO 1 -/** TLS */ -// #define TLS_LISTENER_PORT "TLS.listenerPort" -// #define TLS_ENABLE "TLS.enable" -// #define TLS_PORT "TLS.port" -// #define TLS_CA_LIST_FILE "TLS.certificateListFile" -// #define TLS_CERTIFICATE_FILE "TLS.certificateFile" -// #define TLS_PRIVATE_KEY_FILE "TLS.privateKeyFile" -// #define TLS_PASSWORD "TLS.password" -// #define TLS_METHOD "TLS.method" -// #define TLS_CIPHERS "TLS.ciphers" -// #define TLS_SERVER_NAME "TLS.serverName" -// #define TLS_VERIFY_SERVER "TLS.verifyServer" -// #define TLS_VERIFY_CLIENT "TLS.verifyClient" -// #define TLS_REQUIRE_CLIENT_CERTIFICATE "TLS.requireClientCertificate" -// #define TLS_NEGOTIATION_TIMEOUT_SEC "TLS.negotiationTimeoutSec" -// #define TLS_NEGOTIATION_TIMEOUT_MSEC "TLS.negotiationTimemoutMsec" - -// #define ACCOUNT_ID "Account.id" -// #define ACCOUNT_AUTHENTICATION_USERNAME "authenticationUsername" -// #define ACCOUNT_KEY_EXCHANGE "SRTP.keyExchange" -// #define ACCOUNT_SRTP_ENABLED "SRTP.enable" -// #define ACCOUNT_SRTP_RTP_FALLBACK "SRTP.rtpFallback" -// #define ACCOUNT_ZRTP_DISPLAY_SAS "ZRTP.displaySAS" -// #define ACCOUNT_ZRTP_NOT_SUPP_WARNING "ZRTP.notSuppWarning" -// #define ACCOUNT_ZRTP_HELLO_HASH "ZRTP.helloHashEnable" -// #define ACCOUNT_DISPLAY_SAS_ONCE "ZRTP.displaySasOnce" -// #define KEY_EXCHANGE_NONE "0" -// #define ZRTP "1" -// #define SDES "2" - typedef enum { - /** Ringing incoming call */ - CALL_STATE_INCOMING = 0, - /** Ringing outgoing call */ - CALL_STATE_RINGING = 1, - /** Call to which the user can speak and hear */ - CALL_STATE_CURRENT = 2, - /** Call which numbers are being added by the user */ - CALL_STATE_DIALING = 3, - /** Call is on hold */ - CALL_STATE_HOLD = 4, - /** Call has failed */ - CALL_STATE_FAILURE = 5, - /** Call is busy */ - CALL_STATE_BUSY = 6, - /** Call is being transfered. During this state, the user can enter the new number. */ - CALL_STATE_TRANSFER = 7, - /** Call is on hold for transfer */ - CALL_STATE_TRANSF_HOLD = 8, - /** Call is over and should not be used */ - CALL_STATE_OVER = 9, - /** This state should never be reached */ - CALL_STATE_ERROR = 10 + + CALL_STATE_INCOMING = 0, /** Ringing incoming call */ + CALL_STATE_RINGING = 1, /** Ringing outgoing call */ + CALL_STATE_CURRENT = 2, /** Call to which the user can speak and hear */ + CALL_STATE_DIALING = 3, /** Call which numbers are being added by the user */ + CALL_STATE_HOLD = 4, /** Call is on hold */ + CALL_STATE_FAILURE = 5, /** Call has failed */ + CALL_STATE_BUSY = 6, /** Call is busy */ + CALL_STATE_TRANSFER = 7, /** Call is being transfered. During this state, the user can enter the new number. */ + CALL_STATE_TRANSF_HOLD = 8, /** Call is on hold for transfer */ + CALL_STATE_OVER = 9, /** Call is over and should not be used */ + CALL_STATE_ERROR = 10 /** This state should never be reached */ } call_state; static const QString empty(""); @@ -395,16 +296,15 @@ static const QString empty(""); #endif /** HISTORY SERIALIZATION */ -#define ACCOUNT_ID_KEY "accountid" -#define CALLID_KEY "callid" -#define CONFID_KEY "confid" -#define DISPLAY_NAME_KEY "display_name" -#define PEER_NUMBER_KEY "peer_number" -#define RECORDING_PATH_KEY "recordfile" -#define STATE_KEY "state" -#define TIMESTAMP_START_KEY "timestamp_start" -#define TIMESTAMP_STOP_KEY "timestamp_stop" -#define MISSED_STRING "missed" -#define INCOMING_STRING "incoming" -#define OUTGOING_STRING "outgoing" - +#define ACCOUNT_ID_KEY "accountid" +#define CALLID_KEY "callid" +#define CONFID_KEY "confid" +#define DISPLAY_NAME_KEY "display_name" +#define PEER_NUMBER_KEY "peer_number" +#define RECORDING_PATH_KEY "recordfile" +#define STATE_KEY "state" +#define TIMESTAMP_START_KEY "timestamp_start" +#define TIMESTAMP_STOP_KEY "timestamp_stop" +#define MISSED_STRING "missed" +#define INCOMING_STRING "incoming" +#define OUTGOING_STRING "outgoing" \ No newline at end of file diff --git a/kde/src/widgets/AccountItemWidget.cpp b/kde/src/widgets/AccountItemWidget.cpp index 7be1cf55fb..c4c550a2d9 100755 --- a/kde/src/widgets/AccountItemWidget.cpp +++ b/kde/src/widgets/AccountItemWidget.cpp @@ -24,9 +24,13 @@ //Qt #include <QtGui/QHBoxLayout> +#include <QtGui/QCheckBox> +#include <QtGui/QLabel> +#include <QtGui/QIcon> //KDE #include <KDebug> +#include <KLed> //SFLPhone library #include "lib/sflphone_const.h" @@ -56,7 +60,7 @@ AccountItemWidget::AccountItemWidget(QWidget *parent) updateDisplay(); QMetaObject::connectSlotsByName(this); -} +} //AccountItemWidget ///Destructor AccountItemWidget::~AccountItemWidget() @@ -89,7 +93,7 @@ void AccountItemWidget::updateStateDisplay() default: kDebug() << "Calling AccountItemWidget::setState with value " << m_State << ", not part of enum AccountItemWidget::State."; } -} +} //updateStateDisplay ///If this item is enable or not void AccountItemWidget::updateEnabledDisplay() diff --git a/kde/src/widgets/AccountItemWidget.h b/kde/src/widgets/AccountItemWidget.h index 8b5cabe200..3c76f74ddd 100755 --- a/kde/src/widgets/AccountItemWidget.h +++ b/kde/src/widgets/AccountItemWidget.h @@ -22,10 +22,13 @@ #ifndef ACCOUNTITEMWIDGET_H #define ACCOUNTITEMWIDGET_H +//Base #include <QWidget> -#include <QCheckBox> -#include <QLabel> -#include <kled.h> + +//Qt +class QCheckBox; +class QLabel; + ///@class AccountItemWidget Widget for the config dialog account list class AccountItemWidget : public QWidget diff --git a/kde/src/widgets/BookmarkDock.cpp b/kde/src/widgets/BookmarkDock.cpp index cd4a088613..38f821289f 100644 --- a/kde/src/widgets/BookmarkDock.cpp +++ b/kde/src/widgets/BookmarkDock.cpp @@ -100,7 +100,7 @@ BookmarkDock::BookmarkDock(QWidget* parent) : QDockWidget(parent) connect(m_pMostUsedCK , SIGNAL(toggled(bool)), this , SLOT(reload() )); connect(AkonadiBackend::getInstance() , SIGNAL(collectionChanged()) , this , SLOT(reload() )); reload(); -} +} //BookmarkDock ///Destructor BookmarkDock::~BookmarkDock() @@ -132,7 +132,7 @@ void BookmarkDock::addBookmark_internal(const QString& phone) m_pItemView->addTopLevelItem(item); m_pItemView->setItemWidget(item,0,widget); m_pBookmark << widget; -} +} //addBookmark_internal ///Proxy to add a new bookmark void BookmarkDock::addBookmark(const QString& phone) @@ -174,4 +174,4 @@ void BookmarkDock::reload() addBookmark_internal(nb); } ConfigurationSkeleton::setDisplayContactCallHistory(m_pMostUsedCK->isChecked()); -} \ No newline at end of file +} //reload \ No newline at end of file diff --git a/kde/src/widgets/BookmarkDock.h b/kde/src/widgets/BookmarkDock.h index e47dd018a4..30f58298d2 100644 --- a/kde/src/widgets/BookmarkDock.h +++ b/kde/src/widgets/BookmarkDock.h @@ -56,7 +56,7 @@ private: QSplitter* m_pSplitter ; BookmarkList m_pBookmark ; QCheckBox* m_pMostUsedCK; - QTreeView* m_pTest; + QTreeView* m_pTest ; //Mutators void addBookmark_internal(const QString& phone); diff --git a/kde/src/widgets/CallTreeItem.cpp b/kde/src/widgets/CallTreeItem.cpp index 041ddaae88..1ce85a0e15 100644 --- a/kde/src/widgets/CallTreeItem.cpp +++ b/kde/src/widgets/CallTreeItem.cpp @@ -168,7 +168,7 @@ void CallTreeItem::setCall(Call *call) connect(m_pItemCall, SIGNAL(changed()), this, SLOT(updated())); updated(); -} +} //setCall ///Update data void CallTreeItem::updated() @@ -231,7 +231,7 @@ void CallTreeItem::updated() kDebug() << "not emmiting tranfer signal"; } changed(); -} +} //updated /***************************************************************************** @@ -262,7 +262,7 @@ void CallTreeItem::dragEnterEvent ( QDragEnterEvent *e ) } else e->ignore(); -} +} //dragEnterEvent ///The cursor move on a potential drag event void CallTreeItem::dragMoveEvent ( QDragMoveEvent *e ) @@ -311,7 +311,7 @@ void CallTreeItem::resizeEvent ( QResizeEvent *e ) } e->accept(); -} +} //resizeEvent void CallTreeItem::transferEvent(QMimeData* data) { diff --git a/kde/src/widgets/CallTreeItem.h b/kde/src/widgets/CallTreeItem.h index 93c881245c..8b24885717 100644 --- a/kde/src/widgets/CallTreeItem.h +++ b/kde/src/widgets/CallTreeItem.h @@ -59,18 +59,19 @@ class CallTreeItem : public QWidget private: //Attributes - Call* m_pItemCall; - bool m_Init; - bool m_isHover; - QLabel* m_pIconL; - QLabel* m_pPeerL; - QLabel* m_pCallNumberL; - QLabel* m_pTransferPrefixL; - QLabel* m_pTransferNumberL; - QLabel* m_pCodecL; - QLabel* m_pSecureL; - QLabel* m_pHistoryPeerL; - TranslucentButtons* m_pBtnConf; + Call* m_pItemCall ; + bool m_Init ; + bool m_isHover ; + QLabel* m_pIconL ; + QLabel* m_pPeerL ; + QLabel* m_pCallNumberL ; + QLabel* m_pTransferPrefixL ; + QLabel* m_pTransferNumberL ; + QLabel* m_pCodecL ; + QLabel* m_pSecureL ; + QLabel* m_pHistoryPeerL ; + + TranslucentButtons* m_pBtnConf ; TranslucentButtons* m_pBtnTrans; protected: diff --git a/kde/src/widgets/CategoryDrawer.h b/kde/src/widgets/CategoryDrawer.h index c997268b4e..4973491f61 100644 --- a/kde/src/widgets/CategoryDrawer.h +++ b/kde/src/widgets/CategoryDrawer.h @@ -34,11 +34,7 @@ class CategoryDrawer : public KCategoryDrawerV2 public: CategoryDrawer(); - virtual void drawCategory(const QModelIndex &index, - int sortRole, - const QStyleOption &option, - QPainter *painter) const; - + virtual void drawCategory(const QModelIndex &index, int sortRole, const QStyleOption &option, QPainter *painter) const; virtual int categoryHeight(const QModelIndex &index, const QStyleOption &option) const; }; diff --git a/kde/src/widgets/ContactDock.cpp b/kde/src/widgets/ContactDock.cpp index 349be089f8..9feb082501 100644 --- a/kde/src/widgets/ContactDock.cpp +++ b/kde/src/widgets/ContactDock.cpp @@ -64,12 +64,6 @@ class QNumericTreeWidgetItem_hist : public QTreeWidgetItem { private: bool operator<(const QTreeWidgetItem & other) const { int column = treeWidget()->sortColumn(); - //if (dynamic_cast<QNumericTreeWidgetItem_hist*>((QTreeWidgetItem*)&other)) { - //if (widget !=0 && dynamic_cast<QNumericTreeWidgetItem_hist*>((QTreeWidgetItem*)&other)->widget != 0) - // return widget->getTimeStamp() < dynamic_cast<QNumericTreeWidgetItem_hist*>((QTreeWidgetItem*)&other)->widget->getTimeStamp(); - //else if (weight > 0 && dynamic_cast<QNumericTreeWidgetItem_hist*>((QTreeWidgetItem*)&other)->weight > 0) - // return weight > dynamic_cast<QNumericTreeWidgetItem_hist*>((QTreeWidgetItem*)&other)->weight; - //} return text(column) < other.text(column); } }; @@ -84,7 +78,7 @@ bool KeyPressEaterC::eventFilter(QObject *obj, QEvent *event) // standard event processing return QObject::eventFilter(obj, event); } -} +} //eventFilter ///Constructor ContactDock::ContactDock(QWidget* parent) : QDockWidget(parent) @@ -150,8 +144,7 @@ ContactDock::ContactDock(QWidget* parent) : QDockWidget(parent) timer->start(1800*1000); //30 minutes setWindowTitle(i18n("Contact")); - -} +} //ContactDock ///Destructor ContactDock::~ContactDock() @@ -239,7 +232,7 @@ void ContactDock::reloadContact() } ConfigurationSkeleton::setContactSortMode(m_pSortByCBB->currentIndex()); -} +} //reloadContact ///Query the call history for all items related to this contact void ContactDock::loadContactHistory(QTreeWidgetItem* item) @@ -259,7 +252,7 @@ void ContactDock::loadContactHistory(QTreeWidgetItem* item) } } } -} +} //loadContactHistory ///Filter contact void ContactDock::filter(const QString& text) @@ -277,7 +270,7 @@ void ContactDock::filter(const QString& text) item->getItem()->setHidden(!visible); } //m_pContactView->expandAll(); -} +} //filter void ContactDock::reloadHistoryConst() { @@ -318,7 +311,7 @@ QMimeData* ContactTree::mimeData( const QList<QTreeWidgetItem *> items) const kDebug() << "the item is not a call"; } return mimeData; -} +} //mimeData ///Handle data being dropped on the widget bool ContactTree::dropMimeData(QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action) @@ -374,7 +367,7 @@ void ContactDock::keyPressEvent(QKeyEvent* event) { m_pFilterLE->setText(m_pFilterLE->text().left( m_pFilterLE->text().size()-1 )); else if (!event->text().isEmpty() && !(key == Qt::Key_Backspace)) m_pFilterLE->setText(m_pFilterLE->text()+event->text()); -} +} //keyPressEvent /***************************************************************************** * * diff --git a/kde/src/widgets/ContactDock.h b/kde/src/widgets/ContactDock.h index c7318a0b4f..d76f09bc63 100644 --- a/kde/src/widgets/ContactDock.h +++ b/kde/src/widgets/ContactDock.h @@ -114,4 +114,4 @@ private: }; -#endif \ No newline at end of file +#endif //CONTACT_DOCK_H \ No newline at end of file diff --git a/kde/src/widgets/ContactItemWidget.cpp b/kde/src/widgets/ContactItemWidget.cpp index b253adfff3..eabffd2263 100644 --- a/kde/src/widgets/ContactItemWidget.cpp +++ b/kde/src/widgets/ContactItemWidget.cpp @@ -89,7 +89,7 @@ ContactItemWidget::ContactItemWidget(QWidget *parent) connect(m_pEmail , SIGNAL(triggered()) , this,SLOT(sendEmail() )); connect(m_pAddPhone , SIGNAL(triggered()) , this,SLOT(addPhone() )); connect(m_pBookmark , SIGNAL(triggered()) , this,SLOT(bookmark() )); -} +} //ContactItemWidget ///Destructor ContactItemWidget::~ContactItemWidget() @@ -138,7 +138,7 @@ void ContactItemWidget::setContact(Contact* contact) updated(); connect(this,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(showContext(QPoint))); -} +} //setContact ///Set the model index void ContactItemWidget::setItem(QTreeWidgetItem* item) @@ -185,7 +185,7 @@ void ContactItemWidget::updated() m_pIconL->setPixmap(QPixmap(KIcon("user-identity").pixmap(QSize(48,48)))); else m_pIconL->setPixmap(*m_pContactKA->getPhoto()); -} +} //updated /***************************************************************************** @@ -258,7 +258,7 @@ void ContactItemWidget::showContext(const QPoint& pos) PhoneNumbers numbers = m_pContactKA->getPhoneNumbers(); m_pBookmark->setEnabled(numbers.count() == 1); m_pMenu->exec(mapToGlobal(pos)); -} +} //showContext ///Send an email //TODO diff --git a/kde/src/widgets/Dialpad.cpp b/kde/src/widgets/Dialpad.cpp index 2db664f43d..95bc32bf3c 100755 --- a/kde/src/widgets/Dialpad.cpp +++ b/kde/src/widgets/Dialpad.cpp @@ -57,7 +57,7 @@ Dialpad::Dialpad(QWidget *parent) layout->addWidget ( text ); connect(m_pButtons[i],SIGNAL(typed(QString&)),this,SLOT(clicked(QString&))); } -} +} //Dialpad ///Proxy to make the view more convinient to use void Dialpad::clicked(QString& text) diff --git a/kde/src/widgets/HistoryDock.cpp b/kde/src/widgets/HistoryDock.cpp index 6dad617dee..a656ef860b 100644 --- a/kde/src/widgets/HistoryDock.cpp +++ b/kde/src/widgets/HistoryDock.cpp @@ -51,7 +51,7 @@ #define CURRENT_SORTING_MODE m_pSortByCBB->currentIndex() -///Qt lack official functional sorting algo, so this hack around it +///@class QNumericTreeWidgetItem Qt lack official functional sorting algo, so this hack around it class QNumericTreeWidgetItem : public QTreeWidgetItem { public: QNumericTreeWidgetItem(QTreeWidget* parent=0):QTreeWidgetItem(parent),widget(0),weight(-1){} @@ -160,7 +160,7 @@ HistoryDock::HistoryDock(QWidget* parent) : QDockWidget(parent) connect(SFLPhone::model() , SIGNAL(historyChanged()), this, SLOT(reload() )); reload(); -} +} //HistoryDock ///Destructor HistoryDock::~HistoryDock() @@ -217,22 +217,15 @@ void HistoryDock::reload() switch (m_pSortByCBB->currentIndex()) { case Date: foreach(HistoryTreeItem* hitem, m_History) { - //QNumericTreeWidgetItem* item = new QNumericTreeWidgetItem(m_pItemView);//m_pItemView->addItem<QNumericTreeWidgetItem>(timeToHistoryCategory(QDateTime::fromTime_t(hitem->call()->getStartTimeStamp().toUInt()).date())); QNumericTreeWidgetItem* item = m_pItemView->addItem<QNumericTreeWidgetItem>(timeToHistoryCategory(QDateTime::fromTime_t(hitem->call()->getStartTimeStamp().toUInt()).date())); item->widget = hitem; hitem->setItem(item); - //m_pItemView->addTopLevelItem(item); m_pItemView->setItemWidget(item,0,hitem); } break; case Name2: { QHash<QString,QTreeWidgetItem*> group; foreach(HistoryTreeItem* item, m_History) { -// if (!group[getIdentity(item)]) { -// group[getIdentity(item)] = new QTreeWidgetItem(m_pItemView); -// group[getIdentity(item)]->setText(0,getIdentity(item)); -// m_pItemView->addTopLevelItem(group[getIdentity(item)]); -// } QNumericTreeWidgetItem* twItem = m_pItemView->addItem<QNumericTreeWidgetItem>(getIdentity(item->call())); item->setItem(twItem); twItem->widget = item; @@ -285,7 +278,7 @@ void HistoryDock::reload() foreach(HistoryTreeItem* item, m_History) { item->setDurWidth(maxWidth); } -} +} //reload ///Enable the ability to set a date range like 1 month to limit history void HistoryDock::enableDateRange(bool enable) @@ -330,7 +323,7 @@ void HistoryDock::updateLinkedDate(KDateWidget* item, QDate& prevDate, QDate& ne } } prevDate = newDate; -} +} //updateLinkedDate ///The signals have to be disabled to prevent an ifinite loop void HistoryDock::updateLinkedFromDate(QDate date) @@ -376,7 +369,7 @@ QMimeData* HistoryTree::mimeData( const QList<QTreeWidgetItem *> items) const kDebug() << "the item is not a call"; } return mimeData; -} +} //mimeData ///Handle what happen when serialized data is dropped bool HistoryTree::dropMimeData(QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action) @@ -416,4 +409,4 @@ void HistoryDock::keyPressEvent(QKeyEvent* event) { m_pFilterLE->setText(m_pFilterLE->text().left( m_pFilterLE->text().size()-1 )); else if (!event->text().isEmpty() && !(key == Qt::Key_Backspace)) m_pFilterLE->setText(m_pFilterLE->text()+event->text()); -} \ No newline at end of file +} //keyPressEvent \ No newline at end of file diff --git a/kde/src/widgets/HistoryTreeItem.cpp b/kde/src/widgets/HistoryTreeItem.cpp index 3ba87e729c..f014e1bd26 100644 --- a/kde/src/widgets/HistoryTreeItem.cpp +++ b/kde/src/widgets/HistoryTreeItem.cpp @@ -140,7 +140,7 @@ HistoryTreeItem::HistoryTreeItem(QWidget *parent ,QString phone) m_pIconL = new QLabel( this ); m_pPeerNameL = new QLabel( this ); m_pCallNumberL = new QLabel( this ); - m_pLengthL = new QLabel( this ); + m_pLengthL = new QLabel( this ); m_pTimeL = new QLabel( this ); m_pIconL->setMinimumSize(70,0); @@ -166,7 +166,7 @@ HistoryTreeItem::HistoryTreeItem(QWidget *parent ,QString phone) m_pCallNumberL->setText(phone); m_PhoneNumber = phone; } -} +} //HistoryTreeItem ///Destructor HistoryTreeItem::~HistoryTreeItem() @@ -211,8 +211,7 @@ void HistoryTreeItem::updated() m_pCallNumberL->setText(m_pItemCall->getCallNumber()); } } - -} +} //updated ///Show the context menu void HistoryTreeItem::showContext(const QPoint& pos) @@ -350,7 +349,7 @@ void HistoryTreeItem::showRecordPlayer() connect( m_pMediaObject , SIGNAL(tick(qint64) ) , this , SLOT( tick(qint64) )); connect(m_pMediaObject , SIGNAL(stateChanged(Phonon::State,Phonon::State)), - this, SLOT(stateChanged(Phonon::State,Phonon::State))); + this, SLOT(stateChanged(Phonon::State,Phonon::State))); } kDebug() << "Path:" << m_pItemCall->getRecordingPath(); @@ -361,7 +360,7 @@ void HistoryTreeItem::showRecordPlayer() m_pMetaInformationResolver->setCurrentSource(m_lSources.first()); m_pMediaObject->play(); -} +} //showRecordPlayer ///Called when the user press the stop button void HistoryTreeItem::stopPlayer() @@ -421,7 +420,7 @@ void HistoryTreeItem::stateChanged(Phonon::State newState, Phonon::State /* oldS default: ; } -} +} //stateChanged ///Reference code for metastate change void HistoryTreeItem::metaStateChanged(Phonon::State newState, Phonon::State oldState) @@ -450,7 +449,7 @@ void HistoryTreeItem::metaStateChanged(Phonon::State newState, Phonon::State old if (m_lSources.size() > index) { m_pMetaInformationResolver->setCurrentSource(m_lSources.at(index)); } -} +} //metaStateChanged ///Resize the player void HistoryTreeItem::resizeEvent(QResizeEvent* event) @@ -500,7 +499,7 @@ void HistoryTreeItem::setCall(Call *call) m_pPlay-> setVisible(!m_pItemCall->getRecordingPath().isEmpty() && QFile::exists(m_pItemCall->getRecordingPath())); m_pRemove->setVisible(!m_pItemCall->getRecordingPath().isEmpty() && QFile::exists(m_pItemCall->getRecordingPath())); -} +} //setCall ///Set the index associed with this widget void HistoryTreeItem::setItem(QTreeWidgetItem* item) @@ -539,7 +538,7 @@ bool HistoryTreeItem::getContactInfo(QString phoneNumber) return false; } return true; -} +} //getContactInfo ///Return the time stamp uint HistoryTreeItem::getTimeStamp() -- GitLab