1
0
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:
agilob 2015-05-10 10:12:49 +01:00
parent b8d57cf43a
commit 69972e0d80
2 changed files with 13 additions and 5 deletions

View File

@ -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;
}

View File

@ -858,15 +858,26 @@ 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();