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.
This commit is contained in:
mgrojo
2018-06-24 20:39:59 +02:00
parent 01f0146bbe
commit e11b32ed54
3 changed files with 47 additions and 1 deletions

View File

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

View File

@@ -145,6 +145,7 @@ private:
QMenu* popupTableMenu;
QMenu* recentFilesMenu;
QMenu* popupOpenDbMenu;
QMenu* popupSaveSqlFileMenu;
QMenu* popupSaveSqlResultsMenu;
QMenu* popupSaveFilterAsMenu;

View File

@@ -981,7 +981,7 @@ You can drag SQL statements from an object row and drop them into other applicat
<bool>false</bool>
</attribute>
<addaction name="fileNewAction"/>
<addaction name="fileOpenAction"/>
<addaction name="fileOpenActionPopup"/>
<addaction name="separator"/>
<addaction name="fileSaveAction"/>
<addaction name="fileRevertAction"/>
@@ -2069,6 +2069,30 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed
<string>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.</string>
</property>
</action>
<action name="fileOpenActionPopup">
<property name="icon">
<iconset resource="icons/icons.qrc">
<normaloff>:/icons/db_open</normaloff>:/icons/db_open</iconset>
</property>
<property name="text">
<string>&amp;Open Database...</string>
</property>
<property name="toolTip">
<string>Open an existing database file</string>
</property>
<property name="statusTip">
<string>Open an existing database file</string>
</property>
<property name="whatsThis">
<string>This option is used to open an existing database file.</string>
</property>
<property name="shortcut">
<string>Ctrl+O</string>
</property>
<property name="menuRole">
<enum>QAction::TextHeuristicRole</enum>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
@@ -3361,6 +3385,22 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed
</hint>
</hints>
</connection>
<connection>
<sender>fileOpenActionPopup</sender>
<signal>triggered()</signal>
<receiver>MainWindow</receiver>
<slot>fileOpen()</slot>
<hints>
<hint type="sourcelabel">
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel">
<x>518</x>
<y>314</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>fileOpen()</slot>