kexi

action.h

00001 /***************************************************************************
00002  * This file is part of the KDE project
00003  * copyright (C) 2005 by Sebastian Sauer (mail@dipe.org)
00004  * copyright (C) 2005 by Tobi Krebs (tobi.krebs@gmail.com)
00005  * copyright (C) 2006 by Sascha Kupper (kusato@kfnv.de)
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Library General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2 of the License, or (at your option) any later version.
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Library General Public License for more details.
00015  * You should have received a copy of the GNU Library General Public License
00016  * along with this program; see the file COPYING.  If not, write to
00017  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019  ***************************************************************************/
00020 
00021 #ifndef KOMACRO_ACTION_H
00022 #define KOMACRO_ACTION_H
00023 
00024 #include "manager.h"
00025 #include "context.h"
00026 #include "variable.h"
00027 
00028 #include <qobject.h>
00029 #include <ksharedptr.h>
00030 #include <qstringlist.h>
00031 
00032 namespace KoMacro {
00033 
00038     class KOMACRO_EXPORT Action
00039         : public QObject // Qt functionality like signals and slots
00040         , public KShared // shared reference-counting
00041     {
00042             Q_OBJECT
00043 
00045             Q_PROPERTY(QString name READ name WRITE setName)
00046 
00047             
00048             Q_PROPERTY(QString text READ text WRITE setText)
00049 
00051             Q_PROPERTY(QString comment READ comment WRITE setComment)
00052 
00053         public:
00054 
00058             typedef QMap<QString, KSharedPtr<Action> > Map;
00059 
00066             explicit Action(const QString& name, const QString& text = QString::null);
00067 
00071             virtual ~Action();
00072 
00077             virtual const QString toString() const;
00078 
00082             const QString name() const;
00083             
00087             void setName(const QString& name); 
00088 
00092             const QString text() const;
00093 
00097             void setText(const QString& text);
00098 
00102             const QString comment() const;
00103 
00107             void setComment(const QString& comment);
00108 
00113             bool hasVariable(const QString& name) const;
00114 
00120             KSharedPtr<Variable> variable(const QString& name) const;
00121 
00125             Variable::Map variables() const;
00126 
00130             QStringList variableNames() const;
00131 
00136             void setVariable(KSharedPtr<Variable> variable);
00137 
00145             void setVariable(const QString& name, const QString& text, const QVariant& variant);
00146 
00151             void removeVariable(const QString& name);
00152 
00164             virtual bool notifyUpdated(const KSharedPtr<MacroItem> &macroitem, const QString& name) {
00165                 Q_UNUSED(macroitem);
00166                 Q_UNUSED(name);
00167                 return true; // The default implementation does nothing.
00168             }
00169 
00170         public slots:
00171 
00176             virtual void activate(KSharedPtr<Context> context) = 0;
00177 
00178         private:
00180             class Private;
00182             Private* const d;
00183     };
00184 
00185 }
00186 
00187 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys