mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
fix(Widget): Incorrect removing of contacts
This commit is contained in:
parent
bc8763e835
commit
039f6ff0b3
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright © 2014-2019 by The qTox Project Contributors
|
||||
Copyright © 2014-2022 by The qTox Project Contributors
|
||||
|
||||
This file is part of qTox, a Qt-based graphical interface for Tox.
|
||||
|
||||
|
@ -1746,7 +1746,16 @@ void Widget::removeFriend(Friend* f, bool fake)
|
|||
{
|
||||
assert(f);
|
||||
if (!fake) {
|
||||
removeChatHistory(*f);
|
||||
RemoveChatDialog ask(this, *f);
|
||||
ask.exec();
|
||||
|
||||
if (!ask.accepted()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ask.removeHistory()) {
|
||||
profile.getHistory()->removeChatHistory(f->getPersistentId());
|
||||
}
|
||||
}
|
||||
|
||||
const ToxPk friendPk = f->getPublicKey();
|
||||
|
@ -2054,7 +2063,16 @@ void Widget::removeGroup(Group* g, bool fake)
|
|||
{
|
||||
assert(g);
|
||||
if (!fake) {
|
||||
removeChatHistory(*g);
|
||||
RemoveChatDialog ask(this, *g);
|
||||
ask.exec();
|
||||
|
||||
if (!ask.accepted()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ask.removeHistory()) {
|
||||
profile.getHistory()->removeChatHistory(g->getPersistentId());
|
||||
}
|
||||
}
|
||||
|
||||
const auto& groupId = g->getPersistentId();
|
||||
|
@ -2737,17 +2755,3 @@ void Widget::formatWindowTitle(const QString& content)
|
|||
setWindowTitle(content + " - qTox");
|
||||
}
|
||||
}
|
||||
|
||||
void Widget::removeChatHistory(Chat& chat)
|
||||
{
|
||||
RemoveChatDialog ask(this, chat);
|
||||
ask.exec();
|
||||
|
||||
if (!ask.accepted()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ask.removeHistory()) {
|
||||
profile.getHistory()->removeChatHistory(chat.getPersistentId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,6 +90,7 @@ class IMessageBoxManager;
|
|||
class ContentDialogManager;
|
||||
class FriendList;
|
||||
class GroupList;
|
||||
class RemoveChatDialog;
|
||||
|
||||
class Widget final : public QMainWindow
|
||||
{
|
||||
|
@ -287,7 +288,6 @@ private:
|
|||
void cleanupNotificationSound();
|
||||
void acceptFileTransfer(const ToxFile &file, const QString &path);
|
||||
void formatWindowTitle(const QString& content);
|
||||
void removeChatHistory(Chat& chat);
|
||||
|
||||
private:
|
||||
Profile& profile;
|
||||
|
|
Loading…
Reference in New Issue
Block a user