blob: 6eb520d78e2b0f31293eef2358a0ab197ab05072 (
plain)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
//
// C++ Implementation: kractionbase
//
// Description:
//
//
// Author: Shie Erlich and Rafi Yanai <>, (C) 2006
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include <kinputdialog.h>
#include <tdelocale.h>
#include <tqerrormessage.h>
#include "kraction.h"
#include "expander.h"
#include "kractionbase.h"
KrActionBase::~KrActionBase()
{
}
void KrActionBase::exec() {
KrActionProc *proc;
// replace %% and prepare string
TQStringList commandList;
if(doSubstitution()) {
Expander exp;
exp.expand(command(),acceptURLs());
if(exp.error()) {
handleError(exp.error());
return;
}
commandList=exp.result();
} else
commandList=command();
//TODO: query expander for status and may skip the rest of the function
// stop here if the commandline is empty
if ( commandList.count() == 1 && commandList[0].stripWhiteSpace().isEmpty() )
return;
if ( confirmExecution() ) {
for ( TQStringList::iterator it = commandList.begin(); it != commandList.end(); ++it ) {
bool exec = true;
*it = KInputDialog::getText(
i18n( "Confirm execution" ),
i18n( "Command being executed:" ),
*it,
&exec, 0
);
if ( exec ) {
proc = actionProcFactoryMethod();
proc->start( *it );
}
} //for
} // if ( _properties->confirmExecution() )
else {
proc = actionProcFactoryMethod();
proc->start( commandList );
}
}
void KrActionBase::handleError(const Error& err)
{
TQErrorMessage::qtHandler()->message(err.what());
}
KrActionProc* KrActionBase::actionProcFactoryMethod()
{
return new KrActionProc(this);
}
|