| 16 | #include <KShell> |
| 17 | |
| 18 | EditExternalScript::EditExternalScript(ExternalScriptItem* item, QWidget* parent) |
| 19 | : QDialog(parent) |
| 20 | , m_item(item) |
| 21 | { |
| 22 | setupUi(this); |
| 23 | |
| 24 | connect(buttonBox, &QDialogButtonBox::accepted, this, &EditExternalScript::accept); |
| 25 | connect(buttonBox, &QDialogButtonBox::rejected, this, &EditExternalScript::reject); |
| 26 | shortcutWidget->layout()->setContentsMargins(0, 0, 0, 0); |
| 27 | |
| 28 | //BEGIN setup tooltips |
| 29 | QString tooltip = i18nc("@info:tooltip", |
| 30 | "<p>Defines the command that should be executed when this script is run. Basic shell features of your platform should be available.</p>\n" |
| 31 | "<p>There are a few placeholders you can use in the command:</p>\n" |
| 32 | "<dl>\n" |
| 33 | " <dt><code>%u</code></dt>\n" |
| 34 | " <dd>Gets replaced by the URL of the active document.</dd>\n" |
| 35 | " <dt><code>%f</code></dt>\n" |
| 36 | " <dd>Gets replaced by the local filepath to the active document.</dd>\n" |
| 37 | " <dt><code>%n</code></dt>\n" |
| 38 | " <dd>Gets replaced by the name of the active document, including its extension.</dd>\n" |
| 39 | " <dt><code>%b</code></dt>\n" |
| 40 | " <dd>Gets replaced by the name of the active document without its extension.</dd>\n" |
| 41 | " <dt><code>%d</code></dt>\n" |
| 42 | " <dd>Gets replaced by the path to the directory of the active document.</dd>\n" |
| 43 | " <dt><code>%p</code></dt>\n" |
| 44 | " <dd>Gets replaced by the URL to the project of the active document.</dd>\n" |
| 45 | " <dt><code>%s</code></dt>\n" |
| 46 | " <dd>Gets replaced with the shell escaped contents of the selection in the active document.</dd>\n" |
| 47 | " <dt><code>%i</code></dt>\n" |
| 48 | " <dd>Gets replaced with the PID of the currently running KDevelop process.</dd>\n" |
| 49 | "</dl>\n" |
| 50 | "<p><b>NOTE:</b> It is your responsibility to prevent running hazardous commands that could lead to data loss.</p>\n" |
| 51 | ); |
| 52 | commandEdit->setToolTip(tooltip); |
| 53 | commandLabel->setToolTip(tooltip); |
| 54 | |
| 55 | tooltip = i18nc("@info:tooltip", |
| 56 | "<p>Defines what the external script should get as input (via <code>STDIN</code>).</p>" |
| 57 | ); |
| 58 | stdinCombo->setToolTip(tooltip); |
| 59 | stdinLabel->setToolTip(tooltip); |
| 60 | |
| 61 | tooltip = i18nc("@info:tooltip", |
| 62 | "<p>Defines what should be done with the output (i.e. <code>STDOUT</code>) of the script.</p>" |
| 63 | ); |
| 64 | stdoutCombo->setToolTip(tooltip); |
| 65 | stdoutLabel->setToolTip(tooltip); |
| 66 | |
| 67 | tooltip = i18nc("@info:tooltip", |
| 68 | "<p>Defines what should be done with the errors (i.e. <code>STDERR</code>) of the script.</p>" |
| 69 | "<p>Note: if the action is the same as that chosen for the output, the channels will be merged " |
| 70 | "and handled together.</p>" |
| 71 | ); |
| 72 | stderrCombo->setToolTip(tooltip); |
| 73 | stderrLabel->setToolTip(tooltip); |
| 74 | |
| 75 | tooltip = i18nc("@info:tooltip", |
nothing calls this directly
no test coverage detected