mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-28 01:09:19 +00:00
fix #LINQT-1700 hide account devices if domain does not match default domain
This commit is contained in:
parent
37fd7f586e
commit
1e5af8228e
6 changed files with 53 additions and 1 deletions
|
|
@ -85,6 +85,13 @@ SettingsCore::SettingsCore(QObject *parent) : QObject(parent) {
|
|||
// DND
|
||||
mDndEnabled = settingsModel->dndEnabled();
|
||||
|
||||
mDefaultDomain = settingsModel->getDefaultDomain();
|
||||
auto currentAccount = CoreModel::getInstance()->getCore()->getDefaultAccount();
|
||||
if (currentAccount) {
|
||||
auto accountDomain = Utils::coreStringToAppString(currentAccount->getParams()->getDomain());
|
||||
mShowAccountDevices = (accountDomain == mDefaultDomain);
|
||||
}
|
||||
|
||||
// Ui
|
||||
INIT_CORE_MEMBER(DisableChatFeature, settingsModel)
|
||||
INIT_CORE_MEMBER(DisableMeetingsFeature, settingsModel)
|
||||
|
|
@ -185,6 +192,9 @@ SettingsCore::SettingsCore(const SettingsCore &settingsCore) {
|
|||
mShortcutCount = settingsCore.mShortcutCount;
|
||||
mShortcuts = settingsCore.mShortcuts;
|
||||
mCallToneIndicationsEnabled = settingsCore.mCallToneIndicationsEnabled;
|
||||
|
||||
mDefaultDomain = settingsCore.mDefaultDomain;
|
||||
mShowAccountDevices = settingsCore.mShowAccountDevices;
|
||||
}
|
||||
|
||||
SettingsCore::~SettingsCore() {
|
||||
|
|
@ -403,6 +413,16 @@ void SettingsCore::setSelf(QSharedPointer<SettingsCore> me) {
|
|||
}
|
||||
});
|
||||
});
|
||||
coreModelConnection->makeConnectToModel(&CoreModel::defaultAccountChanged, [this] (const std::shared_ptr<linphone::Core> &core,
|
||||
const std::shared_ptr<linphone::Account> &account) {
|
||||
QString accountDomain;
|
||||
if (account) {
|
||||
accountDomain = Utils::coreStringToAppString(account->getParams()->getDomain());
|
||||
}
|
||||
mSettingsModelConnection->invokeToCore([this, accountDomain]() {
|
||||
setShowAccountDevices(accountDomain == mDefaultDomain);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void SettingsCore::reset(const SettingsCore &settingsCore) {
|
||||
|
|
@ -837,6 +857,16 @@ void SettingsCore::setDndEnabled(bool enabled) {
|
|||
}
|
||||
}
|
||||
|
||||
bool SettingsCore::showAccountDevices() const {
|
||||
return mShowAccountDevices;
|
||||
}
|
||||
void SettingsCore::setShowAccountDevices(bool show) {
|
||||
if (mShowAccountDevices != show) {
|
||||
mShowAccountDevices = show;
|
||||
emit showAccountDevicesChanged(mShowAccountDevices);
|
||||
}
|
||||
}
|
||||
|
||||
bool SettingsCore::getAutoStart() const {
|
||||
return mAutoStart;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,6 +80,8 @@ public:
|
|||
Q_PROPERTY(bool dnd READ dndEnabled WRITE lEnableDnd NOTIFY dndChanged)
|
||||
Q_PROPERTY(bool isSaved READ isSaved WRITE setIsSaved NOTIFY isSavedChanged)
|
||||
|
||||
Q_PROPERTY(bool showAccountDevices READ showAccountDevices WRITE setShowAccountDevices NOTIFY showAccountDevicesChanged)
|
||||
|
||||
static QSharedPointer<SettingsCore> create();
|
||||
SettingsCore(QObject *parent = Q_NULLPTR);
|
||||
SettingsCore(const SettingsCore &settingsCore);
|
||||
|
|
@ -187,6 +189,9 @@ public:
|
|||
bool dndEnabled() const;
|
||||
void setDndEnabled(bool enabled);
|
||||
|
||||
bool showAccountDevices() const;
|
||||
void setShowAccountDevices(bool show);
|
||||
|
||||
Q_INVOKABLE void save();
|
||||
Q_INVOKABLE void undo();
|
||||
|
||||
|
|
@ -285,6 +290,8 @@ signals:
|
|||
|
||||
void lEnableDnd(bool value);
|
||||
|
||||
void showAccountDevicesChanged(bool show);
|
||||
|
||||
protected:
|
||||
void writeIntoModel(std::shared_ptr<SettingsModel> model) const;
|
||||
void writeFromModel(const std::shared_ptr<SettingsModel> &model);
|
||||
|
|
@ -338,6 +345,10 @@ private:
|
|||
QSettings mAppSettings;
|
||||
QSharedPointer<SafeConnection<SettingsCore, SettingsModel>> mSettingsModelConnection;
|
||||
|
||||
//Account
|
||||
QString mDefaultDomain;
|
||||
bool mShowAccountDevices = false;
|
||||
|
||||
DECLARE_ABSTRACT_OBJECT
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ DEFINE_ABSTRACT_OBJECT(SettingsModel)
|
|||
using namespace std;
|
||||
|
||||
const std::string SettingsModel::UiSection("ui");
|
||||
const std::string SettingsModel::AppSection("app");
|
||||
std::shared_ptr<SettingsModel> SettingsModel::gSettingsModel;
|
||||
|
||||
SettingsModel::SettingsModel() {
|
||||
|
|
@ -688,6 +689,10 @@ void SettingsModel::setShortcuts(QVariantList data) {
|
|||
}
|
||||
}
|
||||
|
||||
QString SettingsModel::getDefaultDomain() const {
|
||||
return Utils::coreStringToAppString(mConfig->getString(SettingsModel::AppSection, "default_domain", "sip.linphone.org"));
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
void SettingsModel::notifyConfigReady(){
|
||||
DEFINE_NOTIFY_CONFIG_READY(disableChatFeature, DisableChatFeature)
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ public:
|
|||
const std::string &name) const; // Return the full name of the entry : 'name/readonly' or 'name'
|
||||
|
||||
static const std::string UiSection;
|
||||
static const std::string AppSection;
|
||||
std::shared_ptr<linphone::Config> mConfig;
|
||||
|
||||
bool getVfsEnabled() const;
|
||||
|
|
@ -108,6 +109,8 @@ public:
|
|||
QString getVideoDevice() const;
|
||||
void setVideoDevice(QString device);
|
||||
|
||||
QString getDefaultDomain() const;
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void startEchoCancellerCalibration();
|
||||
|
|
|
|||
|
|
@ -131,8 +131,10 @@ Rectangle {
|
|||
height: contentHeight
|
||||
spacing: Math.round(10 * DefaultStyle.dp)
|
||||
delegate: ColumnLayout {
|
||||
visible: modelData.visible
|
||||
spacing: Math.round(16 * DefaultStyle.dp)
|
||||
width: contentListView.width
|
||||
height: visible ? childrenRect.height: 0
|
||||
Rectangle {
|
||||
visible: index !== 0
|
||||
Layout.topMargin: Math.round((modelData.hideTopSeparator ? 0 : 16) * DefaultStyle.dp)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import QtQuick.Layouts
|
|||
import QtQuick.Controls.Basic as Control
|
||||
import QtQuick.Dialogs
|
||||
import Linphone
|
||||
import SettingsCpp 1.0
|
||||
import SettingsCpp
|
||||
import UtilsCpp
|
||||
import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle
|
||||
|
||||
|
|
@ -22,6 +22,7 @@ AbstractSettingsLayout {
|
|||
contentComponent: accountParametersComponent
|
||||
},
|
||||
{
|
||||
visible: SettingsCpp.showAccountDevices,
|
||||
//: "Vos appareils"
|
||||
title: qsTr("manage_account_devices_title"),
|
||||
//: "La liste des appareils connectés à votre compte. Vous pouvez retirer les appareils que vous n’utilisez plus."
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue