Move ctrl-k callback to the MainWindow

This commit is contained in:
Konstantinos Sideris 2017-10-20 21:39:05 +03:00
parent 9b60fdd620
commit 8a9a513ecd
4 changed files with 11 additions and 13 deletions

View File

@ -48,6 +48,7 @@ public:
// Initialize all the components of the UI.
void bootstrap(QString userid, QString homeserver, QString token);
void showQuickSwitcher();
signals:
void contentLoaded();
@ -69,14 +70,10 @@ private slots:
void addRoom(const QString &room_id);
void removeRoom(const QString &room_id);
protected:
void keyPressEvent(QKeyEvent *event) override;
private:
void updateTypingUsers(const QString &roomid, const QList<QString> &user_ids);
void updateDisplayNames(const RoomState &state);
void loadStateFromCache();
void showQuickSwitcher();
QHBoxLayout *topLayout_;
Splitter *splitter;

View File

@ -43,6 +43,7 @@ public:
protected:
void closeEvent(QCloseEvent *event);
void keyPressEvent(QKeyEvent *event);
private slots:
// Handle interaction with the tray icon.

View File

@ -576,15 +576,6 @@ ChatPage::loadStateFromCache()
client_->sync();
}
void
ChatPage::keyPressEvent(QKeyEvent *event)
{
if (event->key() == Qt::Key_K) {
if (event->modifiers() == Qt::ControlModifier)
showQuickSwitcher();
}
}
void
ChatPage::showQuickSwitcher()
{

View File

@ -100,6 +100,15 @@ MainWindow::MainWindow(QWidget *parent)
}
}
void
MainWindow::keyPressEvent(QKeyEvent *e)
{
if ((e->key() == Qt::Key_K) && (e->modifiers().testFlag(Qt::ControlModifier)))
chat_page_->showQuickSwitcher();
else
QMainWindow::keyPressEvent(e);
}
void
MainWindow::restoreWindowSize()
{