Plasma
appletinterface.cpp
39 AppletInterface::AppletInterface(DeclarativeAppletScript *script, const QVariantList &args, QQuickItem *parent)
53 connect(applet()->containment()->corona(), &Plasma::Corona::editModeChanged, this, &AppletInterface::editModeChanged);
54 connect(this, &AppletInterface::configNeedsSaving, applet(), &Plasma::Applet::configNeedsSaving);
55 connect(applet(), &Plasma::Applet::immutabilityChanged, this, &AppletInterface::immutabilityChanged);
56 connect(applet(), &Plasma::Applet::userConfiguringChanged, this, &AppletInterface::userConfiguringChanged);
58 connect(applet(), &Plasma::Applet::contextualActionsAboutToShow, this, &AppletInterface::contextualActionsAboutToShow);
76 connect(applet(), &Plasma::Applet::backgroundHintsChanged, this, &AppletInterface::backgroundHintsChanged);
77 connect(applet(), &Plasma::Applet::effectiveBackgroundHintsChanged, this, &AppletInterface::effectiveBackgroundHintsChanged);
78 connect(applet(), &Plasma::Applet::userBackgroundHintsChanged, this, &AppletInterface::userBackgroundHintsChanged);
80 connect(applet(), &Plasma::Applet::configurationRequiredChanged, this, [this](bool configurationRequired, const QString &reason) {
88 connect(applet(), &Plasma::Applet::containmentDisplayHintsChanged, this, &AppletInterface::containmentDisplayHintsChanged);
90 connect(appletScript(), &DeclarativeAppletScript::formFactorChanged, this, &AppletInterface::formFactorChanged);
91 connect(appletScript(), &DeclarativeAppletScript::locationChanged, this, &AppletInterface::locationChanged);
92 connect(appletScript(), &DeclarativeAppletScript::contextChanged, this, &AppletInterface::contextChanged);
95 connect(applet()->containment(), &Plasma::Containment::screenChanged, this, &AppletInterface::screenChanged);
98 connect(applet()->containment(), &Plasma::Containment::screenChanged, this, &AppletInterface::screenGeometryChanged);
100 connect(applet()->containment()->corona(), &Plasma::Corona::screenGeometryChanged, this, [this](int id) {
106 connect(applet()->containment()->corona(), &Plasma::Corona::availableScreenRegionChanged, this, &ContainmentInterface::availableScreenRegionChanged);
107 connect(applet()->containment()->corona(), &Plasma::Corona::availableScreenRectChanged, this, &ContainmentInterface::availableScreenRectChanged);
162 connect(this, &AppletInterface::isLoadingChanged, this, &AppletInterface::updateUiReadyConstraint);
253 return applet()->pluginMetaData().isValid() ? applet()->pluginMetaData().pluginId() : QString();
488 void AppletInterface::setAction(const QString &name, const QString &text, const QString &icon, const QString &shortcut)
562 QVector<KPluginMetaData> plugins = KPluginMetaData::findPlugins(QStringLiteral("plasma/scriptengines"), filter);
621 if (!applet() || !applet()->containment() || !applet()->containment()->corona() || applet()->containment()->screen() < 0) {
678 appletScript()->setConfigurationRequired(needsConfiguring, applet()->configurationRequiredReason());
699 const QString downloadDir = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation) + QStringLiteral("/Plasma/")
712 const QString downloadDir = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation) + QStringLiteral("/Plasma/")
724 if (metaObj->indexOfMethod(QMetaObject::normalizedSignature(actionFunctionName.constData()).constData()) != -1) {
725 QMetaObject::invokeMethod(qmlObject()->rootObject(), actionMethodName.constData(), Qt::DirectConnection);
727 QMetaObject::invokeMethod(qmlObject()->rootObject(), "actionTriggered", Qt::DirectConnection, Q_ARG(QVariant, name));
875 ContainmentInterface *ci = c->property("_plasma_graphicObject").value<ContainmentInterface *>();
void availableScreenRegionChanged()
This signal indicates that a change in available screen geometry occurred.
void screenGeometryChanged(int id)
This signal indicates that a change in geometry for the screen occurred.
QAction * addAction(const QString &name, const QObject *receiver=nullptr, const char *member=nullptr)
QRect availableScreenRect
screen area free of panels: the coordinates are relative to the containment, it's independent from th...
Definition: appletinterface.h:245
QAction * action(const QString &name) const
QVariantList availableScreenRegion
The available region of this screen, panels excluded.
Definition: appletinterface.h:250
bool isEmpty() const const
KActionCollection * actions() const
Returns the collection of actions for this Applet.
Definition: applet.cpp:705
KeyPress
QRegion::const_iterator begin() const const
ConstraintHints
This enumeration lists the various hints that an applet can pass to its constraint regarding the way ...
Definition: plasma.h:58
QPoint topLeft() const const
QVariant fromValue(const T &value)
Plasma::Types::BackgroundHints userBackgroundHints
The containment (and/or the user) may decide to use another kind of background instead (if supported ...
Definition: appletinterface.h:153
Q_EMITQ_EMIT
QObject configuration
Configuration object: each config key will be a writable property of this object.
Definition: appletinterface.h:138
T value() const const
void availableScreenRectChanged()
This signal indicates that a change in available screen geometry occurred.
QQuickItem toolTipItem
This allows to set fully custom QML item as the tooltip.
Definition: appletinterface.h:102
QQuickWindow * window() const const
QList< QUrl > associatedApplicationUrls
Sets the associated application of this plasmoid, if the plasmoid is representing the "compact" view ...
Definition: appletinterface.h:195
int length() const const
void configurationRequiredChanged(bool needsConfig, const QString &reason)
Emitted when setConfigurationRequired was called.
QIcon fromTheme(const QString &name)
Q_INVOKABLE QString file(const QString &fileName)
FIXME: remove? Retrieve the path of a file from the Plasmoid package.
Definition: appletinterface.cpp:408
void configNeedsSaving()
Emitted when an applet has changed values in its configuration and wishes for them to be saved at the...
void statusChanged(Plasma::Types::ItemStatus status)
Emitted when the applet status changes.
Plasma::Types::BackgroundHints backgroundHints
How the applet wants its background to be drawn.
Definition: appletinterface.h:148
QString writableLocation(QStandardPaths::StandardLocation type)
void contextualActionsAboutToShow()
Emitted just before the contextual actions are about to show For instance just before the context men...
Q_INVOKABLE QString downloadPath() const
Definition: appletinterface.cpp:697
Files
void setShortcut(const QKeySequence &shortcut)
FormFactor
The FormFactor enumeration describes how a Plasma::Applet should arrange itself.
Definition: plasma.h:72
void setAttribute(Qt::WidgetAttribute attribute, bool on)
T & first()
QString title
User friendly title for the plasmoid: it's the localized applet name by default.
Definition: appletinterface.h:72
bool exists() const const
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void effectiveBackgroundHintsChanged()
Emitted when the effective background hints have changed.
void editModeChanged(bool edit)
emitted when the editMode state changes
This class is exposed to wallpapers as the attached property "wallpaper".
Definition: wallpaperinterface.h:37
QByteArray normalizedSignature(const char *method)
void destroyedChanged(bool destroyed)
Emitted when the applet has been scheduled for destruction or the destruction has been undone.
QRect screenGeometry
Provides access to the geometry of the applet is in.
Definition: appletinterface.h:207
void destroyed(QObject *obj)
QString toolTipSubText
Description for the plasmoid tooltip or other means of quick information: it comes from the pluginifo...
Definition: appletinterface.h:84
Plasma::Types::ItemStatus status
Status of the plasmoid: useful to instruct the shell if this plasmoid is requesting attention,...
Definition: appletinterface.h:185
This class is exposed to containments QML as the attached property Plasmoid.
Definition: containmentinterface.h:39
void userBackgroundHintsChanged()
Emitted when the user background hints have changed.
void setIcon(const QIcon &icon)
Qt::KeyboardModifiers modifiers() const const
int toolTipTextFormat
how to handle the text format of the tooltip subtext:
Definition: appletinterface.h:94
Q_INVOKABLE void prepareContextualActions()
Should be called before retrieving any action to ensure contents are up to date.
Definition: appletinterface.cpp:854
QQuickItem * parentItem() const const
ShortcutFocusReason
ExactMatch
Plasma::Types::ConstraintHints constraintHints
The hints that the applet gives to its constraint, such as asking to fill all the available space ign...
Definition: appletinterface.h:258
void userConfiguringChanged(bool configuring)
emitted when the config ui appears or disappears
bool hideOnWindowDeactivate
Whether the dialog should be hidden when the dialog loses focus.
Definition: appletinterface.h:214
void setActionGroup(QActionGroup *group)
void iconChanged(const QString &icon)
Emitted when the icon name for the applet has changed.
bool isEmpty() const const
QByteArray toUtf8() const const
void immutabilityChanged(Plasma::Types::ImmutabilityType immutable)
Emitted when the immutability changes.
const T & at(int i) const const
Q_SCRIPTABLE CaptureState status()
void setText(const QString &text)
QFuture< void > filter(Sequence &sequence, KeepFunctor filterFunction)
DirectConnection
virtual QVariant rootObject()
AKONADI_CALENDAR_EXPORT KCalendarCore::Event::Ptr event(const Akonadi::Item &item)
int indexOfMethod(const char *method) const const
bool failedToLaunch() const
If for some reason, the applet fails to get up on its feet (the library couldn't be loaded,...
Definition: applet.cpp:546
void trigger()
bool configurationRequired
If true the applet requires manual configuration from the user.
Definition: appletinterface.h:232
void contextualActionsAboutToShow()
Emitted just before the contextual actions are about to show For instance just before the context men...
Plasma::Types::ImmutabilityType immutability
The immutability of the Corona.
Definition: appletinterface.h:175
static QVector< KPluginMetaData > findPlugins(const QString &directory, std::function< bool(const KPluginMetaData &)> filter, KPluginMetaDataOption option)
Q_INVOKABLE void setAction(const QString &name, const QString &text, const QString &icon=QString(), const QString &shortcut=QString())
Add an action to the Plasmoid contextual menu.
Definition: appletinterface.cpp:488
void setData(const QVariant &userData)
void activated()
Emitted when activation is requested due to, for example, a global keyboard shortcut.
Plasma::Types::BackgroundHints effectiveBackgroundHints
The effective background hints the applet has, internally decided how to mix with userBackgroundHints...
Definition: appletinterface.h:158
Q_INVOKABLE void setConfigurationRequired(bool needsConfiguring, const QString &reason=QString())
Set this to true if the plasmoid needs to be configured in order to work.
Definition: appletinterface.cpp:403
QWindow * windowHandle() const const
bool userConfiguring
True when the user is configuring, for instance when the configuration dialog is open.
Definition: appletinterface.h:180
void triggered(bool checked)
DownloadLocation
uint id
Applet id: is unique in the whole Plasma session and will never change across restarts.
Definition: appletinterface.h:112
int key() const const
const char * constData() const const
This class is exposed to applets in QML as the attached property Plasmoid.
Definition: appletinterface.h:51
QString associatedApplication
Sets the associated application of this plasmoid, if the plasmoid is representing the "compact" view ...
Definition: appletinterface.h:190
bool isValid(QStringView ifopt)
void setObjectName(const QString &name)
QPoint globalPos() const const
Location
The Location enumeration describes where on screen an element, such as an Applet or its managing cont...
Definition: plasma.h:158
bool invokeMethod(QObject *obj, const char *member, Qt::ConnectionType type, QGenericReturnArgument ret, QGenericArgument val0, QGenericArgument val1, QGenericArgument val2, QGenericArgument val3, QGenericArgument val4, QGenericArgument val5, QGenericArgument val6, QGenericArgument val7, QGenericArgument val8, QGenericArgument val9)
QString toolTipMainText
Main title for the plasmoid tooltip or other means of quick information: it's the same as the title p...
Definition: appletinterface.h:78
ImmutabilityType
Defines the immutability of items like applets, corona and containments they can be free to modify,...
Definition: plasma.h:235
WId winId() const const
void moveTo(int x, int y)
static QString eventToString(QEvent *event)
Turns a mouse or wheel event into a string suitable for a ContainmentActions.
Definition: containmentactions.cpp:106
int apiVersion
The QML root object defined in the applet main.qml will be direct child of an AppletInterface instanc...
Definition: appletinterface.h:62
void titleChanged(const QString &title)
Emitted when the title has changed.
QRegion::const_iterator end() const const
QString configurationRequiredReason
Reason why the manual user configuration is required.
Definition: appletinterface.h:238
KJOBWIDGETS_EXPORT QWidget * window(KJob *job)
void setSeparator(bool b)
void setFocus(bool)
Plasma::Types::ContainmentDisplayHints containmentDisplayHints
Type of the containment we're in.
Definition: appletinterface.h:123
The base class for plugins that provide backgrounds and applet grouping containers.
Definition: containment.h:45
virtual QList< QAction * > contextualActions()
Implement this to provide a list of actions that can be added to another menu for example,...
Definition: containmentactions.cpp:101
QObject nativeInterface
An interface to the native C++ plasmoid, if implemented.
Definition: appletinterface.h:227
QHash< QString, ContainmentActions * > & containmentActions()
Definition: containment.cpp:565
QKeySequence globalShortcut
The global shortcut to activate the plasmoid.
Definition: appletinterface.h:222
void backgroundHintsChanged()
Emitted when the background hints have changed.
WA_DeleteOnClose
void screenChanged(int newScreen)
This signal indicates that a containment has been associated (or dissociated) with a physical screen.
Q_INVOKABLE QStringList downloadedFiles() const
Definition: appletinterface.cpp:710
QVariant property(const char *name) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Sep 26 2023 04:05:56 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Sep 26 2023 04:05:56 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.