Adds voicemailAddress support
This commit is contained in:
parent
ad0b557cb3
commit
387bf67e8f
7 changed files with 31 additions and 6 deletions
|
|
@ -95,6 +95,8 @@ AccountCore::AccountCore(const std::shared_ptr<linphone::Account> &account) : QO
|
||||||
mDialPlan = mAccountModel->dialPlanAsString(dialPlan);
|
mDialPlan = mAccountModel->dialPlanAsString(dialPlan);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mVoicemailAddress =
|
||||||
|
params->getVoicemailAddress() ? Utils::coreStringToAppString(params->getVoicemailAddress()->asString()) : "";
|
||||||
|
|
||||||
INIT_CORE_MEMBER(VoicemailCount, mAccountModel)
|
INIT_CORE_MEMBER(VoicemailCount, mAccountModel)
|
||||||
INIT_CORE_MEMBER(ShowMwi, mAccountModel)
|
INIT_CORE_MEMBER(ShowMwi, mAccountModel)
|
||||||
|
|
@ -270,6 +272,8 @@ void AccountCore::setSelf(QSharedPointer<AccountCore> me) {
|
||||||
DEFINE_CORE_GET_CONNECT(mAccountModelConnection, AccountCore, AccountModel, mAccountModel, int, voicemailCount,
|
DEFINE_CORE_GET_CONNECT(mAccountModelConnection, AccountCore, AccountModel, mAccountModel, int, voicemailCount,
|
||||||
VoicemailCount)
|
VoicemailCount)
|
||||||
DEFINE_CORE_GET_CONNECT(mAccountModelConnection, AccountCore, AccountModel, mAccountModel, int, showMwi, ShowMwi)
|
DEFINE_CORE_GET_CONNECT(mAccountModelConnection, AccountCore, AccountModel, mAccountModel, int, showMwi, ShowMwi)
|
||||||
|
DEFINE_CORE_GETSET_CONNECT(mAccountModelConnection, AccountCore, AccountModel, mAccountModel, QString,
|
||||||
|
voicemailAddress, VoicemailAddress)
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::shared_ptr<AccountModel> &AccountCore::getModel() const {
|
const std::shared_ptr<AccountModel> &AccountCore::getModel() const {
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,7 @@ class AccountCore : public QObject, public AbstractObject {
|
||||||
Q_PROPERTY(QString limeServerUrl READ getLimeServerUrl WRITE lSetLimeServerUrl NOTIFY limeServerUrlChanged)
|
Q_PROPERTY(QString limeServerUrl READ getLimeServerUrl WRITE lSetLimeServerUrl NOTIFY limeServerUrlChanged)
|
||||||
DECLARE_CORE_GET(int, voicemailCount, VoicemailCount)
|
DECLARE_CORE_GET(int, voicemailCount, VoicemailCount)
|
||||||
DECLARE_CORE_GET(bool, showMwi, ShowMwi)
|
DECLARE_CORE_GET(bool, showMwi, ShowMwi)
|
||||||
|
DECLARE_CORE_GETSET_MEMBER(QString, voicemailAddress, VoicemailAddress)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static QSharedPointer<AccountCore> create(const std::shared_ptr<linphone::Account> &account);
|
static QSharedPointer<AccountCore> create(const std::shared_ptr<linphone::Account> &account);
|
||||||
|
|
|
||||||
|
|
@ -319,6 +319,17 @@ bool AccountModel::getShowMwi() {
|
||||||
else return false;
|
else return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AccountModel::setVoicemailAddress(QString value) {
|
||||||
|
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
||||||
|
auto params = mMonitor->getParams()->clone();
|
||||||
|
auto address = linphone::Factory::get()->createAddress(Utils::appStringToCoreString(value));
|
||||||
|
if (address) {
|
||||||
|
params->setVoicemailAddress(address);
|
||||||
|
mMonitor->setParams(params);
|
||||||
|
emit voicemailAddressChanged(value);
|
||||||
|
} else qWarning() << "Unable to set VoicemailAddress, failed creating address from" << value;
|
||||||
|
}
|
||||||
|
|
||||||
// UserData (see hpp for explanations)
|
// UserData (see hpp for explanations)
|
||||||
|
|
||||||
static QMap<const std::shared_ptr<linphone::Account>, std::shared_ptr<AccountUserData>> userDataMap;
|
static QMap<const std::shared_ptr<linphone::Account>, std::shared_ptr<AccountUserData>> userDataMap;
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,7 @@ public:
|
||||||
QString dialPlanAsString(const std::shared_ptr<linphone::DialPlan> &dialPlan);
|
QString dialPlanAsString(const std::shared_ptr<linphone::DialPlan> &dialPlan);
|
||||||
int getVoicemailCount();
|
int getVoicemailCount();
|
||||||
bool getShowMwi();
|
bool getShowMwi();
|
||||||
|
void setVoicemailAddress(QString value);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void registrationStateChanged(const std::shared_ptr<linphone::Account> &account,
|
void registrationStateChanged(const std::shared_ptr<linphone::Account> &account,
|
||||||
|
|
@ -96,6 +97,7 @@ signals:
|
||||||
void removed();
|
void removed();
|
||||||
void voicemailCountChanged(int count);
|
void voicemailCountChanged(int count);
|
||||||
void showMwiChanged(bool show);
|
void showMwiChanged(bool show);
|
||||||
|
void voicemailAddressChanged(QString value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**Linphone **/
|
/**Linphone **/
|
||||||
|
|
|
||||||
|
|
@ -151,10 +151,10 @@ Control.Control{
|
||||||
visible: mainItem.account.core.showMwi
|
visible: mainItem.account.core.showMwi
|
||||||
voicemailCount: mainItem.account.core.voicemailCount >= 100 ? '99+' : mainItem.account.core.voicemailCount
|
voicemailCount: mainItem.account.core.voicemailCount >= 100 ? '99+' : mainItem.account.core.voicemailCount
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (mainItem.account.core.mwiServerAddress.length > 0)
|
if (mainItem.account.core.voicemailAddress.length > 0)
|
||||||
UtilsCpp.createCall(mainItem.account.core.mwiServerAddress)
|
UtilsCpp.createCall(mainItem.account.core.voicemailAddress)
|
||||||
else
|
else
|
||||||
UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("L'adresse de la messagerie vocale n'est pas définie."), false)
|
UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("L'URI de messagerie vocale n'est pas définie."), false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Item{Layout.fillWidth: true}
|
Item{Layout.fillWidth: true}
|
||||||
|
|
|
||||||
|
|
@ -425,10 +425,10 @@ Item {
|
||||||
if (accountProxy.count > 1) {
|
if (accountProxy.count > 1) {
|
||||||
avatarButton.popup.open()
|
avatarButton.popup.open()
|
||||||
} else {
|
} else {
|
||||||
if (accountProxy.defaultAccount.core.mwiServerAddress.length > 0)
|
if (accountProxy.defaultAccount.core.voicemailAddress.length > 0)
|
||||||
UtilsCpp.createCall(accountProxy.defaultAccount.core.mwiServerAddress)
|
UtilsCpp.createCall(accountProxy.defaultAccount.core.voicemailAddress)
|
||||||
else
|
else
|
||||||
UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("L'adresse de la messagerie vocale n'est pas définie."), false)
|
UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("L'URI de messagerie vocale n'est pas définie."), false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,13 @@ AbstractSettingsLayout {
|
||||||
isValid: function(text) { return UtilsCpp.isValidSIPAddress(text); }
|
isValid: function(text) { return UtilsCpp.isValidSIPAddress(text); }
|
||||||
toValidate: true
|
toValidate: true
|
||||||
}
|
}
|
||||||
|
DecoratedTextField {
|
||||||
|
propertyName: "voicemailAddress"
|
||||||
|
propertyOwner: account.core
|
||||||
|
title: qsTr("URI de messagerie vocale")
|
||||||
|
isValid: function(text) { return UtilsCpp.isValidSIPAddress(text); }
|
||||||
|
toValidate: true
|
||||||
|
}
|
||||||
Item {
|
Item {
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue