Ldap debug option

This commit is contained in:
Christophe Deschamps 2024-11-06 19:10:51 +01:00
parent ab4acc8f03
commit 40137bcf26
5 changed files with 24 additions and 8 deletions

View file

@ -51,7 +51,7 @@ LdapCore::LdapCore(const std::shared_ptr<linphone::Ldap> &ldap) : QObject(nullpt
INIT_CORE_MEMBER(NameAttribute, mLdapModel)
INIT_CORE_MEMBER(SipAttribute, mLdapModel)
INIT_CORE_MEMBER(SipDomain, mLdapModel)
INIT_CORE_MEMBER(DebugLevel, mLdapModel)
INIT_CORE_MEMBER(Debug, mLdapModel)
}
LdapCore::~LdapCore() {
@ -101,13 +101,12 @@ void LdapCore::setSelf(QSharedPointer<LdapCore> me) {
DEFINE_CORE_GETSET_CONNECT(mLdapModelConnection, LdapCore, LdapModel, mLdapModel, QString, sipAttribute,
SipAttribute)
DEFINE_CORE_GETSET_CONNECT(mLdapModelConnection, LdapCore, LdapModel, mLdapModel, QString, sipDomain, SipDomain)
DEFINE_CORE_GETSET_CONNECT(mLdapModelConnection, LdapCore, LdapModel, mLdapModel, linphone::Ldap::DebugLevel,
debugLevel, DebugLevel)
DEFINE_CORE_GETSET_CONNECT(mLdapModelConnection, LdapCore, LdapModel, mLdapModel, bool, debug, Debug)
mLdapModelConnection->makeConnectToModel(&LdapModel::saved, [this]() {
mLdapModelConnection->invokeToCore([this]() { emit App::getInstance()->getSettings()->ldapConfigChanged(); });
mLdapModelConnection->invokeToCore([this]() { emit App::getInstance() -> getSettings()->ldapConfigChanged(); });
});
mLdapModelConnection->makeConnectToModel(&LdapModel::removed, [this]() {
mLdapModelConnection->invokeToCore([this]() { emit App::getInstance()->getSettings()->ldapConfigChanged(); });
mLdapModelConnection->invokeToCore([this]() { emit App::getInstance() -> getSettings()->ldapConfigChanged(); });
});
}

View file

@ -60,7 +60,7 @@ public:
DECLARE_CORE_GETSET_MEMBER(QString, nameAttribute, NameAttribute)
DECLARE_CORE_GETSET_MEMBER(QString, sipAttribute, SipAttribute)
DECLARE_CORE_GETSET_MEMBER(QString, sipDomain, SipDomain)
DECLARE_CORE_GETSET_MEMBER(linphone::Ldap::DebugLevel, debugLevel, DebugLevel)
DECLARE_CORE_GETSET_MEMBER(bool, debug, Debug)
private:
std::shared_ptr<LdapModel> mLdapModel;

View file

@ -63,6 +63,19 @@ void LdapModel::remove() {
emit removed();
}
bool LdapModel::getDebug() const {
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
return mLdapParamsClone->getDebugLevel() == linphone::Ldap::DebugLevel::Verbose;
}
void LdapModel::setDebug(bool data) {
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
if (getDebug() != data) {
mLdapParamsClone->setDebugLevel(data ? linphone::Ldap::DebugLevel::Verbose : linphone::Ldap::DebugLevel::Off);
save();
emit debugChanged(data);
}
}
DEFINE_GETSET(LdapModel, bool, enabled, Enabled, mLdapParamsClone)
DEFINE_GETSET_MODEL_STRING(LdapModel, server, Server, mLdapParamsClone)
DEFINE_GETSET_MODEL_STRING(LdapModel, bindDn, BindDn, mLdapParamsClone)
@ -83,4 +96,3 @@ DEFINE_GETSET(LdapModel, int, minChars, MinChars, mLdapParamsClone)
DEFINE_GETSET_MODEL_STRING(LdapModel, nameAttribute, NameAttribute, mLdapParamsClone)
DEFINE_GETSET_MODEL_STRING(LdapModel, sipAttribute, SipAttribute, mLdapParamsClone)
DEFINE_GETSET_MODEL_STRING(LdapModel, sipDomain, SipDomain, mLdapParamsClone)
DEFINE_GETSET(LdapModel, linphone::Ldap::DebugLevel, debugLevel, DebugLevel, mLdapParamsClone)

View file

@ -54,7 +54,7 @@ public:
DECLARE_GETSET(QString, nameAttribute, NameAttribute)
DECLARE_GETSET(QString, sipAttribute, SipAttribute)
DECLARE_GETSET(QString, sipDomain, SipDomain)
DECLARE_GETSET(linphone::Ldap::DebugLevel, debugLevel, DebugLevel)
DECLARE_GETSET(bool, debug, Debug)
signals:
void saved();

View file

@ -176,6 +176,11 @@ AbstractSettingsLayout {
title: qsTr("Domaine SIP")
toValidate: true
}
SwitchSetting {
titleText: qsTr("Débogage")
propertyName: "debug"
propertyOwner: ldapGui.core
}
}
}
}