Merge branch 'master' into plasma/declarative

This commit is contained in:
Sebastian Kügler 2011-03-16 17:47:21 +01:00
commit b68e3c3f8e
2 changed files with 21 additions and 0 deletions

View File

@ -497,6 +497,26 @@ QScriptValue ContainmentInterface::screenGeometry(int id) const
return val;
}
QScriptValue ContainmentInterface::availableScreenRegion(int id) const
{
QRegion reg;
if (containment()->corona()) {
reg = containment()->corona()->availableScreenRegion(id);
}
QScriptValue regVal = m_appletScriptEngine->engine()->newArray(reg.rects().size());
int i = 0;
foreach (QRect rect, reg.rects()) {
QScriptValue val = m_appletScriptEngine->engine()->newObject();
val.setProperty("x", rect.x());
val.setProperty("y", rect.y());
val.setProperty("width", rect.width());
val.setProperty("height", rect.height());
regVal.setProperty(i++, val);
}
return regVal;
}
void ContainmentInterface::appletAddedForward(Plasma::Applet *applet, const QPointF &pos)
{
applet->setFlag(QGraphicsItem::ItemIsMovable, m_movableApplets);

View File

@ -390,6 +390,7 @@ public:
bool hasMovableApplets() const;
Q_INVOKABLE QScriptValue screenGeometry(int id) const;
Q_INVOKABLE QScriptValue availableScreenRegion(int id) const;
Q_SIGNALS:
void appletAdded(QGraphicsWidget *applet, const QPointF &pos);