Option to set CCMP server URL in account settings

This commit is contained in:
Christophe Deschamps 2025-12-04 08:26:52 +01:00
parent e23a49fbd3
commit c672762b63
7 changed files with 69 additions and 0 deletions

View file

@ -84,6 +84,7 @@ AccountCore::AccountCore(const std::shared_ptr<linphone::Account> &account) : QO
? Utils::coreStringToAppString(params->getAudioVideoConferenceFactoryAddress()->asString()) ? Utils::coreStringToAppString(params->getAudioVideoConferenceFactoryAddress()->asString())
: ""; : "";
mLimeServerUrl = Utils::coreStringToAppString(params->getLimeServerUrl()); mLimeServerUrl = Utils::coreStringToAppString(params->getLimeServerUrl());
mCcmpServerUrl = Utils::coreStringToAppString(params->getCcmpServerUrl());
// Add listener // Add listener
mAccountModel = Utils::makeQObject_ptr<AccountModel>(account); // OK mAccountModel = Utils::makeQObject_ptr<AccountModel>(account); // OK
@ -148,6 +149,7 @@ AccountCore::AccountCore(const AccountCore &accountCore) {
mConferenceFactoryAddress = accountCore.mConferenceFactoryAddress; mConferenceFactoryAddress = accountCore.mConferenceFactoryAddress;
mAudioVideoConferenceFactoryAddress = accountCore.mAudioVideoConferenceFactoryAddress; mAudioVideoConferenceFactoryAddress = accountCore.mAudioVideoConferenceFactoryAddress;
mLimeServerUrl = accountCore.mLimeServerUrl; mLimeServerUrl = accountCore.mLimeServerUrl;
mCcmpServerUrl = accountCore.mCcmpServerUrl;
} }
void AccountCore::setSelf(QSharedPointer<AccountCore> me) { void AccountCore::setSelf(QSharedPointer<AccountCore> me) {
@ -236,6 +238,10 @@ void AccountCore::setSelf(QSharedPointer<AccountCore> me) {
mAccountModelConnection->makeConnectToModel(&AccountModel::limeServerUrlChanged, [this](QString value) { mAccountModelConnection->makeConnectToModel(&AccountModel::limeServerUrlChanged, [this](QString value) {
mAccountModelConnection->invokeToCore([this, value]() { onLimeServerUrlChanged(value); }); mAccountModelConnection->invokeToCore([this, value]() { onLimeServerUrlChanged(value); });
}); });
mAccountModelConnection->makeConnectToModel(&AccountModel::ccmpServerUrlChanged, [this](QString value) {
mAccountModelConnection->invokeToCore([this, value]() { onCcmpServerUrlChanged(value); });
});
mAccountModelConnection->makeConnectToModel( mAccountModelConnection->makeConnectToModel(
&AccountModel::removed, [this]() { mAccountModelConnection->invokeToCore([this]() { emit removed(); }); }); &AccountModel::removed, [this]() { mAccountModelConnection->invokeToCore([this]() { emit removed(); }); });
@ -327,6 +333,7 @@ void AccountCore::reset(const AccountCore &accountCore) {
setConferenceFactoryAddress(accountCore.mConferenceFactoryAddress); setConferenceFactoryAddress(accountCore.mConferenceFactoryAddress);
setAudioVideoConferenceFactoryAddress(accountCore.mAudioVideoConferenceFactoryAddress); setAudioVideoConferenceFactoryAddress(accountCore.mAudioVideoConferenceFactoryAddress);
setLimeServerUrl(accountCore.mLimeServerUrl); setLimeServerUrl(accountCore.mLimeServerUrl);
setCcmpServerUrl(accountCore.mCcmpServerUrl);
} }
const std::shared_ptr<AccountModel> &AccountCore::getModel() const { const std::shared_ptr<AccountModel> &AccountCore::getModel() const {
@ -574,6 +581,10 @@ QString AccountCore::getLimeServerUrl() {
return mLimeServerUrl; return mLimeServerUrl;
} }
QString AccountCore::getCcmpServerUrl() {
return mCcmpServerUrl;
}
void AccountCore::setMwiServerAddress(QString value) { void AccountCore::setMwiServerAddress(QString value) {
if (mMwiServerAddress != value) { if (mMwiServerAddress != value) {
mMwiServerAddress = value; mMwiServerAddress = value;
@ -678,6 +689,14 @@ void AccountCore::setLimeServerUrl(QString value) {
} }
} }
void AccountCore::setCcmpServerUrl(QString value) {
if (mCcmpServerUrl != value) {
mCcmpServerUrl = value;
emit ccmpServerUrlChanged();
setIsSaved(false);
}
}
bool AccountCore::isSaved() const { bool AccountCore::isSaved() const {
return mIsSaved; return mIsSaved;
} }
@ -790,6 +809,13 @@ void AccountCore::onLimeServerUrlChanged(QString value) {
} }
} }
void AccountCore::onCcmpServerUrlChanged(QString value) {
if (value != mCcmpServerUrl) {
mCcmpServerUrl = value;
emit ccmpServerUrlChanged();
}
}
void AccountCore::writeIntoModel(std::shared_ptr<AccountModel> model) const { void AccountCore::writeIntoModel(std::shared_ptr<AccountModel> model) const {
mustBeInLinphoneThread(getClassName() + Q_FUNC_INFO); mustBeInLinphoneThread(getClassName() + Q_FUNC_INFO);
model->setMwiServerAddress(mMwiServerAddress); model->setMwiServerAddress(mMwiServerAddress);
@ -806,6 +832,7 @@ void AccountCore::writeIntoModel(std::shared_ptr<AccountModel> model) const {
model->setConferenceFactoryAddress(mConferenceFactoryAddress); model->setConferenceFactoryAddress(mConferenceFactoryAddress);
model->setAudioVideoConferenceFactoryAddress(mAudioVideoConferenceFactoryAddress); model->setAudioVideoConferenceFactoryAddress(mAudioVideoConferenceFactoryAddress);
model->setLimeServerUrl(mLimeServerUrl); model->setLimeServerUrl(mLimeServerUrl);
model->setCcmpServerUrl(mCcmpServerUrl);
model->setVoicemailAddress(mVoicemailAddress); model->setVoicemailAddress(mVoicemailAddress);
} }
@ -825,6 +852,7 @@ void AccountCore::writeFromModel(const std::shared_ptr<AccountModel> &model) {
onConferenceFactoryAddressChanged(model->getConferenceFactoryAddress()); onConferenceFactoryAddressChanged(model->getConferenceFactoryAddress());
onAudioVideoConferenceFactoryAddressChanged(model->getAudioVideoConferenceFactoryAddress()); onAudioVideoConferenceFactoryAddressChanged(model->getAudioVideoConferenceFactoryAddress());
onLimeServerUrlChanged(model->getLimeServerUrl()); onLimeServerUrlChanged(model->getLimeServerUrl());
onCcmpServerUrlChanged(model->getCcmpServerUrl());
onVoicemailAddressChanged(model->getVoicemailAddress()); onVoicemailAddressChanged(model->getVoicemailAddress());
} }

View file

@ -84,6 +84,7 @@ public:
Q_PROPERTY(LinphoneEnums::Presence explicitPresence MEMBER mExplicitPresence NOTIFY presenceChanged) Q_PROPERTY(LinphoneEnums::Presence explicitPresence MEMBER mExplicitPresence NOTIFY presenceChanged)
Q_PROPERTY(QString presenceNote READ getPresenceNote WRITE setPresenceNote NOTIFY presenceChanged) Q_PROPERTY(QString presenceNote READ getPresenceNote WRITE setPresenceNote NOTIFY presenceChanged)
Q_PROPERTY(int maxPresenceNoteSize MEMBER mMaxPresenceNoteSize CONSTANT) Q_PROPERTY(int maxPresenceNoteSize MEMBER mMaxPresenceNoteSize CONSTANT)
Q_PROPERTY(QString ccmpServerUrl READ getCcmpServerUrl WRITE setCcmpServerUrl NOTIFY ccmpServerUrlChanged)
DECLARE_CORE_GET(int, voicemailCount, VoicemailCount) DECLARE_CORE_GET(int, voicemailCount, VoicemailCount)
static QSharedPointer<AccountCore> create(const std::shared_ptr<linphone::Account> &account); static QSharedPointer<AccountCore> create(const std::shared_ptr<linphone::Account> &account);
@ -143,6 +144,7 @@ public:
QString getAudioVideoConferenceFactoryAddress(); QString getAudioVideoConferenceFactoryAddress();
QString getLimeServerUrl(); QString getLimeServerUrl();
QString getVoicemailAddress(); QString getVoicemailAddress();
QString getCcmpServerUrl();
void setMwiServerAddress(QString value); void setMwiServerAddress(QString value);
void setTransport(QString value); void setTransport(QString value);
@ -157,6 +159,7 @@ public:
void setAudioVideoConferenceFactoryAddress(QString value); void setAudioVideoConferenceFactoryAddress(QString value);
void setLimeServerUrl(QString value); void setLimeServerUrl(QString value);
void setVoicemailAddress(QString value); void setVoicemailAddress(QString value);
void setCcmpServerUrl(QString value);
bool isSaved() const; bool isSaved() const;
void setIsSaved(bool saved); void setIsSaved(bool saved);
@ -175,6 +178,7 @@ public:
void onConferenceFactoryAddressChanged(QString value); void onConferenceFactoryAddressChanged(QString value);
void onAudioVideoConferenceFactoryAddressChanged(QString value); void onAudioVideoConferenceFactoryAddressChanged(QString value);
void onLimeServerUrlChanged(QString value); void onLimeServerUrlChanged(QString value);
void onCcmpServerUrlChanged(QString value);
DECLARE_CORE_GET(bool, showMwi, ShowMwi) DECLARE_CORE_GET(bool, showMwi, ShowMwi)
@ -220,6 +224,7 @@ signals:
void isSavedChanged(); void isSavedChanged();
void voicemailAddressChanged(); void voicemailAddressChanged();
void presenceChanged(); void presenceChanged();
void ccmpServerUrlChanged();
void setValueFailed(const QString &error); void setValueFailed(const QString &error);
@ -268,6 +273,7 @@ private:
QString mAudioVideoConferenceFactoryAddress; QString mAudioVideoConferenceFactoryAddress;
QString mLimeServerUrl; QString mLimeServerUrl;
QString mVoicemailAddress; QString mVoicemailAddress;
QString mCcmpServerUrl;
LinphoneEnums::Presence mPresence = LinphoneEnums::Presence::Undefined; LinphoneEnums::Presence mPresence = LinphoneEnums::Presence::Undefined;
LinphoneEnums::Presence mExplicitPresence; LinphoneEnums::Presence mExplicitPresence;
QString mPresenceNote; QString mPresenceNote;

View file

@ -493,6 +493,12 @@
<extracomment>&quot;URL du serveur déchange de clés de chiffrement&quot;</extracomment> <extracomment>&quot;URL du serveur déchange de clés de chiffrement&quot;</extracomment>
<translation>Lime server URL</translation> <translation>Lime server URL</translation>
</message> </message>
<message>
<location filename="../../view/Page/Layout/Settings/AccountSettingsParametersLayout.qml"/>
<source>account_settings_ccmp_server_url_title</source>
<extracomment>&quot;URL du serveur CCMP&quot;</extracomment>
<translation>CCMP server URL</translation>
</message>
</context> </context>
<context> <context>
<name>AddParticipantsForm</name> <name>AddParticipantsForm</name>

View file

@ -493,6 +493,12 @@
<extracomment>&quot;URL du serveur déchange de clés de chiffrement&quot;</extracomment> <extracomment>&quot;URL du serveur déchange de clés de chiffrement&quot;</extracomment>
<translation>URL du serveur déchange de clés de chiffrement</translation> <translation>URL du serveur déchange de clés de chiffrement</translation>
</message> </message>
<message>
<location filename="../../view/Page/Layout/Settings/AccountSettingsParametersLayout.qml"/>
<source>account_settings_ccmp_server_url_title</source>
<extracomment>&quot;URL du serveur CCMP&quot;</extracomment>
<translation>URL du serveur CCMP</translation>
</message>
</context> </context>
<context> <context>
<name>AddParticipantsForm</name> <name>AddParticipantsForm</name>

View file

@ -606,3 +606,15 @@ bool AccountModel::forwardToVoiceMailInDndPresence() {
std::list<std::shared_ptr<linphone::ChatRoom>> AccountModel::getChatRooms() { std::list<std::shared_ptr<linphone::ChatRoom>> AccountModel::getChatRooms() {
return mMonitor->getChatRooms(); return mMonitor->getChatRooms();
} }
QString AccountModel::getCcmpServerUrl() const {
return Utils::coreStringToAppString(mMonitor->getParams()->getCcmpServerUrl());
}
void AccountModel::setCcmpServerUrl(QString value) {
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
auto params = mMonitor->getParams()->clone();
params->setCcmpServerUrl(Utils::appStringToCoreString(value));
mMonitor->setParams(params);
emit ccmpServerUrlChanged(value);
}

View file

@ -91,6 +91,8 @@ public:
std::string configAccountSection(); std::string configAccountSection();
bool forwardToVoiceMailInDndPresence(); bool forwardToVoiceMailInDndPresence();
std::list<std::shared_ptr<linphone::ChatRoom>> getChatRooms(); std::list<std::shared_ptr<linphone::ChatRoom>> getChatRooms();
QString getCcmpServerUrl() const;
void setCcmpServerUrl(QString value);
signals: signals:
void registrationStateChanged(const std::shared_ptr<linphone::Account> &account, void registrationStateChanged(const std::shared_ptr<linphone::Account> &account,
@ -126,6 +128,7 @@ signals:
void showMwiChanged(bool show); void showMwiChanged(bool show);
void voicemailAddressChanged(QString value); void voicemailAddressChanged(QString value);
void presenceChanged(LinphoneEnums::Presence presence, bool userInitiated); void presenceChanged(LinphoneEnums::Presence presence, bool userInitiated);
void ccmpServerUrlChanged(QString value);
void setValueFailed(const QString &errorMessage); void setValueFailed(const QString &errorMessage);

View file

@ -207,6 +207,14 @@ AbstractSettingsLayout {
propertyOwnerGui: account propertyOwnerGui: account
toValidate: true toValidate: true
} }
DecoratedTextField {
Layout.fillWidth: true
//: "URL du serveur CCMP"
title: qsTr("account_settings_ccmp_server_url_title")
propertyName: "ccmpServerUrl"
propertyOwnerGui: account
toValidate: true
}
} }
} }
} }