diff --git a/kde/src/AccountView.cpp b/kde/src/AccountView.cpp index d45f10b3aa17b7504f1287fab94abe3d554cff73..692a40d1add982490cf1e2ba87f5a58b3f0c4b23 100644 --- a/kde/src/AccountView.cpp +++ b/kde/src/AccountView.cpp @@ -99,11 +99,14 @@ QColor AccountView::getStateColor() ///Get the color name const QString& AccountView::getStateColorName() { + static const QString black("black"); + static const QString darkGreen("darkGreen"); + static const QString red("red"); if(getAccountDetail(ACCOUNT_STATUS) == ACCOUNT_STATE_UNREGISTERED) - return "black"; + return black; if(getAccountDetail(ACCOUNT_STATUS) == ACCOUNT_STATE_REGISTERED || getAccountDetail(ACCOUNT_STATUS) == ACCOUNT_STATE_READY) - return "darkGreen"; - return "red"; + return darkGreen; + return red; } ///Is this item checked? diff --git a/kde/src/lib/Account.cpp b/kde/src/lib/Account.cpp index 2b7acc895102dab0bf9d3fa9b46bedd4f612d343..0f82149ed89e2c33e397273df824add462442dd3 100644 --- a/kde/src/lib/Account.cpp +++ b/kde/src/lib/Account.cpp @@ -125,7 +125,7 @@ const QString& Account::getAccountId() const qDebug() << "Error : getting AccountId of a new account."; if (!m_pAccountId) { qDebug() << "Account not configured"; - return ""; //WARNING May explode + return EMPTY_STRING; //WARNING May explode } return *m_pAccountId; @@ -148,13 +148,13 @@ const QString& Account::getAccountDetail(const QString& param) const { if (!m_pAccountDetails) { qDebug() << "The account list is not set"; - return NULL; //May crash, but better than crashing now + return EMPTY_STRING; //May crash, but better than crashing now } if (m_pAccountDetails->find(param) != m_pAccountDetails->end()) return (*m_pAccountDetails)[param]; else { qDebug() << "Account details not found, there is " << m_pAccountDetails->count() << " details available"; - return NULL; + return EMPTY_STRING; } } diff --git a/kde/src/lib/sflphone_const.h b/kde/src/lib/sflphone_const.h index 4475f5a67c3ec0c3a62632cb7c1988e8230c3464..10009f279c6c30b36a3d129b89c5b54940eacd01 100644 --- a/kde/src/lib/sflphone_const.h +++ b/kde/src/lib/sflphone_const.h @@ -305,6 +305,9 @@ typedef enum CALL_STATE_ERROR = 10 } call_state; +static const QString empty(""); +#define EMPTY_STRING empty + /** MIME API */ #define MIME_CALLID "text/sflphone.call.id" #define MIME_CONTACT "text/sflphone.contact"