Plasma
containmentactions.h
Go to the documentation of this file.
00001 /* 00002 * Copyright (c) 2009 Chani Armitage <chani@kde.org> 00003 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU Library General Public License as 00006 * published by the Free Software Foundation; either version 2, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details 00013 * 00014 * You should have received a copy of the GNU Library General Public 00015 * License along with this program; if not, write to the 00016 * Free Software Foundation, Inc., 00017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef PLASMA_CONTAINMENTACTIONS_H 00021 #define PLASMA_CONTAINMENTACTIONS_H 00022 00023 #include <QList> 00024 00025 #include <kplugininfo.h> 00026 00027 #include <plasma/plasma.h> 00028 #include <plasma/packagestructure.h> 00029 #include <plasma/version.h> 00030 00031 class QAction; 00032 00033 namespace Plasma 00034 { 00035 00036 class DataEngine; 00037 class Containment; 00038 class ContainmentActionsPrivate; 00039 00055 class PLASMA_EXPORT ContainmentActions : public QObject 00056 { 00057 Q_OBJECT 00058 Q_PROPERTY(QString name READ name) 00059 Q_PROPERTY(QString pluginName READ pluginName) 00060 Q_PROPERTY(QString icon READ icon) 00061 00062 public: 00066 explicit ContainmentActions(QObject * parent = 0); 00067 00068 ~ContainmentActions(); 00069 00075 static KPluginInfo::List listContainmentActionsInfo(); 00076 00089 static ContainmentActions *load(Containment *parent, const QString &name, const QVariantList &args = QVariantList()); 00090 00103 static ContainmentActions *load(Containment *parent, const KPluginInfo &info, const QVariantList &args = QVariantList()); 00104 00108 static PackageStructure::Ptr packageStructure(); 00109 00116 QString name() const; 00117 00121 QString pluginName() const; 00122 00126 QString icon() const; 00127 00131 bool isInitialized() const; 00132 00138 void restore(const KConfigGroup &config); 00139 00144 virtual void save(KConfigGroup &config); 00145 00150 virtual QWidget *createConfigurationInterface(QWidget *parent); 00151 00155 virtual void configurationAccepted(); 00156 00163 virtual void contextEvent(QEvent *event); 00164 00170 virtual QList<QAction*> contextualActions(); 00171 00190 Q_INVOKABLE DataEngine *dataEngine(const QString &name) const; 00191 00196 bool configurationRequired() const; 00197 00202 static QString eventToString(QEvent *event); 00203 00212 QPoint popupPosition(const QSize &s, QEvent *event); 00213 00217 bool event(QEvent *e); 00218 00223 void setContainment(Containment *newContainment); 00224 00225 protected: 00234 ContainmentActions(QObject *parent, const QVariantList &args); 00235 00241 virtual void init(const KConfigGroup &config); 00242 00250 void setConfigurationRequired(bool needsConfiguring = true); 00251 00255 Containment *containment(); 00256 00260 void paste(QPointF scenePos, QPoint screenPos); 00261 00262 private: 00263 friend class ContainmentActionsPackage; 00264 friend class ContainmentActionsPrivate; 00265 ContainmentActionsPrivate *const d; 00266 }; 00267 00268 } // Plasma namespace 00269 00273 #define K_EXPORT_PLASMA_CONTAINMENTACTIONS(libname, classname) \ 00274 K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \ 00275 K_EXPORT_PLUGIN(factory("plasma_containmentactions_" #libname)) \ 00276 K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION) 00277 00278 #endif // PLASMA_CONTAINMENTACTIONS_H
KDE 4.6 API Reference