Skip to content
Snippets Groups Projects
Commit f57ea000 authored by Hugo Lefeuvre's avatar Hugo Lefeuvre Committed by Sébastien Blin
Browse files

contactmodel: introduce bannedStatusChanged signal


cb08d760 introduced a new banned contacts logic to the contact model,
which allows to manage banned contacts without using the old lrc.
While this patch is fully functional, the problem of how exactly the
client is notified about a banning / unbanning operation is still
unclear: currently the only way the client gets notified is via the
refreshFilter() operation. This is enough for managing banned
contacts in the smart list, but not in the banned contacts view.

In order to addres this problem we introduce a new signal,
bannedStatusChanged, which allows the client to be notified when a
contact is banned or unbanned.

Change-Id: I2ea845e0fe311048479777504b74885cb931aa13
Reviewed-by: default avatarSebastien Blin <sebastien.blin@savoirfairelinux.com>
parent 6c45bad0
No related branches found
No related tags found
No related merge requests found
......@@ -152,6 +152,12 @@ Q_SIGNALS:
* @param transferInfo DataTransferInfo structure from daemon
*/
void newAccountTransfer(long long dringId, datatransfer::Info info) const;
/**
* Connect this signal to know when a contact is banned or unbanned
* @param contactUri
* @param banned whether contact was banned or unbanned
*/
void bannedStatusChanged(const std::string& contactUri, bool banned) const;
private:
std::unique_ptr<ContactModelPimpl> pimpl_;
......
......@@ -565,6 +565,7 @@ ContactModelPimpl::slotContactAdded(const std::string& accountId, const std::str
if (isBanned) {
// Update the smartlist
linked.owner.conversationModel->refreshFilter();
emit linked.bannedStatusChanged(contactUri, false);
} else {
emit linked.contactAdded(contactUri);
}
......@@ -618,6 +619,7 @@ ContactModelPimpl::slotContactRemoved(const std::string& accountId, const std::s
if (banned) {
// Update the smartlist
linked.owner.conversationModel->refreshFilter();
emit linked.bannedStatusChanged(contactUri, true);
} else {
emit linked.contactRemoved(contactUri);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment