mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-09-02 07:25:46 +00:00
Fixed lock by local passcode for non-primary windows.
This commit is contained in:
@@ -438,27 +438,29 @@ void Application::startSystemDarkModeViewer() {
|
|||||||
}, _lifetime);
|
}, _lifetime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Application::enumerateWindows(Fn<void(
|
||||||
|
not_null<Window::Controller*>)> callback) const {
|
||||||
|
if (_primaryWindow) {
|
||||||
|
callback(_primaryWindow.get());
|
||||||
|
}
|
||||||
|
for (const auto &window : ranges::views::values(_secondaryWindows)) {
|
||||||
|
callback(window.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Application::startTray() {
|
void Application::startTray() {
|
||||||
using WindowRaw = not_null<Window::Controller*>;
|
using WindowRaw = not_null<Window::Controller*>;
|
||||||
const auto enumerate = [=](Fn<void(WindowRaw)> c) {
|
|
||||||
if (_primaryWindow) {
|
|
||||||
c(_primaryWindow.get());
|
|
||||||
}
|
|
||||||
for (const auto &window : ranges::views::values(_secondaryWindows)) {
|
|
||||||
c(window.get());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
_tray->create();
|
_tray->create();
|
||||||
_tray->aboutToShowRequests(
|
_tray->aboutToShowRequests(
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
enumerate([&](WindowRaw w) { w->updateIsActive(); });
|
enumerateWindows([&](WindowRaw w) { w->updateIsActive(); });
|
||||||
_tray->updateMenuText();
|
_tray->updateMenuText();
|
||||||
}, _primaryWindow->widget()->lifetime());
|
}, _primaryWindow->widget()->lifetime());
|
||||||
|
|
||||||
_tray->showFromTrayRequests(
|
_tray->showFromTrayRequests(
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
const auto last = _lastActiveWindow;
|
const auto last = _lastActiveWindow;
|
||||||
enumerate([&](WindowRaw w) { w->widget()->showFromTray(); });
|
enumerateWindows([&](WindowRaw w) { w->widget()->showFromTray(); });
|
||||||
if (last) {
|
if (last) {
|
||||||
last->widget()->showFromTray();
|
last->widget()->showFromTray();
|
||||||
}
|
}
|
||||||
@@ -466,7 +468,7 @@ void Application::startTray() {
|
|||||||
|
|
||||||
_tray->hideToTrayRequests(
|
_tray->hideToTrayRequests(
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
enumerate([&](WindowRaw w) { w->widget()->minimizeToTray(); });
|
enumerateWindows([&](WindowRaw w) { w->widget()->minimizeToTray(); });
|
||||||
}, _primaryWindow->widget()->lifetime());
|
}, _primaryWindow->widget()->lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1012,18 +1014,18 @@ void Application::preventOrInvoke(Fn<void()> &&callback) {
|
|||||||
|
|
||||||
void Application::lockByPasscode() {
|
void Application::lockByPasscode() {
|
||||||
preventOrInvoke([=] {
|
preventOrInvoke([=] {
|
||||||
if (_primaryWindow) {
|
enumerateWindows([&](not_null<Window::Controller*> w) {
|
||||||
_passcodeLock = true;
|
_passcodeLock = true;
|
||||||
_primaryWindow->setupPasscodeLock();
|
w->setupPasscodeLock();
|
||||||
}
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::unlockPasscode() {
|
void Application::unlockPasscode() {
|
||||||
clearPasscodeLock();
|
clearPasscodeLock();
|
||||||
if (_primaryWindow) {
|
enumerateWindows([&](not_null<Window::Controller*> w) {
|
||||||
_primaryWindow->clearPasscodeLock();
|
w->clearPasscodeLock();
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::clearPasscodeLock() {
|
void Application::clearPasscodeLock() {
|
||||||
|
@@ -324,6 +324,9 @@ private:
|
|||||||
void startSystemDarkModeViewer();
|
void startSystemDarkModeViewer();
|
||||||
void startTray();
|
void startTray();
|
||||||
|
|
||||||
|
void enumerateWindows(
|
||||||
|
Fn<void(not_null<Window::Controller*>)> callback) const;
|
||||||
|
|
||||||
friend void QuitAttempt();
|
friend void QuitAttempt();
|
||||||
void quitDelayed();
|
void quitDelayed();
|
||||||
[[nodiscard]] bool readyToQuit();
|
[[nodiscard]] bool readyToQuit();
|
||||||
|
Reference in New Issue
Block a user