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"),
|
ContextMenuGenerator.addMenuItem(qsTr("Clear conversation"),
|
||||||
"qrc:/images/icons/ic_clear_24px.svg",
|
"qrc:/images/icons/ic_clear_24px.svg",
|
||||||
function (){
|
function (){
|
||||||
UtilsAdapter.clearConversationHistory(
|
MessagesAdapter.clearConversationHistory(
|
||||||
responsibleAccountId,
|
responsibleAccountId,
|
||||||
responsibleConvUid)
|
responsibleConvUid)
|
||||||
})
|
})
|
||||||
|
@ -68,7 +68,7 @@ Item {
|
||||||
ContextMenuGenerator.addMenuItem(qsTr("Remove contact"),
|
ContextMenuGenerator.addMenuItem(qsTr("Remove contact"),
|
||||||
"qrc:/images/icons/round-remove_circle-24px.svg",
|
"qrc:/images/icons/round-remove_circle-24px.svg",
|
||||||
function (){
|
function (){
|
||||||
UtilsAdapter.removeConversation(
|
MessagesAdapter.removeConversation(
|
||||||
responsibleAccountId,
|
responsibleAccountId,
|
||||||
responsibleConvUid)
|
responsibleConvUid)
|
||||||
})
|
})
|
||||||
|
|
|
@ -119,10 +119,9 @@ ListView {
|
||||||
sequence: "Ctrl+Shift+L"
|
sequence: "Ctrl+Shift+L"
|
||||||
context: Qt.ApplicationShortcut
|
context: Qt.ApplicationShortcut
|
||||||
enabled: root.visible
|
enabled: root.visible
|
||||||
onActivated: {
|
onActivated: MessagesAdapter.clearConversationHistory(
|
||||||
UtilsAdapter.clearConversationHistory(AccountAdapter.currentAccountId,
|
AccountAdapter.currentAccountId,
|
||||||
UtilsAdapter.getCurrConvId())
|
UtilsAdapter.getCurrConvId())
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Shortcut {
|
Shortcut {
|
||||||
|
@ -138,11 +137,10 @@ ListView {
|
||||||
sequence: "Ctrl+Shift+Delete"
|
sequence: "Ctrl+Shift+Delete"
|
||||||
context: Qt.ApplicationShortcut
|
context: Qt.ApplicationShortcut
|
||||||
enabled: root.visible
|
enabled: root.visible
|
||||||
onActivated: {
|
onActivated: MessagesAdapter.removeConversation(
|
||||||
UtilsAdapter.removeConversation(AccountAdapter.currentAccountId,
|
AccountAdapter.currentAccountId,
|
||||||
UtilsAdapter.getCurrConvId(),
|
UtilsAdapter.getCurrConvId(),
|
||||||
false)
|
false)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Shortcut {
|
Shortcut {
|
||||||
|
|
|
@ -665,6 +665,8 @@ MessagesAdapter::refuseInvitation(const QString& convUid)
|
||||||
const auto currentConvUid = convUid.isEmpty() ? LRCInstance::getCurrentConvUid() : convUid;
|
const auto currentConvUid = convUid.isEmpty() ? LRCInstance::getCurrentConvUid() : convUid;
|
||||||
LRCInstance::getCurrentConversationModel()->removeConversation(currentConvUid, false);
|
LRCInstance::getCurrentConversationModel()->removeConversation(currentConvUid, false);
|
||||||
setInvitation(false);
|
setInvitation(false);
|
||||||
|
if (convUid == currentConvUid_)
|
||||||
|
currentConvUid_.clear();
|
||||||
emit navigateToWelcomePageRequested();
|
emit navigateToWelcomePageRequested();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -674,6 +676,25 @@ MessagesAdapter::blockConversation(const QString& convUid)
|
||||||
const auto currentConvUid = convUid.isEmpty() ? LRCInstance::getCurrentConvUid() : convUid;
|
const auto currentConvUid = convUid.isEmpty() ? LRCInstance::getCurrentConvUid() : convUid;
|
||||||
LRCInstance::getCurrentConversationModel()->removeConversation(currentConvUid, true);
|
LRCInstance::getCurrentConversationModel()->removeConversation(currentConvUid, true);
|
||||||
setInvitation(false);
|
setInvitation(false);
|
||||||
|
if (convUid == currentConvUid_)
|
||||||
|
currentConvUid_.clear();
|
||||||
emit contactBanned();
|
emit contactBanned();
|
||||||
emit navigateToWelcomePageRequested();
|
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 connectConversationModel();
|
||||||
Q_INVOKABLE void sendContactRequest();
|
Q_INVOKABLE void sendContactRequest();
|
||||||
Q_INVOKABLE void updateConversationForAddedContact();
|
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.
|
* JS Q_INVOKABLE.
|
||||||
|
|
|
@ -157,18 +157,6 @@ UtilsAdapter::setConversationFilter(const QString& filter)
|
||||||
LRCInstance::getCurrentConversationModel()->setFilter(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
|
const QString
|
||||||
UtilsAdapter::getCurrConvId()
|
UtilsAdapter::getCurrConvId()
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,10 +43,6 @@ public:
|
||||||
Q_INVOKABLE bool createStartupLink();
|
Q_INVOKABLE bool createStartupLink();
|
||||||
Q_INVOKABLE QString GetRingtonePath();
|
Q_INVOKABLE QString GetRingtonePath();
|
||||||
Q_INVOKABLE bool checkStartupLink();
|
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 void setConversationFilter(const QString& filter);
|
||||||
Q_INVOKABLE int getTotalUnreadMessages();
|
Q_INVOKABLE int getTotalUnreadMessages();
|
||||||
Q_INVOKABLE int getTotalPendingRequest();
|
Q_INVOKABLE int getTotalPendingRequest();
|
||||||
|
|
Loading…
Add table
Reference in a new issue