mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
ask to remove history
This commit is contained in:
parent
b8d57cf43a
commit
69972e0d80
|
@ -92,9 +92,6 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event)
|
|||
}
|
||||
else if (selectedItem == removeFriendAction)
|
||||
{
|
||||
hide();
|
||||
show(); //Toggle visibility to work around bug of repaintEvent() not being fired on parent widget when this is hidden
|
||||
hide();
|
||||
emit removeFriend(friendId);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -857,16 +857,27 @@ void Widget::onFriendRequestReceived(const QString& userId, const QString& messa
|
|||
}
|
||||
|
||||
void Widget::removeFriend(Friend* f, bool fake)
|
||||
{
|
||||
{
|
||||
QMessageBox::StandardButton removeFriendMB;
|
||||
removeFriendMB = QMessageBox::question(this,
|
||||
tr("Remove history"),
|
||||
tr("Do you want to remove history as well?"),
|
||||
QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
|
||||
if (removeFriendMB == QMessageBox::Cancel)
|
||||
return;
|
||||
else if (removeFriendMB == QMessageBox::Yes)
|
||||
HistoryKeeper::getInstance()->removeFriendHistory(f->getToxID().publicKey);
|
||||
|
||||
f->getFriendWidget()->setAsInactiveChatroom();
|
||||
if (static_cast<GenericChatroomWidget*>(f->getFriendWidget()) == activeChatroomWidget)
|
||||
{
|
||||
activeChatroomWidget = nullptr;
|
||||
onAddClicked();
|
||||
}
|
||||
|
||||
FriendList::removeFriend(f->getFriendID(), fake);
|
||||
Nexus::getCore()->removeFriend(f->getFriendID(), fake);
|
||||
HistoryKeeper::getInstance()->removeFriendHistory(f->getToxID().publicKey);
|
||||
|
||||
delete f;
|
||||
if (ui->mainHead->layout()->isEmpty())
|
||||
onAddClicked();
|
||||
|
|
Loading…
Reference in New Issue
Block a user