Added several actions that were left out while switching to module.

- save copy as
- export
- copy as c string
- copy as raw cpp string
This commit is contained in:
eelke 2019-01-06 16:34:50 +01:00
parent 3e4917428d
commit e5dd27ff1a
3 changed files with 39 additions and 3 deletions

View file

@ -629,3 +629,11 @@ void QueryTool::focusEditor()
{
ui->queryEdit->setFocus();
}
void QueryTool::exportData()
{
QString home_dir = QStandardPaths::locate(QStandardPaths::HomeLocation, "", QStandardPaths::LocateDirectory);
QString file_name = QFileDialog::getSaveFileName(this,
tr("Export data"), home_dir, tr("CSV file (*.csv)"));
exportData(file_name);
}

View file

@ -39,14 +39,11 @@ public:
void newdoc();
bool load(const QString &filename);
void saveCopyAs();
void explain(bool analyze);
bool canClose() override;
void copyQueryAsCString();
void copyQueryAsRawCppString();
void generateCode();
void exportData(const QString &filename);
@ -57,11 +54,18 @@ public:
public slots:
void execute();
/// Save the document under its current name, a file save dialog will be shown if this is a new document
bool save();
/// Saves the document under a new name and continue editing the document under this new name.
bool saveAs();
/// Save the document under a new name but continue editing the document under its old name.
void saveCopyAs();
void copyQueryAsCString();
void copyQueryAsRawCppString();
void explain();
void analyze();
void cancel();
void exportData();
private:
using ResultTabContainer = std::vector<TuplesResultWidget*>;

View file

@ -37,6 +37,30 @@ void QueryToolModule::init()
wa.setIcon(":/icons/script_save.png");
registerWidgetAction(wa);
}
{
LWidgetAction wa("Save copy of SQL as", SLOT(saveCopyAs()));
wa.setMenuLocation("File/Save");
//wa.setIcon(":/icons/script_save.png");
registerWidgetAction(wa);
}
{
LWidgetAction wa("&Export data", SLOT(exportData()));
wa.setMenuLocation("File/Export");
wa.setIcon(":/icons/table_save.png");
registerWidgetAction(wa);
}
{
LWidgetAction wa("Copy as C string", SLOT(copyQueryAsCString()));
wa.setMenuLocation("Edit/Copy");
wa.setIcon(":/icons/token_shortland_character.png");
registerWidgetAction(wa);
}
{
LWidgetAction wa("Copy as raw C++ string", SLOT(copyQueryAsRawCppString()));
wa.setMenuLocation("Edit/Copy");
wa.setIcon(":/icons/token_shortland_character.png");
registerWidgetAction(wa);
}
{
LWidgetAction wa("Execute", SLOT(execute()));
wa.setMenuLocation("Query/1");