MCPcopy Create free account
hub / github.com/KDE/kdevelop / start

Method start

plugins/externalscript/externalscriptjob.cpp:220–266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

218}
219
220void ExternalScriptJob::start()
221{
222 qCDebug(PLUGIN_EXTERNALSCRIPT) << "launching?" << m_proc;
223
224 if (m_proc) {
225 if (m_showOutput) {
226 startOutput();
227 }
228 appendLine(i18n("Running external script: %1", m_proc->program().join(QLatin1Char(' '))));
229 m_proc->start();
230
231 if (m_inputMode != ExternalScriptItem::InputNone) {
232 QString inputText;
233
234 switch (m_inputMode) {
235 case ExternalScriptItem::InputNone:
236 // do nothing;
237 break;
238 case ExternalScriptItem::InputSelectionOrNone:
239 if (m_selectionRange.isValid()) {
240 inputText = m_document->text(m_selectionRange);
241 } // else nothing
242 break;
243 case ExternalScriptItem::InputSelectionOrDocument:
244 if (m_selectionRange.isValid()) {
245 inputText = m_document->text(m_selectionRange);
246 } else {
247 inputText = m_document->text();
248 }
249 break;
250 case ExternalScriptItem::InputDocument:
251 inputText = m_document->text();
252 break;
253 }
254
255 ///TODO: what to do with the encoding here?
256 /// maybe ask Christoph for what kate returns...
257 m_proc->write(inputText.toUtf8());
258
259 m_proc->closeWriteChannel();
260 }
261 } else {
262 qCDebug(PLUGIN_EXTERNALSCRIPT) << "No process, something went wrong when creating the job";
263 // No process means we've returned early on from the constructor, some bad error happened
264 emitResult();
265 }
266}
267
268bool ExternalScriptJob::doKill()
269{

Callers

nothing calls this directly

Calls 4

joinMethod · 0.80
isValidMethod · 0.45
textMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected