2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Add group/ungroup action in channel peer menu.

This commit is contained in:
John Preston
2018-01-23 19:51:12 +03:00
parent ced0c4d8f0
commit 65df137610
24 changed files with 347 additions and 118 deletions

View File

@@ -65,26 +65,56 @@ void Entry::cachePinnedIndex(int index) {
}
}
bool Entry::needUpdateInChatList() const {
return inChatList(Dialogs::Mode::All) || shouldBeInChatList();
}
void Entry::updateChatListSortPosition() {
_sortKeyInChatList = isPinnedDialog()
? PinnedDialogPos(_pinnedIndex)
: DialogPosFromDate(adjustChatListDate());
if (auto m = App::main()) {
if (needUpdateInChatList()) {
if (_sortKeyInChatList) {
m->createDialog(_key);
updateChatListEntry();
} else {
removeDialog();
}
if (needUpdateInChatList()) {
setChatListExistence(true);
}
}
void Entry::updateChatListExistence() {
setChatListExistence(shouldBeInChatList());
}
void Entry::setChatListExistence(bool exists) {
if (const auto main = App::main()) {
if (exists && _sortKeyInChatList) {
main->createDialog(_key);
updateChatListEntry();
} else {
main->removeDialog(_key);
}
}
}
void Entry::removeDialog() {
if (const auto main = App::main()) {
main->removeDialog(_key);
}
QDateTime Entry::adjustChatListDate() const {
return chatsListDate();
}
void Entry::changedInChatListHook(Dialogs::Mode list, bool added) {
}
void Entry::changedChatListPinHook() {
}
RowsByLetter &Entry::chatListLinks(Mode list) {
return _chatListLinks[static_cast<int>(list)];
}
const RowsByLetter &Entry::chatListLinks(Mode list) const {
return _chatListLinks[static_cast<int>(list)];
}
Row *Entry::mainChatListLink(Mode list) const {
auto it = chatListLinks(list).find(0);
Assert(it != chatListLinks(list).cend());
return it->second;
}
PositionChange Entry::adjustByPosInChatList(
@@ -99,7 +129,7 @@ PositionChange Entry::adjustByPosInChatList(
void Entry::setChatsListDate(const QDateTime &date) {
if (!_lastMessageDate.isNull() && _lastMessageDate >= date) {
if (!needUpdateInChatList() || !inChatList(Dialogs::Mode::All)) {
if (!inChatList(Dialogs::Mode::All)) {
return;
}
}