mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-04 06:45:45 +02:00
messagesadapter: clear conversation uid cache if it is currently selected
For clearConversationHistory and removeConversation Gitlab: #252 Change-Id: I3008cf20ddace5d3395465bd328a460c72e4c07f
This commit is contained in:
parent
9ef94561a5
commit
8b2512c513
6 changed files with 34 additions and 27 deletions
|
@ -59,7 +59,7 @@ Item {
|
|||
ContextMenuGenerator.addMenuItem(qsTr("Clear conversation"),
|
||||
"qrc:/images/icons/ic_clear_24px.svg",
|
||||
function (){
|
||||
UtilsAdapter.clearConversationHistory(
|
||||
MessagesAdapter.clearConversationHistory(
|
||||
responsibleAccountId,
|
||||
responsibleConvUid)
|
||||
})
|
||||
|
@ -68,7 +68,7 @@ Item {
|
|||
ContextMenuGenerator.addMenuItem(qsTr("Remove contact"),
|
||||
"qrc:/images/icons/round-remove_circle-24px.svg",
|
||||
function (){
|
||||
UtilsAdapter.removeConversation(
|
||||
MessagesAdapter.removeConversation(
|
||||
responsibleAccountId,
|
||||
responsibleConvUid)
|
||||
})
|
||||
|
|
|
@ -119,10 +119,9 @@ ListView {
|
|||
sequence: "Ctrl+Shift+L"
|
||||
context: Qt.ApplicationShortcut
|
||||
enabled: root.visible
|
||||
onActivated: {
|
||||
UtilsAdapter.clearConversationHistory(AccountAdapter.currentAccountId,
|
||||
UtilsAdapter.getCurrConvId())
|
||||
}
|
||||
onActivated: MessagesAdapter.clearConversationHistory(
|
||||
AccountAdapter.currentAccountId,
|
||||
UtilsAdapter.getCurrConvId())
|
||||
}
|
||||
|
||||
Shortcut {
|
||||
|
@ -138,11 +137,10 @@ ListView {
|
|||
sequence: "Ctrl+Shift+Delete"
|
||||
context: Qt.ApplicationShortcut
|
||||
enabled: root.visible
|
||||
onActivated: {
|
||||
UtilsAdapter.removeConversation(AccountAdapter.currentAccountId,
|
||||
UtilsAdapter.getCurrConvId(),
|
||||
false)
|
||||
}
|
||||
onActivated: MessagesAdapter.removeConversation(
|
||||
AccountAdapter.currentAccountId,
|
||||
UtilsAdapter.getCurrConvId(),
|
||||
false)
|
||||
}
|
||||
|
||||
Shortcut {
|
||||
|
|
|
@ -665,6 +665,8 @@ MessagesAdapter::refuseInvitation(const QString& convUid)
|
|||
const auto currentConvUid = convUid.isEmpty() ? LRCInstance::getCurrentConvUid() : convUid;
|
||||
LRCInstance::getCurrentConversationModel()->removeConversation(currentConvUid, false);
|
||||
setInvitation(false);
|
||||
if (convUid == currentConvUid_)
|
||||
currentConvUid_.clear();
|
||||
emit navigateToWelcomePageRequested();
|
||||
}
|
||||
|
||||
|
@ -674,6 +676,25 @@ MessagesAdapter::blockConversation(const QString& convUid)
|
|||
const auto currentConvUid = convUid.isEmpty() ? LRCInstance::getCurrentConvUid() : convUid;
|
||||
LRCInstance::getCurrentConversationModel()->removeConversation(currentConvUid, true);
|
||||
setInvitation(false);
|
||||
if (convUid == currentConvUid_)
|
||||
currentConvUid_.clear();
|
||||
emit contactBanned();
|
||||
emit navigateToWelcomePageRequested();
|
||||
}
|
||||
|
||||
void
|
||||
MessagesAdapter::clearConversationHistory(const QString& accountId, const QString& uid)
|
||||
{
|
||||
LRCInstance::getAccountInfo(accountId).conversationModel->clearHistory(uid);
|
||||
if (uid == currentConvUid_)
|
||||
currentConvUid_.clear();
|
||||
}
|
||||
|
||||
void
|
||||
MessagesAdapter::removeConversation(const QString& accountId, const QString& uid, bool banContact)
|
||||
{
|
||||
LRCInstance::getAccountInfo(accountId).conversationModel->removeConversation(uid, banContact);
|
||||
if (uid == currentConvUid_)
|
||||
currentConvUid_.clear();
|
||||
emit navigateToWelcomePageRequested();
|
||||
}
|
||||
|
|
|
@ -41,6 +41,10 @@ protected:
|
|||
Q_INVOKABLE void connectConversationModel();
|
||||
Q_INVOKABLE void sendContactRequest();
|
||||
Q_INVOKABLE void updateConversationForAddedContact();
|
||||
Q_INVOKABLE void removeConversation(const QString& accountId,
|
||||
const QString& uid,
|
||||
bool banContact = false);
|
||||
Q_INVOKABLE void clearConversationHistory(const QString& accountId, const QString& uid);
|
||||
|
||||
/*
|
||||
* JS Q_INVOKABLE.
|
||||
|
|
|
@ -157,18 +157,6 @@ UtilsAdapter::setConversationFilter(const QString& filter)
|
|||
LRCInstance::getCurrentConversationModel()->setFilter(filter);
|
||||
}
|
||||
|
||||
void
|
||||
UtilsAdapter::clearConversationHistory(const QString& accountId, const QString& uid)
|
||||
{
|
||||
LRCInstance::getAccountInfo(accountId).conversationModel->clearHistory(uid);
|
||||
}
|
||||
|
||||
void
|
||||
UtilsAdapter::removeConversation(const QString& accountId, const QString& uid, bool banContact)
|
||||
{
|
||||
LRCInstance::getAccountInfo(accountId).conversationModel->removeConversation(uid, banContact);
|
||||
}
|
||||
|
||||
const QString
|
||||
UtilsAdapter::getCurrConvId()
|
||||
{
|
||||
|
|
|
@ -43,10 +43,6 @@ public:
|
|||
Q_INVOKABLE bool createStartupLink();
|
||||
Q_INVOKABLE QString GetRingtonePath();
|
||||
Q_INVOKABLE bool checkStartupLink();
|
||||
Q_INVOKABLE void removeConversation(const QString& accountId,
|
||||
const QString& uid,
|
||||
bool banContact = false);
|
||||
Q_INVOKABLE void clearConversationHistory(const QString& accountId, const QString& uid);
|
||||
Q_INVOKABLE void setConversationFilter(const QString& filter);
|
||||
Q_INVOKABLE int getTotalUnreadMessages();
|
||||
Q_INVOKABLE int getTotalPendingRequest();
|
||||
|
|
Loading…
Add table
Reference in a new issue