mirror of
https://github.com/marty-oehme/scripts.git
synced 2024-12-22 07:58:08 +00:00
Added "Delete on import" setting, false by default.
This commit is contained in:
parent
3d5140c7e5
commit
85055c39aa
1 changed files with 25 additions and 4 deletions
|
@ -8,6 +8,7 @@ import QOwnNotesTypes 1.0
|
||||||
QtObject {
|
QtObject {
|
||||||
property string taskPath;
|
property string taskPath;
|
||||||
property bool verbose;
|
property bool verbose;
|
||||||
|
property bool deleteOnImport;
|
||||||
|
|
||||||
property variant settingsVariables: [
|
property variant settingsVariables: [
|
||||||
{
|
{
|
||||||
|
@ -23,6 +24,13 @@ QtObject {
|
||||||
"description": "Should the script log every action?",
|
"description": "Should the script log every action?",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": false
|
"default": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identifier": "deleteOnImport",
|
||||||
|
"name": "Delete on import",
|
||||||
|
"description": "Delete tasks on import?",
|
||||||
|
"type": "boolean",
|
||||||
|
"default": false
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -195,8 +203,8 @@ QtObject {
|
||||||
var result = script.startSynchronousProcess(taskPath,
|
var result = script.startSynchronousProcess(taskPath,
|
||||||
[
|
[
|
||||||
"pro.is:" + concatenatedProjectName,
|
"pro.is:" + concatenatedProjectName,
|
||||||
"rc.report.next.columns=description.desc",
|
"rc.report.next.columns=id,description.desc",
|
||||||
"rc.report.next.labels=Desc"
|
"rc.report.next.labels=ID,Desc"
|
||||||
],
|
],
|
||||||
"");
|
"");
|
||||||
if (result) {
|
if (result) {
|
||||||
|
@ -226,9 +234,22 @@ QtObject {
|
||||||
tasksSeparated.splice(tasksSeparated.length - 1, 1); // removing "X tasks"
|
tasksSeparated.splice(tasksSeparated.length - 1, 1); // removing "X tasks"
|
||||||
tasksSeparated.splice(tasksSeparated.length - 1, 1); // removing ""
|
tasksSeparated.splice(tasksSeparated.length - 1, 1); // removing ""
|
||||||
|
|
||||||
tasksSeparated.forEach( function(taskDesc){
|
var taskIds = [];
|
||||||
script.noteTextEditWrite("* " + taskDesc + "\n");
|
tasksSeparated.forEach( function(task){
|
||||||
|
var taskParamsRegexp = /(\d+)[\s*]?(.+)?[\s*]?/i;
|
||||||
|
var fetchTaskParams = taskParamsRegexp.exec(task);
|
||||||
|
logIfVerbose("Extracted data from task: ID " + fetchTaskParams[1] + " Desc: " + fetchTaskParams[2]);
|
||||||
|
script.noteTextEditWrite("* " + fetchTaskParams[2] + "\n");
|
||||||
|
taskIds.push(fetchTaskParams[1]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (deleteOnImport) {
|
||||||
|
script.startDetachedProcess(taskPath,
|
||||||
|
[
|
||||||
|
taskIds.join(' '),
|
||||||
|
"delete"
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue