mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-09-10 03:53:23 +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());
|
||||
}
|
||||
|
||||
lrc::api::ContactModel*
|
||||
AccountAdapter::getContactModel()
|
||||
{
|
||||
return LRCInstance::getCurrentAccountInfo().contactModel.get();
|
||||
}
|
||||
|
||||
lrc::api::NewDeviceModel*
|
||||
AccountAdapter::getDeviceModel()
|
||||
{
|
||||
|
@ -367,6 +361,7 @@ AccountAdapter::connectAccount(const QString& accountId)
|
|||
QObject::disconnect(contactAddedConnection_);
|
||||
QObject::disconnect(accountProfileChangedConnection_);
|
||||
QObject::disconnect(addedToConferenceConnection_);
|
||||
QObject::disconnect(contactUnbannedConnection_);
|
||||
|
||||
accountProfileChangedConnection_
|
||||
= QObject::connect(&LRCInstance::accountModel(),
|
||||
|
@ -413,6 +408,14 @@ AccountAdapter::connectAccount(const QString& accountId)
|
|||
Q_UNUSED(callId);
|
||||
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 (...) {
|
||||
qWarning() << "Couldn't get account: " << accountId;
|
||||
}
|
||||
|
@ -424,6 +427,5 @@ AccountAdapter::setProperties(const QString& accountId)
|
|||
setProperty("currentAccountId", accountId);
|
||||
auto accountType = LRCInstance::getAccountInfo(accountId).profileInfo.type;
|
||||
setProperty("currentAccountType", lrc::api::profile::to_string(accountType));
|
||||
emit contactModelChanged();
|
||||
emit deviceModelChanged();
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@ class AccountAdapter final : public QmlAdapterBase
|
|||
Q_OBJECT
|
||||
|
||||
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(QString currentAccountId MEMBER currentAccountId_ NOTIFY currentAccountIdChanged)
|
||||
Q_PROPERTY(lrc::api::profile::Type currentAccountType MEMBER currentAccountType_ NOTIFY
|
||||
|
@ -41,14 +40,11 @@ class AccountAdapter final : public QmlAdapterBase
|
|||
|
||||
public:
|
||||
lrc::api::NewAccountModel* getModel();
|
||||
lrc::api::ContactModel* getContactModel();
|
||||
lrc::api::NewDeviceModel* getDeviceModel();
|
||||
|
||||
signals:
|
||||
void modelChanged();
|
||||
void contactModelChanged();
|
||||
void deviceModelChanged();
|
||||
|
||||
void currentAccountIdChanged();
|
||||
void currentAccountTypeChanged();
|
||||
void accountListSizeChanged();
|
||||
|
@ -117,6 +113,7 @@ signals:
|
|||
*/
|
||||
void reportFailure();
|
||||
void accountAdded(bool showBackUp, int index);
|
||||
void contactUnbanned();
|
||||
|
||||
private slots:
|
||||
void onCurrentAccountChanged();
|
||||
|
@ -147,5 +144,6 @@ private:
|
|||
QMetaObject::Connection contactAddedConnection_;
|
||||
QMetaObject::Connection addedToConferenceConnection_;
|
||||
QMetaObject::Connection accountProfileChangedConnection_;
|
||||
QMetaObject::Connection contactUnbannedConnection_;
|
||||
};
|
||||
Q_DECLARE_METATYPE(AccountAdapter*)
|
||||
|
|
|
@ -37,6 +37,7 @@ MaterialLineEdit {
|
|||
id: registeredNameFoundConnection
|
||||
|
||||
target: NameDirectory
|
||||
enabled: root.text.length !== 0
|
||||
|
||||
function onRegisteredNameFound(status, address, name) {
|
||||
if (text === name) {
|
||||
|
|
|
@ -937,13 +937,13 @@ SettingsAdapter::setDeviceName(QString text)
|
|||
void
|
||||
SettingsAdapter::unbanContact(int index)
|
||||
{
|
||||
auto bannedContactList = LRCInstance::getCurrentAccountInfo().contactModel->getBannedContacts();
|
||||
auto& accountInfo = LRCInstance::getCurrentAccountInfo();
|
||||
auto bannedContactList = accountInfo.contactModel->getBannedContacts();
|
||||
auto it = bannedContactList.begin();
|
||||
std::advance(it, index);
|
||||
|
||||
auto contactInfo = LRCInstance::getCurrentAccountInfo().contactModel->getContact(*it);
|
||||
|
||||
LRCInstance::getCurrentAccountInfo().contactModel->addContact(contactInfo);
|
||||
auto contactInfo = accountInfo.contactModel->getContact(*it);
|
||||
accountInfo.contactModel->addContact(contactInfo);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -51,15 +51,9 @@ ColumnLayout {
|
|||
}
|
||||
|
||||
Connections {
|
||||
id: accountConnections_ContactModel
|
||||
target: AccountAdapter.contactModel
|
||||
enabled: root.visible
|
||||
target: AccountAdapter
|
||||
|
||||
function onModelUpdated(uri, needsSorted) {
|
||||
updateAndShowBannedContactsSlot()
|
||||
}
|
||||
|
||||
function onContactAdded(contactUri) {
|
||||
function onContactUnbanned() {
|
||||
updateAndShowBannedContactsSlot()
|
||||
}
|
||||
}
|
||||
|
@ -83,11 +77,6 @@ ColumnLayout {
|
|||
|
||||
function unban(index) {
|
||||
SettingsAdapter.unbanContact(index)
|
||||
updateAndShowBannedContactsSlot()
|
||||
}
|
||||
|
||||
function connectCurrentAccount(status) {
|
||||
accountConnections_ContactModel.enabled = status
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
|
|
|
@ -68,7 +68,8 @@ ItemDelegate {
|
|||
width: avatarImg.width
|
||||
height: avatarImg.height
|
||||
radius: {
|
||||
var size = ((avatarImg.width <= avatarImg.height)? avatarImg.width:avatarImg.height)
|
||||
var size = ((avatarImg.width <= avatarImg.height) ?
|
||||
avatarImg.width:avatarImg.height)
|
||||
return size /2
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,13 +78,11 @@ Rectangle {
|
|||
function connectCurrentAccount() {
|
||||
if (!isSIP) {
|
||||
linkedDevices.connectCurrentAccount(true)
|
||||
bannedContacts.connectCurrentAccount(true)
|
||||
}
|
||||
}
|
||||
|
||||
function disconnectAccountConnections() {
|
||||
linkedDevices.connectCurrentAccount(false)
|
||||
bannedContacts.connectCurrentAccount(false)
|
||||
}
|
||||
|
||||
function getAdvancedSettingsScrollPosition() {
|
||||
|
|
Loading…
Add table
Reference in a new issue