22 #ifndef PLASMA_APPLET_H
23 #define PLASMA_APPLET_H
25 #include <QtGui/QGraphicsItem>
26 #include <QtGui/QGraphicsWidget>
27 #include <QtGui/QIcon>
29 #include <kconfiggroup.h>
30 #include <kgenericfactory.h>
31 #include <kplugininfo.h>
32 #include <kshortcut.h>
45 class KActionCollection;
80 Q_PROPERTY(
bool hasConfigurationInterface READ hasConfigurationInterface)
81 Q_PROPERTY(
QString name READ name CONSTANT)
82 Q_PROPERTY(
QString pluginName READ pluginName CONSTANT)
83 Q_PROPERTY(
QString category READ category CONSTANT)
85 Q_PROPERTY(
bool hasFailedToLaunch READ hasFailedToLaunch WRITE setFailedToLaunch)
86 Q_PROPERTY(
bool isBusy READ isBusy WRITE setBusy)
87 Q_PROPERTY(
bool busy READ isBusy WRITE setBusy)
88 Q_PROPERTY(
bool configurationRequired READ configurationRequired WRITE setConfigurationRequired)
89 Q_PROPERTY(
QRectF geometry READ geometry WRITE setGeometry)
90 Q_PROPERTY(
bool shouldConserveResources READ shouldConserveResources)
91 Q_PROPERTY(uint
id READ
id CONSTANT)
92 Q_PROPERTY(
bool userConfiguring READ isUserConfiguring)
93 Q_PROPERTY(BackgroundHints backgroundHints READ backgroundHints WRITE setBackgroundHints)
94 Q_ENUMS(BackgroundHints)
106 StandardBackground = 1,
107 TranslucentBackground = 2,
109 DefaultBackground = StandardBackground
112 Q_DECLARE_FLAGS(BackgroundHints, BackgroundHint)
133 KConfigGroup config()
const;
142 KConfigGroup config(
const QString &group)
const;
154 virtual void save(KConfigGroup &group)
const;
164 virtual void restore(KConfigGroup &group);
173 KConfigGroup globalConfig()
const;
208 const Package *package()
const;
248 QPoint popupPosition(
const QSize &s, Qt::AlignmentFlag alignment)
const;
305 static KPluginInfo::List listAppletInfo(
const QString &category =
QString(),
313 static KPluginInfo::List listAppletInfoForMimetype(
const QString &mimetype);
321 static KPluginInfo::List listAppletInfoForUrl(
const QUrl &url);
335 bool visibleOnly =
true);
343 void setCustomCategories(
const QStringList &categories);
365 static Applet *loadPlasmoid(
const QString &path, uint appletId = 0,
366 const QVariantList &args = QVariantList());
382 const QVariantList &args = QVariantList());
397 static Applet *load(
const KPluginInfo &info, uint appletId = 0,
398 const QVariantList &args = QVariantList());
405 static QString category(
const KPluginInfo &applet);
422 virtual void paintInterface(
QPainter *painter,
424 const QRect &contentsRect);
450 bool shouldConserveResources()
const;
468 void paintWindowFrame(
QPainter *painter,
476 bool hasFailedToLaunch()
const;
487 bool configurationRequired()
const;
492 bool hasConfigurationInterface()
const;
520 void setBackgroundHints(
const BackgroundHints hints);
526 BackgroundHints backgroundHints()
const;
531 bool isContainment()
const;
542 QRect screenRect()
const;
560 void setGlobalShortcut(
const KShortcut &shortcut);
566 KShortcut globalShortcut()
const;
573 virtual bool isPopupShowing()
const;
579 virtual void addAssociatedWidget(
QWidget *widget);
585 virtual void removeAssociatedWidget(
QWidget *widget);
639 const QVariantList &args);
646 bool destroyed()
const;
671 virtual void createConfigurationInterface(KConfigDialog *parent);
678 bool hasAuthorization(
const QString &constraint)
const;
691 void setAssociatedApplication(
const QString &
string);
700 void setAssociatedApplicationUrls(
const KUrl::List &urls);
706 QString associatedApplication()
const;
712 KUrl::List associatedApplicationUrls()
const;
718 bool hasValidAssociatedApplication()
const;
727 void releaseVisualFocus();
729 #if QT_VERSION >= 0x040700
731 void geometryChanged();
737 void geometryChanged();
744 void appletTransformedByUser();
749 void appletTransformedItself();
754 void sizeHintChanged(Qt::SizeHint which);
764 void configNeedsSaving();
815 virtual void destroy();
830 virtual void showConfigurationInterface();
840 void showConfigurationInterface(
QWidget *widget);
846 bool isUserConfiguring()
const;
862 void flushPendingConstraintsEvents();
879 virtual void configChanged();
885 void setBusy(
bool busy);
891 QVariantList startupArguments()
const;
911 void publish(Plasma::AnnouncementMethods methods,
const QString &resourceName);
915 bool isPublished()
const;
925 void runAssociatedApplication();
952 void setFailedToLaunch(
bool failed,
const QString &reason =
QString());
963 virtual void saveState(KConfigGroup &config)
const;
974 void setHasConfigurationInterface(
bool hasInterface);
987 void setConfigurationRequired(
bool needsConfiguring,
const QString &reason =
QString());
1003 void showMessage(
const QIcon &icon,
const QString &message,
const Plasma::MessageButtons buttons);
1023 virtual void constraintsEvent(Plasma::Constraints constraints);
1119 Applet(
const QString &packagePath, uint appletId,
const QVariantList &args);
1121 Q_PRIVATE_SLOT(d,
void setFocus())
1122 Q_PRIVATE_SLOT(d,
void themeChanged())
1123 Q_PRIVATE_SLOT(d,
void cleanUpAndDelete())
1124 Q_PRIVATE_SLOT(d,
void selectItemToDestroy())
1125 Q_PRIVATE_SLOT(d,
void updateRect(const
QRectF& rect))
1126 Q_PRIVATE_SLOT(d,
void destroyMessageOverlay())
1127 Q_PRIVATE_SLOT(d,
void configDialogFinished())
1128 Q_PRIVATE_SLOT(d,
void updateShortcuts())
1129 Q_PRIVATE_SLOT(d,
void publishCheckboxStateChanged(
int state))
1130 Q_PRIVATE_SLOT(d,
void globalShortcutChanged())
1131 Q_PRIVATE_SLOT(d,
void propagateConfigChanged())
1132 Q_PRIVATE_SLOT(d,
void handleDisappeared(AppletHandle *handle))
1139 AppletPrivate *const d;
1143 friend class CoronaPrivate;
1145 friend class ContainmentPrivate;
1147 friend class AppletHandle;
1148 friend class AppletPrivate;
1149 friend class AccessAppletJobPrivate;
1152 friend class PopupAppletPrivate;
1153 friend class AssociatedApplicationManager;
1157 friend class ExtenderGroupPrivate;
1158 friend class ExtenderPrivate;
1164 Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::
Applet::BackgroundHints)
1169 #define K_EXPORT_PLASMA_APPLET(libname, classname) \
1170 K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
1171 K_EXPORT_PLUGIN(factory("plasma_applet_" #libname)) \
1172 K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION)
1174 #endif // multiple inclusion guard
ImmutabilityType
Defines the immutability of items like applets, corona and containments they can be free to modify...
Extends applets to allow detachable parts.
BackgroundHint
Description on how draw a background for the applet.
Location
The Location enumeration describes where on screen an element, such as an Applet or its managing cont...
KSharedPtr< PackageStructure > Ptr
Data provider for plasmoids (Plasma plugins)
FormFactor
The FormFactor enumeration describes how a Plasma::Applet should arrange itself.
Provides a restricted interface for scripted applets.
object representing an installed Plasmagik package
This is an abstract base class which defines an interface to which Plasma's Applet Loading logic can ...
static QScriptValue type(QScriptContext *ctx, QScriptEngine *eng)
Allows for grouping of extender items.
The base class for plugins that provide backgrounds and applet grouping containers.
ItemStatus
Status of an applet.
Provides detachable items for an Extender.
PackageStructure::Ptr packageStructure(const QString &language, ComponentType type)
Loads an appropriate PackageStructure for the given language and type.
A QGraphicsScene for Plasma::Applets.
AspectRatioMode
Defines the aspect ratio used when scaling an applet.