mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-09-01 06:55:58 +00:00
Separate window for forums/topics/sublists/archive.
This commit is contained in:
@@ -562,6 +562,8 @@ void Widget::chosenRow(const ChosenRow &row) {
|
||||
if (topicJump) {
|
||||
if (controller()->shownForum().current() == topicJump->forum()) {
|
||||
controller()->closeForum();
|
||||
} else if (row.newWindow) {
|
||||
controller()->showInNewWindow(Window::SeparateId(topicJump));
|
||||
} else {
|
||||
if (!controller()->adaptive().isOneColumn()) {
|
||||
controller()->showForum(
|
||||
@@ -575,11 +577,17 @@ void Widget::chosenRow(const ChosenRow &row) {
|
||||
}
|
||||
return;
|
||||
} else if (const auto topic = row.key.topic()) {
|
||||
session().data().saveViewAsMessages(topic->forum(), false);
|
||||
controller()->showThread(
|
||||
topic,
|
||||
row.message.fullId.msg,
|
||||
Window::SectionShow::Way::ClearStack);
|
||||
if (row.newWindow) {
|
||||
controller()->showInNewWindow(
|
||||
Window::SeparateId(topic),
|
||||
row.message.fullId.msg);
|
||||
} else {
|
||||
session().data().saveViewAsMessages(topic->forum(), false);
|
||||
controller()->showThread(
|
||||
topic,
|
||||
row.message.fullId.msg,
|
||||
Window::SectionShow::Way::ClearStack);
|
||||
}
|
||||
} else if (history
|
||||
&& row.userpicClick
|
||||
&& (row.message.fullId.msg == ShowAtUnreadMsgId)
|
||||
@@ -595,16 +603,19 @@ void Widget::chosenRow(const ChosenRow &row) {
|
||||
const auto forum = history->peer->forum();
|
||||
if (controller()->shownForum().current() == forum) {
|
||||
controller()->closeForum();
|
||||
return;
|
||||
}
|
||||
controller()->showForum(
|
||||
forum,
|
||||
Window::SectionShow().withChildColumn());
|
||||
if (forum->channel()->viewForumAsMessages()) {
|
||||
controller()->showThread(
|
||||
history,
|
||||
ShowAtUnreadMsgId,
|
||||
Window::SectionShow::Way::ClearStack);
|
||||
} else if (row.newWindow) {
|
||||
controller()->showInNewWindow(
|
||||
Window::SeparateId(Window::SeparateType::Forum, history));
|
||||
} else {
|
||||
controller()->showForum(
|
||||
forum,
|
||||
Window::SectionShow().withChildColumn());
|
||||
if (forum->channel()->viewForumAsMessages()) {
|
||||
controller()->showThread(
|
||||
history,
|
||||
ShowAtUnreadMsgId,
|
||||
Window::SectionShow::Way::ClearStack);
|
||||
}
|
||||
}
|
||||
return;
|
||||
} else if (history) {
|
||||
@@ -630,6 +641,12 @@ void Widget::chosenRow(const ChosenRow &row) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (row.newWindow) {
|
||||
controller()->showInNewWindow(Window::SeparateId(
|
||||
Window::SeparateType::Archive,
|
||||
&session()));
|
||||
return;
|
||||
}
|
||||
controller()->openFolder(folder);
|
||||
hideChildList();
|
||||
}
|
||||
@@ -1847,13 +1864,21 @@ void Widget::slideFinished() {
|
||||
|
||||
void Widget::escape() {
|
||||
if (!cancelSearch({ .jumpBackToSearchedChat = true })) {
|
||||
if (controller()->shownForum().current()) {
|
||||
controller()->closeForum();
|
||||
if (const auto forum = controller()->shownForum().current()) {
|
||||
const auto id = controller()->windowId();
|
||||
const auto initial = id.forum();
|
||||
if (!initial) {
|
||||
controller()->closeForum();
|
||||
} else if (initial != forum) {
|
||||
controller()->showForum(initial);
|
||||
}
|
||||
} else if (controller()->openedFolder().current()) {
|
||||
controller()->closeFolder();
|
||||
if (!controller()->windowId().folder()) {
|
||||
controller()->closeFolder();
|
||||
}
|
||||
} else if (controller()->activeChatEntryCurrent().key) {
|
||||
controller()->content()->dialogsCancelled();
|
||||
} else {
|
||||
} else if (controller()->isPrimary()) {
|
||||
const auto filters = &session().data().chatsFilters();
|
||||
const auto &list = filters->list();
|
||||
const auto first = list.empty() ? FilterId() : list.front().id();
|
||||
@@ -2704,6 +2729,9 @@ void Widget::updateForceDisplayWide() {
|
||||
void Widget::showForum(
|
||||
not_null<Data::Forum*> forum,
|
||||
const Window::SectionShow ¶ms) {
|
||||
if (_openedForum == forum) {
|
||||
return;
|
||||
}
|
||||
const auto nochat = !controller()->mainSectionShown();
|
||||
if (!params.childColumn
|
||||
|| (Core::App().settings().dialogsWidthRatio(nochat) == 0.)
|
||||
|
Reference in New Issue
Block a user