AppletInterface

#include <appletinterface.h>

Inheritance diagram for AppletInterface:

Properties

int apiVersion
 
QString associatedApplication
 
QList< QUrlassociatedApplicationUrls
 
QRect availableScreenRect
 
QVariantList availableScreenRegion
 
Plasma::Types::BackgroundHints backgroundHints
 
bool busy
 
QObject configuration
 
bool configurationRequired
 
QString configurationRequiredReason
 
QString currentActivity
 
Plasma::Types::BackgroundHints effectiveBackgroundHints
 
Plasma::Types::FormFactor formFactor
 
QKeySequence globalShortcut
 
bool hideOnWindowDeactivate
 
QString icon
 
uint id
 
Plasma::Types::ImmutabilityType immutability
 
bool immutable
 
bool loading
 
Plasma::Types::Location location
 
QObject nativeInterface
 
QString pluginName
 
int screen
 
QRect screenGeometry
 
Plasma::Types::ItemStatus status
 
QString title
 
QQuickItem toolTipItem
 
QString toolTipMainText
 
QString toolTipSubText
 
int toolTipTextFormat
 
Plasma::Types::BackgroundHints userBackgroundHints
 
bool userConfiguring
 

Signals

void activated ()
 
void associatedApplicationChanged ()
 
void associatedApplicationUrlsChanged ()
 
void availableScreenRectChanged ()
 
void availableScreenRegionChanged ()
 
void backgroundHintsChanged ()
 
void busyChanged ()
 
void configNeedsSaving ()
 
void configurationRequiredChanged ()
 
void configurationRequiredReasonChanged ()
 
void contextChanged ()
 
void contextualActionsAboutToShow ()
 
void effectiveBackgroundHintsChanged ()
 
void externalData (const QString &mimetype, const QVariant &data)
 
void formFactorChanged ()
 
void globalShortcutChanged ()
 
void hideOnWindowDeactivateChanged ()
 
void iconChanged ()
 
void immutabilityChanged ()
 
void isLoadingChanged ()
 
void locationChanged ()
 
void screenChanged ()
 
void screenGeometryChanged ()
 
void statusChanged ()
 
void titleChanged ()
 
void toolTipItemChanged ()
 
void toolTipMainTextChanged ()
 
void toolTipSubTextChanged ()
 
void toolTipTextFormatChanged ()
 
void userBackgroundHintsChanged ()
 
void userConfiguringChanged ()
 

Public Member Functions

 AppletInterface (DeclarativeAppletScript *script, const QVariantList &args=QVariantList(), QQuickItem *parent=nullptr)
 
Q_INVOKABLE QActionaction (QString name) const
 
int apiVersion () const
 
DeclarativeAppletScript * appletScript () const
 
QString associatedApplication () const
 
QList< QUrlassociatedApplicationUrls () const
 
QRect availableScreenRect () const
 
QVariantList availableScreenRegion () const
 
Plasma::Types::BackgroundHints backgroundHints () const
 
Q_INVOKABLE void clearActions ()
 
QObjectconfiguration () const
 
bool configurationRequired () const
 
QString configurationRequiredReason () const
 
QList< QAction * > contextualActions () const
 
QString currentActivity () const
 
Q_INVOKABLE QStringList downloadedFiles () const
 
Q_INVOKABLE QString downloadPath () const
 
Q_INVOKABLE PLASMA_DEPRECATED QString downloadPath (const QString &file)
 
Plasma::Types::BackgroundHints effectiveBackgroundHints () const
 
void executeAction (const QString &name)
 
Q_INVOKABLE QString file (const QString &fileName)
 
Q_INVOKABLE QString file (const QString &fileType, const QString &filePath)
 
Plasma::Types::FormFactor formFactor () const
 
QKeySequence globalShortcut () const
 
bool hideOnWindowDeactivate () const
 
QString icon () const
 
uint id () const
 
Plasma::Types::ImmutabilityType immutability () const
 
bool immutable () const
 
bool isBusy () const
 
Plasma::Types::Location location () const
 
QObjectnativeInterface ()
 
QString pluginName () const
 
Q_INVOKABLE void prepareContextualActions ()
 
Q_INVOKABLE void removeAction (const QString &name)
 
int screen () const
 
QRect screenGeometry () const
 
Q_INVOKABLE void setAction (const QString &name, const QString &text, const QString &icon=QString(), const QString &shortcut=QString())
 
Q_INVOKABLE void setActionSeparator (const QString &name)
 
void setAssociatedApplication (const QString &string)
 
void setAssociatedApplicationUrls (const QList< QUrl > &urls)
 
void setBackgroundHints (Plasma::Types::BackgroundHints hint)
 
void setBusy (bool busy)
 
Q_INVOKABLE void setConfigurationRequired (bool needsConfiguring, const QString &reason=QString())
 
void setConfigurationRequiredProperty (bool required)
 
void setConfigurationRequiredReason (const QString &reason)
 
void setGlobalShortcut (const QKeySequence &keySequence)
 
