mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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.h"
|
||||||
#include "main/main_session_settings.h"
|
#include "main/main_session_settings.h"
|
||||||
#include "window/notifications_manager.h"
|
#include "window/notifications_manager.h"
|
||||||
|
#include "window/window_controller.h"
|
||||||
#include "window/window_session_controller.h"
|
#include "window/window_session_controller.h"
|
||||||
#include "window/window_peer_menu.h"
|
#include "window/window_peer_menu.h"
|
||||||
#include "ui/widgets/multi_select.h"
|
#include "ui/widgets/multi_select.h"
|
||||||
|
@ -3011,7 +3012,9 @@ void InnerWidget::updateRowCornerStatusShown(
|
||||||
void InnerWidget::setupShortcuts() {
|
void InnerWidget::setupShortcuts() {
|
||||||
Shortcuts::Requests(
|
Shortcuts::Requests(
|
||||||
) | rpl::filter([=] {
|
) | rpl::filter([=] {
|
||||||
return isActiveWindow() && !Ui::isLayerShown();
|
return isActiveWindow()
|
||||||
|
&& !Ui::isLayerShown()
|
||||||
|
&& !_controller->window().locked();
|
||||||
}) | rpl::start_with_next([=](not_null<Shortcuts::Request*> request) {
|
}) | rpl::start_with_next([=](not_null<Shortcuts::Request*> request) {
|
||||||
using Command = Shortcuts::Command;
|
using Command = Shortcuts::Command;
|
||||||
|
|
||||||
|
|
|
@ -1257,8 +1257,9 @@ void MainWidget::ui_showPeerHistory(
|
||||||
PeerId peerId,
|
PeerId peerId,
|
||||||
const SectionShow ¶ms,
|
const SectionShow ¶ms,
|
||||||
MsgId showAtMsgId) {
|
MsgId showAtMsgId) {
|
||||||
|
if (peerId && _controller->window().locked()) {
|
||||||
if (auto peer = session().data().peerLoaded(peerId)) {
|
return;
|
||||||
|
} else if (auto peer = session().data().peerLoaded(peerId)) {
|
||||||
if (peer->migrateTo()) {
|
if (peer->migrateTo()) {
|
||||||
peer = peer->migrateTo();
|
peer = peer->migrateTo();
|
||||||
peerId = peer->id;
|
peerId = peer->id;
|
||||||
|
@ -1579,6 +1580,9 @@ void MainWidget::showNewSection(
|
||||||
const SectionShow ¶ms) {
|
const SectionShow ¶ms) {
|
||||||
using Column = Window::Column;
|
using Column = Window::Column;
|
||||||
|
|
||||||
|
if (_controller->window().locked()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
auto saveInStack = (params.way == SectionShow::Way::Forward);
|
auto saveInStack = (params.way == SectionShow::Way::Forward);
|
||||||
const auto thirdSectionTop = getThirdSectionTop();
|
const auto thirdSectionTop = getThirdSectionTop();
|
||||||
const auto newThirdGeometry = QRect(
|
const auto newThirdGeometry = QRect(
|
||||||
|
|
|
@ -485,17 +485,15 @@ void MainWindow::createGlobalMenu() {
|
||||||
QMenu *window = psMainMenu.addMenu(tr::lng_mac_menu_window(tr::now));
|
QMenu *window = psMainMenu.addMenu(tr::lng_mac_menu_window(tr::now));
|
||||||
psContacts = window->addAction(tr::lng_mac_menu_contacts(tr::now));
|
psContacts = window->addAction(tr::lng_mac_menu_contacts(tr::now));
|
||||||
connect(psContacts, &QAction::triggered, psContacts, crl::guard(this, [=] {
|
connect(psContacts, &QAction::triggered, psContacts, crl::guard(this, [=] {
|
||||||
if (isHidden()) {
|
Expects(sessionController() != nullptr && !controller().locked());
|
||||||
showFromTray();
|
|
||||||
}
|
ensureWindowShown();
|
||||||
if (!sessionController()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
sessionController()->show(PrepareContactsBox(sessionController()));
|
sessionController()->show(PrepareContactsBox(sessionController()));
|
||||||
}));
|
}));
|
||||||
{
|
{
|
||||||
auto callback = [=] {
|
auto callback = [=] {
|
||||||
Expects(sessionController() != nullptr);
|
Expects(sessionController() != nullptr && !controller().locked());
|
||||||
|
|
||||||
ensureWindowShown();
|
ensureWindowShown();
|
||||||
sessionController()->showAddContact();
|
sessionController()->showAddContact();
|
||||||
};
|
};
|
||||||
|
@ -507,7 +505,8 @@ void MainWindow::createGlobalMenu() {
|
||||||
window->addSeparator();
|
window->addSeparator();
|
||||||
{
|
{
|
||||||
auto callback = [=] {
|
auto callback = [=] {
|
||||||
Expects(sessionController() != nullptr);
|
Expects(sessionController() != nullptr && !controller().locked());
|
||||||
|
|
||||||
ensureWindowShown();
|
ensureWindowShown();
|
||||||
sessionController()->showNewGroup();
|
sessionController()->showNewGroup();
|
||||||
};
|
};
|
||||||
|
@ -518,7 +517,8 @@ void MainWindow::createGlobalMenu() {
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
auto callback = [=] {
|
auto callback = [=] {
|
||||||
Expects(sessionController() != nullptr);
|
Expects(sessionController() != nullptr && !controller().locked());
|
||||||
|
|
||||||
ensureWindowShown();
|
ensureWindowShown();
|
||||||
sessionController()->showNewChannel();
|
sessionController()->showNewChannel();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue