mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-30 01:08:02 +00:00
Merge tag 'v4.14.6' into dev
# Conflicts: # Telegram/Resources/winrc/Telegram.rc # Telegram/Resources/winrc/Updater.rc # Telegram/SourceFiles/core/version.h # Telegram/SourceFiles/dialogs/dialogs_widget.cpp # Telegram/SourceFiles/dialogs/dialogs_widget.h # Telegram/SourceFiles/history/history_item_helpers.cpp # Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp # Telegram/lib_ui # lib/xdg/org.telegram.desktop.metainfo.xml # snap/snapcraft.yaml
This commit is contained in:
@@ -1228,19 +1228,48 @@ void SessionController::showGiftPremiumsBox(const QString &ref) {
|
||||
|
||||
void SessionController::init() {
|
||||
if (session().supportMode()) {
|
||||
initSupportMode();
|
||||
session().supportHelper().registerWindow(this);
|
||||
}
|
||||
setupShortcuts();
|
||||
}
|
||||
|
||||
void SessionController::initSupportMode() {
|
||||
session().supportHelper().registerWindow(this);
|
||||
|
||||
void SessionController::setupShortcuts() {
|
||||
Shortcuts::Requests(
|
||||
) | rpl::filter([=] {
|
||||
return (Core::App().activeWindow() == &window());
|
||||
return (Core::App().activeWindow() == &window())
|
||||
&& !isLayerShown()
|
||||
&& !window().locked();
|
||||
}) | rpl::start_with_next([=](not_null<Shortcuts::Request*> request) {
|
||||
using C = Shortcuts::Command;
|
||||
|
||||
const auto app = &Core::App();
|
||||
const auto accountsCount = int(app->domain().accounts().size());
|
||||
auto &&accounts = ranges::views::zip(
|
||||
Shortcuts::kShowAccount,
|
||||
ranges::views::ints(0, accountsCount));
|
||||
for (const auto &[command, index] : accounts) {
|
||||
request->check(command) && request->handle([=] {
|
||||
const auto list = app->domain().orderedAccounts();
|
||||
if (index >= list.size()) {
|
||||
return false;
|
||||
}
|
||||
const auto account = list[index];
|
||||
if (account == &session().account()) {
|
||||
return false;
|
||||
}
|
||||
const auto window = app->separateWindowForAccount(account);
|
||||
if (window) {
|
||||
window->activate();
|
||||
} else {
|
||||
app->domain().maybeActivate(account);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
if (!session().supportMode()) {
|
||||
return;
|
||||
}
|
||||
request->check(C::SupportHistoryBack) && request->handle([=] {
|
||||
return chatEntryHistoryMove(-1);
|
||||
});
|
||||
@@ -2722,7 +2751,7 @@ void SessionController::openPeerStories(
|
||||
HistoryView::PaintContext SessionController::preparePaintContext(
|
||||
PaintContextArgs &&args) {
|
||||
const auto visibleAreaTopLocal = content()->mapFromGlobal(
|
||||
QPoint(0, args.visibleAreaTopGlobal)).y();
|
||||
args.visibleAreaPositionGlobal).y();
|
||||
const auto viewport = QRect(
|
||||
0,
|
||||
args.visibleAreaTop - visibleAreaTopLocal,
|
||||
|
||||
Reference in New Issue
Block a user