void setHideOnWindowDeactivate (bool hide)
 
void setIcon (const QString &icon)
 
void setStatus (const Plasma::Types::ItemStatus &status)
 
void setTitle (const QString &title)
 
void setToolTipItem (QQuickItem *toolTipItem)
 
void setToolTipMainText (const QString &text)
 
void setToolTipSubText (const QString &text)
 
void setToolTipTextFormat (int format)
 
void setUserBackgroundHints (Plasma::Types::BackgroundHints hint)
 
Plasma::Types::ItemStatus status () const
 
QString title () const
 
QQuickItemtoolTipItem () const
 
QString toolTipMainText () const
 
QString toolTipSubText () const
 
int toolTipTextFormat () const
 
Plasma::Types::BackgroundHints userBackgroundHints () const
 
bool userConfiguring () const
 

Static Public Member Functions

static AppletInterfaceqmlAttachedProperties (QObject *object)
 

Protected Slots

void init () override
 

Protected Member Functions

bool event (QEvent *event) override
 
bool eventFilter (QObject *watched, QEvent *event) override
 
virtual bool isLoading () const
 
void updateUiReadyConstraint ()
 

Detailed Description

This class is exposed to applets in QML as the attached property Plasmoid.

@import org.kde.plasma.Plasmoid

Definition at line 56 of file appletinterface.h.

Property Documentation

int AppletInterface::apiVersion
read

The QML root object defined in the applet main.qml will be direct child of an AppletInterface instance.

Version of the QML2 script engine

Definition at line 67 of file appletinterface.h.

QString AppletInterface::associatedApplication
readwrite

Sets the associated application of this plasmoid, if the plasmoid is representing the "compact" view for some application or for some document type.

Definition at line 190 of file appletinterface.h.

QList< QUrl > AppletInterface::associatedApplicationUrls
readwrite

Sets the associated application of this plasmoid, if the plasmoid is representing the "compact" view for some application or for some document type.

Definition at line 195 of file appletinterface.h.

QRect AppletInterface::availableScreenRect
read

screen area free of panels: the coordinates are relative to the containment, it's independent from the screen position For more precise available geometry use availableScreenRegion()

Definition at line 244 of file appletinterface.h.

QVariantList AppletInterface::availableScreenRegion
read

The available region of this screen, panels excluded.

It's a list of rectangles

Definition at line 249 of file appletinterface.h.

Plasma::Types::BackgroundHints AppletInterface::backgroundHints
readwrite

How the applet wants its background to be drawn.

The containment may chose to ignore this hint.

Definition at line 148 of file appletinterface.h.

bool AppletInterface::busy
readwrite

When true the plasmoid is busy.

The containment may graphically indicate that drawing for instance a spinner busy widget over it

Definition at line 143 of file appletinterface.h.

QObject * AppletInterface::configuration
read

Configuration object: each config key will be a writable property of this object.

property bindings work.

Definition at line 138 of file appletinterface.h.

bool AppletInterface::configurationRequired
readwrite

If true the applet requires manual configuration from the user.

Definition at line 232 of file appletinterface.h.

QString AppletInterface::configurationRequiredReason
readwrite

Reason why the manual user configuration is required.

Definition at line 237 of file appletinterface.h.

QString AppletInterface::currentActivity
read

Current activity name the plasmoid is in.

Definition at line 133 of file appletinterface.h.

Plasma::Types::BackgroundHints AppletInterface::effectiveBackgroundHints
read

The effective background hints the applet has, internally decided how to mix with userBackgroundHints.

Definition at line 158 of file appletinterface.h.

Plasma::Types::FormFactor AppletInterface::formFactor
read

FormFactor for the plasmoid.

Definition at line 123 of file appletinterface.h.

QKeySequence AppletInterface::globalShortcut
readwrite

The global shortcut to activate the plasmoid.

This is typically only used by the default configuration module

Definition at line 222 of file appletinterface.h.

bool AppletInterface::hideOnWindowDeactivate
readwrite

Whether the dialog should be hidden when the dialog loses focus.

The default value is false.

Definition at line 214 of file appletinterface.h.

QString AppletInterface::icon
readwrite

Icon to represent the plasmoid.

Definition at line 113 of file appletinterface.h.

uint AppletInterface::id
read

Applet id: is unique in the whole Plasma session and will never change across restarts.

Definition at line 118 of file appletinterface.h.

Plasma::Types::ImmutabilityType AppletInterface::immutability
read

The immutability of the Corona.

Use this if you need more granular control than just using the immutable property

See also
immutable
Since
5.23

Definition at line 175 of file appletinterface.h.

bool AppletInterface::immutable
read

Whether the Corona is immutable.

The plasmoid implementation should avoid allowing "dangerous" modifications from the user when in an immutable mode

This is true when immutability is not Mutable

Definition at line 165 of file appletinterface.h.

Plasma::Types::Location AppletInterface::location
read

Location for the plasmoid.

Definition at line 128 of file appletinterface.h.

QObject * AppletInterface::nativeInterface
read

An interface to the native C++ plasmoid, if implemented.

Definition at line 227 of file appletinterface.h.

QString AppletInterface::pluginName
read

Plugin name of the plasmoid.

Definition at line 72 of file appletinterface.h.

QRect AppletInterface::screenGeometry
read

Provides access to the geometry of the applet is in.

Can be useful to figure out what's the absolute position of the applet.

Definition at line 207 of file appletinterface.h.

Plasma::Types::ItemStatus AppletInterface::status
readwrite

Status of the plasmoid: useful to instruct the shell if this plasmoid is requesting attention, if is accepting input, or if is in an idle, inactive state.

Definition at line 185 of file appletinterface.h.

QString AppletInterface::title
readwrite

User friendly title for the plasmoid: it's the localized applet name by default.

Definition at line 77 of file appletinterface.h.

QQuickItem * AppletInterface::toolTipItem
readwrite

This allows to set custom full QML items as the tooltip.

It will ignore all texts set by setToolTipMainText or setToolTipSubText

Since
5.19

Definition at line 107 of file appletinterface.h.

QString AppletInterface::toolTipMainText
readwrite

Main title for the plasmoid tooltip or other means of quick information: it's the same as the title property by default, but it can be personalized.

Definition at line 83 of file appletinterface.h.

QString AppletInterface::toolTipSubText
readwrite

Description for the plasmoid tooltip or other means of quick information: it comes from the pluginifo comment by default, but it can be personalized.

Definition at line 89 of file appletinterface.h.

int AppletInterface::toolTipTextFormat
readwrite

how to handle the text format of the tooltip subtext:

  • Text.AutoText (default)
  • Text.PlainText
  • Text.StyledText
  • Text.RichText Note: in the default implementation the main text is always plain text

Definition at line 99 of file appletinterface.h.

Plasma::Types::BackgroundHints AppletInterface::userBackgroundHints
readwrite

The containment (and/or the user) may decide to use another kind of background instead (if supported by the applet)

Definition at line 153 of file appletinterface.h.

bool AppletInterface::userConfiguring
read

True when the user is configuring, for instance when the configuration dialog is open.

Definition at line 180 of file appletinterface.h.

Member Function Documentation

void AppletInterface::activated ( )
signal

Emitted when the applet's activation action is triggered.

void AppletInterface::contextualActionsAboutToShow ( )
signal

Emitted just before the contextual actions are about to show For instance just before the context menu containing the actions added with setAction() is shown.

QStringList AppletInterface::downloadedFiles ( ) const
Returns
The list of files that have been downloaded

Definition at line 679 of file appletinterface.cpp.

QString AppletInterface::downloadPath ( ) const
Returns
A path where it is safe to write on disk downloaded files.
Since
5.23

Definition at line 667 of file appletinterface.cpp.

QString AppletInterface::downloadPath ( const QString file)
Returns
A path where it is safe to write on disk downloaded files.
Parameters
filethat name of the file to download (unused).
Deprecated:
Since 5,23, use downloadPath() instead.

Definition at line 661 of file appletinterface.cpp.

void AppletInterface::externalData ( const QString mimetype,
const QVariant data 
)
signal

somebody else, usually the containment sent some data to the applet

Parameters
mimetypethe mime type of the data such as text/plain
dataeither the actual data or an URL representing it
QString AppletInterface::file ( const QString fileName)

FIXME: remove? Retrieve the path of a file from the Plasmoid package.

Parameters
fileNamethe package-recognized name, such as "mainscript"
Returns
the full absolute path of the file, if found, an empty string if not

Definition at line 423 of file appletinterface.cpp.

QString AppletInterface::file ( const QString fileType,
const QString filePath 
)

FIXME: remove? Retrieve the path of a file from the Plasmoid package.

Parameters
fileTypethe type supported from the package, such as "ui", "config" or "image"
filePaththe name of the file, such as "foo.qml" or "bar.png"
Returns
the full absolute path of the file, if found, an empty string if not

Definition at line 428 of file appletinterface.cpp.

void AppletInterface::prepareContextualActions ( )

Should be called before retrieving any action to ensure contents are up to date.

See also
contextualActionsAboutToShow
Since
5.58

Definition at line 810 of file appletinterface.cpp.

void AppletInterface::setAction ( const QString name,
const QString text,
const QString icon = QString(),
const QString shortcut = QString() 
)

Add an action to the Plasmoid contextual menu.

When the action is triggered a function called action_<name> will be called, if there is no function with that name actionTriggered(name) will be called instead.

Parameters

Definition at line 467 of file appletinterface.cpp.

void AppletInterface::setConfigurationRequired ( bool  needsConfiguring,
const QString reason = QString() 
)

Set this to true if the plasmoid needs to be configured in order to work.

The containment will display reason as a message to ask the user to configure.

Parameters
needsConfiguringIf the plasmoid needs configuration
reasonThe user readable (and localized) reason the plasmoid needs

Definition at line 418 of file appletinterface.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat Jun 6 2020 22:52:17 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.