mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Add some checks for actions in a locked state.
This commit is contained in:
parent
6db537d1ec
commit
01c2be3f01
3 changed files with 19 additions and 12 deletions
|
@ -42,6 +42,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "main/main_session.h"
|
||||
#include "main/main_session_settings.h"
|
||||
#include "window/notifications_manager.h"
|
||||
#include "window/window_controller.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "window/window_peer_menu.h"
|
||||
#include "ui/widgets/multi_select.h"
|
||||
|
@ -3011,7 +3012,9 @@ void InnerWidget::updateRowCornerStatusShown(
|
|||
void InnerWidget::setupShortcuts() {
|
||||
Shortcuts::Requests(
|
||||
) | rpl::filter([=] {
|
||||
return isActiveWindow() && !Ui::isLayerShown();
|
||||
return isActiveWindow()
|
||||
&& !Ui::isLayerShown()
|
||||
&& !_controller->window().locked();
|
||||
}) | rpl::start_with_next([=](not_null<Shortcuts::Request*> request) {
|
||||
using Command = Shortcuts::Command;
|
||||
|
||||
|
|
|
@ -1257,8 +1257,9 @@ void MainWidget::ui_showPeerHistory(
|
|||
PeerId peerId,
|
||||
const SectionShow ¶ms,
|
||||
MsgId showAtMsgId) {
|
||||
|
||||
if (auto peer = session().data().peerLoaded(peerId)) {
|
||||
if (peerId && _controller->window().locked()) {
|
||||
return;
|
||||
} else if (auto peer = session().data().peerLoaded(peerId)) {
|
||||
if (peer->migrateTo()) {
|
||||
peer = peer->migrateTo();
|
||||
peerId = peer->id;
|
||||
|
@ -1579,6 +1580,9 @@ void MainWidget::showNewSection(
|
|||
const SectionShow ¶ms) {
|
||||
using Column = Window::Column;
|
||||
|
||||
if (_controller->window().locked()) {
|
||||
return;
|
||||
}
|
||||
auto saveInStack = (params.way == SectionShow::Way::Forward);
|
||||
const auto thirdSectionTop = getThirdSectionTop();
|
||||
const auto newThirdGeometry = QRect(
|
||||
|
|
|
@ -485,17 +485,15 @@ void MainWindow::createGlobalMenu() {
|
|||
QMenu *window = psMainMenu.addMenu(tr::lng_mac_menu_window(tr::now));
|
||||
psContacts = window->addAction(tr::lng_mac_menu_contacts(tr::now));
|
||||
connect(psContacts, &QAction::triggered, psContacts, crl::guard(this, [=] {
|
||||
if (isHidden()) {
|
||||
showFromTray();
|
||||
}
|
||||
if (!sessionController()) {
|
||||
return;
|
||||
}
|
||||
Expects(sessionController() != nullptr && !controller().locked());
|
||||
|
||||
ensureWindowShown();
|
||||
sessionController()->show(PrepareContactsBox(sessionController()));
|
||||
}));
|
||||
{
|
||||
auto callback = [=] {
|
||||
Expects(sessionController() != nullptr);
|
||||
Expects(sessionController() != nullptr && !controller().locked());
|
||||
|
||||
ensureWindowShown();
|
||||
sessionController()->showAddContact();
|
||||
};
|
||||
|
@ -507,7 +505,8 @@ void MainWindow::createGlobalMenu() {
|
|||
window->addSeparator();
|
||||
{
|
||||
auto callback = [=] {
|
||||
Expects(sessionController() != nullptr);
|
||||
Expects(sessionController() != nullptr && !controller().locked());
|
||||
|
||||
ensureWindowShown();
|
||||
sessionController()->showNewGroup();
|
||||
};
|
||||
|
@ -518,7 +517,8 @@ void MainWindow::createGlobalMenu() {
|
|||
}
|
||||
{
|
||||
auto callback = [=] {
|
||||
Expects(sessionController() != nullptr);
|
||||
Expects(sessionController() != nullptr && !controller().locked());
|
||||
|
||||
ensureWindowShown();
|
||||
sessionController()->showNewChannel();
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue