allow a subclass to define the default screen for the panel at runtime
CCBUG:262558
This commit is contained in:
parent
365be18057
commit
13164dd664
@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
#include "scriptengine.h"
|
#include "scriptengine.h"
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QDesktopWidget>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
@ -135,7 +137,7 @@ QScriptValue ScriptEngine::createContainment(const QString &type, const QString
|
|||||||
if (c) {
|
if (c) {
|
||||||
if (type == "panel") {
|
if (type == "panel") {
|
||||||
// some defaults
|
// some defaults
|
||||||
c->setScreen(0);
|
c->setScreen(env->defaultPanelScreen());
|
||||||
c->setLocation(Plasma::TopEdge);
|
c->setLocation(Plasma::TopEdge);
|
||||||
}
|
}
|
||||||
c->updateConstraints(Plasma::AllConstraints | Plasma::StartupCompletedConstraint);
|
c->updateConstraints(Plasma::AllConstraints | Plasma::StartupCompletedConstraint);
|
||||||
@ -173,6 +175,11 @@ QScriptValue ScriptEngine::wrap(Containment *c)
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ScriptEngine::defaultPanelScreen() const
|
||||||
|
{
|
||||||
|
return qApp ? qApp->desktop()->primaryScreen() : 0;
|
||||||
|
}
|
||||||
|
|
||||||
ScriptEngine *ScriptEngine::envFor(QScriptEngine *engine)
|
ScriptEngine *ScriptEngine::envFor(QScriptEngine *engine)
|
||||||
{
|
{
|
||||||
QObject *object = engine->globalObject().toQObject();
|
QObject *object = engine->globalObject().toQObject();
|
||||||
|
@ -53,6 +53,7 @@ public:
|
|||||||
QScriptValue wrap(Plasma::Applet *w);
|
QScriptValue wrap(Plasma::Applet *w);
|
||||||
virtual QScriptValue wrap(Plasma::Containment *c);
|
virtual QScriptValue wrap(Plasma::Containment *c);
|
||||||
QScriptValue wrap(Containment *c);
|
QScriptValue wrap(Containment *c);
|
||||||
|
virtual int defaultPanelScreen() const;
|
||||||
|
|
||||||
static bool isPanel(const Plasma::Containment *c);
|
static bool isPanel(const Plasma::Containment *c);
|
||||||
static ScriptEngine *envFor(QScriptEngine *engine);
|
static ScriptEngine *envFor(QScriptEngine *engine);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user