mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Added saving of scroll state in dialogs widget for restoring from forum.
This commit is contained in:
parent
c320917069
commit
629314cfa2
3 changed files with 27 additions and 11 deletions
|
@ -426,6 +426,9 @@ void InnerWidget::changeOpenedForum(ChannelData *forum) {
|
||||||
stopReorderPinned();
|
stopReorderPinned();
|
||||||
clearSelection();
|
clearSelection();
|
||||||
|
|
||||||
|
if (forum) {
|
||||||
|
saveChatsFilterScrollState(_filterId);
|
||||||
|
}
|
||||||
_filterId = forum
|
_filterId = forum
|
||||||
? 0
|
? 0
|
||||||
: _controller->activeChatsFilterCurrent();
|
: _controller->activeChatsFilterCurrent();
|
||||||
|
@ -450,6 +453,10 @@ void InnerWidget::changeOpenedForum(ChannelData *forum) {
|
||||||
if (_loadMoreCallback) {
|
if (_loadMoreCallback) {
|
||||||
_loadMoreCallback();
|
_loadMoreCallback();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!forum) {
|
||||||
|
restoreChatsFilterScrollState(_filterId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InnerWidget::paintEvent(QPaintEvent *e) {
|
void InnerWidget::paintEvent(QPaintEvent *e) {
|
||||||
|
@ -2971,7 +2978,7 @@ void InnerWidget::switchToFilter(FilterId filterId) {
|
||||||
_mustScrollTo.fire({ 0, 0 });
|
_mustScrollTo.fire({ 0, 0 });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_chatsFilterScrollStates[_filterId] = -pos().y();
|
saveChatsFilterScrollState(_filterId);
|
||||||
if (_openedFolder) {
|
if (_openedFolder) {
|
||||||
_filterId = filterId;
|
_filterId = filterId;
|
||||||
} else {
|
} else {
|
||||||
|
@ -2982,18 +2989,26 @@ void InnerWidget::switchToFilter(FilterId filterId) {
|
||||||
}
|
}
|
||||||
refreshEmptyLabel();
|
refreshEmptyLabel();
|
||||||
{
|
{
|
||||||
const auto it = _chatsFilterScrollStates.find(filterId);
|
const auto skip = found
|
||||||
if (it != end(_chatsFilterScrollStates)) {
|
// Don't save a scroll state for very flexible chat filters.
|
||||||
const auto skip = found
|
&& (filterIt->flags() & (Data::ChatFilter::Flag::NoRead));
|
||||||
// Don't save a scroll state for very flexible chat filters.
|
if (!skip) {
|
||||||
&& (filterIt->flags() & (Data::ChatFilter::Flag::NoRead));
|
restoreChatsFilterScrollState(filterId);
|
||||||
if (!skip) {
|
|
||||||
_mustScrollTo.fire({ it->second, -1 });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InnerWidget::saveChatsFilterScrollState(FilterId filterId) {
|
||||||
|
_chatsFilterScrollStates[filterId] = -pos().y();
|
||||||
|
}
|
||||||
|
|
||||||
|
void InnerWidget::restoreChatsFilterScrollState(FilterId filterId) {
|
||||||
|
const auto it = _chatsFilterScrollStates.find(filterId);
|
||||||
|
if (it != end(_chatsFilterScrollStates)) {
|
||||||
|
_mustScrollTo.fire({ it->second, -1 });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool InnerWidget::chooseHashtag() {
|
bool InnerWidget::chooseHashtag() {
|
||||||
if (_state != WidgetState::Filtered) {
|
if (_state != WidgetState::Filtered) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -357,6 +357,9 @@ private:
|
||||||
void handleChatListEntryRefreshes();
|
void handleChatListEntryRefreshes();
|
||||||
void moveCancelSearchButtons();
|
void moveCancelSearchButtons();
|
||||||
|
|
||||||
|
void saveChatsFilterScrollState(FilterId filterId);
|
||||||
|
void restoreChatsFilterScrollState(FilterId filterId);
|
||||||
|
|
||||||
const not_null<Window::SessionController*> _controller;
|
const not_null<Window::SessionController*> _controller;
|
||||||
|
|
||||||
FilterId _filterId = 0;
|
FilterId _filterId = 0;
|
||||||
|
|
|
@ -17,8 +17,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/text/text_options.h"
|
#include "ui/text/text_options.h"
|
||||||
|
|
||||||
TextForMimeData HistoryItemText(not_null<HistoryItem*> item) {
|
TextForMimeData HistoryItemText(not_null<HistoryItem*> item) {
|
||||||
const auto media = item->media();
|
|
||||||
|
|
||||||
auto textResult = item->clipboardText();
|
auto textResult = item->clipboardText();
|
||||||
auto logEntryOriginalResult = [&] {
|
auto logEntryOriginalResult = [&] {
|
||||||
const auto entry = item->Get<HistoryMessageLogEntryOriginal>();
|
const auto entry = item->Get<HistoryMessageLogEntryOriginal>();
|
||||||
|
|
Loading…
Add table
Reference in a new issue