Put all Plasma emums in a Types class
This makes possible to use them directly frmo QML as a minus, is not pretty and requires tons of search and replace in old c++ code
This commit is contained in:
parent
13c5cf9380
commit
e07600a83f
@ -40,20 +40,20 @@
|
||||
// just for debugging purposes, FIXME: remove later
|
||||
QString locString(const Plasma::Location l) {
|
||||
QString o = "Unknown: " + l;
|
||||
if (l == Plasma::Floating) {
|
||||
if (l == Plasma::Types::Floating) {
|
||||
o = "Floating";
|
||||
} else if (l == Plasma::Desktop) {
|
||||
} else if (l == Plasma::Types::Desktop) {
|
||||
o = "Desktop";
|
||||
} else if (l == Plasma::FullScreen) {
|
||||
} else if (l == Plasma::Types::FullScreen) {
|
||||
o = "FullScreen";
|
||||
} else if (l == Plasma::TopEdge) {
|
||||
o = "TopEdge";
|
||||
} else if (l == Plasma::BottomEdge) {
|
||||
o = "BottomEdge";
|
||||
} else if (l == Plasma::LeftEdge) {
|
||||
o = "LeftEdge";
|
||||
} else if (l == Plasma::RightEdge) {
|
||||
o = "RightEdge";
|
||||
} else if (l == Plasma::Types::TopEdge) {
|
||||
o = "Types::TopEdge";
|
||||
} else if (l == Plasma::Types::BottomEdge) {
|
||||
o = "Types::BottomEdge";
|
||||
} else if (l == Plasma::Types::LeftEdge) {
|
||||
o = "Types::LeftEdge";
|
||||
} else if (l == Plasma::Types::RightEdge) {
|
||||
o = "Types::RightEdge";
|
||||
}
|
||||
return o;
|
||||
}
|
||||
@ -61,7 +61,7 @@ QString locString(const Plasma::Location l) {
|
||||
DialogProxy::DialogProxy(QQuickItem *parent)
|
||||
: QQuickWindow(),
|
||||
m_activeWindow(false),
|
||||
m_location(Plasma::TopEdge)
|
||||
m_location(Plasma::Types::TopEdge)
|
||||
{
|
||||
QSurfaceFormat format;
|
||||
format.setAlphaBufferSize(8);
|
||||
@ -153,7 +153,7 @@ void DialogProxy::setVisible(const bool visible)
|
||||
syncToMainItemSize();
|
||||
if (!m_visualParent.isNull() && m_visualParent.data()->window()) {
|
||||
avail = m_visualParent.data()->window()->screen()->availableGeometry();
|
||||
if (location() == Plasma::FullScreen) {
|
||||
if (location() == Plasma::Types::FullScreen) {
|
||||
m_frameSvgItem->setEnabledBorders(Plasma::FrameSvg::NoBorder);
|
||||
setGeometry(avail);
|
||||
|
||||
@ -228,13 +228,13 @@ QPoint DialogProxy::popupPosition(QQuickItem *item, Qt::AlignmentFlag alignment)
|
||||
(item->boundingRect().height() - height())/2);
|
||||
|
||||
QPoint offset(0, 0);
|
||||
if (l == Plasma::BottomEdge) {
|
||||
if (l == Plasma::Types::BottomEdge) {
|
||||
offset = bottomPoint;
|
||||
} else if (l == Plasma::LeftEdge) {
|
||||
} else if (l == Plasma::Types::LeftEdge) {
|
||||
offset = leftPoint;
|
||||
} else if (l == Plasma::RightEdge) {
|
||||
} else if (l == Plasma::Types::RightEdge) {
|
||||
offset = rightPoint;
|
||||
} else { // TopEdge
|
||||
} else { // Types::TopEdge
|
||||
offset = topPoint;
|
||||
}
|
||||
|
||||
@ -248,7 +248,7 @@ QPoint DialogProxy::popupPosition(QQuickItem *item, Qt::AlignmentFlag alignment)
|
||||
|
||||
if (menuPos.x() < leftMargin) {
|
||||
// popup hits lhs
|
||||
if (l == Plasma::TopEdge || l == Plasma::BottomEdge) {
|
||||
if (l == Plasma::Types::TopEdge || l == Plasma::Types::BottomEdge) {
|
||||
// move it
|
||||
menuPos.setX(0-leftMargin);
|
||||
} else {
|
||||
@ -258,7 +258,7 @@ QPoint DialogProxy::popupPosition(QQuickItem *item, Qt::AlignmentFlag alignment)
|
||||
}
|
||||
if (menuPos.x() + width() > avail.width() - rightMargin) {
|
||||
// popup hits rhs
|
||||
if (l == Plasma::TopEdge || l == Plasma::BottomEdge) {
|
||||
if (l == Plasma::Types::TopEdge || l == Plasma::Types::BottomEdge) {
|
||||
menuPos.setX(avail.width() - item->boundingRect().width() + rightMargin);
|
||||
} else {
|
||||
menuPos.setX(pos.x() + leftPoint.x());
|
||||
@ -266,7 +266,7 @@ QPoint DialogProxy::popupPosition(QQuickItem *item, Qt::AlignmentFlag alignment)
|
||||
}
|
||||
if (menuPos.y() < topMargin) {
|
||||
// hitting top
|
||||
if (l == Plasma::LeftEdge || l == Plasma::RightEdge) {
|
||||
if (l == Plasma::Types::LeftEdge || l == Plasma::Types::RightEdge) {
|
||||
menuPos.setY(0);
|
||||
} else {
|
||||
menuPos.setY(pos.y() + bottomPoint.y());
|
||||
@ -274,7 +274,7 @@ QPoint DialogProxy::popupPosition(QQuickItem *item, Qt::AlignmentFlag alignment)
|
||||
}
|
||||
if (menuPos.y() + height() > avail.height() - bottomMargin) {
|
||||
// hitting bottom
|
||||
if (l == Plasma::TopEdge || l == Plasma::BottomEdge) {
|
||||
if (l == Plasma::Types::TopEdge || l == Plasma::Types::BottomEdge) {
|
||||
menuPos.setY(pos.y() + topPoint.y());
|
||||
} else {
|
||||
menuPos.setY(avail.height() - item->boundingRect().height() + bottomMargin);
|
||||
|
@ -37,22 +37,22 @@ FrameSvgItemMargins::FrameSvgItemMargins(Plasma::FrameSvg *frameSvg, QObject *pa
|
||||
|
||||
qreal FrameSvgItemMargins::left() const
|
||||
{
|
||||
return m_frameSvg->marginSize(LeftMargin);
|
||||
return m_frameSvg->marginSize(Types::LeftMargin);
|
||||
}
|
||||
|
||||
qreal FrameSvgItemMargins::top() const
|
||||
{
|
||||
return m_frameSvg->marginSize(TopMargin);
|
||||
return m_frameSvg->marginSize(Types::TopMargin);
|
||||
}
|
||||
|
||||
qreal FrameSvgItemMargins::right() const
|
||||
{
|
||||
return m_frameSvg->marginSize(RightMargin);
|
||||
return m_frameSvg->marginSize(Types::RightMargin);
|
||||
}
|
||||
|
||||
qreal FrameSvgItemMargins::bottom() const
|
||||
{
|
||||
return m_frameSvg->marginSize(BottomMargin);
|
||||
return m_frameSvg->marginSize(Types::BottomMargin);
|
||||
}
|
||||
|
||||
void FrameSvgItemMargins::update()
|
||||
@ -84,11 +84,11 @@ void FrameSvgItem::setImagePath(const QString &path)
|
||||
m_frameSvg->setElementPrefix(m_prefix);
|
||||
|
||||
if (implicitWidth() <= 0) {
|
||||
setImplicitWidth(m_frameSvg->marginSize(Plasma::LeftMargin) + m_frameSvg->marginSize(Plasma::RightMargin));
|
||||
setImplicitWidth(m_frameSvg->marginSize(Plasma::Types::LeftMargin) + m_frameSvg->marginSize(Plasma::Types::RightMargin));
|
||||
}
|
||||
|
||||
if (implicitHeight() <= 0) {
|
||||
setImplicitHeight(m_frameSvg->marginSize(Plasma::TopMargin) + m_frameSvg->marginSize(Plasma::BottomMargin));
|
||||
setImplicitHeight(m_frameSvg->marginSize(Plasma::Types::TopMargin) + m_frameSvg->marginSize(Plasma::Types::BottomMargin));
|
||||
}
|
||||
|
||||
emit imagePathChanged();
|
||||
@ -114,11 +114,11 @@ void FrameSvgItem::setPrefix(const QString &prefix)
|
||||
m_prefix = prefix;
|
||||
|
||||
if (implicitWidth() <= 0) {
|
||||
setImplicitWidth(m_frameSvg->marginSize(Plasma::LeftMargin) + m_frameSvg->marginSize(Plasma::RightMargin));
|
||||
setImplicitWidth(m_frameSvg->marginSize(Plasma::Types::LeftMargin) + m_frameSvg->marginSize(Plasma::Types::RightMargin));
|
||||
}
|
||||
|
||||
if (implicitHeight() <= 0) {
|
||||
setImplicitHeight(m_frameSvg->marginSize(Plasma::TopMargin) + m_frameSvg->marginSize(Plasma::BottomMargin));
|
||||
setImplicitHeight(m_frameSvg->marginSize(Plasma::Types::TopMargin) + m_frameSvg->marginSize(Plasma::Types::BottomMargin));
|
||||
}
|
||||
|
||||
emit prefixChanged();
|
||||
@ -167,11 +167,11 @@ void FrameSvgItem::geometryChanged(const QRectF &newGeometry,
|
||||
void FrameSvgItem::doUpdate()
|
||||
{
|
||||
if (implicitWidth() <= 0) {
|
||||
setImplicitWidth(m_frameSvg->marginSize(Plasma::LeftMargin) + m_frameSvg->marginSize(Plasma::RightMargin));
|
||||
setImplicitWidth(m_frameSvg->marginSize(Plasma::Types::LeftMargin) + m_frameSvg->marginSize(Plasma::Types::RightMargin));
|
||||
}
|
||||
|
||||
if (implicitHeight() <= 0) {
|
||||
setImplicitHeight(m_frameSvg->marginSize(Plasma::TopMargin) + m_frameSvg->marginSize(Plasma::BottomMargin));
|
||||
setImplicitHeight(m_frameSvg->marginSize(Plasma::Types::TopMargin) + m_frameSvg->marginSize(Plasma::Types::BottomMargin));
|
||||
}
|
||||
|
||||
update();
|
||||
|
@ -167,7 +167,7 @@ void Applet::save(KConfigGroup &g) const
|
||||
void Applet::restore(KConfigGroup &group)
|
||||
{
|
||||
|
||||
setImmutability((ImmutabilityType)group.readEntry("immutability", (int)Mutable));
|
||||
setImmutability((ImmutabilityType)group.readEntry("immutability", (int)Types::Mutable));
|
||||
|
||||
KConfigGroup shortcutConfig(&group, "Shortcuts");
|
||||
QString shortcutText = shortcutConfig.readEntryUntranslated("global", QString());
|
||||
@ -257,7 +257,7 @@ KConfigGroup Applet::globalConfig() const
|
||||
|
||||
void Applet::destroy()
|
||||
{
|
||||
if (immutability() != Mutable || d->transient || !d->started) {
|
||||
if (immutability() != Types::Mutable || d->transient || !d->started) {
|
||||
return; //don't double delete
|
||||
}
|
||||
|
||||
@ -350,18 +350,18 @@ ImmutabilityType Applet::immutability() const
|
||||
// restrictive setting possible and will override anything that might be happening above it
|
||||
// in the Corona->Containment->Applet hierarchy
|
||||
if (d->transient || (d->mainConfig && d->mainConfig->isImmutable())) {
|
||||
return SystemImmutable;
|
||||
return Types::SystemImmutable;
|
||||
}
|
||||
|
||||
//Returning the more strict immutability between the applet immutability, Containment and Corona
|
||||
ImmutabilityType upperImmutability = Mutable;
|
||||
ImmutabilityType upperImmutability = Types::Mutable;
|
||||
Containment *cont = d->isContainment ? 0 : containment();
|
||||
|
||||
if (cont) {
|
||||
upperImmutability = cont->immutability();
|
||||
}
|
||||
|
||||
if (upperImmutability != Mutable) {
|
||||
if (upperImmutability != Types::Mutable) {
|
||||
// it's either system or user immutable, and we already check for local system immutability,
|
||||
// so upperImmutability is guaranteed to be as or more severe as this object's immutability
|
||||
return upperImmutability;
|
||||
@ -372,7 +372,7 @@ ImmutabilityType Applet::immutability() const
|
||||
|
||||
void Applet::setImmutability(const ImmutabilityType immutable)
|
||||
{
|
||||
if (d->immutability == immutable || immutable == Plasma::SystemImmutable) {
|
||||
if (d->immutability == immutable || immutable == Types::SystemImmutable) {
|
||||
// we do not store system immutability in d->immutability since that gets saved
|
||||
// out to the config file; instead, we check with
|
||||
// the config group itself for this information at all times. this differs from
|
||||
@ -381,7 +381,7 @@ void Applet::setImmutability(const ImmutabilityType immutable)
|
||||
}
|
||||
|
||||
d->immutability = immutable;
|
||||
updateConstraints(ImmutableConstraint);
|
||||
updateConstraints(Types::ImmutableConstraint);
|
||||
}
|
||||
|
||||
QString Applet::launchErrorMessage() const
|
||||
@ -422,7 +422,7 @@ void Applet::setStatus(const ItemStatus status)
|
||||
|
||||
void Applet::flushPendingConstraintsEvents()
|
||||
{
|
||||
if (d->pendingConstraints == NoConstraint) {
|
||||
if (d->pendingConstraints == Types::NoConstraint) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -432,11 +432,11 @@ void Applet::flushPendingConstraintsEvents()
|
||||
|
||||
//kDebug() << "fushing constraints: " << d->pendingConstraints << "!!!!!!!!!!!!!!!!!!!!!!!!!!!";
|
||||
Plasma::Constraints c = d->pendingConstraints;
|
||||
d->pendingConstraints = NoConstraint;
|
||||
d->pendingConstraints = Types::NoConstraint;
|
||||
|
||||
if (c & Plasma::StartupCompletedConstraint) {
|
||||
if (c & Plasma::Types::StartupCompletedConstraint) {
|
||||
//common actions
|
||||
bool unlocked = immutability() == Mutable;
|
||||
bool unlocked = immutability() == Types::Mutable;
|
||||
QAction *closeApplet = d->actions->action("remove");
|
||||
if (closeApplet) {
|
||||
closeApplet->setEnabled(unlocked);
|
||||
@ -467,8 +467,8 @@ void Applet::flushPendingConstraintsEvents()
|
||||
}
|
||||
}
|
||||
|
||||
if (c & Plasma::ImmutableConstraint) {
|
||||
bool unlocked = immutability() == Mutable;
|
||||
if (c & Plasma::Types::ImmutableConstraint) {
|
||||
bool unlocked = immutability() == Types::Mutable;
|
||||
QAction *action = d->actions->action("remove");
|
||||
if (action) {
|
||||
action->setVisible(unlocked);
|
||||
@ -494,7 +494,7 @@ void Applet::flushPendingConstraintsEvents()
|
||||
// pass the constraint on to the actual subclass
|
||||
constraintsEvent(c);
|
||||
|
||||
if (c & StartupCompletedConstraint) {
|
||||
if (c & Types::StartupCompletedConstraint) {
|
||||
// start up is done, we can now go do a mod timer
|
||||
if (d->modificationsTimer) {
|
||||
if (d->modificationsTimer->isActive()) {
|
||||
@ -528,7 +528,7 @@ FormFactor Applet::formFactor() const
|
||||
parentApplet = qobject_cast<Plasma::Applet *>(pw);
|
||||
}
|
||||
|
||||
return c ? c->d->formFactor : Plasma::Planar;
|
||||
return c ? c->d->formFactor : Plasma::Types::Planar;
|
||||
}
|
||||
|
||||
Containment *Applet::containment() const
|
||||
@ -602,7 +602,7 @@ KShortcut Applet::globalShortcut() const
|
||||
Location Applet::location() const
|
||||
{
|
||||
Containment *c = containment();
|
||||
return c ? c->d->location : Plasma::Desktop;
|
||||
return c ? c->d->location : Plasma::Types::Desktop;
|
||||
}
|
||||
|
||||
bool Applet::hasConfigurationInterface() const
|
||||
@ -620,7 +620,7 @@ void Applet::setHasConfigurationInterface(bool hasInterface)
|
||||
if (configAction) {
|
||||
bool enable = hasInterface;
|
||||
if (enable) {
|
||||
const bool unlocked = immutability() == Mutable;
|
||||
const bool unlocked = immutability() == Types::Mutable;
|
||||
enable = unlocked || KAuthorized::authorize("plasma/allow_configure_when_locked");
|
||||
}
|
||||
configAction->setEnabled(enable);
|
||||
@ -714,7 +714,7 @@ void Applet::timerEvent(QTimerEvent *event)
|
||||
|
||||
// Don't flushPendingConstraints if we're just starting up
|
||||
// flushPendingConstraints will be called by Corona
|
||||
if(!(d->pendingConstraints & Plasma::StartupCompletedConstraint)) {
|
||||
if(!(d->pendingConstraints & Plasma::Types::StartupCompletedConstraint)) {
|
||||
flushPendingConstraintsEvents();
|
||||
}
|
||||
} else if (d->modificationsTimer && event->timerId() == d->modificationsTimer->timerId()) {
|
||||
|
@ -225,7 +225,7 @@ class PLASMA_EXPORT Applet : public QObject
|
||||
*
|
||||
* @param constraints the type of constraints that were updated
|
||||
*/
|
||||
void updateConstraints(Plasma::Constraints constraints = Plasma::AllConstraints);
|
||||
void updateConstraints(Plasma::Constraints constraints = Plasma::Types::AllConstraints);
|
||||
|
||||
|
||||
//METADATA
|
||||
|
@ -67,7 +67,7 @@ Containment::Containment(QObject *parent,
|
||||
{
|
||||
// WARNING: do not access config() OR globalConfig() in this method!
|
||||
// that requires a scene, which is not available at this point
|
||||
setContainmentType(CustomContainment);
|
||||
setContainmentType(Types::CustomContainment);
|
||||
setHasConfigurationInterface(true);
|
||||
}
|
||||
|
||||
@ -104,26 +104,26 @@ void Containment::init()
|
||||
return;
|
||||
}
|
||||
|
||||
if (d->type == NoContainmentType) {
|
||||
//setContainmentType(Plasma::DesktopContainment);
|
||||
if (d->type == Types::NoContainmentType) {
|
||||
//setContainmentType(Plasma::Types::DesktopContainment);
|
||||
//Try to determine the containment type. It must be done as soon as possible
|
||||
QString type = pluginInfo().property("X-Plasma-ContainmentType").toString();
|
||||
|
||||
if (type == "Panel") {
|
||||
setContainmentType(Plasma::PanelContainment);
|
||||
setContainmentType(Plasma::Types::PanelContainment);
|
||||
} else if (type == "Custom") {
|
||||
setContainmentType(Plasma::CustomContainment);
|
||||
setContainmentType(Plasma::Types::CustomContainment);
|
||||
} else if (type == "CustomPanel") {
|
||||
setContainmentType(Plasma::CustomPanelContainment);
|
||||
setContainmentType(Plasma::Types::CustomPanelContainment);
|
||||
//default to desktop
|
||||
} else {
|
||||
setContainmentType(Plasma::DesktopContainment);
|
||||
setContainmentType(Plasma::Types::DesktopContainment);
|
||||
}
|
||||
}
|
||||
|
||||
//connect actions
|
||||
ContainmentPrivate::addDefaultActions(actions(), this);
|
||||
bool unlocked = immutability() == Mutable;
|
||||
bool unlocked = immutability() == Types::Mutable;
|
||||
|
||||
//fix the text of the actions that need title()
|
||||
//btw, do we really want to use title() when it's a desktopcontainment?
|
||||
@ -144,7 +144,7 @@ void Containment::init()
|
||||
connect(appletBrowserAction, SIGNAL(triggered()), this, SLOT(triggerShowAddWidgets()));
|
||||
}
|
||||
|
||||
if (immutability() != SystemImmutable && corona()) {
|
||||
if (immutability() != Types::SystemImmutable && corona()) {
|
||||
QAction *lockDesktopAction = corona()->actions()->action("lock widgets");
|
||||
//keep a pointer so nobody notices it moved to corona
|
||||
if (lockDesktopAction) {
|
||||
@ -186,7 +186,7 @@ void Containment::restore(KConfigGroup &group)
|
||||
|
||||
flushPendingConstraintsEvents();
|
||||
restoreContents(group);
|
||||
setImmutability((ImmutabilityType)group.readEntry("immutability", (int)Mutable));
|
||||
setImmutability((ImmutabilityType)group.readEntry("immutability", (int)Types::Mutable));
|
||||
|
||||
setWallpaper(group.readEntry("wallpaperplugin", ContainmentPrivate::defaultWallpaper));
|
||||
|
||||
@ -202,9 +202,9 @@ void Containment::restore(KConfigGroup &group)
|
||||
}
|
||||
} else { //shell defaults
|
||||
KConfigGroup defaultActionsCfg;
|
||||
if (d->type == Plasma::PanelContainment) {
|
||||
if (d->type == Plasma::Types::PanelContainment) {
|
||||
defaultActionsCfg = KConfigGroup(KSharedConfig::openConfig(corona()->package().filePath("defaults")), "Panel");
|
||||
//Plasma::DesktopContainment
|
||||
//Plasma::Types::DesktopContainment
|
||||
} else {
|
||||
defaultActionsCfg = KConfigGroup(KSharedConfig::openConfig(corona()->package().filePath("defaults")), "Desktop");
|
||||
}
|
||||
@ -319,7 +319,7 @@ void Containment::setFormFactor(FormFactor formFactor)
|
||||
//kDebug() << "switching FF to " << formFactor;
|
||||
d->formFactor = formFactor;
|
||||
|
||||
updateConstraints(Plasma::FormFactorConstraint);
|
||||
updateConstraints(Plasma::Types::FormFactorConstraint);
|
||||
|
||||
KConfigGroup c = config();
|
||||
c.writeEntry("formfactor", (int)formFactor);
|
||||
@ -336,10 +336,10 @@ void Containment::setLocation(Location location)
|
||||
d->location = location;
|
||||
|
||||
foreach (Applet *applet, d->applets) {
|
||||
applet->updateConstraints(Plasma::LocationConstraint);
|
||||
applet->updateConstraints(Plasma::Types::LocationConstraint);
|
||||
}
|
||||
|
||||
updateConstraints(Plasma::LocationConstraint);
|
||||
updateConstraints(Plasma::Types::LocationConstraint);
|
||||
|
||||
KConfigGroup c = config();
|
||||
c.writeEntry("location", (int)location);
|
||||
@ -354,7 +354,7 @@ Applet *Containment::createApplet(const QString &name, const QVariantList &args)
|
||||
|
||||
void Containment::addApplet(Applet *applet)
|
||||
{
|
||||
if (!isContainment() || immutability() != Mutable) {
|
||||
if (!isContainment() || immutability() != Types::Mutable) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -416,13 +416,13 @@ void Containment::addApplet(Applet *applet)
|
||||
//FIXME: an on-appear animation would be nice to have again
|
||||
}
|
||||
|
||||
applet->updateConstraints(Plasma::AllConstraints);
|
||||
applet->updateConstraints(Plasma::Types::AllConstraints);
|
||||
applet->flushPendingConstraintsEvents();
|
||||
|
||||
emit appletAdded(applet);
|
||||
|
||||
if (!currentContainment) {
|
||||
applet->updateConstraints(Plasma::StartupCompletedConstraint);
|
||||
applet->updateConstraints(Plasma::Types::StartupCompletedConstraint);
|
||||
applet->flushPendingConstraintsEvents();
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ void Corona::exportLayout(KConfigGroup &config, QList<Containment*> containments
|
||||
|
||||
//temporarily unlock so that removal works
|
||||
ImmutabilityType oldImm = immutability();
|
||||
d->immutability = Mutable;
|
||||
d->immutability = Types::Mutable;
|
||||
|
||||
KConfigGroup dest(&config, "Containments");
|
||||
KConfigGroup dummy;
|
||||
@ -102,10 +102,10 @@ void Corona::exportLayout(KConfigGroup &config, QList<Containment*> containments
|
||||
c->config().reparent(&dest);
|
||||
|
||||
//ensure the containment is unlocked
|
||||
//this is done directly because we have to bypass any SystemImmutable checks
|
||||
c->Applet::d->immutability = Mutable;
|
||||
//this is done directly because we have to bypass any Types::SystemImmutable checks
|
||||
c->Applet::d->immutability = Types::Mutable;
|
||||
foreach (Applet *a, c->applets()) {
|
||||
a->d->immutability = Mutable;
|
||||
a->d->immutability = Types::Mutable;
|
||||
}
|
||||
|
||||
c->destroy();
|
||||
@ -161,8 +161,8 @@ Containment *Corona::containmentForScreen(int screen) const
|
||||
{
|
||||
foreach (Containment *containment, d->containments) {
|
||||
if (containment->screen() == screen &&
|
||||
(containment->containmentType() == Plasma::DesktopContainment ||
|
||||
containment->containmentType() == Plasma::CustomContainment)) {
|
||||
(containment->containmentType() == Plasma::Types::DesktopContainment ||
|
||||
containment->containmentType() == Plasma::Types::CustomContainment)) {
|
||||
return containment;
|
||||
}
|
||||
}
|
||||
@ -186,7 +186,7 @@ KSharedConfigPtr Corona::config() const
|
||||
|
||||
Containment *Corona::createContainment(const QString &name, const QVariantList &args)
|
||||
{
|
||||
if (d->immutability == Mutable) {
|
||||
if (d->immutability == Types::Mutable) {
|
||||
return d->addContainment(name, args, 0);
|
||||
}
|
||||
|
||||
@ -220,7 +220,7 @@ ImmutabilityType Corona::immutability() const
|
||||
|
||||
void Corona::setImmutability(const ImmutabilityType immutable)
|
||||
{
|
||||
if (d->immutability == immutable || d->immutability == SystemImmutable) {
|
||||
if (d->immutability == immutable || d->immutability == Types::SystemImmutable) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -235,11 +235,11 @@ void Corona::setImmutability(const ImmutabilityType immutable)
|
||||
//update our actions
|
||||
QAction *action = d->actions.action("lock widgets");
|
||||
if (action) {
|
||||
if (d->immutability == SystemImmutable) {
|
||||
if (d->immutability == Types::SystemImmutable) {
|
||||
action->setEnabled(false);
|
||||
action->setVisible(false);
|
||||
} else {
|
||||
bool unlocked = d->immutability == Mutable;
|
||||
bool unlocked = d->immutability == Types::Mutable;
|
||||
action->setText(unlocked ? i18n("Lock Widgets") : i18n("Unlock Widgets"));
|
||||
action->setIcon(QIcon::fromTheme(unlocked ? "object-locked" : "object-unlocked"));
|
||||
action->setEnabled(true);
|
||||
@ -247,7 +247,7 @@ void Corona::setImmutability(const ImmutabilityType immutable)
|
||||
}
|
||||
}
|
||||
|
||||
if (d->immutability != SystemImmutable) {
|
||||
if (d->immutability != Types::SystemImmutable) {
|
||||
KConfigGroup cg(config(), "General");
|
||||
|
||||
// we call the dptr member directly for locked since isImmutable()
|
||||
@ -260,8 +260,8 @@ void Corona::setImmutability(const ImmutabilityType immutable)
|
||||
QList<Plasma::Location> Corona::freeEdges(int screen) const
|
||||
{
|
||||
QList<Plasma::Location> freeEdges;
|
||||
freeEdges << Plasma::TopEdge << Plasma::BottomEdge
|
||||
<< Plasma::LeftEdge << Plasma::RightEdge;
|
||||
freeEdges << Plasma::Types::TopEdge << Plasma::Types::BottomEdge
|
||||
<< Plasma::Types::LeftEdge << Plasma::Types::RightEdge;
|
||||
|
||||
foreach (Containment *containment, containments()) {
|
||||
if (containment->screen() == screen &&
|
||||
@ -280,7 +280,7 @@ KActionCollection *Corona::actions() const
|
||||
|
||||
CoronaPrivate::CoronaPrivate(Corona *corona)
|
||||
: q(corona),
|
||||
immutability(Mutable),
|
||||
immutability(Types::Mutable),
|
||||
config(0),
|
||||
configSyncTimer(new QTimer(corona)),
|
||||
actions(corona)
|
||||
@ -317,7 +317,7 @@ void CoronaPrivate::init()
|
||||
lockAction->setText(i18n("Lock Widgets"));
|
||||
lockAction->setAutoRepeat(true);
|
||||
lockAction->setIcon(QIcon::fromTheme("object-locked"));
|
||||
lockAction->setData(Plasma::ControlAction);
|
||||
lockAction->setData(Plasma::Types::ControlAction);
|
||||
lockAction->setShortcut(KShortcut("alt+d, l"));
|
||||
lockAction->setShortcutContext(Qt::ApplicationShortcut);
|
||||
|
||||
@ -328,10 +328,10 @@ void CoronaPrivate::init()
|
||||
|
||||
void CoronaPrivate::toggleImmutability()
|
||||
{
|
||||
if (immutability == Mutable) {
|
||||
q->setImmutability(UserImmutable);
|
||||
if (immutability == Types::Mutable) {
|
||||
q->setImmutability(Types::UserImmutable);
|
||||
} else {
|
||||
q->setImmutability(Mutable);
|
||||
q->setImmutability(Types::Mutable);
|
||||
}
|
||||
}
|
||||
|
||||
@ -349,7 +349,7 @@ void CoronaPrivate::updateContainmentImmutability()
|
||||
{
|
||||
foreach (Containment *c, containments) {
|
||||
// we need to tell each containment that immutability has been altered
|
||||
c->updateConstraints(ImmutableConstraint);
|
||||
c->updateConstraints(Types::ImmutableConstraint);
|
||||
}
|
||||
}
|
||||
|
||||
@ -418,7 +418,7 @@ Containment *CoronaPrivate::addContainment(const QString &name, const QVariantLi
|
||||
}
|
||||
|
||||
// we want to provide something and don't care about the failure to launch
|
||||
containment->setFormFactor(Plasma::Planar);
|
||||
containment->setFormFactor(Plasma::Types::Planar);
|
||||
}
|
||||
|
||||
// if this is a new containment, we need to ensure that there are no stale
|
||||
@ -443,7 +443,7 @@ Containment *CoronaPrivate::addContainment(const QString &name, const QVariantLi
|
||||
containment->init();
|
||||
KConfigGroup cg = containment->config();
|
||||
containment->restore(cg);
|
||||
containment->updateConstraints(Plasma::StartupCompletedConstraint);
|
||||
containment->updateConstraints(Plasma::Types::StartupCompletedConstraint);
|
||||
containment->save(cg);
|
||||
q->requestConfigSync();
|
||||
containment->flushPendingConstraintsEvents();
|
||||
@ -507,7 +507,7 @@ QList<Plasma::Containment *> CoronaPrivate::importLayout(const KConfigGroup &con
|
||||
}
|
||||
|
||||
foreach (Containment *containment, newContainments) {
|
||||
containment->updateConstraints(Plasma::StartupCompletedConstraint);
|
||||
containment->updateConstraints(Plasma::Types::StartupCompletedConstraint);
|
||||
emit q->containmentAdded(containment);
|
||||
#ifndef NDEBUG
|
||||
// kDebug() << "!!{} STARTUP TIME" << QTime().msecsTo(QTime::currentTime()) << "Containment" << containment->name();
|
||||
|
@ -120,7 +120,7 @@ class PLASMA_EXPORT DataEngine : public QObject
|
||||
Q_INVOKABLE void connectSource(
|
||||
const QString &source, QObject *visualization,
|
||||
uint pollingInterval = 0,
|
||||
Plasma::IntervalAlignment intervalAlignment = NoAlignment) const;
|
||||
Plasma::Types::IntervalAlignment intervalAlignment = Types::NoAlignment) const;
|
||||
|
||||
/**
|
||||
* Connects all currently existing sources to an object for data updates.
|
||||
@ -150,8 +150,8 @@ class PLASMA_EXPORT DataEngine : public QObject
|
||||
* @param intervalAlignment the number of ms to align the interval to
|
||||
**/
|
||||
Q_INVOKABLE void connectAllSources(QObject *visualization, uint pollingInterval = 0,
|
||||
Plasma::IntervalAlignment intervalAlignment =
|
||||
NoAlignment) const;
|
||||
Plasma::Types::IntervalAlignment intervalAlignment =
|
||||
Types::NoAlignment) const;
|
||||
|
||||
/**
|
||||
* Disconnects a source from an object that was receiving data updates.
|
||||
|
@ -183,16 +183,16 @@ FrameSvg::EnabledBorders FrameSvg::enabledBorders() const
|
||||
void FrameSvg::setElementPrefix(Plasma::Location location)
|
||||
{
|
||||
switch (location) {
|
||||
case TopEdge:
|
||||
case Types::TopEdge:
|
||||
setElementPrefix("north");
|
||||
break;
|
||||
case BottomEdge:
|
||||
case Types::BottomEdge:
|
||||
setElementPrefix("south");
|
||||
break;
|
||||
case LeftEdge:
|
||||
case Types::LeftEdge:
|
||||
setElementPrefix("west");
|
||||
break;
|
||||
case RightEdge:
|
||||
case Types::RightEdge:
|
||||
setElementPrefix("east");
|
||||
break;
|
||||
default:
|
||||
@ -269,7 +269,7 @@ void FrameSvg::setElementPrefix(const QString &prefix)
|
||||
}
|
||||
}
|
||||
|
||||
d->location = Floating;
|
||||
d->location = Types::Floating;
|
||||
}
|
||||
|
||||
bool FrameSvg::hasElementPrefix(const QString & prefix) const
|
||||
@ -286,16 +286,16 @@ bool FrameSvg::hasElementPrefix(const QString & prefix) const
|
||||
bool FrameSvg::hasElementPrefix(Plasma::Location location) const
|
||||
{
|
||||
switch (location) {
|
||||
case TopEdge:
|
||||
case Types::TopEdge:
|
||||
return hasElementPrefix("north");
|
||||
break;
|
||||
case BottomEdge:
|
||||
case Types::BottomEdge:
|
||||
return hasElementPrefix("south");
|
||||
break;
|
||||
case LeftEdge:
|
||||
case Types::LeftEdge:
|
||||
return hasElementPrefix("west");
|
||||
break;
|
||||
case RightEdge:
|
||||
case Types::RightEdge:
|
||||
return hasElementPrefix("east");
|
||||
break;
|
||||
default:
|
||||
@ -393,15 +393,15 @@ qreal FrameSvg::marginSize(const Plasma::MarginEdge edge) const
|
||||
}
|
||||
|
||||
switch (edge) {
|
||||
case Plasma::TopMargin:
|
||||
case Plasma::Types::TopMargin:
|
||||
return d->frames[d->prefix]->topMargin;
|
||||
break;
|
||||
|
||||
case Plasma::LeftMargin:
|
||||
case Plasma::Types::LeftMargin:
|
||||
return d->frames[d->prefix]->leftMargin;
|
||||
break;
|
||||
|
||||
case Plasma::RightMargin:
|
||||
case Plasma::Types::RightMargin:
|
||||
return d->frames[d->prefix]->rightMargin;
|
||||
break;
|
||||
|
||||
|
@ -28,46 +28,46 @@
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
Direction locationToDirection(Location location)
|
||||
Types::Direction locationToDirection(Types::Location location)
|
||||
{
|
||||
switch (location) {
|
||||
case Floating:
|
||||
case Desktop:
|
||||
case TopEdge:
|
||||
case FullScreen:
|
||||
case Types::Floating:
|
||||
case Types::Desktop:
|
||||
case Types::TopEdge:
|
||||
case Types::FullScreen:
|
||||
//TODO: should we be smarter for floating and planer?
|
||||
// perhaps we should take a QRect and/or QPos as well?
|
||||
return Down;
|
||||
case BottomEdge:
|
||||
return Up;
|
||||
case LeftEdge:
|
||||
return Right;
|
||||
case RightEdge:
|
||||
return Left;
|
||||
return Types::Down;
|
||||
case Types::BottomEdge:
|
||||
return Types::Up;
|
||||
case Types::LeftEdge:
|
||||
return Types::Right;
|
||||
case Types::RightEdge:
|
||||
return Types::Left;
|
||||
}
|
||||
|
||||
return Down;
|
||||
return Types::Down;
|
||||
}
|
||||
|
||||
Direction locationToInverseDirection(Location location)
|
||||
Types::Direction locationToInverseDirection(Types::Location location)
|
||||
{
|
||||
switch (location) {
|
||||
case Floating:
|
||||
case Desktop:
|
||||
case TopEdge:
|
||||
case FullScreen:
|
||||
case Types::Floating:
|
||||
case Types::Desktop:
|
||||
case Types::TopEdge:
|
||||
case Types::FullScreen:
|
||||
//TODO: should we be smarter for floating and planer?
|
||||
// perhaps we should take a QRect and/or QPos as well?
|
||||
return Up;
|
||||
case BottomEdge:
|
||||
return Down;
|
||||
case LeftEdge:
|
||||
return Left;
|
||||
case RightEdge:
|
||||
return Right;
|
||||
return Types::Up;
|
||||
case Types::BottomEdge:
|
||||
return Types::Down;
|
||||
case Types::LeftEdge:
|
||||
return Types::Left;
|
||||
case Types::RightEdge:
|
||||
return Types::Right;
|
||||
}
|
||||
|
||||
return Up;
|
||||
return Types::Up;
|
||||
}
|
||||
|
||||
} // Plasma namespace
|
||||
|
@ -34,6 +34,13 @@ class QAction;
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
class PLASMA_EXPORT Types : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_ENUMS(Constraint)
|
||||
Q_ENUMS(FormFactor)
|
||||
|
||||
public:
|
||||
/**
|
||||
* The Constraint enumeration lists the various constraints that Plasma
|
||||
* objects have managed for them and which they may wish to react to,
|
||||
@ -246,12 +253,6 @@ enum ItemStatus {
|
||||
};
|
||||
Q_ENUMS(ItemStatus)
|
||||
|
||||
enum AnnouncementMethod {
|
||||
NoAnnouncement = 0, /**< No announcements **/
|
||||
ZeroconfAnnouncement = 1 /**< Announcements via ZeroConf **/
|
||||
};
|
||||
Q_DECLARE_FLAGS(AnnouncementMethods, AnnouncementMethod)
|
||||
|
||||
enum TrustLevel {
|
||||
UnverifiableTrust = 0, /**< The trust of the object can not be verified, usually because no
|
||||
trust information (e.g. a cryptographic signature) was provided */
|
||||
@ -276,6 +277,8 @@ enum BackgroundHints {
|
||||
};
|
||||
Q_ENUMS(BackgroundHints)
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a location to a direction. Handy for figuring out which way to send a popup based on
|
||||
* location or to point arrows and other directional items.
|
||||
@ -283,7 +286,7 @@ Q_ENUMS(BackgroundHints)
|
||||
* @param location the location of the container the element will appear in
|
||||
* @return the visual direction the element should be oriented in
|
||||
**/
|
||||
PLASMA_EXPORT Direction locationToDirection(Location location);
|
||||
PLASMA_EXPORT Types::Direction locationToDirection(Types::Location location);
|
||||
|
||||
/**
|
||||
* Converts a location to the direction facing it. Handy for figuring out which way to collapse
|
||||
@ -292,13 +295,36 @@ PLASMA_EXPORT Direction locationToDirection(Location location);
|
||||
* @param location the location of the container the element will appear in
|
||||
* @return the visual direction the element should be oriented in
|
||||
**/
|
||||
PLASMA_EXPORT Direction locationToInverseDirection(Location location);
|
||||
PLASMA_EXPORT Types::Direction locationToInverseDirection(Types::Location location);
|
||||
|
||||
//For porting
|
||||
//TODO: remove
|
||||
typedef Types::Constraint Constraint;
|
||||
Q_DECLARE_FLAGS(Constraints, Constraint)
|
||||
typedef Types::FormFactor FormFactor;
|
||||
typedef Types::ContainmentType ContainmentType;
|
||||
typedef Types::ActionType ActionType;
|
||||
typedef Types::Direction Direction;
|
||||
typedef Types::Location Location;
|
||||
typedef Types::Position Position;
|
||||
typedef Types::PopupPlacement PopupPlacement;
|
||||
typedef Types::FlipDirection FlipDirection;
|
||||
typedef Types::IntervalAlignment IntervalAlignment;
|
||||
typedef Types::ImmutabilityType ImmutabilityType;
|
||||
typedef Types::ComponentType ComponentType;
|
||||
typedef Types::MarginEdge MarginEdge;
|
||||
typedef Types::MessageButton MessageButton;
|
||||
typedef Types::ItemStatus ItemStatus;
|
||||
typedef Types::TrustLevel TrustLevel;
|
||||
typedef Types::BackgroundHints BackgroundHints;
|
||||
|
||||
} // Plasma namespace
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::Constraints)
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::Flip)
|
||||
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::Types::Constraints)
|
||||
/*Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::Flip)
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::ComponentTypes)
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::MessageButtons)
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::MessageButtons)*/
|
||||
|
||||
#endif // multiple inclusion guard
|
||||
|
@ -50,16 +50,16 @@ namespace Plasma
|
||||
AppletPrivate::AppletPrivate(KService::Ptr service, const KPluginInfo *info, int uniqueID, Applet *applet)
|
||||
: appletId(uniqueID),
|
||||
q(applet),
|
||||
immutability(Mutable),
|
||||
immutability(Types::Mutable),
|
||||
appletDescription(info ? *info : KPluginInfo(service)),
|
||||
mainConfig(0),
|
||||
pendingConstraints(NoConstraint),
|
||||
pendingConstraints(Types::NoConstraint),
|
||||
script(0),
|
||||
package(0),
|
||||
configLoader(0),
|
||||
actions(AppletPrivate::defaultActions(applet)),
|
||||
activationAction(0),
|
||||
itemStatus(UnknownStatus),
|
||||
itemStatus(Types::UnknownStatus),
|
||||
modificationsTimer(0),
|
||||
hasConfigurationInterface(false),
|
||||
isContainment(false),
|
||||
@ -202,14 +202,14 @@ KActionCollection* AppletPrivate::defaultActions(QObject *parent)
|
||||
configAction->setText(i18n("Widget Settings"));
|
||||
configAction->setIcon(QIcon::fromTheme("configure"));
|
||||
configAction->setShortcut(KShortcut("alt+d, s"));
|
||||
configAction->setData(Plasma::ConfigureAction);
|
||||
configAction->setData(Plasma::Types::ConfigureAction);
|
||||
|
||||
KAction *closeApplet = actions->add<KAction>("remove");
|
||||
closeApplet->setAutoRepeat(false);
|
||||
closeApplet->setText(i18n("Remove this Widget"));
|
||||
closeApplet->setIcon(QIcon::fromTheme("edit-delete"));
|
||||
closeApplet->setShortcut(KShortcut("alt+d, r"));
|
||||
closeApplet->setData(Plasma::DestructiveAction);
|
||||
closeApplet->setData(Plasma::Types::DestructiveAction);
|
||||
|
||||
KAction *runAssociatedApplication = actions->add<KAction>("run associated application");
|
||||
runAssociatedApplication->setAutoRepeat(false);
|
||||
@ -218,7 +218,7 @@ KActionCollection* AppletPrivate::defaultActions(QObject *parent)
|
||||
runAssociatedApplication->setShortcut(KShortcut("alt+d, t"));
|
||||
runAssociatedApplication->setVisible(false);
|
||||
runAssociatedApplication->setEnabled(false);
|
||||
runAssociatedApplication->setData(Plasma::ControlAction);
|
||||
runAssociatedApplication->setData(Plasma::Types::ControlAction);
|
||||
|
||||
return actions;
|
||||
}
|
||||
@ -321,11 +321,11 @@ void AppletPrivate::scheduleConstraintsUpdate(Plasma::Constraints c)
|
||||
{
|
||||
// Don't start up a timer if we're just starting up
|
||||
// flushPendingConstraints will be called by Corona
|
||||
if (started && !constraintsTimer.isActive() && !(c & Plasma::StartupCompletedConstraint)) {
|
||||
if (started && !constraintsTimer.isActive() && !(c & Plasma::Types::StartupCompletedConstraint)) {
|
||||
constraintsTimer.start(0, q);
|
||||
}
|
||||
|
||||
if (c & Plasma::StartupCompletedConstraint) {
|
||||
if (c & Plasma::Types::StartupCompletedConstraint) {
|
||||
started = true;
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ void ContainmentPrivate::addDefaultActions(KActionCollection *actions, Containme
|
||||
appletBrowserAction->setText(i18n("Add Widgets..."));
|
||||
appletBrowserAction->setIcon(QIcon::fromTheme("list-add"));
|
||||
appletBrowserAction->setShortcut(KShortcut("alt+d, a"));
|
||||
appletBrowserAction->setData(Plasma::AddAction);
|
||||
appletBrowserAction->setData(Plasma::Types::AddAction);
|
||||
}
|
||||
|
||||
void ContainmentPrivate::setScreen(int newScreen)
|
||||
@ -101,8 +101,8 @@ void ContainmentPrivate::setScreen(int newScreen)
|
||||
//kDebug() << activity() << "setting screen to " << newScreen << "and type is" << type;
|
||||
|
||||
Containment *swapScreensWith(0);
|
||||
const bool isDesktopContainment = type == Plasma::DesktopContainment ||
|
||||
type == Plasma::CustomContainment;
|
||||
const bool isDesktopContainment = type == Plasma::Types::DesktopContainment ||
|
||||
type == Plasma::Types::CustomContainment;
|
||||
if (isDesktopContainment) {
|
||||
if (newScreen > -1) {
|
||||
// sanity check to make sure someone else doesn't have this screen already!
|
||||
@ -123,7 +123,7 @@ void ContainmentPrivate::setScreen(int newScreen)
|
||||
int oldScreen = screen;
|
||||
screen = newScreen;
|
||||
|
||||
q->updateConstraints(Plasma::ScreenConstraint);
|
||||
q->updateConstraints(Plasma::Types::ScreenConstraint);
|
||||
|
||||
if (oldScreen != newScreen) {
|
||||
/*
|
||||
@ -194,9 +194,9 @@ void ContainmentPrivate::containmentConstraintsEvent(Plasma::Constraints constra
|
||||
}
|
||||
|
||||
//kDebug() << "got containmentConstraintsEvent" << constraints;
|
||||
if (constraints & Plasma::ImmutableConstraint) {
|
||||
if (constraints & Plasma::Types::ImmutableConstraint) {
|
||||
//update actions
|
||||
const bool unlocked = q->immutability() == Mutable;
|
||||
const bool unlocked = q->immutability() == Types::Mutable;
|
||||
|
||||
QAction *action = q->actions()->action("remove");
|
||||
if (action) {
|
||||
@ -213,21 +213,21 @@ void ContainmentPrivate::containmentConstraintsEvent(Plasma::Constraints constra
|
||||
// tell the applets too
|
||||
foreach (Applet *a, applets) {
|
||||
a->setImmutability(q->immutability());
|
||||
a->updateConstraints(ImmutableConstraint);
|
||||
a->updateConstraints(Types::ImmutableConstraint);
|
||||
}
|
||||
}
|
||||
|
||||
// pass on the constraints that are relevant here
|
||||
Constraints appletConstraints = NoConstraint;
|
||||
if (constraints & FormFactorConstraint) {
|
||||
appletConstraints |= FormFactorConstraint;
|
||||
Constraints appletConstraints = Types::NoConstraint;
|
||||
if (constraints & Types::FormFactorConstraint) {
|
||||
appletConstraints |= Types::FormFactorConstraint;
|
||||
}
|
||||
|
||||
if (constraints & ScreenConstraint) {
|
||||
appletConstraints |= ScreenConstraint;
|
||||
if (constraints & Types::ScreenConstraint) {
|
||||
appletConstraints |= Types::ScreenConstraint;
|
||||
}
|
||||
|
||||
if (appletConstraints != NoConstraint) {
|
||||
if (appletConstraints != Types::NoConstraint) {
|
||||
foreach (Applet *applet, applets) {
|
||||
applet->updateConstraints(appletConstraints);
|
||||
}
|
||||
@ -240,7 +240,7 @@ Applet *ContainmentPrivate::createApplet(const QString &name, const QVariantList
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (q->immutability() != Mutable) {
|
||||
if (q->immutability() != Types::Mutable) {
|
||||
#ifndef NDEBUG
|
||||
kDebug() << "addApplet for" << name << "requested, but we're currently immutable!";
|
||||
#endif
|
||||
@ -271,7 +271,7 @@ void ContainmentPrivate::appletDeleted(Plasma::Applet *applet)
|
||||
|
||||
bool ContainmentPrivate::isPanelContainment() const
|
||||
{
|
||||
return type == Plasma::PanelContainment || type == Plasma::CustomPanelContainment;
|
||||
return type == Plasma::Types::PanelContainment || type == Plasma::Types::CustomPanelContainment;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -47,10 +47,10 @@ class ContainmentPrivate
|
||||
public:
|
||||
ContainmentPrivate(Containment *c)
|
||||
: q(c),
|
||||
formFactor(Planar),
|
||||
location(Floating),
|
||||
formFactor(Types::Planar),
|
||||
location(Types::Floating),
|
||||
screen(-1), // no screen
|
||||
type(Plasma::NoContainmentType),
|
||||
type(Plasma::Types::NoContainmentType),
|
||||
drawWallpaper(false)
|
||||
{
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ SignalRelay::SignalRelay(DataContainer *parent, DataContainerPrivate *data, uint
|
||||
{
|
||||
//kDebug() << "signal relay with time of" << m_timerId << "being set up";
|
||||
m_timerId = startTimer(immediateUpdate ? 0 : m_interval);
|
||||
if (m_align != Plasma::NoAlignment) {
|
||||
if (m_align != Plasma::Types::NoAlignment) {
|
||||
checkAlignment();
|
||||
}
|
||||
}
|
||||
@ -87,12 +87,12 @@ void SignalRelay::checkAlignment()
|
||||
int newTime = 0;
|
||||
|
||||
QTime t = QTime::currentTime();
|
||||
if (m_align == Plasma::AlignToMinute) {
|
||||
if (m_align == Plasma::Types::AlignToMinute) {
|
||||
int seconds = t.second();
|
||||
if (seconds > 2) {
|
||||
newTime = ((60 - seconds) * 1000) + 500;
|
||||
}
|
||||
} else if (m_align == Plasma::AlignToHour) {
|
||||
} else if (m_align == Plasma::Types::AlignToHour) {
|
||||
int minutes = t.minute();
|
||||
int seconds = t.second();
|
||||
if (minutes > 1 || seconds > 10) {
|
||||
@ -147,7 +147,7 @@ void SignalRelay::timerEvent(QTimerEvent *event)
|
||||
m_resetTimer = false;
|
||||
}
|
||||
|
||||
if (m_align != Plasma::NoAlignment) {
|
||||
if (m_align != Plasma::Types::NoAlignment) {
|
||||
checkAlignment();
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ Plasma::ContainmentType AppletScript::containmentType() const
|
||||
if (cont) {
|
||||
return cont->containmentType();
|
||||
} else {
|
||||
return Plasma::NoContainmentType;
|
||||
return Plasma::Types::NoContainmentType;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,12 +61,12 @@ QString ScriptEngine::mainScript() const
|
||||
return QString();
|
||||
}
|
||||
|
||||
QStringList knownLanguages(ComponentTypes types)
|
||||
QStringList knownLanguages(Types::ComponentTypes types)
|
||||
{
|
||||
QString constraintTemplate = "'%1' in [X-Plasma-ComponentTypes]";
|
||||
QString constraint;
|
||||
|
||||
if (types & AppletComponent) {
|
||||
if (types & Types::AppletComponent) {
|
||||
// currently this if statement is not needed, but this future proofs
|
||||
// the code against someone initializing constraint to something
|
||||
// before we get here.
|
||||
@ -77,7 +77,7 @@ QStringList knownLanguages(ComponentTypes types)
|
||||
constraint.append(constraintTemplate.arg("Applet"));
|
||||
}
|
||||
|
||||
if (types & DataEngineComponent) {
|
||||
if (types & Types::DataEngineComponent) {
|
||||
if (!constraint.isEmpty()) {
|
||||
constraint.append(" or ");
|
||||
}
|
||||
@ -85,7 +85,7 @@ QStringList knownLanguages(ComponentTypes types)
|
||||
constraint.append(constraintTemplate.arg("DataEngine"));
|
||||
}
|
||||
|
||||
if (types & RunnerComponent) {
|
||||
if (types & Types::RunnerComponent) {
|
||||
if (!constraint.isEmpty()) {
|
||||
constraint.append(" or ");
|
||||
}
|
||||
@ -124,13 +124,13 @@ KService::List engineOffers(const QString &language, ComponentType type)
|
||||
|
||||
QString component;
|
||||
switch (type) {
|
||||
case AppletComponent:
|
||||
case Types::AppletComponent:
|
||||
component = "Applet";
|
||||
break;
|
||||
case DataEngineComponent:
|
||||
case Types::DataEngineComponent:
|
||||
component = "DataEngine";
|
||||
break;
|
||||
case RunnerComponent:
|
||||
case Types::RunnerComponent:
|
||||
component = "Runner";
|
||||
break;
|
||||
default:
|
||||
@ -162,13 +162,13 @@ ScriptEngine *loadEngine(const QString &language, ComponentType type, QObject *p
|
||||
ScriptEngine *engine = 0;
|
||||
foreach (const KService::Ptr &service, offers) {
|
||||
switch (type) {
|
||||
case AppletComponent:
|
||||
case Types::AppletComponent:
|
||||
engine = service->createInstance<Plasma::AppletScript>(parent, args, &error);
|
||||
break;
|
||||
case DataEngineComponent:
|
||||
case Types::DataEngineComponent:
|
||||
engine = service->createInstance<Plasma::DataEngineScript>(parent, args, &error);
|
||||
break;
|
||||
case RunnerComponent:
|
||||
case Types::RunnerComponent:
|
||||
engine = service->createInstance<Plasma::RunnerScript>(parent, args, &error);
|
||||
break;
|
||||
default:
|
||||
@ -195,7 +195,7 @@ ScriptEngine *loadEngine(const QString &language, ComponentType type, QObject *p
|
||||
AppletScript *loadScriptEngine(const QString &language, Applet *applet)
|
||||
{
|
||||
AppletScript *engine =
|
||||
static_cast<AppletScript*>(loadEngine(language, AppletComponent, applet));
|
||||
static_cast<AppletScript*>(loadEngine(language, Types::AppletComponent, applet));
|
||||
|
||||
if (engine) {
|
||||
engine->setApplet(applet);
|
||||
@ -207,7 +207,7 @@ AppletScript *loadScriptEngine(const QString &language, Applet *applet)
|
||||
DataEngineScript *loadScriptEngine(const QString &language, DataEngine *dataEngine)
|
||||
{
|
||||
DataEngineScript *engine =
|
||||
static_cast<DataEngineScript*>(loadEngine(language, DataEngineComponent, dataEngine));
|
||||
static_cast<DataEngineScript*>(loadEngine(language, Types::DataEngineComponent, dataEngine));
|
||||
|
||||
if (engine) {
|
||||
engine->setDataEngine(dataEngine);
|
||||
@ -218,7 +218,7 @@ DataEngineScript *loadScriptEngine(const QString &language, DataEngine *dataEngi
|
||||
|
||||
RunnerScript *loadScriptEngine(const QString &language, AbstractRunner *runner)
|
||||
{
|
||||
RunnerScript *engine = static_cast<RunnerScript*>(loadEngine(language, RunnerComponent, runner));
|
||||
RunnerScript *engine = static_cast<RunnerScript*>(loadEngine(language, Types::RunnerComponent, runner));
|
||||
|
||||
if (engine) {
|
||||
engine->setRunner(runner);
|
||||
|
@ -85,7 +85,7 @@ private:
|
||||
* language support for
|
||||
* @return a list of all supported languages for the given type(s).
|
||||
**/
|
||||
PLASMA_EXPORT QStringList knownLanguages(ComponentTypes types);
|
||||
PLASMA_EXPORT QStringList knownLanguages(Types::ComponentTypes types);
|
||||
|
||||
/**
|
||||
* Loads an Applet script engine for the given language.
|
||||
|
@ -56,7 +56,7 @@ AppletInterface::AppletInterface(DeclarativeAppletScript *script, QQuickItem *pa
|
||||
: QQuickItem(parent),
|
||||
m_appletScriptEngine(script),
|
||||
m_actionSignals(0),
|
||||
m_backgroundHints(Plasma::StandardBackground),
|
||||
m_backgroundHints(Plasma::Types::StandardBackground),
|
||||
m_busy(false),
|
||||
m_expanded(false)
|
||||
{
|
||||
@ -135,9 +135,9 @@ void AppletInterface::init()
|
||||
Plasma::Containment *pc = qobject_cast<Plasma::Containment *>(applet());
|
||||
if (pc && !qobject_cast<Plasma::Applet *>(pc->parent())) {
|
||||
KConfigGroup defaults;
|
||||
if (pc->containmentType() == Plasma::DesktopContainment) {
|
||||
if (pc->containmentType() == Plasma::Types::DesktopContainment) {
|
||||
defaults = KConfigGroup(KSharedConfig::openConfig(pc->corona()->package().filePath("defaults")), "Desktop");
|
||||
} else if (pc->containmentType() == Plasma::PanelContainment) {
|
||||
} else if (pc->containmentType() == Plasma::Types::PanelContainment) {
|
||||
defaults = KConfigGroup(KSharedConfig::openConfig(pc->corona()->package().filePath("defaults")), "Panel");
|
||||
}
|
||||
|
||||
@ -179,14 +179,14 @@ void AppletInterface::init()
|
||||
emit busyChanged();
|
||||
}
|
||||
|
||||
AppletInterface::FormFactor AppletInterface::formFactor() const
|
||||
Plasma::Types::FormFactor AppletInterface::formFactor() const
|
||||
{
|
||||
return static_cast<FormFactor>(applet()->formFactor());
|
||||
return applet()->formFactor();
|
||||
}
|
||||
|
||||
AppletInterface::Location AppletInterface::location() const
|
||||
Plasma::Types::Location AppletInterface::location() const
|
||||
{
|
||||
return static_cast<Location>(applet()->location());
|
||||
return applet()->location();
|
||||
}
|
||||
|
||||
QString AppletInterface::currentActivity() const
|
||||
@ -256,18 +256,18 @@ void AppletInterface::setExpanded(bool expanded)
|
||||
emit expandedChanged();
|
||||
}
|
||||
|
||||
AppletInterface::BackgroundHints AppletInterface::backgroundHints() const
|
||||
Plasma::Types::BackgroundHints AppletInterface::backgroundHints() const
|
||||
{
|
||||
return (BackgroundHints)m_backgroundHints;
|
||||
return m_backgroundHints;
|
||||
}
|
||||
|
||||
void AppletInterface::setBackgroundHints(BackgroundHints hint)
|
||||
void AppletInterface::setBackgroundHints(Plasma::Types::BackgroundHints hint)
|
||||
{
|
||||
if (m_backgroundHints == (Plasma::BackgroundHints)hint) {
|
||||
if (m_backgroundHints == hint) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_backgroundHints = (Plasma::BackgroundHints)hint;
|
||||
m_backgroundHints = hint;
|
||||
emit backgroundHintsChanged();
|
||||
}
|
||||
|
||||
@ -447,7 +447,7 @@ QAction *AppletInterface::action(QString name) const
|
||||
|
||||
bool AppletInterface::immutable() const
|
||||
{
|
||||
return applet()->immutability() != Plasma::Mutable;
|
||||
return applet()->immutability() != Plasma::Types::Mutable;
|
||||
}
|
||||
|
||||
bool AppletInterface::userConfiguring() const
|
||||
@ -482,14 +482,14 @@ QString AppletInterface::associatedApplication() const
|
||||
return applet()->associatedApplication();
|
||||
}
|
||||
|
||||
void AppletInterface::setStatus(const AppletInterface::ItemStatus &status)
|
||||
void AppletInterface::setStatus(const Plasma::Types::ItemStatus &status)
|
||||
{
|
||||
applet()->setStatus((Plasma::ItemStatus)status);
|
||||
applet()->setStatus(status);
|
||||
}
|
||||
|
||||
AppletInterface::ItemStatus AppletInterface::status() const
|
||||
Plasma::Types::ItemStatus AppletInterface::status() const
|
||||
{
|
||||
return (AppletInterface::ItemStatus)((int)(applet()->status()));
|
||||
return applet()->status();
|
||||
}
|
||||
|
||||
QString AppletInterface::downloadPath(const QString &file)
|
||||
|
@ -49,30 +49,23 @@ namespace Plasma
|
||||
class AppletInterface : public QQuickItem
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_ENUMS(FormFactor)
|
||||
Q_ENUMS(Location)
|
||||
Q_ENUMS(BackgroundHints)
|
||||
Q_ENUMS(AnimationDirection)
|
||||
Q_ENUMS(IntervalAlignment)
|
||||
Q_ENUMS(ThemeColors)
|
||||
Q_ENUMS(ItemStatus)
|
||||
|
||||
Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
|
||||
//TODO: writable icon
|
||||
Q_PROPERTY(QString icon READ icon CONSTANT)
|
||||
Q_PROPERTY(uint id READ id CONSTANT)
|
||||
Q_PROPERTY(FormFactor formFactor READ formFactor NOTIFY formFactorChanged)
|
||||
Q_PROPERTY(Location location READ location NOTIFY locationChanged)
|
||||
Q_PROPERTY(Plasma::Types::FormFactor formFactor READ formFactor NOTIFY formFactorChanged)
|
||||
Q_PROPERTY(Plasma::Types::Location location READ location NOTIFY locationChanged)
|
||||
Q_PROPERTY(QString currentActivity READ currentActivity NOTIFY contextChanged)
|
||||
Q_PROPERTY(QObject* configuration READ configuration CONSTANT)
|
||||
Q_PROPERTY(QString activeConfig WRITE setActiveConfig READ activeConfig)
|
||||
Q_PROPERTY(bool busy WRITE setBusy READ isBusy NOTIFY busyChanged)
|
||||
Q_PROPERTY(bool expanded WRITE setExpanded READ isExpanded NOTIFY expandedChanged)
|
||||
Q_PROPERTY(BackgroundHints backgroundHints WRITE setBackgroundHints READ backgroundHints NOTIFY backgroundHintsChanged)
|
||||
Q_PROPERTY(Plasma::Types::BackgroundHints backgroundHints WRITE setBackgroundHints READ backgroundHints NOTIFY backgroundHintsChanged)
|
||||
Q_PROPERTY(bool immutable READ immutable NOTIFY immutableChanged)
|
||||
Q_PROPERTY(bool userConfiguring READ userConfiguring) // @since 4.5
|
||||
Q_PROPERTY(int apiVersion READ apiVersion CONSTANT)
|
||||
Q_PROPERTY(ItemStatus status READ status WRITE setStatus NOTIFY statusChanged)
|
||||
Q_PROPERTY(Plasma::Types::ItemStatus status READ status WRITE setStatus NOTIFY statusChanged)
|
||||
Q_PROPERTY(QString associatedApplication WRITE setAssociatedApplication READ associatedApplication)
|
||||
|
||||
public:
|
||||
@ -82,73 +75,6 @@ public:
|
||||
//API not intended for the QML part
|
||||
QmlObject *qmlObject();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
//enums copy&pasted from plasma.h because qtscript is evil
|
||||
|
||||
|
||||
//TODO: all of this should go from here
|
||||
enum FormFactor {
|
||||
Planar = 0, /**< The applet lives in a plane and has two
|
||||
degrees of freedom to grow. Optimize for
|
||||
desktop, laptop or tablet usage: a high
|
||||
resolution screen 1-3 feet distant from the
|
||||
viewer. */
|
||||
MediaCenter, /**< As with Planar, the applet lives in a plane
|
||||
but the interface should be optimized for
|
||||
medium-to-high resolution screens that are
|
||||
5-15 feet distant from the viewer. Sometimes
|
||||
referred to as a "ten foot interface".*/
|
||||
Horizontal, /**< The applet is constrained vertically, but
|
||||
can expand horizontally. */
|
||||
Vertical, /**< The applet is constrained horizontally, but
|
||||
can expand vertically. */
|
||||
Application /**< The Applet lives in a plane and should be optimized to look as a full application,
|
||||
for the desktop or the particular device. */
|
||||
};
|
||||
|
||||
enum Location {
|
||||
Floating = 0, /**< Free floating. Neither geometry or z-ordering
|
||||
is described precisely by this value. */
|
||||
Desktop, /**< On the planar desktop layer, extending across
|
||||
the full screen from edge to edge */
|
||||
FullScreen, /**< Full screen */
|
||||
TopEdge, /**< Along the top of the screen*/
|
||||
BottomEdge, /**< Along the bottom of the screen*/
|
||||
LeftEdge, /**< Along the left side of the screen */
|
||||
RightEdge /**< Along the right side of the screen */
|
||||
};
|
||||
|
||||
enum ItemStatus {
|
||||
UnknownStatus = 0, /**< The status is unknown **/
|
||||
PassiveStatus = 1, /**< The Item is passive **/
|
||||
ActiveStatus = 2, /**< The Item is active **/
|
||||
NeedsAttentionStatus = 3, /**< The Item needs attention **/
|
||||
AcceptingInputStatus = 4 /**< The Item is accepting input **/
|
||||
};
|
||||
|
||||
enum BackgroundHints {
|
||||
NoBackground = Plasma::NoBackground,
|
||||
StandardBackground = Plasma::StandardBackground,
|
||||
TranslucentBackground = Plasma::TranslucentBackground,
|
||||
DefaultBackground = Plasma::DefaultBackground
|
||||
};
|
||||
|
||||
enum ThemeColors {
|
||||
TextColor = Plasma::Theme::TextColor,
|
||||
HighlightColor = Plasma::Theme::HighlightColor,
|
||||
BackgroundColor = Plasma::Theme::BackgroundColor,
|
||||
ButtonTextColor = Plasma::Theme::ButtonTextColor,
|
||||
ButtonBackgroundColor = Plasma::Theme::ButtonBackgroundColor,
|
||||
LinkColor = Plasma::Theme::LinkColor,
|
||||
VisitedLinkColor = Plasma::Theme::VisitedLinkColor
|
||||
};
|
||||
|
||||
enum IntervalAlignment {
|
||||
NoAlignment = 0,
|
||||
AlignToMinute,
|
||||
AlignToHour
|
||||
};
|
||||
|
||||
//QML API-------------------------------------------------------------------
|
||||
|
||||
Q_INVOKABLE void setConfigurationRequired(bool needsConfiguring, const QString &reason = QString());
|
||||
@ -186,9 +112,9 @@ enum IntervalAlignment {
|
||||
|
||||
uint id() const;
|
||||
|
||||
FormFactor formFactor() const;
|
||||
Plasma::Types::FormFactor formFactor() const;
|
||||
|
||||
Location location() const;
|
||||
Plasma::Types::Location location() const;
|
||||
|
||||
QString currentActivity() const;
|
||||
|
||||
@ -200,14 +126,14 @@ enum IntervalAlignment {
|
||||
bool isExpanded() const;
|
||||
void setExpanded(bool expanded);
|
||||
|
||||
BackgroundHints backgroundHints() const;
|
||||
void setBackgroundHints(BackgroundHints hint);
|
||||
Plasma::Types::BackgroundHints backgroundHints() const;
|
||||
void setBackgroundHints(Plasma::Types::BackgroundHints hint);
|
||||
|
||||
void setAssociatedApplication(const QString &string);
|
||||
QString associatedApplication() const;
|
||||
|
||||
void setStatus(const ItemStatus &status);
|
||||
ItemStatus status() const;
|
||||
void setStatus(const Plasma::Types::ItemStatus &status);
|
||||
Plasma::Types::ItemStatus status() const;
|
||||
|
||||
QString activeConfig() const;
|
||||
void setActiveConfig(const QString &name);
|
||||
@ -253,7 +179,7 @@ private:
|
||||
|
||||
QTimer *m_creationTimer;
|
||||
|
||||
Plasma::BackgroundHints m_backgroundHints;
|
||||
Plasma::Types::BackgroundHints m_backgroundHints;
|
||||
bool m_busy : 1;
|
||||
bool m_expanded : 1;
|
||||
};
|
||||
|
@ -282,7 +282,7 @@ void ContainmentInterface::addAppletActions(KMenu &desktopMenu, Plasma::Applet *
|
||||
}
|
||||
}
|
||||
|
||||
if (containment()->immutability() == Plasma::Mutable) {
|
||||
if (containment()->immutability() == Plasma::Types::Mutable) {
|
||||
QAction *closeApplet = applet->actions()->action("remove");
|
||||
//kDebug() << "checking for removal" << closeApplet;
|
||||
if (closeApplet) {
|
||||
@ -298,7 +298,7 @@ void ContainmentInterface::addAppletActions(KMenu &desktopMenu, Plasma::Applet *
|
||||
|
||||
void ContainmentInterface::addContainmentActions(KMenu &desktopMenu, QEvent *event)
|
||||
{
|
||||
if (containment()->corona()->immutability() != Plasma::Mutable &&
|
||||
if (containment()->corona()->immutability() != Plasma::Types::Mutable &&
|
||||
!KAuthorized::authorizeKAction("plasma/containment_actions")) {
|
||||
//kDebug() << "immutability";
|
||||
return;
|
||||
@ -329,8 +329,8 @@ void ContainmentInterface::addContainmentActions(KMenu &desktopMenu, QEvent *eve
|
||||
if (actions.isEmpty()) {
|
||||
//it probably didn't bother implementing the function. give the user a chance to set
|
||||
//a better plugin. note that if the user sets no-plugin this won't happen...
|
||||
if ((containment()->containmentType() != Plasma::PanelContainment &&
|
||||
containment()->containmentType() != Plasma::CustomPanelContainment) &&
|
||||
if ((containment()->containmentType() != Plasma::Types::PanelContainment &&
|
||||
containment()->containmentType() != Plasma::Types::CustomPanelContainment) &&
|
||||
containment()->actions()->action("configure")) {
|
||||
desktopMenu.addAction(containment()->actions()->action("configure"));
|
||||
}
|
||||
|
@ -131,15 +131,15 @@ QObject *DeclarativeAppletScript::loadui(const QString &filename)
|
||||
|
||||
void DeclarativeAppletScript::constraintsEvent(Plasma::Constraints constraints)
|
||||
{
|
||||
if (constraints & Plasma::FormFactorConstraint) {
|
||||
if (constraints & Plasma::Types::FormFactorConstraint) {
|
||||
emit formFactorChanged();
|
||||
}
|
||||
|
||||
if (constraints & Plasma::LocationConstraint) {
|
||||
if (constraints & Plasma::Types::LocationConstraint) {
|
||||
emit locationChanged();
|
||||
}
|
||||
|
||||
if (constraints & Plasma::ContextConstraint) {
|
||||
if (constraints & Plasma::Types::ContextConstraint) {
|
||||
emit contextChanged();
|
||||
}
|
||||
}
|
||||
|
@ -147,8 +147,8 @@ void DesktopCorona::checkScreen(int screen, bool signalWhenExists)
|
||||
}
|
||||
|
||||
Plasma::ContainmentType t = c->containmentType();
|
||||
if (t == Plasma::PanelContainment ||
|
||||
t == Plasma::CustomPanelContainment) {
|
||||
if (t == Plasma::Types::PanelContainment ||
|
||||
t == Plasma::Types::CustomPanelContainment) {
|
||||
emit containmentAdded(c);
|
||||
}
|
||||
}
|
||||
@ -257,8 +257,8 @@ void DesktopCorona::updateScreenOwner(int wasScreen, int isScreen, Plasma::Conta
|
||||
{
|
||||
qDebug() << "Was screen" << wasScreen << "Is screen" << isScreen <<"Containment" << containment << containment->title();
|
||||
|
||||
if (containment->formFactor() == Plasma::Horizontal ||
|
||||
containment->formFactor() == Plasma::Vertical) {
|
||||
if (containment->formFactor() == Plasma::Types::Horizontal ||
|
||||
containment->formFactor() == Plasma::Types::Vertical) {
|
||||
|
||||
if (isScreen >= 0) {
|
||||
m_panelViews[containment] = new PanelView(this);
|
||||
|
@ -65,21 +65,21 @@ void PanelConfigView::syncGeometry()
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_containment->formFactor() == Plasma::Vertical) {
|
||||
if (m_containment->formFactor() == Plasma::Types::Vertical) {
|
||||
resize(rootObject()->implicitWidth(), screen()->size().height());
|
||||
|
||||
if (m_containment->location() == Plasma::LeftEdge) {
|
||||
if (m_containment->location() == Plasma::Types::LeftEdge) {
|
||||
setPosition(screen()->geometry().left() + m_panelView->thickness(), screen()->geometry().top());
|
||||
} else if (m_containment->location() == Plasma::RightEdge) {
|
||||
} else if (m_containment->location() == Plasma::Types::RightEdge) {
|
||||
setPosition(screen()->geometry().right() - width() - m_panelView->thickness(), screen()->geometry().top());
|
||||
}
|
||||
|
||||
} else {
|
||||
resize(screen()->size().width(), rootObject()->implicitHeight());
|
||||
|
||||
if (m_containment->location() == Plasma::TopEdge) {
|
||||
if (m_containment->location() == Plasma::Types::TopEdge) {
|
||||
setPosition(screen()->geometry().left(), screen()->geometry().top() + m_panelView->thickness());
|
||||
} else if (m_containment->location() == Plasma::BottomEdge) {
|
||||
} else if (m_containment->location() == Plasma::Types::BottomEdge) {
|
||||
setPosition(screen()->geometry().left(), screen()->geometry().bottom() - height() - m_panelView->thickness());
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ PanelView::~PanelView()
|
||||
config().writeEntry("offset", m_offset);
|
||||
config().writeEntry("max", m_maxLength);
|
||||
config().writeEntry("min", m_minLength);
|
||||
if (formFactor() == Plasma::Vertical) {
|
||||
if (formFactor() == Plasma::Types::Vertical) {
|
||||
config().writeEntry("length", size().height());
|
||||
config().writeEntry("thickness", size().width());
|
||||
} else {
|
||||
@ -85,8 +85,8 @@ KConfigGroup PanelView::config() const
|
||||
KConfigGroup views(m_corona->applicationConfig(), "PlasmaViews");
|
||||
views = KConfigGroup(&views, QString("Panel %1").arg(containment()->id()));
|
||||
|
||||
if (containment()->formFactor() == Plasma::Vertical) {
|
||||
return KConfigGroup(&views, "Vertical" + QString::number(screen()->size().height()));
|
||||
if (containment()->formFactor() == Plasma::Types::Vertical) {
|
||||
return KConfigGroup(&views, "Types::Vertical" + QString::number(screen()->size().height()));
|
||||
//treat everything else as horizontal
|
||||
} else {
|
||||
return KConfigGroup(&views, "Horizontal" + QString::number(screen()->size().width()));
|
||||
@ -150,7 +150,7 @@ void PanelView::setThickness(int value)
|
||||
return;
|
||||
}
|
||||
|
||||
if (formFactor() == Plasma::Vertical) {
|
||||
if (formFactor() == Plasma::Types::Vertical) {
|
||||
setWidth(value);
|
||||
} else {
|
||||
setHeight(value);
|
||||
@ -162,7 +162,7 @@ void PanelView::setThickness(int value)
|
||||
|
||||
int PanelView::length() const
|
||||
{
|
||||
if (formFactor() == Plasma::Vertical) {
|
||||
if (formFactor() == Plasma::Types::Vertical) {
|
||||
config().readEntry<int>("length", screen()->size().height());
|
||||
} else {
|
||||
config().readEntry<int>("length", screen()->size().width());
|
||||
@ -175,7 +175,7 @@ void PanelView::setLength(int value)
|
||||
return;
|
||||
}
|
||||
|
||||
if (formFactor() == Plasma::Vertical) {
|
||||
if (formFactor() == Plasma::Types::Vertical) {
|
||||
setHeight(value);
|
||||
} else {
|
||||
setWidth(value);
|
||||
@ -200,7 +200,7 @@ void PanelView::setMaximumLength(int length)
|
||||
setMinimumLength(length);
|
||||
}
|
||||
|
||||
if (formFactor() == Plasma::Vertical) {
|
||||
if (formFactor() == Plasma::Types::Vertical) {
|
||||
setMaximumHeight(length);
|
||||
} else {
|
||||
setMaximumWidth(length);
|
||||
@ -227,7 +227,7 @@ void PanelView::setMinimumLength(int length)
|
||||
setMaximumLength(length);
|
||||
}
|
||||
|
||||
if (formFactor() == Plasma::Vertical) {
|
||||
if (formFactor() == Plasma::Types::Vertical) {
|
||||
setMinimumHeight(length);
|
||||
} else {
|
||||
setMinimumWidth(length);
|
||||
@ -249,8 +249,8 @@ void PanelView::positionPanel()
|
||||
const int oldThickness = thickness();
|
||||
|
||||
switch (containment()->location()) {
|
||||
case Plasma::TopEdge:
|
||||
containment()->setFormFactor(Plasma::Horizontal);
|
||||
case Plasma::Types::TopEdge:
|
||||
containment()->setFormFactor(Plasma::Types::Horizontal);
|
||||
restore();
|
||||
|
||||
switch (m_alignment) {
|
||||
@ -266,8 +266,8 @@ void PanelView::positionPanel()
|
||||
}
|
||||
break;
|
||||
|
||||
case Plasma::LeftEdge:
|
||||
containment()->setFormFactor(Plasma::Vertical);
|
||||
case Plasma::Types::LeftEdge:
|
||||
containment()->setFormFactor(Plasma::Types::Vertical);
|
||||
restore();
|
||||
switch (m_alignment) {
|
||||
case Qt::AlignCenter:
|
||||
@ -282,8 +282,8 @@ void PanelView::positionPanel()
|
||||
}
|
||||
break;
|
||||
|
||||
case Plasma::RightEdge:
|
||||
containment()->setFormFactor(Plasma::Vertical);
|
||||
case Plasma::Types::RightEdge:
|
||||
containment()->setFormFactor(Plasma::Types::Vertical);
|
||||
restore();
|
||||
switch (m_alignment) {
|
||||
case Qt::AlignCenter:
|
||||
@ -298,9 +298,9 @@ void PanelView::positionPanel()
|
||||
}
|
||||
break;
|
||||
|
||||
case Plasma::BottomEdge:
|
||||
case Plasma::Types::BottomEdge:
|
||||
default:
|
||||
containment()->setFormFactor(Plasma::Horizontal);
|
||||
containment()->setFormFactor(Plasma::Types::Horizontal);
|
||||
restore();
|
||||
switch (m_alignment) {
|
||||
case Qt::AlignCenter:
|
||||
@ -340,7 +340,7 @@ void PanelView::restore()
|
||||
//FIXME: an invalid size doesn't work with QWindows
|
||||
setMaximumSize(screen()->size());
|
||||
|
||||
if (containment()->formFactor() == Plasma::Vertical) {
|
||||
if (containment()->formFactor() == Plasma::Types::Vertical) {
|
||||
const int maxSize = screen()->size().height() - m_offset;
|
||||
m_maxLength = qBound<int>(MINSIZE, m_maxLength, maxSize);
|
||||
m_minLength = qBound<int>(MINSIZE, m_minLength, maxSize);
|
||||
@ -371,7 +371,7 @@ void PanelView::restore()
|
||||
|
||||
void PanelView::resizeEvent(QResizeEvent *ev)
|
||||
{
|
||||
if (containment()->formFactor() == Plasma::Vertical) {
|
||||
if (containment()->formFactor() == Plasma::Types::Vertical) {
|
||||
config().writeEntry("length", ev->size().height());
|
||||
config().writeEntry("thickness", ev->size().width());
|
||||
if (ev->size().height() != ev->oldSize().height()) {
|
||||
|
@ -144,12 +144,12 @@ int AppInterface::multiheadScreen() const
|
||||
|
||||
void AppInterface::lockCorona(bool locked)
|
||||
{
|
||||
m_env->corona()->setImmutability(locked ? Plasma::UserImmutable : Plasma::Mutable);
|
||||
m_env->corona()->setImmutability(locked ? Plasma::Types::UserImmutable : Plasma::Types::Mutable);
|
||||
}
|
||||
|
||||
bool AppInterface::coronaLocked() const
|
||||
{
|
||||
return m_env->corona()->immutability() != Plasma::Mutable;
|
||||
return m_env->corona()->immutability() != Plasma::Types::Mutable;
|
||||
}
|
||||
|
||||
void AppInterface::sleep(int ms)
|
||||
|
@ -232,7 +232,7 @@ void Applet::setLocked(bool locked)
|
||||
return;
|
||||
}
|
||||
|
||||
app->setImmutability(locked ? Plasma::UserImmutable : Plasma::Mutable);
|
||||
app->setImmutability(locked ? Plasma::Types::UserImmutable : Plasma::Types::Mutable);
|
||||
KConfigGroup cg = app->config();
|
||||
if (!app->isContainment()) {
|
||||
cg = cg.parent();
|
||||
@ -247,10 +247,10 @@ bool Applet::locked() const
|
||||
{
|
||||
Plasma::Applet *app = applet();
|
||||
if (!app) {
|
||||
return Plasma::Mutable;
|
||||
return Plasma::Types::Mutable;
|
||||
}
|
||||
|
||||
return app->immutability() != Plasma::Mutable;
|
||||
return app->immutability() != Plasma::Types::Mutable;
|
||||
}
|
||||
|
||||
bool Applet::wallpaperConfigDirty() const
|
||||
|
@ -117,19 +117,19 @@ QString Containment::formFactor() const
|
||||
}
|
||||
|
||||
switch (d->containment.data()->formFactor()) {
|
||||
case Plasma::Planar:
|
||||
case Plasma::Types::Planar:
|
||||
return "planar";
|
||||
break;
|
||||
case Plasma::MediaCenter:
|
||||
case Plasma::Types::MediaCenter:
|
||||
return "mediacenter";
|
||||
break;
|
||||
case Plasma::Horizontal:
|
||||
case Plasma::Types::Horizontal:
|
||||
return "horizontal";
|
||||
break;
|
||||
case Plasma::Vertical:
|
||||
case Plasma::Types::Vertical:
|
||||
return "vertical";
|
||||
break;
|
||||
case Plasma::Application:
|
||||
case Plasma::Types::Application:
|
||||
return "application";
|
||||
break;
|
||||
}
|
||||
|
@ -52,25 +52,25 @@ QString Panel::location() const
|
||||
}
|
||||
|
||||
switch (c->location()) {
|
||||
case Plasma::Floating:
|
||||
case Plasma::Types::Floating:
|
||||
return "floating";
|
||||
break;
|
||||
case Plasma::Desktop:
|
||||
case Plasma::Types::Desktop:
|
||||
return "desktop";
|
||||
break;
|
||||
case Plasma::FullScreen:
|
||||
case Plasma::Types::FullScreen:
|
||||
return "fullscreen";
|
||||
break;
|
||||
case Plasma::TopEdge:
|
||||
case Plasma::Types::TopEdge:
|
||||
return "top";
|
||||
break;
|
||||
case Plasma::BottomEdge:
|
||||
case Plasma::Types::BottomEdge:
|
||||
return "bottom";
|
||||
break;
|
||||
case Plasma::LeftEdge:
|
||||
case Plasma::Types::LeftEdge:
|
||||
return "left";
|
||||
break;
|
||||
case Plasma::RightEdge:
|
||||
case Plasma::Types::RightEdge:
|
||||
return "right";
|
||||
break;
|
||||
}
|
||||
@ -86,24 +86,24 @@ void Panel::setLocation(const QString &locationString)
|
||||
}
|
||||
|
||||
const QString lower = locationString.toLower();
|
||||
Plasma::Location loc = Plasma::Floating;
|
||||
Plasma::FormFactor ff = Plasma::Planar;
|
||||
Plasma::Location loc = Plasma::Types::Floating;
|
||||
Plasma::FormFactor ff = Plasma::Types::Planar;
|
||||
if (lower == "desktop") {
|
||||
loc = Plasma::Desktop;
|
||||
loc = Plasma::Types::Desktop;
|
||||
} else if (lower == "fullscreen") {
|
||||
loc = Plasma::FullScreen;
|
||||
loc = Plasma::Types::FullScreen;
|
||||
} else if (lower == "top") {
|
||||
loc = Plasma::TopEdge;
|
||||
ff = Plasma::Horizontal;
|
||||
loc = Plasma::Types::TopEdge;
|
||||
ff = Plasma::Types::Horizontal;
|
||||
} else if (lower == "bottom") {
|
||||
loc = Plasma::BottomEdge;
|
||||
ff = Plasma::Horizontal;
|
||||
loc = Plasma::Types::BottomEdge;
|
||||
ff = Plasma::Types::Horizontal;
|
||||
} else if (lower == "left") {
|
||||
loc = Plasma::LeftEdge;
|
||||
ff = Plasma::Vertical;
|
||||
loc = Plasma::Types::LeftEdge;
|
||||
ff = Plasma::Types::Vertical;
|
||||
} else if (lower == "right") {
|
||||
loc = Plasma::RightEdge;
|
||||
ff = Plasma::Vertical;
|
||||
loc = Plasma::Types::RightEdge;
|
||||
ff = Plasma::Types::Vertical;
|
||||
}
|
||||
|
||||
c->setLocation(loc);
|
||||
@ -199,7 +199,7 @@ void Panel::setOffset(int pixels)
|
||||
QRectF screen = v->screen()->geometry();
|
||||
QSizeF size(graphicObject->width(), graphicObject->height());
|
||||
|
||||
if (c->formFactor() == Plasma::Vertical) {
|
||||
if (c->formFactor() == Plasma::Types::Vertical) {
|
||||
if (pixels > screen.height()) {
|
||||
return;
|
||||
}
|
||||
@ -234,7 +234,7 @@ int Panel::length() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (c->formFactor() == Plasma::Vertical) {
|
||||
if (c->formFactor() == Plasma::Types::Vertical) {
|
||||
return graphicObject->height();
|
||||
} else {
|
||||
return graphicObject->width();
|
||||
@ -259,7 +259,7 @@ void Panel::setLength(int pixels)
|
||||
QRectF screen = v->screen()->geometry();
|
||||
QSizeF s(graphicObject->width(), graphicObject->height());
|
||||
|
||||
if (c->formFactor() == Plasma::Vertical) {
|
||||
if (c->formFactor() == Plasma::Types::Vertical) {
|
||||
if (pixels > screen.height() - v->offset()) {
|
||||
return;
|
||||
}
|
||||
@ -291,7 +291,7 @@ int Panel::height() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
return c->formFactor() == Plasma::Vertical ? graphicObject->width()
|
||||
return c->formFactor() == Plasma::Types::Vertical ? graphicObject->width()
|
||||
: graphicObject->height();
|
||||
}
|
||||
|
||||
@ -312,10 +312,10 @@ void Panel::setHeight(int height)
|
||||
if (v) {
|
||||
QRect screen = v->screen()->geometry();
|
||||
QSizeF size(graphicObject->width(), graphicObject->height());
|
||||
const int max = (c->formFactor() == Plasma::Vertical ? screen.width() : screen.height()) / 3;
|
||||
const int max = (c->formFactor() == Plasma::Types::Vertical ? screen.width() : screen.height()) / 3;
|
||||
height = qBound(16, height, max);
|
||||
|
||||
if (c->formFactor() == Plasma::Vertical) {
|
||||
if (c->formFactor() == Plasma::Types::Vertical) {
|
||||
size.setWidth(height);
|
||||
} else {
|
||||
size.setHeight(height);
|
||||
|
@ -141,11 +141,11 @@ QScriptValue ScriptEngine::createContainment(const QString &type, const QString
|
||||
if (c) {
|
||||
if (type == "Panel") {
|
||||
// some defaults
|
||||
c->setFormFactor(Plasma::Horizontal);
|
||||
c->setLocation(Plasma::TopEdge);
|
||||
c->setFormFactor(Plasma::Types::Horizontal);
|
||||
c->setLocation(Plasma::Types::TopEdge);
|
||||
c->setScreen(env->defaultPanelScreen());
|
||||
}
|
||||
c->updateConstraints(Plasma::AllConstraints | Plasma::StartupCompletedConstraint);
|
||||
c->updateConstraints(Plasma::Types::AllConstraints | Plasma::Types::StartupCompletedConstraint);
|
||||
c->flushPendingConstraintsEvents();
|
||||
}
|
||||
|
||||
@ -598,8 +598,8 @@ bool ScriptEngine::isPanel(const Plasma::Containment *c)
|
||||
return false;
|
||||
}
|
||||
|
||||
return c->containmentType() == Plasma::PanelContainment ||
|
||||
c->containmentType() == Plasma::CustomPanelContainment;
|
||||
return c->containmentType() == Plasma::Types::PanelContainment ||
|
||||
c->containmentType() == Plasma::Types::CustomPanelContainment;
|
||||
}
|
||||
|
||||
QScriptValue ScriptEngine::activities(QScriptContext *context, QScriptEngine *engine)
|
||||
|
@ -116,8 +116,8 @@ void View::setContainment(Plasma::Containment *cont)
|
||||
|
||||
//graphicObject->setProperty("visible", false);
|
||||
graphicObject->setProperty("drawWallpaper",
|
||||
(cont->containmentType() == Plasma::DesktopContainment ||
|
||||
cont->containmentType() == Plasma::CustomContainment));
|
||||
(cont->containmentType() == Plasma::Types::DesktopContainment ||
|
||||
cont->containmentType() == Plasma::Types::CustomContainment));
|
||||
graphicObject->setProperty("parent", QVariant::fromValue(rootObject()));
|
||||
rootObject()->setProperty("containment", QVariant::fromValue(graphicObject));
|
||||
} else {
|
||||
@ -140,7 +140,7 @@ void View::setLocation(int location)
|
||||
int View::location() const
|
||||
{
|
||||
if (!m_containment) {
|
||||
return Plasma::Desktop;
|
||||
return Plasma::Types::Desktop;
|
||||
}
|
||||
return m_containment.data()->location();
|
||||
}
|
||||
@ -148,7 +148,7 @@ int View::location() const
|
||||
Plasma::FormFactor View::formFactor() const
|
||||
{
|
||||
if (!m_containment) {
|
||||
return Plasma::Planar;
|
||||
return Plasma::Types::Planar;
|
||||
}
|
||||
return m_containment.data()->formFactor();
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ void WidgetExplorerPrivate::init(Plasma::Location loc)
|
||||
|
||||
//init widgets
|
||||
location = loc;
|
||||
orientation = ((location == Plasma::LeftEdge || location == Plasma::RightEdge)?Qt::Vertical:Qt::Horizontal);
|
||||
orientation = ((location == Plasma::Types::LeftEdge || location == Plasma::Types::RightEdge)?Qt::Vertical:Qt::Horizontal);
|
||||
// mainLayout = new QGraphicsLinearLayout(Qt::Vertical);
|
||||
// mainLayout->setContentsMargins(0, 0, 0, 0);
|
||||
// mainLayout->setSpacing(0);
|
||||
@ -214,7 +214,7 @@ void WidgetExplorerPrivate::finished()
|
||||
void WidgetExplorerPrivate::setLocation(const Plasma::Location loc)
|
||||
{
|
||||
Qt::Orientation orient;
|
||||
if (loc == Plasma::LeftEdge || loc == Plasma::RightEdge) {
|
||||
if (loc == Plasma::Types::LeftEdge || loc == Plasma::Types::RightEdge) {
|
||||
orient = Qt::Vertical;
|
||||
} else {
|
||||
orient = Qt::Horizontal;
|
||||
@ -375,7 +375,7 @@ WidgetExplorer::WidgetExplorer(QObject *parent)
|
||||
:QObject(parent),
|
||||
d(new WidgetExplorerPrivate(this))
|
||||
{
|
||||
d->init(Plasma::LeftEdge);
|
||||
d->init(Plasma::Types::LeftEdge);
|
||||
}
|
||||
|
||||
WidgetExplorer::~WidgetExplorer()
|
||||
@ -472,7 +472,7 @@ void WidgetExplorer::addApplet(const QString &pluginName)
|
||||
|
||||
void WidgetExplorer::immutabilityChanged(Plasma::ImmutabilityType type)
|
||||
{
|
||||
if (type != Plasma::Mutable) {
|
||||
if (type != Plasma::Types::Mutable) {
|
||||
emit closeClicked();
|
||||
}
|
||||
}
|
||||
@ -639,7 +639,7 @@ QPoint WidgetExplorer::tooltipPosition(QGraphicsObject *item, int tipWidth, int
|
||||
item->boundingRect().size().toSize());
|
||||
QPoint pos;
|
||||
switch (d->location) {
|
||||
case Plasma::LeftEdge:
|
||||
case Plasma::Types::LeftEdge:
|
||||
pos.setX(itemRect.right());
|
||||
pos.setY(itemRect.top() + (itemRect.height() - tipHeight) / 2);
|
||||
break;
|
||||
@ -647,7 +647,7 @@ QPoint WidgetExplorer::tooltipPosition(QGraphicsObject *item, int tipWidth, int
|
||||
pos.setX(itemRect.left() + (itemRect.width() - tipWidth) / 2);
|
||||
pos.setY(itemRect.bottom());
|
||||
break;
|
||||
case Plasma::RightEdge:
|
||||
case Plasma::Types::RightEdge:
|
||||
pos.setX(itemRect.left() - tipWidth);
|
||||
pos.setY(itemRect.top() + (itemRect.height() - tipHeight) / 2);
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user