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);
|
||||
}
|
||||
}
|
||||
mVoicemailAddress =
|
||||
params->getVoicemailAddress() ? Utils::coreStringToAppString(params->getVoicemailAddress()->asString()) : "";
|
||||
|
||||
INIT_CORE_MEMBER(VoicemailCount, 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,
|
||||
VoicemailCount)
|
||||
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 {
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ class AccountCore : public QObject, public AbstractObject {
|
|||
Q_PROPERTY(QString limeServerUrl READ getLimeServerUrl WRITE lSetLimeServerUrl NOTIFY limeServerUrlChanged)
|
||||
DECLARE_CORE_GET(int, voicemailCount, VoicemailCount)
|
||||
DECLARE_CORE_GET(bool, showMwi, ShowMwi)
|
||||
DECLARE_CORE_GETSET_MEMBER(QString, voicemailAddress, VoicemailAddress)
|
||||
|
||||
public:
|
||||
static QSharedPointer<AccountCore> create(const std::shared_ptr<linphone::Account> &account);
|
||||
|
|
|
|||
|
|
@ -319,6 +319,17 @@ bool AccountModel::getShowMwi() {
|
|||
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)
|
||||
|
||||
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);
|
||||
int getVoicemailCount();
|
||||
bool getShowMwi();
|
||||
void setVoicemailAddress(QString value);
|
||||
|
||||
signals:
|
||||
void registrationStateChanged(const std::shared_ptr<linphone::Account> &account,
|
||||
|
|
@ -96,6 +97,7 @@ signals:
|
|||
void removed();
|
||||
void voicemailCountChanged(int count);
|
||||
void showMwiChanged(bool show);
|
||||
void voicemailAddressChanged(QString value);
|
||||
|
||||
private:
|
||||
/**Linphone **/
|
||||
|
|
|
|||
|
|
@ -151,10 +151,10 @@ Control.Control{
|
|||
visible: mainItem.account.core.showMwi
|
||||
voicemailCount: mainItem.account.core.voicemailCount >= 100 ? '99+' : mainItem.account.core.voicemailCount
|
||||
onClicked: {
|
||||
if (mainItem.account.core.mwiServerAddress.length > 0)
|
||||
UtilsCpp.createCall(mainItem.account.core.mwiServerAddress)
|
||||
if (mainItem.account.core.voicemailAddress.length > 0)
|
||||
UtilsCpp.createCall(mainItem.account.core.voicemailAddress)
|
||||
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}
|
||||
|
|
|
|||
|
|
@ -425,10 +425,10 @@ Item {
|
|||
if (accountProxy.count > 1) {
|
||||
avatarButton.popup.open()
|
||||
} else {
|
||||
if (accountProxy.defaultAccount.core.mwiServerAddress.length > 0)
|
||||
UtilsCpp.createCall(accountProxy.defaultAccount.core.mwiServerAddress)
|
||||
if (accountProxy.defaultAccount.core.voicemailAddress.length > 0)
|
||||
UtilsCpp.createCall(accountProxy.defaultAccount.core.voicemailAddress)
|
||||
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); }
|
||||
toValidate: true
|
||||
}
|
||||
DecoratedTextField {
|
||||
propertyName: "voicemailAddress"
|
||||
propertyOwner: account.core
|
||||
title: qsTr("URI de messagerie vocale")
|
||||
isValid: function(text) { return UtilsCpp.isValidSIPAddress(text); }
|
||||
toValidate: true
|
||||
}
|
||||
Item {
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
|
|
|
|||
Loading…
Reference in a new issue