Skip to content

Commit

Permalink
Enable room switcher only in the chat view (mujx#251)
Browse files Browse the repository at this point in the history
  • Loading branch information
mujx committed Feb 26, 2018
1 parent dc1cedd commit eb1d954
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions include/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ private slots:
private:
bool hasActiveUser();
void restoreWindowSize();
//! Check if there is an open dialog.
bool hasActiveDialogs() const;

static MainWindow *instance_;

Expand Down
10 changes: 9 additions & 1 deletion src/MainWindow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -289,3 +290,10 @@ MainWindow::showOverlayProgressBar()
progressModal_->show();
}
}

bool
MainWindow::hasActiveDialogs() const
{
return (!leaveRoomModal_.isNull() && leaveRoomModal_->isVisible()) ||
(!progressModal_.isNull() && progressModal_->isVisible());
}

0 comments on commit eb1d954

Please sign in to comment.