From eaba8e318aed1cf84db0e4ae251df71cb918bdbe Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage <emmanuel.lepage@savoirfairelinux.com> Date: Fri, 30 Sep 2011 11:17:51 -0400 Subject: [PATCH] More polishing for release --- src/Account.cpp | 2 ++ src/Account.h | 4 ++-- src/AccountList.cpp | 2 +- src/Call.cpp | 3 ++- src/Call.h | 11 ++++++----- src/CallModel.cpp | 1 + src/CallModel.h | 27 ++++++++++++++------------- src/CallModel.hpp | 15 +++++++++++++++ src/Contact.cpp | 6 ++++++ src/Contact.h | 20 +++++++++++++------- src/ContactBackend.h | 1 + 11 files changed, 63 insertions(+), 29 deletions(-) diff --git a/src/Account.cpp b/src/Account.cpp index c9c41586..bf978941 100644 --- a/src/Account.cpp +++ b/src/Account.cpp @@ -23,6 +23,8 @@ #include <QtGui/QApplication> #include <QDebug> +#include <QtCore/QString> +#include <QtGui/QColor> #include "sflphone_const.h" #include "configurationmanager_interface_singleton.h" diff --git a/src/Account.h b/src/Account.h index b4c235ac..f393a13f 100644 --- a/src/Account.h +++ b/src/Account.h @@ -22,8 +22,8 @@ #ifndef ACCOUNT_H #define ACCOUNT_H -#include <QtCore/QString> -#include <QtGui/QColor> +//Qt +class QString; #include "typedefs.h" diff --git a/src/AccountList.cpp b/src/AccountList.cpp index 14212427..be54288e 100644 --- a/src/AccountList.cpp +++ b/src/AccountList.cpp @@ -166,7 +166,7 @@ Account* AccountList::firstRegisteredAccount() const Account* current; for (int i = 0; i < m_pAccounts->count(); ++i) { current = (*m_pAccounts)[i]; - if(current->getAccountDetail(ACCOUNT_STATUS) == ACCOUNT_STATE_REGISTERED) { + if(current && current->getAccountDetail(ACCOUNT_STATUS) == ACCOUNT_STATE_REGISTERED) { return current; } else { diff --git a/src/Call.cpp b/src/Call.cpp index 30313bfd..54533d8b 100644 --- a/src/Call.cpp +++ b/src/Call.cpp @@ -610,7 +610,8 @@ void Call::call() this->m_pPeerPhoneNumber = m_pCallNumber; if (m_pContactBackend) { Contact* contact = m_pContactBackend->getContactByPhone(m_pPeerPhoneNumber); - m_pPeerName = contact->getFormattedName(); + if (contact) + m_pPeerName = contact->getFormattedName(); } this->m_pStartTime = new QDateTime(QDateTime::currentDateTime()); this->m_pHistoryState = OUTGOING; diff --git a/src/Call.h b/src/Call.h index 0ad0ee8b..e8769151 100644 --- a/src/Call.h +++ b/src/Call.h @@ -17,16 +17,17 @@ * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ + **************************************************************************/ #ifndef CALL_H #define CALL_H -#include <QtCore/QString> -#include <QtCore/QDateTime> -#include <QtGui/QLabel> -#include <QtGui/QWidget> +//Qt +class QString; +class QDateTime; +class QLabel; +class QWidget; #include "sflphone_const.h" #include "typedefs.h" diff --git a/src/CallModel.cpp b/src/CallModel.cpp index e9541dd8..e74ca594 100644 --- a/src/CallModel.cpp +++ b/src/CallModel.cpp @@ -62,6 +62,7 @@ void CallModelBase::on1_callStateChanged(const QString &callID, const QString &s void CallModelBase::on1_incomingCall(const QString & accountID, const QString & callID) { + Q_UNUSED(accountID) qDebug() << "Signal : Incoming Call ! ID = " << callID; Call* call = addIncomingCall(callID); diff --git a/src/CallModel.h b/src/CallModel.h index cdd9c681..62627511 100644 --- a/src/CallModel.h +++ b/src/CallModel.h @@ -22,25 +22,26 @@ #define CALL_MODEL_H #include <QObject> -#include <QHash> #include <QVector> -#include <QDragEnterEvent> -#include <QDebug> - -#include "Call.h" -#include "AccountList.h" -#include "dbus/metatypes.h" -#include "callmanager_interface_singleton.h" -#include "configurationmanager_interface_singleton.h" -#include "instance_interface_singleton.h" -#include "sflphone_const.h" -#include "unistd.h" +#include <QHash> #include "typedefs.h" -#include "ContactBackend.h" + +//Qt +class QDragEnterEvent; +class QDebug; +class QModelIndex; + +//SFLPhone +class Call; +class AccountList; +class Account; +class ContactBackend; typedef QHash<QString, Call*> CallHash; typedef QList<Call*> CallList; +///This class need to exist because template classes can't have signals ans +///slots because Qt MOC generator can't guess the type at precompilation class LIB_EXPORT CallModelBase : public QObject { Q_OBJECT diff --git a/src/CallModel.hpp b/src/CallModel.hpp index 54c74c2b..371a4853 100644 --- a/src/CallModel.hpp +++ b/src/CallModel.hpp @@ -1,3 +1,18 @@ +#include <QHash> +#include <QVector> +#include <QDragEnterEvent> +#include <QDebug> +#include "Call.h" +#include "AccountList.h" +#include "dbus/metatypes.h" +#include "callmanager_interface_singleton.h" +#include "configurationmanager_interface_singleton.h" +#include "instance_interface_singleton.h" +#include "sflphone_const.h" +#include "unistd.h" +#include "typedefs.h" +#include "ContactBackend.h" + //Static member template <typename CallWidget, typename Index> QString CallModel<CallWidget,Index>::m_pPriorAccountId = "" ; template <typename CallWidget, typename Index> AccountList* CallModel<CallWidget,Index>::m_pAccountList = 0 ; diff --git a/src/Contact.cpp b/src/Contact.cpp index 11551f75..84eee4a9 100644 --- a/src/Contact.cpp +++ b/src/Contact.cpp @@ -21,6 +21,12 @@ #include "Contact.h" #include <QtCore/QDebug> +#include <kabc/addressee.h> +#include <kabc/picture.h> +#include <kabc/phonenumber.h> +#include <QtGui/QListWidgetItem> +#include <QtGui/QWidget> +#include <QPixmap> #include "sflphone_const.h" diff --git a/src/Contact.h b/src/Contact.h index 68e133ac..5e03a500 100644 --- a/src/Contact.h +++ b/src/Contact.h @@ -21,20 +21,25 @@ #ifndef CONTACT_H #define CONTACT_H -#include <QtGui/QListWidgetItem> -#include <QtGui/QWidget> +#include <QObject> -#include <QPixmap> +//Qt +class QListWidgetItem; +class QWidget; +class QPixmap; -#include <kabc/addressee.h> -#include <kabc/picture.h> -#include <kabc/phonenumber.h> +//KDE +namespace KABC { + class Addressee ; + class Picture ; + class PhoneNumber ; +} #include "typedefs.h" /** @author Jérémy Quentin <jeremy.quentin@savoirfairelinux.com> - @author Jérémy Quentin <emmanuel.lepage@savoirfairelinux.com> + @author Emmanuel Lepage <emmanuel.lepage@savoirfairelinux.com> */ class LIB_EXPORT Contact : public QObject{ Q_OBJECT @@ -85,6 +90,7 @@ public: virtual QString getType() const; virtual void initItem(); + //Setters virtual void setPhoneNumbers (PhoneNumbers ); virtual void setFormattedName (QString name ); virtual void setNickName (QString name ); diff --git a/src/ContactBackend.h b/src/ContactBackend.h index 72584f8c..1a3cc57a 100644 --- a/src/ContactBackend.h +++ b/src/ContactBackend.h @@ -6,6 +6,7 @@ #include "typedefs.h" +//SFLPhone class Contact; typedef QList<Contact*> ContactList; -- GitLab