summaryrefslogtreecommitdiffstats
path: root/kexi/plugins/macros/lib/action.h
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 01:29:50 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 01:29:50 +0000
commit8362bf63dea22bbf6736609b0f49c152f975eb63 (patch)
tree0eea3928e39e50fae91d4e68b21b1e6cbae25604 /kexi/plugins/macros/lib/action.h
downloadkoffice-8362bf63dea22bbf6736609b0f49c152f975eb63.tar.gz
koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.zip
Added old abandoned KDE3 version of koffice
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1077364 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kexi/plugins/macros/lib/action.h')
-rw-r--r--kexi/plugins/macros/lib/action.h187
1 files changed, 187 insertions, 0 deletions
diff --git a/kexi/plugins/macros/lib/action.h b/kexi/plugins/macros/lib/action.h
new file mode 100644
index 00000000..5200c1a4
--- /dev/null
+++ b/kexi/plugins/macros/lib/action.h
@@ -0,0 +1,187 @@
+/***************************************************************************
+ * This file is part of the KDE project
+ * copyright (C) 2005 by Sebastian Sauer ([email protected])
+ * copyright (C) 2005 by Tobi Krebs ([email protected])
+ * copyright (C) 2006 by Sascha Kupper ([email protected])
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ * You should have received a copy of the GNU Library General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ ***************************************************************************/
+
+#ifndef KOMACRO_ACTION_H
+#define KOMACRO_ACTION_H
+
+#include "manager.h"
+#include "context.h"
+#include "variable.h"
+
+#include <qobject.h>
+#include <ksharedptr.h>
+#include <qstringlist.h>
+
+namespace KoMacro {
+
+ /**
+ * The Action class extendes KAction to implement some additional
+ * functionality KAction doesn't provide.
+ */
+ class KOMACRO_EXPORT Action
+ : public QObject // Qt functionality like signals and slots
+ , public KShared // shared reference-counting
+ {
+ Q_OBJECT
+
+ /// Property to get/set the name.
+ Q_PROPERTY(QString name READ name WRITE setName)
+
+ /// Property to get/set the text.
+ Q_PROPERTY(QString text READ text WRITE setText)
+
+ /// Property to get/set the comment.
+ Q_PROPERTY(QString comment READ comment WRITE setComment)
+
+ public:
+
+ /**
+ * Shared pointer to implement reference-counting.
+ */
+ typedef QMap<QString, KSharedPtr<Action> > Map;
+
+ /**
+ * Constructor.
+ *
+ * @param name The unique name this @a Action has.
+ * @param text The i18n-caption text this @a Action has.
+ */
+ explicit Action(const QString& name, const QString& text = QString::null);
+
+ /**
+ * Destructor.
+ */
+ virtual ~Action();
+
+ /**
+ * @return a string representation of the functionality
+ * this action provides.
+ */
+ virtual const QString toString() const;
+
+ /**
+ * The name this @a Action has.
+ */
+ const QString name() const;
+
+ /**
+ * Set the name of the @a Action to @p name .
+ */
+ void setName(const QString& name);
+
+ /**
+ * @return the i18n-caption text this @a Action has.
+ */
+ const QString text() const;
+
+ /**
+ * Set the i18n-caption text this @a Action has.
+ */
+ void setText(const QString& text);
+
+ /**
+ * @return the comment associated with this action.
+ */
+ const QString comment() const;
+
+ /**
+ * Set the @p comment associated with this action.
+ */
+ void setComment(const QString& comment);
+
+ /**
+ * @return true if there exists a variable with the
+ * name @p name else false is returned.
+ */
+ bool hasVariable(const QString& name) const;
+
+ /**
+ * @return the variable @a Variable defined for the
+ * name @p name . If there exists no @a Variable with
+ * such a name, NULL is returned.
+ */
+ KSharedPtr<Variable> variable(const QString& name) const;
+
+ /**
+ * @return the map of variables this @a Action provides.
+ */
+ Variable::Map variables() const;
+
+ /**
+ * @return a list of variablenames this @a Action provides.s
+ */
+ QStringList variableNames() const;
+
+ /**
+ * Append the @a Variable @p variable to list of variables
+ * this @a Action provides.
+ */
+ void setVariable(KSharedPtr<Variable> variable);
+
+ /**
+ * Set the variable.
+ *
+ * @param name The name the variable should have.
+ * @param text The i18n-caption used for display.
+ * @param variant The QVariant value.
+ */
+ void setVariable(const QString& name, const QString& text, const QVariant& variant);
+
+ /**
+ * Remove the variable defined with @p name . If there exists
+ * no such variable, nothing is done.
+ */
+ void removeVariable(const QString& name);
+
+ /**
+ * This function is called, when the @a KoMacro::Variable
+ * with name @p name used within the @a KoMacro::MacroItem
+ * @p macroitem got changed.
+ *
+ * @param macroitem The @a KoMacro::MacroItem instance where
+ * the variable defined with @p name is located in.
+ * @param name The name the @a KoMacro::Variable has.
+ * @return true if the update was successfully else false
+ * is returned.
+ */
+ virtual bool notifyUpdated(const KSharedPtr<MacroItem> &macroitem, const QString& name) {
+ Q_UNUSED(macroitem);
+ Q_UNUSED(name);
+ return true; // The default implementation does nothing.
+ }
+
+ public slots:
+
+ /**
+ * Called if the @a Action should be executed within the
+ * defined @p context .
+ */
+ virtual void activate(KSharedPtr<Context> context) = 0;
+
+ private:
+ /// @internal d-pointer class.
+ class Private;
+ /// @internal d-pointer instance.
+ Private* const d;
+ };
+
+}
+
+#endif