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

fix(friend): Add save friend alias on change

Fix #4706
This commit is contained in:
Diadlo 2017-11-22 22:52:04 +03:00
parent 5bc8ef4e74
commit c0a7488c12
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
2 changed files with 8 additions and 7 deletions

View File

@ -429,8 +429,4 @@ void FriendWidget::setAlias(const QString& _alias)
// Hack to avoid edit const Friend. TODO: Repalce on emit // Hack to avoid edit const Friend. TODO: Repalce on emit
Friend* f = FriendList::findFriend(frnd->getId()); Friend* f = FriendList::findFriend(frnd->getId());
f->setAlias(alias); f->setAlias(alias);
Settings& s = Settings::getInstance();
s.setFriendAlias(frnd->getPublicKey(), alias);
s.savePersonal();
} }

View File

@ -1099,10 +1099,10 @@ void Widget::onFriendAliasChanged(uint32_t friendId, const QString& alias)
GUI::setWindowTitle(alias); GUI::setWindowTitle(alias);
} }
Status s = f->getStatus(); Status status = f->getStatus();
contactListWidget->moveWidget(friendWidget, s); contactListWidget->moveWidget(friendWidget, status);
FilterCriteria criteria = getFilterCriteria(); FilterCriteria criteria = getFilterCriteria();
bool filter = s == Status::Offline ? filterOffline(criteria) : filterOnline(criteria); bool filter = status == Status::Offline ? filterOffline(criteria) : filterOnline(criteria);
friendWidget->searchName(ui->searchContactText->text(), filter); friendWidget->searchName(ui->searchContactText->text(), filter);
ChatForm* friendForm = chatForms[friendId]; ChatForm* friendForm = chatForms[friendId];
@ -1110,6 +1110,11 @@ void Widget::onFriendAliasChanged(uint32_t friendId, const QString& alias)
for (Group* g : GroupList::getAllGroups()) { for (Group* g : GroupList::getAllGroups()) {
g->regeneratePeerList(); g->regeneratePeerList();
} }
const ToxPk& pk = f->getPublicKey();
Settings& s = Settings::getInstance();
s.setFriendAlias(pk, alias);
s.savePersonal();
} }
void Widget::onChatroomWidgetClicked(GenericChatroomWidget* widget) void Widget::onChatroomWidgetClicked(GenericChatroomWidget* widget)