mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-09-10 12:03:18 +02:00
settingsview: fix banned contact list model refresh issue
A small fix to prevent username registration line edit receiving signal when there is no input is also in since adding banned contact back will trigger lookupAddress. Gitlab: #152 Change-Id: I30afb42eab5903aefb7dd19e9f7a5ad77183e866
This commit is contained in:
parent
be1419c0a6
commit
f47ae0fa62
7 changed files with 20 additions and 31 deletions
|
@ -53,12 +53,6 @@ AccountAdapter::getModel()
|
||||||
return &(LRCInstance::accountModel());
|
return &(LRCInstance::accountModel());
|
||||||
}
|
}
|
||||||
|
|
||||||
lrc::api::ContactModel*
|
|
||||||
AccountAdapter::getContactModel()
|
|
||||||
{
|
|
||||||
return LRCInstance::getCurrentAccountInfo().contactModel.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
lrc::api::NewDeviceModel*
|
lrc::api::NewDeviceModel*
|
||||||
AccountAdapter::getDeviceModel()
|
AccountAdapter::getDeviceModel()
|
||||||
{
|
{
|
||||||
|
@ -367,6 +361,7 @@ AccountAdapter::connectAccount(const QString& accountId)
|
||||||
QObject::disconnect(contactAddedConnection_);
|
QObject::disconnect(contactAddedConnection_);
|
||||||
QObject::disconnect(accountProfileChangedConnection_);
|
QObject::disconnect(accountProfileChangedConnection_);
|
||||||
QObject::disconnect(addedToConferenceConnection_);
|
QObject::disconnect(addedToConferenceConnection_);
|
||||||
|
QObject::disconnect(contactUnbannedConnection_);
|
||||||
|
|
||||||
accountProfileChangedConnection_
|
accountProfileChangedConnection_
|
||||||
= QObject::connect(&LRCInstance::accountModel(),
|
= QObject::connect(&LRCInstance::accountModel(),
|
||||||
|
@ -413,6 +408,14 @@ AccountAdapter::connectAccount(const QString& accountId)
|
||||||
Q_UNUSED(callId);
|
Q_UNUSED(callId);
|
||||||
LRCInstance::renderer()->addDistantRenderer(confId);
|
LRCInstance::renderer()->addDistantRenderer(confId);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
contactUnbannedConnection_ = QObject::connect(accInfo.contactModel.get(),
|
||||||
|
&lrc::api::ContactModel::bannedStatusChanged,
|
||||||
|
[this](const QString& contactUri,
|
||||||
|
bool banned) {
|
||||||
|
if (!banned)
|
||||||
|
emit contactUnbanned();
|
||||||
|
});
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
qWarning() << "Couldn't get account: " << accountId;
|
qWarning() << "Couldn't get account: " << accountId;
|
||||||
}
|
}
|
||||||
|
@ -424,6 +427,5 @@ AccountAdapter::setProperties(const QString& accountId)
|
||||||
setProperty("currentAccountId", accountId);
|
setProperty("currentAccountId", accountId);
|
||||||
auto accountType = LRCInstance::getAccountInfo(accountId).profileInfo.type;
|
auto accountType = LRCInstance::getAccountInfo(accountId).profileInfo.type;
|
||||||
setProperty("currentAccountType", lrc::api::profile::to_string(accountType));
|
setProperty("currentAccountType", lrc::api::profile::to_string(accountType));
|
||||||
emit contactModelChanged();
|
|
||||||
emit deviceModelChanged();
|
emit deviceModelChanged();
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,6 @@ class AccountAdapter final : public QmlAdapterBase
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
Q_PROPERTY(lrc::api::NewAccountModel* model READ getModel NOTIFY modelChanged)
|
Q_PROPERTY(lrc::api::NewAccountModel* model READ getModel NOTIFY modelChanged)
|
||||||
Q_PROPERTY(lrc::api::ContactModel* contactModel READ getContactModel NOTIFY contactModelChanged)
|
|
||||||
Q_PROPERTY(lrc::api::NewDeviceModel* deviceModel READ getDeviceModel NOTIFY deviceModelChanged)
|
Q_PROPERTY(lrc::api::NewDeviceModel* deviceModel READ getDeviceModel NOTIFY deviceModelChanged)
|
||||||
Q_PROPERTY(QString currentAccountId MEMBER currentAccountId_ NOTIFY currentAccountIdChanged)
|
Q_PROPERTY(QString currentAccountId MEMBER currentAccountId_ NOTIFY currentAccountIdChanged)
|
||||||
Q_PROPERTY(lrc::api::profile::Type currentAccountType MEMBER currentAccountType_ NOTIFY
|
Q_PROPERTY(lrc::api::profile::Type currentAccountType MEMBER currentAccountType_ NOTIFY
|
||||||
|
@ -41,14 +40,11 @@ class AccountAdapter final : public QmlAdapterBase
|
||||||
|
|
||||||
public:
|
public:
|
||||||
lrc::api::NewAccountModel* getModel();
|
lrc::api::NewAccountModel* getModel();
|
||||||
lrc::api::ContactModel* getContactModel();
|
|
||||||
lrc::api::NewDeviceModel* getDeviceModel();
|
lrc::api::NewDeviceModel* getDeviceModel();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void modelChanged();
|
void modelChanged();
|
||||||
void contactModelChanged();
|
|
||||||
void deviceModelChanged();
|
void deviceModelChanged();
|
||||||
|
|
||||||
void currentAccountIdChanged();
|
void currentAccountIdChanged();
|
||||||
void currentAccountTypeChanged();
|
void currentAccountTypeChanged();
|
||||||
void accountListSizeChanged();
|
void accountListSizeChanged();
|
||||||
|
@ -117,6 +113,7 @@ signals:
|
||||||
*/
|
*/
|
||||||
void reportFailure();
|
void reportFailure();
|
||||||
void accountAdded(bool showBackUp, int index);
|
void accountAdded(bool showBackUp, int index);
|
||||||
|
void contactUnbanned();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onCurrentAccountChanged();
|
void onCurrentAccountChanged();
|
||||||
|
@ -147,5 +144,6 @@ private:
|
||||||
QMetaObject::Connection contactAddedConnection_;
|
QMetaObject::Connection contactAddedConnection_;
|
||||||
QMetaObject::Connection addedToConferenceConnection_;
|
QMetaObject::Connection addedToConferenceConnection_;
|
||||||
QMetaObject::Connection accountProfileChangedConnection_;
|
QMetaObject::Connection accountProfileChangedConnection_;
|
||||||
|
QMetaObject::Connection contactUnbannedConnection_;
|
||||||
};
|
};
|
||||||
Q_DECLARE_METATYPE(AccountAdapter*)
|
Q_DECLARE_METATYPE(AccountAdapter*)
|
||||||
|
|
|
@ -37,6 +37,7 @@ MaterialLineEdit {
|
||||||
id: registeredNameFoundConnection
|
id: registeredNameFoundConnection
|
||||||
|
|
||||||
target: NameDirectory
|
target: NameDirectory
|
||||||
|
enabled: root.text.length !== 0
|
||||||
|
|
||||||
function onRegisteredNameFound(status, address, name) {
|
function onRegisteredNameFound(status, address, name) {
|
||||||
if (text === name) {
|
if (text === name) {
|
||||||
|
|
|
@ -937,13 +937,13 @@ SettingsAdapter::setDeviceName(QString text)
|
||||||
void
|
void
|
||||||
SettingsAdapter::unbanContact(int index)
|
SettingsAdapter::unbanContact(int index)
|
||||||
{
|
{
|
||||||
auto bannedContactList = LRCInstance::getCurrentAccountInfo().contactModel->getBannedContacts();
|
auto& accountInfo = LRCInstance::getCurrentAccountInfo();
|
||||||
|
auto bannedContactList = accountInfo.contactModel->getBannedContacts();
|
||||||
auto it = bannedContactList.begin();
|
auto it = bannedContactList.begin();
|
||||||
std::advance(it, index);
|
std::advance(it, index);
|
||||||
|
|
||||||
auto contactInfo = LRCInstance::getCurrentAccountInfo().contactModel->getContact(*it);
|
auto contactInfo = accountInfo.contactModel->getContact(*it);
|
||||||
|
accountInfo.contactModel->addContact(contactInfo);
|
||||||
LRCInstance::getCurrentAccountInfo().contactModel->addContact(contactInfo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -51,15 +51,9 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
id: accountConnections_ContactModel
|
target: AccountAdapter
|
||||||
target: AccountAdapter.contactModel
|
|
||||||
enabled: root.visible
|
|
||||||
|
|
||||||
function onModelUpdated(uri, needsSorted) {
|
function onContactUnbanned() {
|
||||||
updateAndShowBannedContactsSlot()
|
|
||||||
}
|
|
||||||
|
|
||||||
function onContactAdded(contactUri) {
|
|
||||||
updateAndShowBannedContactsSlot()
|
updateAndShowBannedContactsSlot()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,11 +77,6 @@ ColumnLayout {
|
||||||
|
|
||||||
function unban(index) {
|
function unban(index) {
|
||||||
SettingsAdapter.unbanContact(index)
|
SettingsAdapter.unbanContact(index)
|
||||||
updateAndShowBannedContactsSlot()
|
|
||||||
}
|
|
||||||
|
|
||||||
function connectCurrentAccount(status) {
|
|
||||||
accountConnections_ContactModel.enabled = status
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
|
|
@ -68,7 +68,8 @@ ItemDelegate {
|
||||||
width: avatarImg.width
|
width: avatarImg.width
|
||||||
height: avatarImg.height
|
height: avatarImg.height
|
||||||
radius: {
|
radius: {
|
||||||
var size = ((avatarImg.width <= avatarImg.height)? avatarImg.width:avatarImg.height)
|
var size = ((avatarImg.width <= avatarImg.height) ?
|
||||||
|
avatarImg.width:avatarImg.height)
|
||||||
return size /2
|
return size /2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,13 +78,11 @@ Rectangle {
|
||||||
function connectCurrentAccount() {
|
function connectCurrentAccount() {
|
||||||
if (!isSIP) {
|
if (!isSIP) {
|
||||||
linkedDevices.connectCurrentAccount(true)
|
linkedDevices.connectCurrentAccount(true)
|
||||||
bannedContacts.connectCurrentAccount(true)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function disconnectAccountConnections() {
|
function disconnectAccountConnections() {
|
||||||
linkedDevices.connectCurrentAccount(false)
|
linkedDevices.connectCurrentAccount(false)
|
||||||
bannedContacts.connectCurrentAccount(false)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAdvancedSettingsScrollPosition() {
|
function getAdvancedSettingsScrollPosition() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue