blob: 6691a06f60b3711ab04fd2c4661e3b3c11567c50 (
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
//
// C++ Interface: kractionbase
//
// Description:
//
//
// Author: Shie Erlich and Rafi Yanai <>, (C) 2006
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef KRACTIONBASE_H
#define KRACTIONBASE_H
#include <tqstring.h>
#include "expander.h"
class KrActionProc;
class KrActionBase
{
public:
KrActionBase() {}
virtual ~KrActionBase();
/** \brief Specifies the mode for executing the action */
enum ExecType {
Normal, ///< Run the command freely
Terminal, ///< Run the command in new terminal window
CollectOutput, ///< Collect output from this command
CollectOutputSeparateStderr, ///< Like #CollectOutput, but display stderr output separately
RunInTE ///< Run in built-in terminal emulator
};
/** \brief Command which runs this action
*
* The string of the command may contain placeholders
* which are parsed by the #Expander class, unless #doSubstitution
* returns false
*
* The command is run by the shell, which should be bash (see #Expander)
*
* @see Expander
* @see doSubstitution
*
* @return The command to execute
*/
virtual TQString command() const =0;
/** \brief Execution type of the action
*
* @see #ExecType
*/
virtual ExecType execType() const =0;
/** \brief Working directory of the command
*
* @return The working directory of the command. May be \a null,
* in which case the command is executed in current directory
*/
virtual TQString startpath() const =0;
/** \brief Username under which the command is run
*
* @return The username of the command. May be \a null,
* in which case the command is executed under the current user
*/
virtual TQString user() const=0;
/** \brief Name of the action
*
* @return The name of the action which will be shown to the user
* eg. any string will do
*/
virtual TQString text() const=0;
/** \brief Does the command accept URLs as filenames (like KDE apps)?
*
* @return \a true iff it does
*/
virtual bool acceptURLs() const=0;
/** \brief Confirm execution of this action by the user?
*
* @return \a true iff execution should be confirmed
*/
virtual bool confirmExecution() const=0;
/** \brief Can #command contain placeholders?
*
* @return \a true iff #command should be expanded by #Expander
*/
virtual bool doSubstitution() const=0;
/** \brief A factory method for creating KrActionProc
*
* @return A new instance of KrActionProc
*/
virtual KrActionProc* actionProcFactoryMethod();
virtual void handleError(const Error& err);
void exec();
};
#endif
|