From 6a76e9491d1c711c5210a974ac8ee01c2855725e Mon Sep 17 00:00:00 2001 From: Sander Boom Date: Thu, 30 Nov 2017 10:39:48 +0100 Subject: [PATCH 1/2] Add a setting to specify a folder where newly created journal notes will be placed. Refs pbek/QOwnNotes#795 --- journal-entry/info.json | 4 ++-- journal-entry/journal-entry.qml | 28 +++++++++++++++++++++++++--- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/journal-entry/info.json b/journal-entry/info.json index e7a4c2d..34cef1d 100644 --- a/journal-entry/info.json +++ b/journal-entry/info.json @@ -2,8 +2,8 @@ "name": "Journal entry", "identifier": "journal-entry", "script": "journal-entry.qml", - "version": "1.0.0", - "minAppVersion": "17.05.6", + "version": "1.1.0", + "minAppVersion": "17.12.0", "authors": ["@pbek", "@sanderboom"], "description" : "This script creates a menu item and a button to create or jump to the current date's journal entry." } diff --git a/journal-entry/journal-entry.qml b/journal-entry/journal-entry.qml index b871547..1dff6d6 100644 --- a/journal-entry/journal-entry.qml +++ b/journal-entry/journal-entry.qml @@ -5,12 +5,20 @@ import com.qownnotes.noteapi 1.0 * This script creates a menu item and a button to create or jump to the current date's journal entry */ QtObject { + property string defaultFolder; property string defaultTags; property variant settingsVariables: [ + { + "identifier": "defaultFolder", + "name": "Default folder", + "description": "The default folder where the newly created journal note should be placed. Specify the path to the folder relative to the note folder. Make sure that the full path exists. Examples: to place new journal notes in the subfolder 'Journal' enter: \"Journal\"; to place new journal notes in the subfolder 'Journal' in the subfolder 'Personal' enter: \"Personal/Journal\". Leave blank to disable (notes will be created in the currently active folder).", + "type": "string", + "default": "", + }, { "identifier": "defaultTags", - "name": "Auto-tagging", + "name": "Default tags", "description": "One or more default tags (separated by commas) to assign to a newly created journal note. Leave blank to disable auto-tagging.", "type": "string", "default": "journal", @@ -51,15 +59,29 @@ QtObject { // create a new journal entry note if it wasn't found // keep in mind that the note will not be created instantly on the disk script.log("creating new journal entry: " + headline); + + // Default folder. + if (defaultFolder && defaultFolder !== '') { + var msg = 'Jump to default folder \'' + defaultFolder + '\' before creating a new journal note.'; + script.log('Attempt: ' + msg); + var jump = script.jumpToNoteSubFolder(defaultFolder); + if (jump) { + script.log('Success: ' + msg); + } else { + script.log('Failed: ' + msg); + } + } + + // Create the new journal note. script.createNote(headline + "\n================\n\n"); - // Auto-tagging. + // Default tags. if (defaultTags && defaultTags !== '') { defaultTags // Split on 0..* ws, 1..* commas, 0..* ws. .split(/\s*,+\s*/) .forEach(function(i) { - script.log('Auto-tag new journal entry with: ' + i); + script.log('Tag the new journal note with default tag: ' + i); script.tagCurrentNote(i); }); } From 87af56999b889cf75e3f0e85348e32ac4a39588b Mon Sep 17 00:00:00 2001 From: Sander Boom Date: Thu, 30 Nov 2017 11:14:37 +0100 Subject: [PATCH 2/2] Add a setting to specify a folder where created journal notes will be placed. Downgrade minimal version as requested. Refs pbek/QOwnNotes#795 --- journal-entry/info.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/journal-entry/info.json b/journal-entry/info.json index 34cef1d..f0a189a 100644 --- a/journal-entry/info.json +++ b/journal-entry/info.json @@ -3,7 +3,7 @@ "identifier": "journal-entry", "script": "journal-entry.qml", "version": "1.1.0", - "minAppVersion": "17.12.0", + "minAppVersion": "17.11.6", "authors": ["@pbek", "@sanderboom"], "description" : "This script creates a menu item and a button to create or jump to the current date's journal entry." }