Commit 3dc02a33 authored by Urs Fleisch's avatar Urs Fleisch
Browse files

Select CSV file using dialog in ExportCsv.qml, ImportCsv.qml.

parent 361af734
......@@ -174,11 +174,18 @@ void UserActionsConfig::setDefaultUserActions(bool upgradeOnly)
m_contextMenuCommands.push_back(
UserActionsConfig::MenuCommand(QLatin1String("Text Encoding ID3v1"), QLatin1String("@qml %{qmlpath}/script/ShowTextEncodingV1.qml"), false, true));
m_contextMenuCommands.push_back(
UserActionsConfig::MenuCommand(QLatin1String("Export CSV"), QLatin1String("@qml %{qmlpath}/script/ExportCsv.qml %{directory}/export.csv"), false, true));
UserActionsConfig::MenuCommand(QLatin1String("Export CSV"), QLatin1String("@qml %{qmlpath}/script/ExportCsv.qml"), false, true));
} else if (upgradeOnly && ConfigStore::getConfigVersion() == 2) {
// Remove default argument from "Export CSV", a file selector is now used.
int exportCsvIdx = m_contextMenuCommands.indexOf(
UserActionsConfig::MenuCommand(QLatin1String("Export CSV"), QLatin1String("@qml %{qmlpath}/script/ExportCsv.qml %{directory}/export.csv"), false, true));
if (exportCsvIdx != -1) {
m_contextMenuCommands[exportCsvIdx].setCommand(QLatin1String("@qml %{qmlpath}/script/ExportCsv.qml"));
}
}
if (!upgradeOnly || ConfigStore::getConfigVersion() < 3) {
m_contextMenuCommands.push_back(
UserActionsConfig::MenuCommand(QLatin1String("Import CSV"), QLatin1String("@qml %{qmlpath}/script/ImportCsv.qml %{directory}/export.csv"), false, true));
UserActionsConfig::MenuCommand(QLatin1String("Import CSV"), QLatin1String("@qml %{qmlpath}/script/ImportCsv.qml"), false, true));
}
#endif
}
......
......@@ -89,7 +89,13 @@ Kid3Script {
}
var exportPath = getArguments()[0]
if (!exportPath) {
exportPath = script.tempPath() + "/export.csv"
exportPath = script.selectFileName(
"Export", app.dirName + "/export.csv",
"CSV files (*.csv);;All files (*)", true)
if (!exportPath) {
Qt.quit()
return
}
}
if (script.writeFile(exportPath, txt)) {
console.log("Exported tags of %1 files to %2".
......
......@@ -112,7 +112,12 @@ Kid3Script {
var importPath = getArguments()[0]
if (!importPath) {
importPath = script.tempPath() + "/export.csv"
importPath = script.selectFileName(
"Import", app.dirName, "CSV files (*.csv);;All files (*)", false)
if (!importPath) {
Qt.quit()
return
}
}
readCsvFile(importPath)
if (rows && rows.length > 0 && names && names.length > 1) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment