diff --git a/src/gui/WelcomeWidget.cpp b/src/gui/WelcomeWidget.cpp index ed0ca2936a..9acb0a5752 100644 --- a/src/gui/WelcomeWidget.cpp +++ b/src/gui/WelcomeWidget.cpp @@ -16,6 +16,7 @@ * along with this program. If not, see . */ +#include #include "WelcomeWidget.h" #include "ui_WelcomeWidget.h" @@ -76,3 +77,11 @@ void WelcomeWidget::refreshLastDatabases() m_ui->recentListWidget->addItem(itm); } } + +void WelcomeWidget::keyPressEvent(QKeyEvent *event) { + if (m_ui->recentListWidget->hasFocus() && (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter)) { + openDatabaseFromFile(m_ui->recentListWidget->currentItem()); + } + + QWidget::keyPressEvent(event); +} diff --git a/src/gui/WelcomeWidget.h b/src/gui/WelcomeWidget.h index 1b24834374..53565902ff 100644 --- a/src/gui/WelcomeWidget.h +++ b/src/gui/WelcomeWidget.h @@ -43,6 +43,9 @@ class WelcomeWidget : public QWidget void importKeePass1Database(); void importCsv(); +protected: + void keyPressEvent(QKeyEvent *event) override; + private slots: void openDatabaseFromFile(QListWidgetItem* item);