Libplasma
containment.cpp
43Containment::Containment(QObject *parentObject, const KPluginMetaData &data, const QVariantList &args)
56 qCWarning(LOG_PLASMA) << "Unknown containment type requested:" << type << pluginMetaData().fileName()
157 setWallpaperPlugin(group.readEntry("wallpaperplugin", ContainmentPrivate::defaultWallpaperPlugin));
183 defaultActionsCfg = KConfigGroup(KSharedConfig::openConfig(corona()->kPackage().filePath("defaults")), QStringLiteral("Panel"));
186 defaultActionsCfg = KConfigGroup(KSharedConfig::openConfig(corona()->kPackage().filePath("defaults")), QStringLiteral("Desktop"));
354Applet *Containment::createApplet(const QString &name, const QVariantList &args, const QRectF &geometryHint)
372 if (immutability() != Types::Mutable && !applet->property("org.kde.plasma:force-create").toBool()) {
397 KConfigGroup c = config().group(QStringLiteral("Applets")).group(QString::number(applet->id()));
405 const QString oldGroupPrefix = QStringLiteral("Containments") + QString::number(currentContainment->id()) + QStringLiteral("Applets");
406 const QString newGroupPrefix = QStringLiteral("Containments") + QString::number(id()) + QStringLiteral("Applets");
408 applet->configScheme()->setCurrentGroup(applet->configScheme()->currentGroup().replace(0, oldGroupPrefix.length(), newGroupPrefix));
420 const auto position = std::lower_bound(d->applets.begin(), d->applets.end(), applet, [](Plasma::Applet *a1, Plasma::Applet *a2) {
431 connect(applet, SIGNAL(appletDeleted(Plasma::Applet *)), this, SLOT(appletDeleted(Plasma::Applet *)));
432 connect(applet, SIGNAL(statusChanged(Plasma::Types::ItemStatus)), this, SLOT(checkStatus(Plasma::Types::ItemStatus)));
433 connect(this, &Containment::containmentDisplayHintsChanged, applet, &Applet::containmentDisplayHintsChanged);
static Q_INVOKABLE bool authorize(const QString &action)
KConfigGroup group(const QString &group)
void reparent(KConfigBase *parent, WriteConfigFlags pFlags=Normal)
QString name() const
void deleteEntry(const char *key, WriteConfigFlags pFlags=Normal)
void writeEntry(const char *key, const char *value, WriteConfigFlags pFlags=Normal)
void deleteGroup(const QString &group, WriteConfigFlags flags=Normal)
bool isValid() const
QString readEntry(const char *key, const char *aDefault=nullptr) const
bool exists() const
QStringList keyList() const
QString currentGroup() const
KConfigSkeletonItem::List items() const
void setCurrentGroup(const QString &group)
QString pluginId() const
bool value(QStringView key, bool defaultValue) const
QString fileName() const
uint id
Applet id: is unique in the whole Plasma session and will never change across restarts.
Definition applet.h:69
void updateConstraints(Constraints constraints=AllConstraints)
Called when any of the geometry constraints have been updated.
Definition applet.cpp:266
virtual void save(KConfigGroup &group) const
Saves state information about this applet that will be accessed when next instantiated in the restore...
Definition applet.cpp:102
void setHasConfigurationInterface(bool hasInterface)
Sets whether or not this applet provides a user interface for configuring the applet.
Definition applet.cpp:780
Plasma::Types::Location location
The location of the scene which is displaying applet.
Definition applet.h:95
Q_INVOKABLE QAction * internalAction(const QString &name) const
Definition applet.cpp:662
KConfigGroup config() const
Returns the KConfigGroup to access the applets configuration.
Definition applet.cpp:189
bool isContainment
True if this applet is a Containment and is acting as one, such as a desktop or a panel.
Definition applet.h:200
void containmentChanged(Plasma::Containment *containment)
Emitted when the containment changes.
void configNeedsSaving()
Emitted when an applet has changed values in its configuration and wishes for them to be saved at the...
void activated()
Emitted when activation is requested due to, for example, a global keyboard shortcut.
void appletDeleted(Plasma::Applet *applet)
Emitted when the applet is deleted.
virtual void init()
This method is called once the applet is loaded and added to a Corona.
Definition applet.cpp:87
void statusChanged(Plasma::Types::ItemStatus status)
Emitted when the applet status changes.
void containmentDisplayHintsChanged(Plasma::Types::ContainmentDisplayHints hints)
Emitted when the containment display hints change.
Plasma::Types::FormFactor formFactor
The current form factor the applet is being displayed in.
Definition applet.h:88
Q_INVOKABLE void setInternalAction(const QString &name, QAction *action)
Add a new internal action.
Definition applet.cpp:640
QString title
User friendly title for the plasmoid: it's the localized applet name by default.
Definition applet.h:74
void setImmutability(const Types::ImmutabilityType immutable)
Sets the immutability type for this applet (not immutable, user immutable or system immutable)
Definition applet.cpp:438
void flushPendingConstraintsEvents()
Sends all pending constraints updates to the applet.
Definition applet.cpp:533
KConfigLoader * configScheme() const
Returns the config skeleton object from this applet's package, if any.
Definition applet.cpp:238
virtual void restore(KConfigGroup &group)
Restores state information about this applet saved previously in save(KConfigGroup&).
Definition applet.cpp:135
KPluginMetaData metadata() const
Definition containmentactions.cpp:48
virtual void restore(const KConfigGroup &config)
This method should be called once the plugin is loaded or settings are changed.
Definition containmentactions.cpp:61
void setContainment(Containment *newContainment)
newContainment the containment the plugin should be associated with.
Definition containmentactions.cpp:140
The base class for plugins that provide backgrounds and applet grouping containers.
Definition containment.h:47
Q_INVOKABLE void addApplet(Applet *applet, const QRectF &geometryHint=QRectF())
Add an existing applet to this Containment.
Definition containment.cpp:362
void save(KConfigGroup &group) const override
Definition containment.cpp:203
void setActivity(const QString &activityId)
Sets the current activity by id.
Definition containment.cpp:637
void configureRequested(Plasma::Applet *applet)
Emitted when the user wants to configure/change the containment, or an applet inside it.
void containmentDisplayHintsChanged(Plasma::Types::ContainmentDisplayHints hints)
Emitted when the containment disaplay hints change.
void formFactorChanged(Plasma::Types::FormFactor formFactor)
Emitted when the formFactor has changed.
void setContainmentDisplayHints(Plasma::Types::ContainmentDisplayHints hints)
Set Display hints that come from the containment that suggest the applet how to look and behave.
Definition containment.cpp:323
void appletCreated(Plasma::Applet *applet, const QRectF &geometryHint)
This signal is emitted when a new applet is created by the containment.
void activityChanged(const QString &activity)
Emitted when the activity id has changed.
QRectF screenGeometry
Provides access to the geometry of the applet is in.
Definition containment.h:105
void wallpaperPluginChanged()
Emitted when the wallpaper plugin is changed.
void availableRelativeScreenRegionChanged(const QList< QRectF > ®ion)
Emitted when the available screen rectangle has changed.
void setFormFactor(Plasma::Types::FormFactor formFactor)
Sets the form factor for this Containment.
Definition containment.cpp:306
QList< QRectF > availableRelativeScreenRegion() const
Definition containment.cpp:513
void appletRemoved(Plasma::Applet *applet)
This signal is emitted when an applet is destroyed.
void appletAboutToBeRemoved(Plasma::Applet *applet)
This signal is emitted right before appletRemoved, it can be used to do a preliminary setup on the ap...
void setContainmentActions(const QString &trigger, const QString &pluginName)
Sets a containmentactions plugin.
Definition containment.cpp:588
QHash< QString, ContainmentActions * > & containmentActions()
Definition containment.cpp:627
virtual void saveContents(KConfigGroup &group) const
Called when the contents of the containment should be saved.
Definition containment.cpp:228
void locationChanged(Plasma::Types::Location location)
Emitted when the location has changed.
void screenGeometryChanged(const QRectF &rect)
Emitted when the screen geometry has changed.
Applet * createApplet(const QString &name, const QVariantList &args=QVariantList(), const QRectF &geometryHint=QRectF(-1, -1, 0, 0))
Adds an applet to this Containment.
Definition containment.cpp:353
virtual void restoreContents(KConfigGroup &group)
Called when the contents of the containment should be loaded.
Definition containment.cpp:237
void wallpaperGraphicsObjectChanged()
Emitted when the root wallpaper item has changed.
void appletAboutToBeAdded(Plasma::Applet *applet, const QRectF &geometryHint)
This signal is emitted right before appletAdded, it can be used to do a preliminary setup on the appl...
void setLocation(Plasma::Types::Location location)
Informs the Corona as to what position it is in.
Definition containment.cpp:333
void appletsChanged()
Emitted when the list of applets has changed, either added or removed.
void setWallpaperPlugin(const QString &pluginName)
Sets wallpaper plugin.
Definition containment.cpp:549
int screen
The screen number this containment is serving as the desktop for, or -1 if none.
Definition containment.h:87
void screenChanged(int newScreen)
This signal indicates that a containment has been associated (or dissociated) with a physical screen.
void appletAdded(Plasma::Applet *applet, const QRectF &geometryHint)
This signal is emitted when a new applet is added in the containment It may happen in the following s...
void availableRelativeScreenRectChanged(const QRectF &rect)
Emitted when the available screen rectangle has changed.
void restore(KConfigGroup &group) override
Definition containment.cpp:142
QRectF availableRelativeScreenRect() const
Definition containment.cpp:485
QList< Plasma::Applet * > applets
List of applets this containment has: the containments KF6: this should be AppletQuickItem *.
Definition containment.h:54
Q_INVOKABLE QAction * action(const QString &name) const
Definition corona.cpp:397
virtual QRect screenGeometry(int id) const =0
Returns the geometry of a given screen.
virtual QRegion availableScreenRegion(int id) const
Returns the available region for a given screen.
Definition corona.cpp:267
void availableScreenRegionChanged(int id)
This signal indicates that a change in available screen geometry occurred.
virtual QRect availableScreenRect(int id) const
Returns the available rect for a given screen.
Definition corona.cpp:272
void screenGeometryChanged(int id)
This signal indicates that a change in geometry for the screen occurred.
void availableScreenRectChanged(int id)
This signal indicates that a change in available screen geometry occurred.
ContainmentActions * loadContainmentActions(Containment *parent, const QString &containmentActionsName, const QVariantList &args=QVariantList())
Load a ContainmentActions plugin.
Definition pluginloader.cpp:110
ImmutabilityType
Defines the immutability of items like applets, corona and containments they can be free to modify,...
Definition plasma.h:99
@ SystemImmutable
the item is locked down by the system, the user can't unlock it
Definition plasma.h:103
Location
The Location enumeration describes where on screen an element, such as an Applet or its managing cont...
Definition plasma.h:81
FormFactor
The FormFactor enumeration describes how a Plasma::Applet should arrange itself.
Definition plasma.h:40
QString i18nc(const char *context, const char *text, const TYPE &arg...)
QString i18n(const char *text, const TYPE &arg...)
void setEnabled(bool)
void setIcon(const QIcon &icon)
void setText(const QString &text)
void setVisible(bool)
QIcon fromTheme(const QString &name)
void append(QList< T > &&value)
iterator begin()
iterator end()
QMetaEnum fromType()
int keyToValue(const char *key, bool *ok) const const
bool hasNext() const const
T & next()
Q_EMITQ_EMIT
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
bool disconnect(const QMetaObject::Connection &connection)
QObject * parent() const const
QVariant property(const char *name) const const
T qobject_cast(QObject *object)
void setParent(QObject *parent)
void moveTo(const QPoint &position)
QPoint topLeft() const const
void moveTo(const QPointF &position)
QPointF topLeft() const const
const_iterator begin() const const
const_iterator end() const const
bool isEmpty() const const
qsizetype length() const const
QString number(double n, char format, int precision)
QString & replace(QChar before, QChar after, Qt::CaseSensitivity cs)
uint toUInt(bool *ok, int base) const const
bool toBool() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:52:43 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:52:43 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.