Plasma
Plasma::Corona Class Reference
A QGraphicsScene for Plasma::Applets. More...
#include <Plasma/Corona>

Public Slots | |
| ImmutabilityType | immutability () const |
| void | initializeLayout (const QString &config=QString()) |
| void | layoutContainments () |
| void | loadLayout (const QString &config=QString()) |
| void | requestConfigSync () |
| void | requireConfigSync () |
| void | saveLayout (const QString &config=QString()) const |
| void | setImmutability (const ImmutabilityType immutable) |
Signals | |
| void | availableScreenRegionChanged () |
| void | configSynced () |
| void | containmentAdded (Plasma::Containment *containment) |
| void | immutabilityChanged (Plasma::ImmutabilityType immutability) |
| void | releaseVisualFocus () |
| void | screenOwnerChanged (int wasScreen, int isScreen, Plasma::Containment *containment) |
| void | shortcutsChanged () |
Public Member Functions | |
| Corona (QObject *parent=0) | |
| ~Corona () | |
| QAction * | action (QString name) const |
| QList< QAction * > | actions () const |
| void | addAction (QString name, QAction *action) |
| KAction * | addAction (QString name) |
| Containment * | addContainment (const QString &name, const QVariantList &args=QVariantList()) |
| void | addOffscreenWidget (QGraphicsWidget *widget) |
| void | addShortcuts (KActionCollection *newShortcuts) |
| QString | appletMimeType () |
| virtual QRegion | availableScreenRegion (int id) const |
| void | clearContainments () |
| KSharedConfig::Ptr | config () const |
| ContainmentActionsPluginsConfig | containmentActionsDefaults (Containment::Type containmentType) |
| Containment * | containmentForScreen (int screen, int desktop=-1) const |
| Containment * | containmentForScreen (int screen, int desktop, const QString &defaultPluginIfNonExistent, const QVariantList &defaultArgs=QVariantList()) |
| QList< Containment * > | containments () const |
| AbstractDialogManager * | dialogManager () |
| void | enableAction (const QString &name, bool enable) |
| void | exportLayout (KConfigGroup &config, QList< Containment * > containments) |
| QList< Plasma::Location > | freeEdges (int screen) const |
| QList< Plasma::Containment * > | importLayout (const KConfigBase &config) |
| QList< Plasma::Containment * > | importLayout (const KConfigGroup &config) |
| virtual int | numScreens () const |
| QList< QGraphicsWidget * > | offscreenWidgets () const |
| QPoint | popupPosition (const QGraphicsItem *item, const QSize &size, Qt::AlignmentFlag alignment) |
| QPoint | popupPosition (const QGraphicsItem *item, const QSize &size) |
| QString | preferredToolBoxPlugin (const Containment::Type type) const |
| void | removeOffscreenWidget (QGraphicsWidget *widget) |
| virtual QRect | screenGeometry (int id) const |
| void | setAppletMimeType (const QString &mimetype) |
| void | setContainmentActionsDefaults (Containment::Type containmentType, const ContainmentActionsPluginsConfig &config) |
| void | setDialogManager (AbstractDialogManager *manager) |
| void | updateShortcuts () |
Protected Member Functions | |
| Containment * | addContainmentDelayed (const QString &name, const QVariantList &args=QVariantList()) |
| void | dragEnterEvent (QGraphicsSceneDragDropEvent *event) |
| void | dragLeaveEvent (QGraphicsSceneDragDropEvent *event) |
| void | dragMoveEvent (QGraphicsSceneDragDropEvent *event) |
| virtual void | loadDefaultLayout () |
| void | mapAnimation (Animator::Animation from, Animator::Animation to) |
| void | mapAnimation (Animator::Animation from, const QString &to) |
| void | setPreferredToolBoxPlugin (const Containment::Type type, const QString &plugin) |
Detailed Description
A QGraphicsScene for Plasma::Applets.
Constructor & Destructor Documentation
| Plasma::Corona::Corona | ( | QObject * | parent = 0 | ) | [explicit] |
Definition at line 297 of file corona.cpp.
| Plasma::Corona::~Corona | ( | ) |
Definition at line 307 of file corona.cpp.
Member Function Documentation
| QAction * Plasma::Corona::action | ( | QString | name | ) | const |
Returns the QAction with the given name from our collection.
Definition at line 961 of file corona.cpp.
| QList< QAction * > Plasma::Corona::actions | ( | ) | const |
Returns all the actions in our collection.
Definition at line 976 of file corona.cpp.
| void Plasma::Corona::addAction | ( | QString | name, |
| QAction * | action | ||
| ) |
Adds the action to our collection under the given name.
Definition at line 966 of file corona.cpp.
| KAction * Plasma::Corona::addAction | ( | QString | name | ) |
- Since:
- 4.3 Creates an action in our collection under the given name
- Returns:
- the new action FIXME I'm wrapping so much of kactioncollection API now, maybe I should just expose the collection itself :P
Definition at line 971 of file corona.cpp.
| Containment * Plasma::Corona::addContainment | ( | const QString & | name, |
| const QVariantList & | args = QVariantList() |
||
| ) |
Adds a Containment to the Corona.
- Parameters:
-
name the plugin name for the containment, as given by KPluginInfo::pluginName(). If an empty string is passed in, the defalt containment plugin will be used (usually DesktopContainment). If the string literal "null" is passed in, then no plugin will be loaded and a simple Containment object will be created instead. args argument list to pass to the containment
- Returns:
- a pointer to the containment on success, or 0 on failure
Definition at line 626 of file corona.cpp.
| Containment * Plasma::Corona::addContainmentDelayed | ( | const QString & | name, |
| const QVariantList & | args = QVariantList() |
||
| ) | [protected] |
Loads a containment with delayed initialization, primarily useful for implementations of loadDefaultLayout.
The caller is responsible for all initializating, saving and notification of a new containment.
- Parameters:
-
name the plugin name for the containment, as given by KPluginInfo::pluginName(). If an empty string is passed in, the defalt containment plugin will be used (usually DesktopContainment). If the string literal "null" is passed in, then no plugin will be loaded and a simple Containment object will be created instead. args argument list to pass to the containment
- Returns:
- a pointer to the containment on success, or 0 on failure
Definition at line 635 of file corona.cpp.
| void Plasma::Corona::addOffscreenWidget | ( | QGraphicsWidget * | widget | ) |
Adds a widget in the topleft quadrant in the scene.
Widgets in the topleft quadrant are normally never shown unless you specifically aim a view at it, which makes it ideal for toplevel views etc.
- Parameters:
-
widget the widget to add.
Definition at line 654 of file corona.cpp.
| void Plasma::Corona::addShortcuts | ( | KActionCollection * | newShortcuts | ) |
- Since:
- 4.3 Adds a set of actions to the shortcut config dialog. don't use this on actions in the corona's own actioncollection, those are handled automatically. this is for stuff outside of that.
Definition at line 996 of file corona.cpp.
| QString Plasma::Corona::appletMimeType | ( | ) |
The current mime type of Drag/Drop items.
Definition at line 324 of file corona.cpp.
| QRegion Plasma::Corona::availableScreenRegion | ( | int | id | ) | const [virtual] |
Returns the available region for a given screen.
The available region excludes panels and similar windows. Valid screen ids are 0 to numScreens()-1. By default this method returns a rectangular region equal to screenGeometry(id); subclasses that need another behavior should override this method.
Definition at line 729 of file corona.cpp.
| void Plasma::Corona::availableScreenRegionChanged | ( | ) | [signal] |
This signal inicates that a change in available screen goemetry occurred.
| void Plasma::Corona::clearContainments | ( | ) |
Clear the Corona from all applets.
Definition at line 610 of file corona.cpp.
| KSharedConfigPtr Plasma::Corona::config | ( | ) | const |
Returns the config file used to store the configuration for this Corona.
Definition at line 617 of file corona.cpp.
| void Plasma::Corona::configSynced | ( | ) | [signal] |
This signal indicates that the configuration file was flushed to disc.
| ContainmentActionsPluginsConfig Plasma::Corona::containmentActionsDefaults | ( | Containment::Type | containmentType | ) |
- Since:
- 4.4 Returns the default containmentactions plugins for the given containment type
Definition at line 1006 of file corona.cpp.
| void Plasma::Corona::containmentAdded | ( | Plasma::Containment * | containment | ) | [signal] |
This signal indicates a new containment has been added to the Corona.
| Containment * Plasma::Corona::containmentForScreen | ( | int | screen, |
| int | desktop, | ||
| const QString & | defaultPluginIfNonExistent, | ||
| const QVariantList & | defaultArgs = QVariantList() |
||
| ) |
Returns the Containment for a given physical screen and desktop, creating one if none exists.
- Parameters:
-
screen number of the physical screen to locate desktop the virtual desktop) to locate; if < 0 then it will simply return the first Containment associated with screen defaultPluginIfNonExistent the plugin to load by default; "null" is an empty Containment and "default" creates the default plugin defaultArgs optional arguments to pass in when creating a Containment if needed
- Since:
- 4.6
Definition at line 588 of file corona.cpp.
| Containment * Plasma::Corona::containmentForScreen | ( | int | screen, |
| int | desktop = -1 |
||
| ) | const |
Returns the Containment, if any, for a given physical screen and desktop.
- Parameters:
-
screen number of the physical screen to locate desktop the virtual desktop) to locate; if < 0 then it will simply return the first Containment associated with screen
Definition at line 574 of file corona.cpp.
| QList< Containment * > Plasma::Corona::containments | ( | ) | const |
- Returns:
- all containments on this Corona
Definition at line 605 of file corona.cpp.
| AbstractDialogManager * Plasma::Corona::dialogManager | ( | ) |
- Returns:
- the AbstractDialogManager that will show dialogs used by applets, like configuration dialogs
- Since:
- 4.5
Definition at line 1016 of file corona.cpp.
| void Plasma::Corona::dragEnterEvent | ( | QGraphicsSceneDragDropEvent * | event | ) | [protected] |
Definition at line 888 of file corona.cpp.
| void Plasma::Corona::dragLeaveEvent | ( | QGraphicsSceneDragDropEvent * | event | ) | [protected] |
Definition at line 893 of file corona.cpp.
| void Plasma::Corona::dragMoveEvent | ( | QGraphicsSceneDragDropEvent * | event | ) | [protected] |
Definition at line 898 of file corona.cpp.
| void Plasma::Corona::enableAction | ( | const QString & | name, |
| bool | enable | ||
| ) |
convenience function - enables or disables an action by name
- Parameters:
-
name the name of the action in our collection enable true to enable, false to disable
Definition at line 981 of file corona.cpp.
| void Plasma::Corona::exportLayout | ( | KConfigGroup & | config, |
| QList< Containment * > | containments | ||
| ) |
Exports a set of containments to a config file.
- Parameters:
-
config the config group to save to containments the list of containments to save
- Since:
- 4.6
Definition at line 342 of file corona.cpp.
| QList< Plasma::Location > Plasma::Corona::freeEdges | ( | int | screen | ) | const |
This method is useful in order to retrieve the list of available screen edges for panel type containments.
- Parameters:
-
screen the id of the screen to look for free edges.
- Returns:
- a list of free edges not filled with panel type containments.
Definition at line 945 of file corona.cpp.
| ImmutabilityType Plasma::Corona::immutability | ( | ) | const [slot] |
- Returns:
- The type of immutability of this Corona
Definition at line 903 of file corona.cpp.
| void Plasma::Corona::immutabilityChanged | ( | Plasma::ImmutabilityType | immutability | ) | [signal] |
emitted when immutability changes.
this is for use by things that don't get contraints events, like plasmaapp. it's NOT for containments or applets or any of the other stuff on the scene. if your code's not in shells/ it probably shouldn't be using it.
| QList< Plasma::Containment * > Plasma::Corona::importLayout | ( | const KConfigBase & | config | ) |
Imports an applet layout from a config file.
The results will be added to the current set of Containments.
- Deprecated:
- Use the 4.6 version that takes a KConfigGroup
- Parameters:
-
config the name of the config file to load from, or the default config file if QString()
- Returns:
- the list of containments that were loaded
- Since:
- 4.5
Definition at line 503 of file corona.cpp.
| QList< Plasma::Containment * > Plasma::Corona::importLayout | ( | const KConfigGroup & | config | ) |
Imports an applet layout from a config file.
The results will be added to the current set of Containments.
- Parameters:
-
config the name of the config file to load from, or the default config file if QString()
- Returns:
- the list of containments that were loaded
- Since:
- 4.6
Definition at line 497 of file corona.cpp.
| void Plasma::Corona::initializeLayout | ( | const QString & | config = QString() | ) | [slot] |
Initializes the layout from a config file.
This will first clear any existing Containments, load a layout from the requested configuration file, request the default layout if needed and update immutability.
- Parameters:
-
config the name of the config file to load from, or the default config file if QString()
Definition at line 394 of file corona.cpp.
| void Plasma::Corona::layoutContainments | ( | ) | [slot] |
- Since:
- 4.5 Layout the containments on this corona. The default implementation organizes them in a grid-like view, but subclasses can reimplement this slot to provide their own layout.
Definition at line 419 of file corona.cpp.
| void Plasma::Corona::loadDefaultLayout | ( | ) | [protected, virtual] |
Loads the default (system wide) layout for this user.
Definition at line 873 of file corona.cpp.
| void Plasma::Corona::loadLayout | ( | const QString & | config = QString() | ) | [slot] |
Load applet layout from a config file.
The results will be added to the current set of Containments.
- Parameters:
-
config the name of the config file to load from, or the default config file if QString()
Definition at line 485 of file corona.cpp.
| void Plasma::Corona::mapAnimation | ( | Animator::Animation | from, |
| Animator::Animation | to | ||
| ) | [protected] |
Maps a stock animation to one of the semantic animations.
Used to control things such as what animation is used to make a Plasma::Appear appear in a containment.
- from the animation to map a new value to
- to the animation value to map to from
- Since:
- 4.5
Definition at line 644 of file corona.cpp.
| void Plasma::Corona::mapAnimation | ( | Animator::Animation | from, |
| const QString & | to | ||
| ) | [protected] |
Maps a loadable animation to one of the semantic animations.
Used to control things such as what animation is used to make a Plasma::Appear appear in a containment.
- from the animation to map a new value to
- to the animation value to map to from; this must map to a Javascript animation
- Since:
- 4.5
Definition at line 649 of file corona.cpp.
| int Plasma::Corona::numScreens | ( | ) | const [virtual] |
Returns the number of screens available to plasma.
Subclasses should override this method as the default implementation returns a meaningless value.
Definition at line 711 of file corona.cpp.
| QList< QGraphicsWidget * > Plasma::Corona::offscreenWidgets | ( | ) | const |
| QPoint Plasma::Corona::popupPosition | ( | const QGraphicsItem * | item, |
| const QSize & | size, | ||
| Qt::AlignmentFlag | alignment | ||
| ) |
- Since:
- 4.4 Recommended position for a popup window like a menu or a tooltip given its size
- Parameters:
-
item the item that the popup should appear adjacent to (an applet, say) size size of the popup alignment alignment of the popup, valid flags are Qt::AlignLeft, Qt::AlignRight and Qt::AlignCenter
- Returns:
- reccomended position
Definition at line 739 of file corona.cpp.
| QPoint Plasma::Corona::popupPosition | ( | const QGraphicsItem * | item, |
| const QSize & | size | ||
| ) |
Recommended position for a popup window like a menu or a tooltip given its size.
- Parameters:
-
item the item that the popup should appear adjacent to (an applet, say) size size of the popup
- Returns:
- reccomended position
Definition at line 734 of file corona.cpp.
| QString Plasma::Corona::preferredToolBoxPlugin | ( | const Containment::Type | type | ) | const |
Returns the name of the preferred plugin to be used as containment toolboxes.
CustomContainments and CustomPanelContainments can still override it as their liking. It's also not guaranteed that the plugin will actually exist.
- Parameters:
-
type the containment type of which we want to know the associated toolbox plugin
- Since:
- 4.6
Definition at line 883 of file corona.cpp.
| void Plasma::Corona::releaseVisualFocus | ( | ) | [signal] |
This signal indicates that an application launch, window creation or window focus event was triggered.
This is used, for instance, to ensure that the Dashboard view in Plasma hides when such an event is triggered by an item it is displaying.
| void Plasma::Corona::removeOffscreenWidget | ( | QGraphicsWidget * | widget | ) |
Removes a widget from the topleft quadrant in the scene.
- Parameters:
-
widget the widget to remove.
Definition at line 685 of file corona.cpp.
| void Plasma::Corona::requestConfigSync | ( | ) | [slot] |
Schedules a flush-to-disk synchronization of the configuration state at the next convenient moment.
Definition at line 375 of file corona.cpp.
| void Plasma::Corona::requireConfigSync | ( | ) | [slot] |
Schedules a time sensitive flush-to-disk synchronization of the configuration state.
Since this method does not provide any sort of event compression, it should only be used when an *immediate* disk sync is *absolutely* required. Otherwise, use
- See also:
- requestConfigSync() which does do event compression.
Definition at line 389 of file corona.cpp.
| void Plasma::Corona::saveLayout | ( | const QString & | config = QString() | ) | const [slot] |
Save applets layout to file.
- config the file to save to, or the default config file if QString()
Definition at line 329 of file corona.cpp.
| QRect Plasma::Corona::screenGeometry | ( | int | id | ) | const [virtual] |
Returns the geometry of a given screen.
Valid screen ids are 0 to numScreen()-1, or -1 for the full desktop geometry. Subclasses should override this method as the default implementation returns a meaningless value.
Definition at line 716 of file corona.cpp.
| void Plasma::Corona::screenOwnerChanged | ( | int | wasScreen, |
| int | isScreen, | ||
| Plasma::Containment * | containment | ||
| ) | [signal] |
This signal indicates that a containment has been newly associated (or dissociated) with a physical screen.
- Parameters:
-
wasScreen the screen it was associated with isScreen the screen it is now associated with containment the containment switching screens
| void Plasma::Corona::setAppletMimeType | ( | const QString & | mimetype | ) |
Sets the mimetype of Drag/Drop items.
Default is text/x-plasmoidservicename
Definition at line 319 of file corona.cpp.
| void Plasma::Corona::setContainmentActionsDefaults | ( | Containment::Type | containmentType, |
| const ContainmentActionsPluginsConfig & | config | ||
| ) |
- Since:
- 4.4 Sets the default containmentactions plugins for the given containment type
Definition at line 1001 of file corona.cpp.
| void Plasma::Corona::setDialogManager | ( | AbstractDialogManager * | manager | ) |
- Parameters:
-
the AbstractDialogManager implementaion
- Since:
- 4.5
Definition at line 1011 of file corona.cpp.
| void Plasma::Corona::setImmutability | ( | const ImmutabilityType | immutable | ) | [slot] |
Sets the immutability type for this Corona (not immutable, user immutable or system immutable)
- immutable the new immutability type of this applet
Definition at line 908 of file corona.cpp.
| void Plasma::Corona::setPreferredToolBoxPlugin | ( | const Containment::Type | type, |
| const QString & | plugin | ||
| ) | [protected] |
- Returns:
- The preferred toolbox plugin name for a given containment type.
- Parameters:
-
type the containment type of which we want to know the preferred toolbox plugin. plugin the toolbox plugin name
- Since:
- 4.6
Definition at line 877 of file corona.cpp.
| void Plasma::Corona::shortcutsChanged | ( | ) | [signal] |
- Since:
- 4.3 emitted when the user changes keyboard shortcut settings connect to this if you've put some extra shortcuts in your app that are NOT in corona's actioncollection. if your code's not in shells/ it probably shouldn't be using this function.
- See also:
- addShortcuts
| void Plasma::Corona::updateShortcuts | ( | ) |
- Since:
- 4.3 Updates keyboard shortcuts for all the corona's actions. If you've added actions to the corona you'll need to call this for them to be configurable.
Definition at line 990 of file corona.cpp.
The documentation for this class was generated from the following files:
KDE 4.6 API Reference