1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

feat(UI): Add UI for removing group history

This commit is contained in:
Anthony Bilinski 2022-03-09 03:45:39 -08:00
parent 1142cc03f8
commit cd3c7b392e
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
2 changed files with 21 additions and 10 deletions

View File

@ -1744,16 +1744,7 @@ void Widget::removeFriend(Friend* f, bool fake)
{ {
assert(f); assert(f);
if (!fake) { if (!fake) {
RemoveChatDialog ask(this, *f); removeChatHistory(*f);
ask.exec();
if (!ask.accepted()) {
return;
}
if (ask.removeHistory()) {
profile.getHistory()->removeFriendHistory(f->getPublicKey());
}
} }
const ToxPk friendPk = f->getPublicKey(); const ToxPk friendPk = f->getPublicKey();
@ -2059,6 +2050,11 @@ void Widget::onGroupPeerAudioPlaying(int groupnumber, ToxPk peerPk)
void Widget::removeGroup(Group* g, bool fake) void Widget::removeGroup(Group* g, bool fake)
{ {
assert(g);
if (!fake) {
removeChatHistory(*g);
}
const auto& groupId = g->getPersistentId(); const auto& groupId = g->getPersistentId();
const auto groupnumber = g->getId(); const auto groupnumber = g->getId();
auto groupWidgetIt = groupWidgets.find(groupId); auto groupWidgetIt = groupWidgets.find(groupId);
@ -2742,3 +2738,17 @@ void Widget::formatWindowTitle(const QString& content)
setWindowTitle(content + " - qTox"); 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());
}
}

View File

@ -287,6 +287,7 @@ private:
void cleanupNotificationSound(); void cleanupNotificationSound();
void acceptFileTransfer(const ToxFile &file, const QString &path); void acceptFileTransfer(const ToxFile &file, const QString &path);
void formatWindowTitle(const QString& content); void formatWindowTitle(const QString& content);
void removeChatHistory(Chat& chat);
private: private:
Profile& profile; Profile& profile;