[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [labplot/sql] src/kdefrontend: Use a sub-menu for "import from file" and "import from database" acti
From: Alexander Semke <alexander.semke () web ! de>
Date: 2016-12-03 12:01:47
Message-ID: E1cD90l-0006GQ-BC () code ! kde ! org
[Download RAW message or body]
Git commit de089a2493966edf9b554df1f1e83f2775780e86 by Alexander Semke.
Committed on 03/12/2016 at 12:01.
Pushed by asemke into branch 'sql'.
Use a sub-menu for "import from file" and "import from database" actions.
M +15 -17 src/kdefrontend/MainWin.cpp
M +3 -2 src/kdefrontend/MainWin.h
M +4 -1 src/kdefrontend/labplot2ui.rc
https://commits.kde.org/labplot/de089a2493966edf9b554df1f1e83f2775780e86
diff --git a/src/kdefrontend/MainWin.cpp b/src/kdefrontend/MainWin.cpp
index 3e7b8ff..970ee7a 100644
--- a/src/kdefrontend/MainWin.cpp
+++ b/src/kdefrontend/MainWin.cpp
@@ -271,15 +271,15 @@ void MainWin::initActions() {
actionCollection()->addAction("new_file_datasource", m_newFileDataSourceAction);
connect(m_newFileDataSourceAction, SIGNAL(triggered()), this, \
SLOT(newFileDataSourceActionTriggered()));
- //"New database datasources"
- m_newSqlDataSourceAction = new KAction(KIcon("server-database"),i18n("SQL Data \
Source "),this);
- actionCollection()->addAction("new_database_datasource", m_newSqlDataSourceAction);
- connect(m_newSqlDataSourceAction, SIGNAL(triggered()), this, \
SLOT(newSqlDataSourceActionTriggered())); + //Import/Export
+ m_importFileAction = new KAction(KIcon("document-import"), i18n("Import from \
File"), this); + m_importFileAction->setShortcut(Qt::CTRL+Qt::SHIFT+Qt::Key_I);
+ actionCollection()->addAction("import_file", m_importFileAction);
+ connect(m_importFileAction, SIGNAL(triggered()),SLOT(importFileDialog()));
- m_importAction = new KAction(KIcon("document-import-database"), i18n("Import"), \
this);
- m_importAction->setShortcut(Qt::CTRL+Qt::SHIFT+Qt::Key_I);
- actionCollection()->addAction("import", m_importAction);
- connect(m_importAction, SIGNAL(triggered()),SLOT(importFileDialog()));
+ m_importSqlAction = new KAction(KIcon("document-import-database"), i18n("Import \
from SQL Database"), this); + actionCollection()->addAction("import_sql", \
m_importSqlAction); + connect(m_importSqlAction, \
SIGNAL(triggered()),SLOT(importSqlDialog()));
m_exportAction = new KAction(KIcon("document-export-database"), i18n("Export"), \
this); m_exportAction->setShortcut(Qt::CTRL+Qt::SHIFT+Qt::Key_E);
@@ -446,7 +446,8 @@ void MainWin::updateGUIOnProjectChanges() {
m_saveAsAction->setEnabled(!b);
m_printAction->setEnabled(!b);
m_printPreviewAction->setEnabled(!b);
- m_importAction->setEnabled(!b);
+ m_importFileAction->setEnabled(!b);
+ m_importSqlAction->setEnabled(!b);
m_exportAction->setEnabled(!b);
m_newWorkbookAction->setEnabled(!b);
m_newSpreadsheetAction->setEnabled(!b);
@@ -1524,6 +1525,11 @@ void MainWin::importFileDialog(const QString& fileName) {
DEBUG_LOG("MainWin::importFileDialog() DONE");
}
+void MainWin::importSqlDialog() {
+ ImportSQLDatabaseDialog* dlg = new ImportSQLDatabaseDialog(this, m_project);
+ dlg->exec();
+}
+
/*!
opens the dialog for the export of the currently active worksheet, spreadsheet or \
matrix.
*/
@@ -1558,14 +1564,6 @@ void MainWin::newFileDataSourceActionTriggered() {
delete dlg;
}
-/*!
- adds a new SQL data source to the current project.
-*/
-void MainWin::newSqlDataSourceActionTriggered() {
- ImportSQLDatabaseDialog* dlg = new ImportSQLDatabaseDialog(this, m_project);
- dlg->exec();
-}
-
void MainWin::addAspectToProject(AbstractAspect* aspect) {
QModelIndex index = m_projectExplorer->currentIndex();
if (!index.isValid())
diff --git a/src/kdefrontend/MainWin.h b/src/kdefrontend/MainWin.h
index 9ef5c7d..e9db3e7 100644
--- a/src/kdefrontend/MainWin.h
+++ b/src/kdefrontend/MainWin.h
@@ -109,7 +109,8 @@ private:
KAction* m_saveAsAction;
KAction* m_printAction;
KAction* m_printPreviewAction;
- KAction* m_importAction;
+ KAction* m_importFileAction;
+ KAction* m_importSqlAction;
KAction* m_exportAction;
KAction* m_closeAction;
KAction* m_newFolderAction;
@@ -230,6 +231,7 @@ private slots:
void historyDialog();
void importFileDialog(const QString& fileName = QString());
+ void importSqlDialog();
void exportDialog();
void editFitsFileDialog();
void settingsDialog();
@@ -244,7 +246,6 @@ private slots:
void newDatapicker();
//TODO: void newScript();
void newFileDataSourceActionTriggered();
- void newSqlDataSourceActionTriggered();
void createContextMenu(QMenu*) const;
void createFolderContextMenu(const Folder*, QMenu*) const;
diff --git a/src/kdefrontend/labplot2ui.rc b/src/kdefrontend/labplot2ui.rc
index 32a66c3..5f27b7a 100644
--- a/src/kdefrontend/labplot2ui.rc
+++ b/src/kdefrontend/labplot2ui.rc
@@ -52,7 +52,10 @@
<Action name="new_database_datasource" />
</Menu>
<Separator/>
-<Action name="import" />
+<Menu name="Import"><text>Import</text>
+ <Action name="import_file" />
+ <Action name="import_sql" />
+</Menu>
<Action name="export" />
<Action name="project" />
</Menu>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic