mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge branch 'pr1605'
Ask to remove history Also adds ability to cancel friend removal
This commit is contained in:
commit
260918c1aa
|
@ -92,9 +92,6 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event)
|
||||||
}
|
}
|
||||||
else if (selectedItem == removeFriendAction)
|
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);
|
emit removeFriend(friendId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -858,15 +858,26 @@ void Widget::onFriendRequestReceived(const QString& userId, const QString& messa
|
||||||
|
|
||||||
void Widget::removeFriend(Friend* f, bool fake)
|
void Widget::removeFriend(Friend* f, bool fake)
|
||||||
{
|
{
|
||||||
|
QMessageBox::StandardButton removeFriendMB;
|
||||||
|
removeFriendMB = QMessageBox::question(0,
|
||||||
|
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();
|
f->getFriendWidget()->setAsInactiveChatroom();
|
||||||
if (static_cast<GenericChatroomWidget*>(f->getFriendWidget()) == activeChatroomWidget)
|
if (static_cast<GenericChatroomWidget*>(f->getFriendWidget()) == activeChatroomWidget)
|
||||||
{
|
{
|
||||||
activeChatroomWidget = nullptr;
|
activeChatroomWidget = nullptr;
|
||||||
onAddClicked();
|
onAddClicked();
|
||||||
}
|
}
|
||||||
|
|
||||||
FriendList::removeFriend(f->getFriendID(), fake);
|
FriendList::removeFriend(f->getFriendID(), fake);
|
||||||
Nexus::getCore()->removeFriend(f->getFriendID(), fake);
|
Nexus::getCore()->removeFriend(f->getFriendID(), fake);
|
||||||
HistoryKeeper::getInstance()->removeFriendHistory(f->getToxID().publicKey);
|
|
||||||
delete f;
|
delete f;
|
||||||
if (ui->mainHead->layout()->isEmpty())
|
if (ui->mainHead->layout()->isEmpty())
|
||||||
onAddClicked();
|
onAddClicked();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user