Skip to content
Snippets Groups Projects
Commit 95315ce6 authored by Ming Rui Zhang's avatar Ming Rui Zhang
Browse files

adapter: move bannedStatusChanged connection out from redundant safeInit

Gitlab: #492

Change-Id: I8bab7bc1cd1f5bdbf7c6c54e615a21690dad1585
parent cc440b93
No related branches found
No related tags found
No related merge requests found
......@@ -48,10 +48,6 @@ AccountAdapter::AccountAdapter(AppSettingsManager* settingsManager,
&AccountAdapter::accountStatusChanged);
}
void
AccountAdapter::safeInit()
{}
NewAccountModel*
AccountAdapter::getModel()
{
......
......@@ -50,7 +50,7 @@ public:
QObject* parent = nullptr);
~AccountAdapter() = default;
void safeInit() override;
void safeInit() override {}
// Change to account corresponding to combox box index.
Q_INVOKABLE void changeAccount(int row);
......
......@@ -26,18 +26,10 @@ ContactAdapter::ContactAdapter(LRCInstance* instance, QObject* parent)
: QmlAdapterBase(instance, parent)
{
selectableProxyModel_.reset(new SelectableProxyModel(this));
}
void
ContactAdapter::safeInit()
{
connect(lrcInstance_, &LRCInstance::currentAccountIdChanged, [this] {
connect(lrcInstance_->getCurrentContactModel(),
&ContactModel::bannedStatusChanged,
this,
&ContactAdapter::bannedStatusChanged,
Qt::UniqueConnection);
});
if (lrcInstance_) {
connectSignals();
connect(lrcInstance_, &LRCInstance::currentAccountIdChanged, [this] { connectSignals(); });
}
}
QVariant
......@@ -194,3 +186,13 @@ ContactAdapter::contactSelected(int index)
}
}
}
void
ContactAdapter::connectSignals()
{
connect(lrcInstance_->getCurrentContactModel(),
&ContactModel::bannedStatusChanged,
this,
&ContactAdapter::bannedStatusChanged,
Qt::UniqueConnection);
}
......@@ -86,12 +86,14 @@ public:
using Role = ConversationList::Role;
void safeInit() override;
void safeInit() override {}
Q_INVOKABLE QVariant getContactSelectableModel(int type);
Q_INVOKABLE void setSearchFilter(const QString& filter);
Q_INVOKABLE void contactSelected(int index);
void connectSignals();
Q_SIGNALS:
void bannedStatusChanged(const QString& uri, bool banned);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment