Enable room switcher only in the chat view (#251)

This commit is contained in:
Konstantinos Sideris 2018-02-26 13:17:04 +02:00
parent ea268d9761
commit c75a136973
2 changed files with 11 additions and 1 deletions

View file

@ -83,6 +83,8 @@ private slots:
private: private:
bool hasActiveUser(); bool hasActiveUser();
void restoreWindowSize(); void restoreWindowSize();
//! Check if there is an open dialog.
bool hasActiveDialogs() const;
static MainWindow *instance_; static MainWindow *instance_;

View file

@ -118,7 +118,8 @@ MainWindow::MainWindow(QWidget *parent)
QShortcut *quickSwitchShortcut = new QShortcut(QKeySequence("Ctrl+K"), this); QShortcut *quickSwitchShortcut = new QShortcut(QKeySequence("Ctrl+K"), this);
connect(quickSwitchShortcut, &QShortcut::activated, this, [this]() { connect(quickSwitchShortcut, &QShortcut::activated, this, [this]() {
chat_page_->showQuickSwitcher(); if (chat_page_->isVisible() && !hasActiveDialogs())
chat_page_->showQuickSwitcher();
}); });
QSettings settings; QSettings settings;
@ -289,3 +290,10 @@ MainWindow::showOverlayProgressBar()
progressModal_->show(); progressModal_->show();
} }
} }
bool
MainWindow::hasActiveDialogs() const
{
return (!leaveRoomModal_.isNull() && leaveRoomModal_->isVisible()) ||
(!progressModal_.isNull() && progressModal_->isVisible());
}