2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-02 15:45:12 +00:00

Updated TDesktop sources to 2.6

This commit is contained in:
RadRussianRus
2021-02-25 00:09:00 +03:00
574 changed files with 17884 additions and 8895 deletions

View File

@@ -301,14 +301,27 @@ MainWidget::MainWidget(
session().changes().historyUpdates(
Data::HistoryUpdate::Flag::MessageSent
| Data::HistoryUpdate::Flag::LocalDraftSet
) | rpl::start_with_next([=](const Data::HistoryUpdate &update) {
const auto history = update.history;
history->forgetScrollState();
if (const auto from = history->peer->migrateFrom()) {
if (const auto migrated = history->owner().historyLoaded(from)) {
migrated->forgetScrollState();
if (update.flags & Data::HistoryUpdate::Flag::MessageSent) {
history->forgetScrollState();
if (const auto from = history->peer->migrateFrom()) {
auto &owner = history->owner();
if (const auto migrated = owner.historyLoaded(from)) {
migrated->forgetScrollState();
}
}
}
if (update.flags & Data::HistoryUpdate::Flag::LocalDraftSet) {
const auto opened = (_history->peer() == history->peer.get());
if (opened) {
_history->applyDraft();
} else {
Ui::showPeerHistory(history, ShowAtUnreadMsgId);
}
Ui::hideLayer();
}
}, lifetime());
// MSVC BUG + REGRESSION rpl::mappers::tuple :(
@@ -535,14 +548,15 @@ bool MainWidget::shareUrl(
QFIXED_MAX
};
auto history = peer->owner().history(peer);
history->setLocalDraft(
std::make_unique<Data::Draft>(textWithTags, 0, cursor, false));
history->setLocalDraft(std::make_unique<Data::Draft>(
textWithTags,
0,
cursor,
Data::PreviewState::Allowed));
history->clearLocalEditDraft();
if (_history->peer() == peer) {
_history->applyDraft();
} else {
Ui::showPeerHistory(peer, ShowAtUnreadMsgId);
}
history->session().changes().historyUpdated(
history,
Data::HistoryUpdate::Flag::LocalDraftSet);
return true;
}
@@ -565,14 +579,15 @@ bool MainWidget::inlineSwitchChosen(PeerId peerId, const QString &botAndQuery) {
const auto h = peer->owner().history(peer);
TextWithTags textWithTags = { botAndQuery, TextWithTags::Tags() };
MessageCursor cursor = { botAndQuery.size(), botAndQuery.size(), QFIXED_MAX };
h->setLocalDraft(std::make_unique<Data::Draft>(textWithTags, 0, cursor, false));
h->setLocalDraft(std::make_unique<Data::Draft>(
textWithTags,
0,
cursor,
Data::PreviewState::Allowed));
h->clearLocalEditDraft();
const auto opened = _history->peer() && (_history->peer() == peer);
if (opened) {
_history->applyDraft();
} else {
Ui::showPeerHistory(peer, ShowAtUnreadMsgId);
}
h->session().changes().historyUpdated(
h,
Data::HistoryUpdate::Flag::LocalDraftSet);
return true;
}
@@ -625,10 +640,6 @@ void MainWidget::notify_showScheduledButtonChanged() {
_history->notify_showScheduledButtonChanged();
}
MsgId MainWidget::highlightedOriginalId() const {
return _history->highlightOrigId();
}
void MainWidget::clearHider(not_null<Window::HistoryHider*> instance) {
if (_hider != instance) {
return;
@@ -1407,6 +1418,21 @@ void MainWidget::ctrlEnterSubmitUpdated() {
_history->updateFieldSubmitSettings();
}
void MainWidget::showChooseReportMessages(
not_null<PeerData*> peer,
Ui::ReportReason reason,
Fn<void(MessageIdsList)> done) {
_history->setChooseReportMessagesDetails(reason, std::move(done));
ui_showPeerHistory(
peer->id,
SectionShow::Way::Forward,
ShowForChooseMessagesMsgId);
}
void MainWidget::clearChooseReportMessages() {
_history->setChooseReportMessagesDetails({}, nullptr);
}
void MainWidget::ui_showPeerHistory(
PeerId peerId,
const SectionShow &params,
@@ -2414,7 +2440,7 @@ void MainWidget::ensureThirdColumnResizeAreaCreated() {
if (!Adaptive::ThreeColumn() || !_thirdSection) {
return;
}
Core::App().settings().setThirdColumnWidth(snap(
Core::App().settings().setThirdColumnWidth(std::clamp(
Core::App().settings().thirdColumnWidth(),
st::columnMinimalWidthThird,
st::columnMaximalWidthThird));