Merge pull request #29 from Flashwalker/feature

+ script: add-multiple-tags/add-multiple-tags.qml
This commit is contained in:
Patrizio Bekerle 2018-04-27 21:20:21 +02:00 committed by GitHub
commit 0b123514a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 45 additions and 0 deletions

View File

@ -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;
}
}
}

View File

@ -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."
}