From 509dda73ae3be3ebfdb4fadd2b143ab6227839e6 Mon Sep 17 00:00:00 2001 From: Flashwalker Date: Fri, 27 Apr 2018 21:49:15 +0300 Subject: [PATCH] + script: add-multiple-tags/add-multiple-tags.qml --- add-multiple-tags/add-multiple-tags.qml | 35 +++++++++++++++++++++++++ add-multiple-tags/info.json | 10 +++++++ 2 files changed, 45 insertions(+) create mode 100644 add-multiple-tags/add-multiple-tags.qml create mode 100644 add-multiple-tags/info.json diff --git a/add-multiple-tags/add-multiple-tags.qml b/add-multiple-tags/add-multiple-tags.qml new file mode 100644 index 0000000..b95b4af --- /dev/null +++ b/add-multiple-tags/add-multiple-tags.qml @@ -0,0 +1,35 @@ +import QtQml 2.0 + +/** + * This script creates a menu item and a button with which you can add space separated tags to the current note + */ +QtObject { + /** + * Initializes the custom action + */ + function init() { + // create the menu entry + script.registerCustomAction("addMultipleTags", "Add Multiple tags", "fav", "bookmark-new"); + } + + /** + * This function is invoked when a custom action is triggered + * in the menu or via button + * + * @param identifier string the identifier defined in registerCustomAction + */ + function customActionInvoked(identifier) { + switch (identifier) { + // add tags to the current note + case "addMultipleTags": + var tags = script.inputDialogGetText("Add tags", "Enter tags separated by space", ""); + script.log(tags); + var tagsList = tags.split(' '); + var i; + for (i = 0; i < tagsList.length; i++) { + script.tagCurrentNote(tagsList[i]); + } + break; + } + } +} diff --git a/add-multiple-tags/info.json b/add-multiple-tags/info.json new file mode 100644 index 0000000..faedd75 --- /dev/null +++ b/add-multiple-tags/info.json @@ -0,0 +1,10 @@ +{ + "name": "Add Multiple tags", + "identifier": "add-multiple-tags", + "script": "add-multiple-tags.qml", + "authors": ["@Flashwalker"], + "platforms": ["linux", "macos", "windows"], + "version": "0.0.1", + "minAppVersion": "17.06.2", + "description" : "This script creates a menu item and a button with which you can add space separated tags to the current note." +}