From c75a136973a2eaae53223e7374a196c04b7aa6f6 Mon Sep 17 00:00:00 2001 From: Konstantinos Sideris Date: Mon, 26 Feb 2018 13:17:04 +0200 Subject: [PATCH] Enable room switcher only in the chat view (#251) --- include/MainWindow.h | 2 ++ src/MainWindow.cc | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/include/MainWindow.h b/include/MainWindow.h index 54a4766d..3aba736e 100644 --- a/include/MainWindow.h +++ b/include/MainWindow.h @@ -83,6 +83,8 @@ private slots: private: bool hasActiveUser(); void restoreWindowSize(); + //! Check if there is an open dialog. + bool hasActiveDialogs() const; static MainWindow *instance_; diff --git a/src/MainWindow.cc b/src/MainWindow.cc index 56aef005..ea30b694 100644 --- a/src/MainWindow.cc +++ b/src/MainWindow.cc @@ -118,7 +118,8 @@ MainWindow::MainWindow(QWidget *parent) QShortcut *quickSwitchShortcut = new QShortcut(QKeySequence("Ctrl+K"), this); connect(quickSwitchShortcut, &QShortcut::activated, this, [this]() { - chat_page_->showQuickSwitcher(); + if (chat_page_->isVisible() && !hasActiveDialogs()) + chat_page_->showQuickSwitcher(); }); QSettings settings; @@ -289,3 +290,10 @@ MainWindow::showOverlayProgressBar() progressModal_->show(); } } + +bool +MainWindow::hasActiveDialogs() const +{ + return (!leaveRoomModal_.isNull() && leaveRoomModal_->isVisible()) || + (!progressModal_.isNull() && progressModal_->isVisible()); +}