From e11b32ed54822684c70c04f8b671a2727c1f6eda Mon Sep 17 00:00:00 2001 From: mgrojo Date: Sun, 24 Jun 2018 20:39:59 +0200 Subject: [PATCH] Issue #1432: Popup menu in "Open Database" A popup menu has been added in the "Open Database" button. A normal click selects the "Open Database..." action as before. A delayed click opens the popup menu for selecting either the "Open Database..." action or the "Open Database Read Only..." action. --- src/MainWindow.cpp | 5 +++++ src/MainWindow.h | 1 + src/MainWindow.ui | 42 +++++++++++++++++++++++++++++++++++++++++- 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index cef6705a..4c77e54a 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -175,6 +175,11 @@ void MainWindow::init() popupTableMenu->addAction(ui->actionEditCopyCreateStatement); popupTableMenu->addAction(ui->actionExportCsvPopup); + popupOpenDbMenu = new QMenu(this); + popupOpenDbMenu->addAction(ui->fileOpenAction); + popupOpenDbMenu->addAction(ui->fileOpenReadOnlyAction); + ui->fileOpenActionPopup->setMenu(popupOpenDbMenu); + popupSaveSqlFileMenu = new QMenu(this); popupSaveSqlFileMenu->addAction(ui->actionSqlSaveFile); popupSaveSqlFileMenu->addAction(ui->actionSqlSaveFileAs); diff --git a/src/MainWindow.h b/src/MainWindow.h index 714ea087..40913755 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -145,6 +145,7 @@ private: QMenu* popupTableMenu; QMenu* recentFilesMenu; + QMenu* popupOpenDbMenu; QMenu* popupSaveSqlFileMenu; QMenu* popupSaveSqlResultsMenu; QMenu* popupSaveFilterAsMenu; diff --git a/src/MainWindow.ui b/src/MainWindow.ui index 57efc2a4..bb9976ef 100644 --- a/src/MainWindow.ui +++ b/src/MainWindow.ui @@ -981,7 +981,7 @@ You can drag SQL statements from an object row and drop them into other applicat false - + @@ -2069,6 +2069,30 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed This button saves the current setting of the browsed table (filters, display formats and order column) as an SQL view that you can later browse or use in SQL statements. + + + + :/icons/db_open:/icons/db_open + + + &Open Database... + + + Open an existing database file + + + Open an existing database file + + + This option is used to open an existing database file. + + + Ctrl+O + + + QAction::TextHeuristicRole + + @@ -3361,6 +3385,22 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed + + fileOpenActionPopup + triggered() + MainWindow + fileOpen() + + + -1 + -1 + + + 518 + 314 + + + fileOpen()