mirror of
https://github.com/marty-oehme/scripts.git
synced 2024-12-22 16:08:09 +00:00
added external-note-diff script
This commit is contained in:
parent
ba0b27fbcc
commit
c14289d57b
2 changed files with 53 additions and 0 deletions
44
external-note-diff/external-note-diff.qml
Normal file
44
external-note-diff/external-note-diff.qml
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
import QtQml 2.0
|
||||||
|
import QOwnNotesTypes 1.0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This script adds a menu entry to the context menu of the note list to diff selected notes in an external diff program
|
||||||
|
* The path of the diff program can be selected in the script settings of the script
|
||||||
|
*/
|
||||||
|
Script {
|
||||||
|
property string executablePath;
|
||||||
|
|
||||||
|
// register your settings variables so the user can set them in the script settings
|
||||||
|
property variant settingsVariables: [
|
||||||
|
{
|
||||||
|
"identifier": "executablePath",
|
||||||
|
"name": "Path of external diff program",
|
||||||
|
"description": "Please select the path to the executable:",
|
||||||
|
"type": "file",
|
||||||
|
"default": "kdiff3",
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the custom actions
|
||||||
|
*/
|
||||||
|
function init() {
|
||||||
|
script.registerCustomAction("externalNoteDiff", "Diff selected notes", "", "", false, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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) {
|
||||||
|
if (identifier != "externalNoteDiff") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// start the diff programm with the selected note paths as parameters
|
||||||
|
var params = script.selectedNotePaths();
|
||||||
|
script.startDetachedProcess(executablePath, params);
|
||||||
|
}
|
||||||
|
}
|
9
external-note-diff/info.json
Normal file
9
external-note-diff/info.json
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"name": "External note diff",
|
||||||
|
"identifier": "external-note-diff",
|
||||||
|
"script": "external-note-diff.qml",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"minAppVersion": "17.07.8",
|
||||||
|
"authors": ["@pbek"],
|
||||||
|
"description" : "This script adds a menu entry to the context menu of the note list to diff selected notes in an external diff program. The path of the diff program can be selected in the script settings of the script."
|
||||||
|
}
|
Loading…
Reference in a new issue