Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
fix(friend): Add save friend alias on change
Browse files Browse the repository at this point in the history
Fix #4706
  • Loading branch information
Diadlo committed Nov 24, 2017
1 parent 5bc8ef4 commit c0a7488
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 0 additions & 4 deletions src/widget/friendwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,4 @@ void FriendWidget::setAlias(const QString& _alias)
// Hack to avoid edit const Friend. TODO: Repalce on emit
Friend* f = FriendList::findFriend(frnd->getId());
f->setAlias(alias);

Settings& s = Settings::getInstance();
s.setFriendAlias(frnd->getPublicKey(), alias);
s.savePersonal();
}
11 changes: 8 additions & 3 deletions src/widget/widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1099,17 +1099,22 @@ void Widget::onFriendAliasChanged(uint32_t friendId, const QString& alias)
GUI::setWindowTitle(alias);
}

Status s = f->getStatus();
contactListWidget->moveWidget(friendWidget, s);
Status status = f->getStatus();
contactListWidget->moveWidget(friendWidget, status);
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);

ChatForm* friendForm = chatForms[friendId];
friendForm->setName(alias);
for (Group* g : GroupList::getAllGroups()) {
g->regeneratePeerList();
}

const ToxPk& pk = f->getPublicKey();
Settings& s = Settings::getInstance();
s.setFriendAlias(pk, alias);
s.savePersonal();
}

void Widget::onChatroomWidgetClicked(GenericChatroomWidget* widget)
Expand Down

0 comments on commit c0a7488

Please sign in to comment.