-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy pathadd-multiple-tags.qml
35 lines (33 loc) · 1.08 KB
/
add-multiple-tags.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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;
}
}
}