mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
fix(addfriendform, widget): Remove Accepted Request
Fix #3066. Fix #3166.
This commit is contained in:
parent
5966c84b84
commit
53071e952e
|
@ -173,6 +173,7 @@ void AddFriendForm::onSendTriggered()
|
|||
id = toxId.toString();
|
||||
}
|
||||
|
||||
deleteFriendRequest(id);
|
||||
if (id.toUpper() == Core::getInstance()->getSelfId().toString().toUpper())
|
||||
GUI::showWarning(tr("Couldn't add friend"), tr("You can't add yourself as a friend!","When trying to add your own Tox ID as friend"));
|
||||
else
|
||||
|
@ -222,6 +223,20 @@ void AddFriendForm::setIdFromClipboard()
|
|||
}
|
||||
}
|
||||
|
||||
void AddFriendForm::deleteFriendRequest(const QString& toxId)
|
||||
{
|
||||
int size = Settings::getInstance().getFriendRequestSize();
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
Settings::Request request = Settings::getInstance().getFriendRequest(i);
|
||||
if (ToxId(toxId) == ToxId(request.address))
|
||||
{
|
||||
Settings::getInstance().removeFriendRequest(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AddFriendForm::onFriendRequestAccepted()
|
||||
{
|
||||
QPushButton* acceptButton = static_cast<QPushButton*>(sender());
|
||||
|
|
|
@ -75,9 +75,10 @@ private:
|
|||
void removeFriendRequestWidget(QWidget *friendWidget);
|
||||
void retranslateAcceptButton(QPushButton* acceptButton);
|
||||
void retranslateRejectButton(QPushButton* rejectButton);
|
||||
void deleteFriendRequest(const QString &toxId);
|
||||
void setIdFromClipboard();
|
||||
|
||||
private:
|
||||
void setIdFromClipboard();
|
||||
QLabel headLabel, toxIdLabel, messageLabel;
|
||||
QPushButton sendButton;
|
||||
QLineEdit toxId;
|
||||
|
|
|
@ -392,6 +392,7 @@ void Widget::init()
|
|||
groupInvitesButton = nullptr;
|
||||
unreadGroupInvites = 0;
|
||||
|
||||
connect(addFriendForm, &AddFriendForm::friendRequested, this, &Widget::friendRequestsUpdate);
|
||||
connect(addFriendForm, &AddFriendForm::friendRequestsSeen, this, &Widget::friendRequestsUpdate);
|
||||
connect(addFriendForm, &AddFriendForm::friendRequestAccepted, this, &Widget::friendRequestAccepted);
|
||||
connect(groupInviteForm, &GroupInviteForm::groupInvitesSeen, this, &Widget::groupInvitesClear);
|
||||
|
|
Loading…
Reference in New Issue
Block a user