action.h
1/***************************************************************************
2 * This file is part of the KDE project
3 * copyright (C) 2005 by Sebastian Sauer (mail@dipe.org)
4 * copyright (C) 2005 by Tobi Krebs (tobi.krebs@gmail.com)
5 * copyright (C) 2006 by Sascha Kupper (kusato@kfnv.de)
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public License
16 * along with this program; see the file COPYING. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 ***************************************************************************/
20
21#ifndef KOMACRO_ACTION_H
22#define KOMACRO_ACTION_H
23
24#include "manager.h"
25#include "context.h"
26#include "variable.h"
27
28#include <tqobject.h>
29#include <ksharedptr.h>
30#include <tqstringlist.h>
31
32namespace KoMacro {
33
38 class KOMACRO_EXPORT Action
39 : public TQObject // TQt functionality like signals and slots
40 , public TDEShared // shared reference-counting
41 {
42 TQ_OBJECT
43
44
46 TQ_PROPERTY(TQString name READ name WRITE setName)
47
48
49 TQ_PROPERTY(TQString text READ text WRITE setText)
50
51
52 TQ_PROPERTY(TQString comment READ comment WRITE setComment)
53
54 public:
55
59 typedef TQMap<TQString, TDESharedPtr<Action> > Map;
60
67 explicit Action(const TQString& name, const TQString& text = TQString());
68
72 virtual ~Action();
73
78 virtual const TQString toString() const;
79
83 const TQString name() const;
84
88 void setName(const TQString& name);
89
93 const TQString text() const;
94
98 void setText(const TQString& text);
99
103 const TQString comment() const;
104
108 void setComment(const TQString& comment);
109
114 bool hasVariable(const TQString& name) const;
115
121 TDESharedPtr<Variable> variable(const TQString& name) const;
122
126 Variable::Map variables() const;
127
131 TQStringList variableNames() const;
132
137 void setVariable(TDESharedPtr<Variable> variable);
138
146 void setVariable(const TQString& name, const TQString& text, const TQVariant& variant);
147
152 void removeVariable(const TQString& name);
153
165 virtual bool notifyUpdated(const TDESharedPtr<MacroItem> &macroitem, const TQString& name) {
166 Q_UNUSED(macroitem);
167 Q_UNUSED(name);
168 return true; // The default implementation does nothing.
169 }
170
171 public slots:
172
177 virtual void activate(TDESharedPtr<Context> context) = 0;
178
179 private:
181 class Private;
183 Private* const d;
184 };
185
186}
187
188#endif
The Action class extendes TDEAction to implement some additional functionality TDEAction doesn't prov...
Definition action.h:41
TQMap< TQString, TDESharedPtr< Action > > Map
Property to get/set the name.
Definition action.h:59
virtual void activate(TDESharedPtr< Context > context)=0
Called if the Action should be executed within the defined context .
virtual bool notifyUpdated(const TDESharedPtr< MacroItem > &macroitem, const TQString &name)
This function is called, when the KoMacro::Variable with name name used within the KoMacro::MacroItem...
Definition action.h:165
TQMap< TQString, TDESharedPtr< Variable > > Map
A map of variables.
Definition variable.h:66