Move ctrl-k callback to the MainWindow

remotes/origin/HEAD
Konstantinos Sideris 7 years ago
parent 9b60fdd620
commit 8a9a513ecd
  1. 5
      include/ChatPage.h
  2. 1
      include/MainWindow.h
  3. 9
      src/ChatPage.cc
  4. 9
      src/MainWindow.cc

@ -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;

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

@ -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()
{

@ -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()
{

Loading…
Cancel
Save