provide a containmentForScreen implementation that allows adding containments for screens / desktop affinities even in spite of immutabilities
svn path=/trunk/KDE/kdelibs/; revision=1198498
This commit is contained in:
parent
3edc7be1c5
commit
c21986f62d
24
corona.cpp
24
corona.cpp
@ -33,13 +33,14 @@
|
|||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
#include <kaction.h>
|
||||||
|
#include <kactioncollection.h>
|
||||||
#include <kdebug.h>
|
#include <kdebug.h>
|
||||||
#include <kglobal.h>
|
#include <kglobal.h>
|
||||||
#include <klocale.h>
|
#include <klocale.h>
|
||||||
#include <kmimetype.h>
|
#include <kmimetype.h>
|
||||||
#include <kactioncollection.h>
|
|
||||||
#include <kaction.h>
|
|
||||||
#include <kshortcutsdialog.h>
|
#include <kshortcutsdialog.h>
|
||||||
|
#include <kwindowsystem.h>
|
||||||
|
|
||||||
#include "animator.h"
|
#include "animator.h"
|
||||||
#include "abstracttoolbox.h"
|
#include "abstracttoolbox.h"
|
||||||
@ -192,7 +193,7 @@ public:
|
|||||||
|
|
||||||
//kDebug() << "Loading" << name << args << id;
|
//kDebug() << "Loading" << name << args << id;
|
||||||
|
|
||||||
if (pluginName.isEmpty()) {
|
if (pluginName.isEmpty() || pluginName == "default") {
|
||||||
// default to the desktop containment
|
// default to the desktop containment
|
||||||
pluginName = "desktop";
|
pluginName = "desktop";
|
||||||
}
|
}
|
||||||
@ -583,6 +584,23 @@ Containment *Corona::containmentForScreen(int screen, int desktop) const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Containment *Corona::containmentForScreen(int screen, int desktop,
|
||||||
|
const QString &defaultPluginIfNonExistent, const QVariantList &defaultArgs)
|
||||||
|
{
|
||||||
|
Containment *containment = containmentForScreen(screen, desktop);
|
||||||
|
if (!containment && !defaultPluginIfNonExistent.isEmpty()) {
|
||||||
|
// screen requests are allowed to bypass immutability
|
||||||
|
if (screen >= 0 && screen < numScreens() &&
|
||||||
|
desktop >= -1 && desktop < KWindowSystem::numberOfDesktops()) {
|
||||||
|
containment = d->addContainment(defaultPluginIfNonExistent, defaultArgs, 0, false);
|
||||||
|
if (containment) {
|
||||||
|
containment->setScreen(screen, desktop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return containment;
|
||||||
|
}
|
||||||
QList<Containment*> Corona::containments() const
|
QList<Containment*> Corona::containments() const
|
||||||
{
|
{
|
||||||
return d->containments;
|
return d->containments;
|
||||||
|
17
corona.h
17
corona.h
@ -96,7 +96,7 @@ public:
|
|||||||
Containment *addContainment(const QString &name, const QVariantList &args = QVariantList());
|
Containment *addContainment(const QString &name, const QVariantList &args = QVariantList());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Containment, if any, for a given physical screen
|
* Returns the Containment, if any, for a given physical screen and desktop
|
||||||
*
|
*
|
||||||
* @param screen number of the physical screen to locate
|
* @param screen number of the physical screen to locate
|
||||||
* @param desktop the virtual desktop) to locate; if < 0 then it will
|
* @param desktop the virtual desktop) to locate; if < 0 then it will
|
||||||
@ -104,6 +104,21 @@ public:
|
|||||||
*/
|
*/
|
||||||
Containment *containmentForScreen(int screen, int desktop = -1) const;
|
Containment *containmentForScreen(int screen, int desktop = -1) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Containment for a given physical screen and desktop, creating one
|
||||||
|
* if none exists
|
||||||
|
*
|
||||||
|
* @param screen number of the physical screen to locate
|
||||||
|
* @param desktop the virtual desktop) to locate; if < 0 then it will
|
||||||
|
* simply return the first Containment associated with screen
|
||||||
|
* @param defaultPluginIfNonExistent the plugin to load by default; "null" is an empty
|
||||||
|
* Containment and "default" creates the default plugin
|
||||||
|
* @param defaultArgs optional arguments to pass in when creating a Containment if needed
|
||||||
|
* @since 4.6
|
||||||
|
*/
|
||||||
|
Containment *containmentForScreen(int screen, int desktop,
|
||||||
|
const QString &defaultPluginIfNonExistent,
|
||||||
|
const QVariantList &defaultArgs = QVariantList());
|
||||||
/**
|
/**
|
||||||
* Adds a widget in the topleft quadrant in the scene. Widgets in the topleft quadrant are
|
* 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
|
* normally never shown unless you specifically aim a view at it, which makes it ideal for
|
||||||
|
Loading…
Reference in New Issue
Block a user