Merge branch 'PlasmaTypesClass'

This commit is contained in:
Marco Martin 2013-06-12 11:24:03 +02:00
commit 50ee44b70d
58 changed files with 459 additions and 597 deletions

View File

@ -23,7 +23,6 @@ set(corebindings_SRCS
serviceoperationstatus.cpp
dataenginebindings.cpp
iconitem.cpp
plasmanamespace.cpp
)
add_library(corebindingsplugin SHARED ${corebindings_SRCS})

View File

@ -45,7 +45,7 @@
#include "tooltip.h"
// #include "dataenginebindings_p.h"
#include "plasmanamespace.h"
#include <QDebug>
@ -78,7 +78,7 @@ void CoreBindingsPlugin::registerTypes(const char *uri)
{
Q_ASSERT(uri == QLatin1String("org.kde.plasma.core"));
qmlRegisterUncreatableType<PlasmaNamespace>(uri, 2, 0, "Plasma", "");
qmlRegisterUncreatableType<Plasma::Types>(uri, 2, 0, "Types", "");
qmlRegisterType<Plasma::Svg>(uri, 2, 0, "Svg");
qmlRegisterType<Plasma::FrameSvg>(uri, 2, 0, "FrameSvg");

View File

@ -38,22 +38,22 @@
#include <QDebug>
// just for debugging purposes, FIXME: remove later
QString locString(const Plasma::Location l) {
QString locString(const Plasma::Types::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);
@ -215,7 +215,7 @@ QPoint DialogProxy::popupPosition(QQuickItem *item, Qt::AlignmentFlag alignment)
}
}
Plasma::Location l = (Plasma::Location)location();
Plasma::Types::Location l = (Plasma::Types::Location)location();
QPoint topPoint((item->boundingRect().width() - width())/2,
-height());
@ -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);
@ -316,7 +316,7 @@ void DialogProxy::setWindowFlags(const int flags)
int DialogProxy::location() const
{
return (Plasma::Location)m_location;
return (Plasma::Types::Location)m_location;
}
void DialogProxy::setLocation(int location)
@ -324,7 +324,7 @@ void DialogProxy::setLocation(int location)
if (m_location == location) {
return;
}
m_location = (Plasma::Location)location;
m_location = (Plasma::Types::Location)location;
emit locationChanged();
}

View File

@ -161,7 +161,7 @@ protected:
void focusOutEvent(QFocusEvent *ev);
QTimer *m_syncTimer;
Plasma::Location m_location;
Plasma::Types::Location m_location;
Plasma::FrameSvgItem *m_frameSvgItem;
QWeakPointer<QQuickItem> m_mainItem;
QWeakPointer<QQuickItem> m_visualParent;

View File

@ -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();

View File

@ -1,32 +0,0 @@
/***************************************************************************
* Copyright 2013 Sebastian Kügler <sebas@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
#include "plasmanamespace.h"
PlasmaNamespace::PlasmaNamespace(QObject *parent)
: QObject(parent)
{
}
PlasmaNamespace::~PlasmaNamespace()
{
}
#include "plasmanamespace.moc"

View File

@ -1,46 +0,0 @@
/***************************************************************************
* Copyright 2013 Sebastian Kügler <sebas@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
#ifndef PLASMA_NAMESPACE_CORE
#define PLASMA_NAMESPACE_CORE
#include <QObject>
class PlasmaNamespace : public QObject
{
Q_OBJECT
Q_ENUMS(Location)
public:
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 */
};
PlasmaNamespace(QObject *parent = 0);
~PlasmaNamespace();
};
#endif

View File

@ -34,7 +34,7 @@ class PlasmaKPartView : public Plasma::View
{
Q_OBJECT
public:
typedef Plasma::ImmutabilityType ImmutabilityType;
typedef Plasma::Types::ImmutabilityType ImmutabilityType;
PlasmaKPartView(Plasma::Containment *containment, int uid, QWidget *parent = 0);
~PlasmaKPartView();

View File

@ -167,7 +167,7 @@ void Applet::save(KConfigGroup &g) const
void Applet::restore(KConfigGroup &group)
{
setImmutability((ImmutabilityType)group.readEntry("immutability", (int)Mutable));
setImmutability((Types::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
}
@ -293,12 +293,12 @@ Package Applet::package() const
return d->package ? *d->package : Package();
}
void Applet::updateConstraints(Plasma::Constraints constraints)
void Applet::updateConstraints(Plasma::Types::Constraints constraints)
{
d->scheduleConstraintsUpdate(constraints);
}
void Applet::constraintsEvent(Plasma::Constraints constraints)
void Applet::constraintsEvent(Plasma::Types::Constraints constraints)
{
//NOTE: do NOT put any code in here that reacts to constraints updates
// as it will not get called for any applet that reimplements constraintsEvent
@ -344,24 +344,24 @@ KPluginInfo Applet::pluginInfo() const
return d->appletDescription;
}
ImmutabilityType Applet::immutability() const
Types::Types::ImmutabilityType Applet::immutability() const
{
// if this object is itself system immutable, then just return that; it's the most
// 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;
Types::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;
@ -370,9 +370,9 @@ ImmutabilityType Applet::immutability() const
}
}
void Applet::setImmutability(const ImmutabilityType immutable)
void Applet::setImmutability(const Types::Types::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
@ -409,12 +409,12 @@ void Applet::setConfigurationRequired(bool needsConfig, const QString &reason)
d->showConfigurationRequiredMessage(needsConfig, reason);
}
ItemStatus Applet::status() const
Types::ItemStatus Applet::status() const
{
return d->itemStatus;
}
void Applet::setStatus(const ItemStatus status)
void Applet::setStatus(const Types::ItemStatus status)
{
d->itemStatus = status;
emit statusChanged(status);
@ -422,7 +422,7 @@ void Applet::setStatus(const ItemStatus status)
void Applet::flushPendingConstraintsEvents()
{
if (d->pendingConstraints == NoConstraint) {
if (d->pendingConstraints == Types::NoConstraint) {
return;
}
@ -431,12 +431,12 @@ void Applet::flushPendingConstraintsEvents()
}
//kDebug() << "fushing constraints: " << d->pendingConstraints << "!!!!!!!!!!!!!!!!!!!!!!!!!!!";
Plasma::Constraints c = d->pendingConstraints;
d->pendingConstraints = NoConstraint;
Plasma::Types::Constraints c = d->pendingConstraints;
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()) {
@ -517,7 +517,7 @@ KActionCollection *Applet::actions() const
return d->actions;
}
FormFactor Applet::formFactor() const
Types::FormFactor Applet::formFactor() const
{
Containment *c = containment();
QObject *pw = qobject_cast<QObject *>(parent());
@ -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
@ -599,10 +599,10 @@ KShortcut Applet::globalShortcut() const
return KShortcut();
}
Location Applet::location() const
Types::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()) {

View File

@ -101,7 +101,7 @@ class PLASMA_EXPORT Applet : public QObject
/**
* @return The type of immutability of this applet
*/
ImmutabilityType immutability() const;
Types::ImmutabilityType immutability() const;
/**
* If for some reason, the applet fails to get up on its feet (the
@ -138,21 +138,21 @@ class PLASMA_EXPORT Applet : public QObject
* @return the status of the applet
* @since 4.4
*/
ItemStatus status() const;
Types::ItemStatus status() const;
/**
* Returns the current form factor the applet is being displayed in.
*
* @see Plasma::FormFactor
*/
FormFactor formFactor() const;
Types::FormFactor formFactor() const;
/**
* Returns the location of the scene which is displaying applet.
*
* @see Plasma::Location
* @see Plasma::Types::Location
*/
Location location() const;
Types::Location location() const;
//CONFIGURATION
/**
@ -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::Types::Constraints constraints = Plasma::Types::AllConstraints);
//METADATA
@ -357,13 +357,13 @@ class PLASMA_EXPORT Applet : public QObject
* Emitted when the immutability changes
* @since 4.4
*/
void immutabilityChanged(Plasma::ImmutabilityType immutable);
void immutabilityChanged(Plasma::Types::ImmutabilityType immutable);
/**
* Emitted when the applet status changes
* @since 4.4
*/
void statusChanged(Plasma::ItemStatus status);
void statusChanged(Plasma::Types::ItemStatus status);
//CONFIGURATION
/**
@ -407,7 +407,7 @@ class PLASMA_EXPORT Applet : public QObject
* user immutable or system immutable)
* @param immutable the new immutability type of this applet
*/
void setImmutability(const ImmutabilityType immutable);
void setImmutability(const Types::ImmutabilityType immutable);
/**
* Destroys the applet; it will be removed nicely and deleted.
@ -420,7 +420,7 @@ class PLASMA_EXPORT Applet : public QObject
* sets the status for this applet
* @since 4.4
*/
void setStatus(const ItemStatus stat);
void setStatus(const Types::ItemStatus stat);
//CONFIGURATION
/**
@ -546,7 +546,7 @@ class PLASMA_EXPORT Applet : public QObject
* @param constraints the type of constraints that were updated
* @property constraint
*/
virtual void constraintsEvent(Plasma::Constraints constraints);
virtual void constraintsEvent(Plasma::Types::Constraints constraints);
//TODO: timerEvent should go into AppletPrivate
/**

View File

@ -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) {
@ -178,15 +178,15 @@ void Containment::restore(KConfigGroup &group)
return;
}
setLocation((Plasma::Location)group.readEntry("location", (int)d->location));
setFormFactor((Plasma::FormFactor)group.readEntry("formfactor", (int)d->formFactor));
setLocation((Plasma::Types::Location)group.readEntry("location", (int)d->location));
setFormFactor((Plasma::Types::FormFactor)group.readEntry("formfactor", (int)d->formFactor));
//kDebug() << "setScreen from restore";
d->setScreen(group.readEntry("screen", d->screen));
d->activityId = group.readEntry("activityId", QString());
flushPendingConstraintsEvents();
restoreContents(group);
setImmutability((ImmutabilityType)group.readEntry("immutability", (int)Mutable));
setImmutability((Types::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");
}
@ -291,12 +291,12 @@ void Containment::restoreContents(KConfigGroup &group)
}
}
Plasma::ContainmentType Containment::containmentType() const
Plasma::Types::ContainmentType Containment::containmentType() const
{
return d->type;
}
void Containment::setContainmentType(Plasma::ContainmentType type)
void Containment::setContainmentType(Plasma::Types::ContainmentType type)
{
if (d->type == type) {
return;
@ -310,7 +310,7 @@ Corona *Containment::corona() const
return qobject_cast<Corona*>(parent());
}
void Containment::setFormFactor(FormFactor formFactor)
void Containment::setFormFactor(Types::FormFactor formFactor)
{
if (d->formFactor == formFactor) {
return;
@ -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);
@ -327,7 +327,7 @@ void Containment::setFormFactor(FormFactor formFactor)
emit formFactorChanged(formFactor);
}
void Containment::setLocation(Location location)
void Containment::setLocation(Types::Location location)
{
if (d->location == location) {
return;
@ -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;
}
@ -397,7 +397,7 @@ void Containment::addApplet(Applet *applet)
connect(applet, SIGNAL(configNeedsSaving()), this, SIGNAL(configNeedsSaving()));
connect(applet, SIGNAL(releaseVisualFocus()), this, SIGNAL(releaseVisualFocus()));
connect(applet, SIGNAL(appletDeleted(Plasma::Applet*)), this, SLOT(appletDeleted(Plasma::Applet*)));
connect(applet, SIGNAL(statusChanged(Plasma::ItemStatus)), this, SLOT(checkStatus(Plasma::ItemStatus)));
connect(applet, SIGNAL(statusChanged(Plasma::Types::ItemStatus)), this, SLOT(checkStatus(Plasma::Types::ItemStatus)));
connect(applet, SIGNAL(activate()), this, SIGNAL(activate()));
if (!currentContainment) {
@ -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();
}

View File

@ -100,7 +100,7 @@ class PLASMA_EXPORT Containment : public Applet
/**
* Returns the type of containment
*/
Plasma::ContainmentType containmentType() const;
Plasma::Types::ContainmentType containmentType() const;
/**
* Returns the Corona (if any) that this Containment is hosted by
@ -254,13 +254,13 @@ Q_SIGNALS:
* Emitted when the location has changed
* @since 5.0
*/
void locationChanged(Plasma::Location location);
void locationChanged(Plasma::Types::Location location);
/**
* Emitted when the formFactor has changed
* @since 5.0
*/
void formFactorChanged(Plasma::FormFactor formFactor);
void formFactorChanged(Plasma::Types::FormFactor formFactor);
public Q_SLOTS:
/**
@ -270,19 +270,19 @@ Q_SIGNALS:
*
* @param location the new location of this Corona
*/
void setLocation(Plasma::Location location);
void setLocation(Plasma::Types::Location location);
/**
* Sets the form factor for this Containment. This may cause changes in both
* the arrangement of Applets as well as the display choices of individual
* Applets.
*/
void setFormFactor(Plasma::FormFactor formFactor);
void setFormFactor(Plasma::Types::FormFactor formFactor);
/**
* Sets the type of this containment.
*/
void setContainmentType(Plasma::ContainmentType type);
void setContainmentType(Plasma::Types::ContainmentType type);
/**
* Sets whether wallpaper is painted or not.
@ -319,7 +319,7 @@ Q_SIGNALS:
Q_PRIVATE_SLOT(d, void appletDeleted(Plasma::Applet*))
Q_PRIVATE_SLOT(d, void triggerShowAddWidgets())
Q_PRIVATE_SLOT(d, void checkStatus(Plasma::ItemStatus))
Q_PRIVATE_SLOT(d, void checkStatus(Plasma::Types::ItemStatus))
friend class Applet;
friend class AppletPrivate;

View File

@ -92,8 +92,8 @@ void Corona::exportLayout(KConfigGroup &config, QList<Containment*> containments
}
//temporarily unlock so that removal works
ImmutabilityType oldImm = immutability();
d->immutability = Mutable;
Types::ImmutabilityType oldImm = immutability();
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);
}
@ -213,14 +213,14 @@ void Corona::loadDefaultLayout()
//Default implementation does nothing
}
ImmutabilityType Corona::immutability() const
Types::ImmutabilityType Corona::immutability() const
{
return d->immutability;
}
void Corona::setImmutability(const ImmutabilityType immutable)
void Corona::setImmutability(const Types::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()
@ -257,11 +257,11 @@ void Corona::setImmutability(const ImmutabilityType immutable)
}
}
QList<Plasma::Location> Corona::freeEdges(int screen) const
QList<Plasma::Types::Location> Corona::freeEdges(int screen) const
{
QList<Plasma::Location> freeEdges;
freeEdges << Plasma::TopEdge << Plasma::BottomEdge
<< Plasma::LeftEdge << Plasma::RightEdge;
QList<Plasma::Types::Location> freeEdges;
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();

View File

@ -127,7 +127,7 @@ public:
* @param screen the id of the screen to look for free edges.
* @returns a list of free edges not filled with panel type containments.
*/
QList<Plasma::Location> freeEdges(int screen) const;
QList<Plasma::Types::Location> freeEdges(int screen) const;
/**
* The actions assocated with this Corona
@ -173,14 +173,14 @@ public Q_SLOTS:
/**
* @return The type of immutability of this Corona
*/
ImmutabilityType immutability() const;
Types::ImmutabilityType immutability() const;
/**
* Sets the immutability type for this Corona (not immutable,
* user immutable or system immutable)
* @param immutable the new immutability type of this applet
*/
void setImmutability(const ImmutabilityType immutable);
void setImmutability(const Types::ImmutabilityType immutable);
/**
* Schedules a flush-to-disk synchronization of the configuration state
@ -230,7 +230,7 @@ Q_SIGNALS:
* 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.
*/
void immutabilityChanged(Plasma::ImmutabilityType immutability);
void immutabilityChanged(Plasma::Types::ImmutabilityType immutability);
protected:
/**

View File

@ -83,7 +83,7 @@ bool DataContainer::visualizationIsConnected(QObject *visualization) const
}
void DataContainer::connectVisualization(QObject *visualization, uint pollingInterval,
Plasma::IntervalAlignment alignment)
Plasma::Types::IntervalAlignment alignment)
{
//kDebug() << "connecting visualization" << visualization << "at interval of"
// << pollingInterval << "to" << objectName();

View File

@ -122,7 +122,7 @@ class PLASMA_EXPORT DataContainer : public QObject
* @param alignment the clock position to align updates to
**/
void connectVisualization(QObject *visualization, uint pollingInterval,
Plasma::IntervalAlignment alignment);
Plasma::Types::IntervalAlignment alignment);
/**
* sets this data container to be automatically stored.

View File

@ -96,7 +96,7 @@ KPluginInfo DataEngine::pluginInfo() const
void DataEngine::connectSource(const QString &source, QObject *visualization,
uint pollingInterval,
Plasma::IntervalAlignment intervalAlignment) const
Plasma::Types::IntervalAlignment intervalAlignment) const
{
//kDebug() << "connectSource" << source;
bool newSource;
@ -117,7 +117,7 @@ void DataEngine::connectSource(const QString &source, QObject *visualization,
}
void DataEngine::connectAllSources(QObject *visualization, uint pollingInterval,
Plasma::IntervalAlignment intervalAlignment) const
Plasma::Types::IntervalAlignment intervalAlignment) const
{
foreach (DataContainer *s, d->sources) {
d->connectSource(s, visualization, pollingInterval, intervalAlignment);
@ -486,7 +486,7 @@ DataContainer *DataEnginePrivate::source(const QString &sourceName, bool createW
void DataEnginePrivate::connectSource(DataContainer *s, QObject *visualization,
uint pollingInterval,
Plasma::IntervalAlignment align,
Plasma::Types::IntervalAlignment align,
bool immediateCall)
{
//kDebug() << "connect source called" << s->objectName() << "with interval" << pollingInterval;

View File

@ -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.

View File

@ -180,19 +180,19 @@ FrameSvg::EnabledBorders FrameSvg::enabledBorders() const
}
}
void FrameSvg::setElementPrefix(Plasma::Location location)
void FrameSvg::setElementPrefix(Plasma::Types::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
@ -283,19 +283,19 @@ bool FrameSvg::hasElementPrefix(const QString & prefix) const
}
}
bool FrameSvg::hasElementPrefix(Plasma::Location location) const
bool FrameSvg::hasElementPrefix(Plasma::Types::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:
@ -386,22 +386,22 @@ QSizeF FrameSvg::frameSize() const
}
}
qreal FrameSvg::marginSize(const Plasma::MarginEdge edge) const
qreal FrameSvg::marginSize(const Plasma::Types::MarginEdge edge) const
{
if (d->frames[d->prefix]->noBorderPadding) {
return .0;
}
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;

View File

@ -140,7 +140,7 @@ class PLASMA_EXPORT FrameSvg : public Svg
* @param edge the margin edge we want, top, bottom, left or right
* @return the margin size
*/
Q_INVOKABLE qreal marginSize(const Plasma::MarginEdge edge) const;
Q_INVOKABLE qreal marginSize(const Plasma::Types::MarginEdge edge) const;
/**
* Convenience method that extracts the size of the four margins
@ -166,7 +166,7 @@ class PLASMA_EXPORT FrameSvg : public Svg
* called successfully after setImagePath is called.
* @param location location in the UI this frame will be drawn
*/
Q_INVOKABLE void setElementPrefix(Plasma::Location location);
Q_INVOKABLE void setElementPrefix(Plasma::Types::Location location);
/**
* Sets the prefix for the SVG elements to be used for painting. For example,
@ -201,7 +201,7 @@ class PLASMA_EXPORT FrameSvg : public Svg
* to draw a frame.
* @param location the given prefix we want to check if drawable
*/
Q_INVOKABLE bool hasElementPrefix(Plasma::Location location) const;
Q_INVOKABLE bool hasElementPrefix(Plasma::Types::Location location) const;
/**
* Returns the prefix for SVG elements of the FrameSvg

View File

@ -28,46 +28,55 @@
namespace Plasma
{
Direction locationToDirection(Location location)
Types::Types(QObject *parent)
: QObject(parent)
{
}
Types::~Types()
{
}
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

View File

@ -34,6 +34,12 @@ class QAction;
namespace Plasma
{
class PLASMA_EXPORT Types : public QObject
{
Q_OBJECT
public:
~Types();
/**
* The Constraint enumeration lists the various constraints that Plasma
* objects have managed for them and which they may wish to react to,
@ -50,6 +56,7 @@ enum Constraint {
AllConstraints = FormFactorConstraint | LocationConstraint | ScreenConstraint |
ImmutableConstraint
};
Q_ENUMS(Constraint)
Q_DECLARE_FLAGS(Constraints, Constraint)
/**
@ -75,6 +82,7 @@ enum FormFactor {
Application /**< The Applet lives in a plane and should be optimized to look as a full application,
for the desktop or the particular device. */
};
Q_ENUMS(FormFactor)
/**
* This enumeration describes the type of the Containment.
@ -116,6 +124,7 @@ enum Direction {
Left, /**< Display to the left */
Right /**< Display to the right */
};
Q_ENUMS(Direction)
/**
* The Location enumeration describes where on screen an element, such as an
@ -132,6 +141,7 @@ enum Location {
LeftEdge, /**< Along the left side of the screen */
RightEdge /**< Along the right side of the screen */
};
Q_ENUMS(Location)
/**
* The position enumeration
@ -144,12 +154,12 @@ enum Position {
BottomPositioned, /**< Positioned bottom */
CenterPositioned /**< Positioned in the center */
};
Q_ENUMS(Position)
/**
* The popup position enumeration relatively to his attached widget
*
**/
enum PopupPlacement {
FloatingPopup = 0, /**< Free floating, non attached popup */
TopPosedLeftAlignedPopup, /**< Popup positioned on the top, aligned
@ -169,6 +179,7 @@ enum PopupPlacement {
RightPosedBottomAlignedPopup /**< Popup positioned on the right, aligned
to the bottom of the widget */
};
Q_ENUMS(PopupPlacement)
/**
* Flip enumeration
@ -178,6 +189,7 @@ enum FlipDirection {
HorizontalFlip = 1, /**< Flip horizontally */
VerticalFlip = 2 /**< Flip vertically */
};
Q_ENUMS(FlipDirection)
Q_DECLARE_FLAGS(Flip, FlipDirection)
/**
@ -188,6 +200,7 @@ enum IntervalAlignment {
AlignToMinute, /**< Align to the minute **/
AlignToHour /**< Align to the hour **/
};
Q_ENUMS(IntervalAlignment)
/**
* Defines the immutability of items like applets, corona and containments
@ -201,6 +214,7 @@ enum ImmutabilityType {
SystemImmutable = 4 /**< the item is locked down by the system, the user
can't unlock it **/
};
Q_ENUMS(ImmutabilityType)
/**
* The ComonentType enumeration refers to the various types of components,
@ -215,6 +229,7 @@ enum ComponentType {
WallpaperComponent = 32, /**< Plasma::Wallpaper based plugins **/
GenericComponent = 64 /** Generic repositories of files, usually they keep QML files and their assets **/
};
Q_ENUMS(ComponentType)
Q_DECLARE_FLAGS(ComponentTypes, ComponentType)
enum MarginEdge {
@ -223,15 +238,7 @@ enum MarginEdge {
LeftMargin, /**< The left margin **/
RightMargin /**< The right margin **/
};
enum MessageButton {
ButtonNone = 0, /**< None **/
ButtonOk = 1, /**< OK Button **/
ButtonYes = 2, /**< Yes Button **/
ButtonNo = 4, /**< No Button **/
ButtonCancel = 8 /**< Cancel Button **/
};
Q_DECLARE_FLAGS(MessageButtons, MessageButton)
Q_ENUMS(MarginEdge)
/**
* Status of an applet
@ -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,10 @@ enum BackgroundHints {
};
Q_ENUMS(BackgroundHints)
private:
Types(QObject *parent = 0);
};
/**
* 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 +288,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 +297,14 @@ 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);
} // Plasma namespace
Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::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::Types::Constraints)
Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::Types::Flip)
Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::Types::ComponentTypes)
#endif // multiple inclusion guard

View File

@ -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;
}
@ -317,15 +317,15 @@ QString AppletPrivate::globalName() const
return appletDescription.service()->library();
}
void AppletPrivate::scheduleConstraintsUpdate(Plasma::Constraints c)
void AppletPrivate::scheduleConstraintsUpdate(Plasma::Types::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;
}

View File

@ -62,7 +62,7 @@ public:
void setIsContainment(bool isContainment, bool forceUpdate = false);
QString globalName() const;
void scheduleConstraintsUpdate(Plasma::Constraints c);
void scheduleConstraintsUpdate(Plasma::Types::Constraints c);
void scheduleModificationNotification();
KConfigGroup *mainConfigGroup();
void resetConfigurationObject();
@ -80,7 +80,7 @@ public:
Applet *q;
// applet attributes
ImmutabilityType immutability;
Types::ImmutabilityType immutability;
QString launchErrorMessage;
// applet info we keep around in case its needed
@ -89,7 +89,7 @@ public:
// bookkeeping
KConfigGroup *mainConfig;
Plasma::Constraints pendingConstraints;
Plasma::Types::Constraints pendingConstraints;
// sripting and package stuff
AppletScript *script;
@ -100,7 +100,7 @@ public:
KActionCollection *actions;
KAction *activationAction;
ItemStatus itemStatus;
Types::ItemStatus itemStatus;
// timerEvent bookkeeping
QBasicTimer constraintsTimer;

View File

@ -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) {
/*
@ -161,7 +161,7 @@ void ContainmentPrivate::configChanged()
q->setWallpaper(group.readEntry("wallpaperplugin", defaultWallpaper));
}
void ContainmentPrivate::checkStatus(Plasma::ItemStatus appletStatus)
void ContainmentPrivate::checkStatus(Plasma::Types::ItemStatus appletStatus)
{
//kDebug() << "================== "<< appletStatus << q->status();
if (appletStatus == q->status()) {
@ -187,16 +187,16 @@ void ContainmentPrivate::triggerShowAddWidgets()
emit q->showAddWidgetsInterface(QPointF());
}
void ContainmentPrivate::containmentConstraintsEvent(Plasma::Constraints constraints)
void ContainmentPrivate::containmentConstraintsEvent(Plasma::Types::Constraints constraints)
{
if (!q->isContainment()) {
return;
}
//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;
Types::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;
}
}

View File

@ -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)
{
}
@ -65,7 +65,7 @@ public:
}
void triggerShowAddWidgets();
void checkStatus(Plasma::ItemStatus status);
void checkStatus(Plasma::Types::ItemStatus status);
void setScreen(int newScreen);
/**
@ -73,7 +73,7 @@ public:
* constraint services common to all containments. Containments should still
* implement their own constraintsEvent method
*/
void containmentConstraintsEvent(Plasma::Constraints constraints);
void containmentConstraintsEvent(Plasma::Types::Constraints constraints);
bool isPanelContainment() const;
void setLockToolText();
@ -95,14 +95,14 @@ public:
static void addDefaultActions(KActionCollection *actions, Containment *c = 0);
Containment *q;
FormFactor formFactor;
Location location;
Types::FormFactor formFactor;
Types::Location location;
QList<Applet *> applets;
QString wallpaper;
QHash<QString, ContainmentActions*> localActionPlugins;
int screen;
QString activityId;
ContainmentType type;
Types::ContainmentType type;
bool drawWallpaper : 1;
static const char defaultWallpaper[];

View File

@ -51,7 +51,7 @@ public:
Corona *q;
Package package;
KConfigGroup desktopDefaultsConfig;
ImmutabilityType immutability;
Types::ImmutabilityType immutability;
QString configName;
KSharedConfigPtr config;
QTimer *configSyncTimer;

View File

@ -25,7 +25,7 @@ namespace Plasma
SignalRelay *DataContainerPrivate::signalRelay(const DataContainer *dc, QObject *visualization,
uint pollingInterval,
Plasma::IntervalAlignment align,
Plasma::Types::IntervalAlignment align,
bool immediateUpdate)
{
QMap<uint, SignalRelay *>::const_iterator relayIt = relays.constFind(pollingInterval);
@ -56,7 +56,7 @@ bool DataContainerPrivate::hasUpdates()
}
SignalRelay::SignalRelay(DataContainer *parent, DataContainerPrivate *data, uint ival,
Plasma::IntervalAlignment align, bool immediateUpdate)
Plasma::Types::IntervalAlignment align, bool immediateUpdate)
: QObject(parent),
dc(parent),
d(data),
@ -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();
}

View File

@ -59,7 +59,7 @@ public:
void checkUsage();
SignalRelay *signalRelay(const DataContainer *dc, QObject *visualization,
uint pollingInterval, Plasma::IntervalAlignment align,
uint pollingInterval, Plasma::Types::IntervalAlignment align,
bool immediateUpdate);
bool hasUpdates();
@ -100,7 +100,7 @@ class SignalRelay : public QObject
public:
SignalRelay(DataContainer *parent, DataContainerPrivate *data,
uint ival, Plasma::IntervalAlignment align, bool immediateUpdate);
uint ival, Plasma::Types::IntervalAlignment align, bool immediateUpdate);
int receiverCount() const;
bool isUnused() const;
@ -112,7 +112,7 @@ public:
DataContainer *dc;
DataContainerPrivate *d;
uint m_interval;
Plasma::IntervalAlignment m_align;
Plasma::Types::IntervalAlignment m_align;
int m_timerId;
bool m_resetTimer;
bool m_queued;

View File

@ -38,7 +38,7 @@ class DataEnginePrivate
~DataEnginePrivate();
DataContainer *source(const QString &sourceName, bool createWhenMissing = true);
void connectSource(DataContainer *s, QObject *visualization, uint pollingInterval,
Plasma::IntervalAlignment align, bool immediateCall = true);
Plasma::Types::IntervalAlignment align, bool immediateCall = true);
DataContainer *requestSource(const QString &sourceName, bool *newSource = 0);
void internalUpdateSource(DataContainer*);
void setupScriptSupport();

View File

@ -134,7 +134,7 @@ public:
void updateAndSignalSizes();
QSizeF frameSize(FrameData *frame) const;
Location location;
Types::Location location;
QString prefix;
FrameSvg *q;

View File

@ -66,7 +66,7 @@ void AppletScript::paintInterface(QPainter *painter,
Q_UNUSED(contentsRect);
}
void AppletScript::constraintsEvent(Plasma::Constraints constraints)
void AppletScript::constraintsEvent(Plasma::Types::Constraints constraints)
{
Q_UNUSED(constraints);
}
@ -146,18 +146,18 @@ void AppletScript::setDrawWallpaper(bool drawWallpaper)
}
}
Plasma::ContainmentType AppletScript::containmentType() const
Plasma::Types::ContainmentType AppletScript::containmentType() const
{
Q_ASSERT(d->applet);
Plasma::Containment *cont = qobject_cast<Plasma::Containment *>(d->applet);
if (cont) {
return cont->containmentType();
} else {
return Plasma::NoContainmentType;
return Plasma::Types::NoContainmentType;
}
}
void AppletScript::setContainmentType(Plasma::ContainmentType type)
void AppletScript::setContainmentType(Plasma::Types::ContainmentType type)
{
Q_ASSERT(d->applet);
Plasma::Containment *cont = qobject_cast<Plasma::Containment *>(d->applet);

View File

@ -94,7 +94,7 @@ public:
*
* @param constraints the type of constraints that were updated
*/
virtual void constraintsEvent(Plasma::Constraints constraints);
virtual void constraintsEvent(Plasma::Types::Constraints constraints);
/**
* Returns a list of context-related QAction instances.
@ -143,13 +143,13 @@ public:
* @see Containment
* @since 4.7
*/
Plasma::ContainmentType containmentType() const;
Plasma::Types::ContainmentType containmentType() const;
/**
* @see Containment
* @since 4.7
*/
void setContainmentType(Plasma::ContainmentType type);
void setContainmentType(Plasma::Types::ContainmentType type);
Q_SIGNALS:
/**

View File

@ -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 ");
}
@ -108,7 +108,7 @@ QStringList knownLanguages(ComponentTypes types)
return languages;
}
KService::List engineOffers(const QString &language, ComponentType type)
KService::List engineOffers(const QString &language, Types::ComponentType type)
{
if (language.isEmpty()) {
return KService::List();
@ -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:
@ -152,7 +152,7 @@ KService::List engineOffers(const QString &language, ComponentType type)
return offers;
}
ScriptEngine *loadEngine(const QString &language, ComponentType type, QObject *parent)
ScriptEngine *loadEngine(const QString &language, Types::ComponentType type, QObject *parent)
{
KService::List offers = engineOffers(language, type);
@ -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);

View File

@ -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.

View File

@ -590,10 +590,10 @@ TrustLevel Signing::trustLevelOf(const QString &keyID) const
return Plasma::UnverifiableTrust;
for (int i = (int)Plasma::UnverifiableTrust; i <= (int)Plasma::UltimatelyTrusted; ++i) {
QList< QByteArray > tmp = d->keys[(Plasma::TrustLevel)i];
QList< QByteArray > tmp = d->keys[(Plasma::Types::TrustLevel)i];
foreach(QByteArray key, tmp) {
if (key.contains(keyID.toAscii().data()))
return (Plasma::TrustLevel)i;
return (Plasma::Types::TrustLevel)i;
}
}

View File

@ -70,7 +70,7 @@ class SigningPrivate;
* QString signer = m_auth->signerOf(plasmoidPath);
*
* // If you need to know the authentication level associated with a specific signer, simply call:
* Plasma::TrustLevel level = m_auth->trustLevelOf(signer)
* Plasma::Types::TrustLevel level = m_auth->trustLevelOf(signer)
*
* // If you need more details about a key with a given keyID, you have to call:
* QString info = m_auth->descriptiveString(keyID);

View File

@ -59,7 +59,7 @@ void AppletContainer::setApplet(QGraphicsWidget *widget)
m_applet = applet;
connect(applet, SIGNAL(sizeHintChanged(Qt::SizeHint)), this, SLOT(sizeHintChanged(Qt::SizeHint)));
connect(applet, SIGNAL(statusChanged(Plasma::ItemStatus)), this, SIGNAL(statusChanged()));
connect(applet, SIGNAL(statusChanged(Plasma::Types::ItemStatus)), this, SIGNAL(statusChanged()));
applet->setParentItem(this);
applet->setGeometry(0, 0, qMax((qreal)16, width()), qMax((qreal)16, height()));
@ -151,7 +151,7 @@ void AppletContainer::setStatus(const AppletContainer::ItemStatus status)
return;
}
m_applet.data()->setStatus((Plasma::ItemStatus)status);
m_applet.data()->setStatus((Plasma::Types::ItemStatus)status);
}
AppletContainer::ItemStatus AppletContainer::status() const

View File

@ -70,8 +70,8 @@ void ToolBoxProxy::init()
d->configureAction = 0;
if (d->containment) {
connect(d->containment, SIGNAL(immutabilityChanged(Plasma::ImmutabilityType)),
this, SLOT(immutabilityChanged(Plasma::ImmutabilityType)));
connect(d->containment, SIGNAL(immutabilityChanged(Plasma::Types::ImmutabilityType)),
this, SLOT(immutabilityChanged(Plasma::Types::ImmutabilityType)));
connect(this, SIGNAL(configureRequested(Plasma::Containment*)),
d->containment, SIGNAL(configureRequested(Plasma::Containment*)));
connect(this, SIGNAL(showAddWidgetsInterface(const QPointF&)),
@ -171,7 +171,7 @@ void ToolBoxProxy::setShowing(const bool show)
d->showing = show;
}
void ToolBoxProxy::immutabilityChanged(Plasma::ImmutabilityType immutability)
void ToolBoxProxy::immutabilityChanged(Plasma::Types::ImmutabilityType immutability)
{
Q_UNUSED(immutability);
loadActions();

View File

@ -60,7 +60,7 @@ Q_SIGNALS:
private Q_SLOTS:
void actionDestroyed(QObject *object);
void immutabilityChanged(Plasma::ImmutabilityType immutability);
void immutabilityChanged(Plasma::Types::ImmutabilityType immutability);
private:
void init();

View File

@ -128,12 +128,12 @@ QScriptValue DataEngineReceiver::connectAllSources(QScriptContext *context, QScr
}
int pollingInterval = 0;
Plasma::IntervalAlignment intervalAlignment = Plasma::NoAlignment;
Plasma::Types::IntervalAlignment intervalAlignment = Plasma::NoAlignment;
if (context->argumentCount() > 1) {
pollingInterval = context->argument(2).toInt32();
if (context->argumentCount() > 2) {
intervalAlignment = static_cast<Plasma::IntervalAlignment>(context->argument(4).toInt32());
intervalAlignment = static_cast<Plasma::Types::IntervalAlignment>(context->argument(4).toInt32());
}
}
@ -168,12 +168,12 @@ QScriptValue DataEngineReceiver::connectSource(QScriptContext *context, QScriptE
}
int pollingInterval = 0;
Plasma::IntervalAlignment intervalAlignment = Plasma::NoAlignment;
Plasma::Types::IntervalAlignment intervalAlignment = Plasma::NoAlignment;
if (context->argumentCount() > 2) {
pollingInterval = context->argument(2).toInt32();
if (context->argumentCount() > 3) {
intervalAlignment = static_cast<Plasma::IntervalAlignment>(context->argument(4).toInt32());
intervalAlignment = static_cast<Plasma::Types::IntervalAlignment>(context->argument(4).toInt32());
}
}

View File

@ -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)
{
@ -65,8 +65,8 @@ AppletInterface::AppletInterface(DeclarativeAppletScript *script, QQuickItem *pa
connect(this, SIGNAL(releaseVisualFocus()), applet(), SIGNAL(releaseVisualFocus()));
connect(this, SIGNAL(configNeedsSaving()), applet(), SIGNAL(configNeedsSaving()));
connect(applet(), SIGNAL(immutabilityChanged(Plasma::ImmutabilityType)), this, SIGNAL(immutableChanged()));
connect(applet(), SIGNAL(statusChanged(Plasma::ItemStatus)), this, SIGNAL(statusChanged()));
connect(applet(), SIGNAL(immutabilityChanged(Plasma::Types::ImmutabilityType)), this, SIGNAL(immutableChanged()));
connect(applet(), SIGNAL(statusChanged(Plasma::Types::ItemStatus)), this, SIGNAL(statusChanged()));
connect(m_appletScriptEngine, SIGNAL(formFactorChanged()),
this, SIGNAL(formFactorChanged()));
connect(m_appletScriptEngine, SIGNAL(locationChanged()),
@ -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)

View 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;
};

View File

@ -97,7 +97,7 @@ ContainmentInterface::Type ContainmentInterface::containmentType() const
void ContainmentInterface::setContainmentType(ContainmentInterface::Type type)
{
m_appletScriptEngine->setContainmentType((Plasma::ContainmentType)type);
m_appletScriptEngine->setContainmentType((Plasma::Types::ContainmentType)type);
}
int ContainmentInterface::screen() const
@ -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"));
}

View File

@ -129,17 +129,17 @@ QObject *DeclarativeAppletScript::loadui(const QString &filename)
}
void DeclarativeAppletScript::constraintsEvent(Plasma::Constraints constraints)
void DeclarativeAppletScript::constraintsEvent(Plasma::Types::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();
}
}

View File

@ -43,7 +43,7 @@ public:
QList<QAction*> contextualActions();
void constraintsEvent(Plasma::Constraints constraints);
void constraintsEvent(Plasma::Types::Constraints constraints);
bool include(const QString &path);

View File

@ -146,9 +146,9 @@ void DesktopCorona::checkScreen(int screen, bool signalWhenExists)
continue;
}
Plasma::ContainmentType t = c->containmentType();
if (t == Plasma::PanelContainment ||
t == Plasma::CustomPanelContainment) {
Plasma::Types::ContainmentType t = c->containmentType();
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);

View File

@ -68,21 +68,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());
}
}

View File

@ -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()) {

View File

@ -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)

View File

@ -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

View File

@ -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;
}

View File

@ -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::Types::Location loc = Plasma::Types::Floating;
Plasma::Types::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);

View File

@ -142,11 +142,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();
}
@ -626,8 +626,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)

View File

@ -75,8 +75,8 @@ void View::init()
void View::setContainment(Plasma::Containment *cont)
{
Plasma::Location oldLoc = (Plasma::Location)location();
Plasma::FormFactor oldForm = formFactor();
Plasma::Types::Location oldLoc = (Plasma::Types::Location)location();
Plasma::Types::FormFactor oldForm = formFactor();
if (m_containment) {
disconnect(m_containment.data(), 0, this, 0);
@ -90,7 +90,7 @@ void View::setContainment(Plasma::Containment *cont)
m_containment = cont;
if (oldLoc != location()) {
emit locationChanged((Plasma::Location)location());
emit locationChanged((Plasma::Types::Location)location());
}
if (oldForm != formFactor()) {
emit formFactorChanged(formFactor());
@ -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 {
@ -133,22 +133,22 @@ Plasma::Containment *View::containment() const
//FIXME: wrong types
void View::setLocation(int location)
{
m_containment.data()->setLocation((Plasma::Location)location);
m_containment.data()->setLocation((Plasma::Types::Location)location);
}
//FIXME: wrong types
int View::location() const
{
if (!m_containment) {
return Plasma::Desktop;
return Plasma::Types::Desktop;
}
return m_containment.data()->location();
}
Plasma::FormFactor View::formFactor() const
Plasma::Types::FormFactor View::formFactor() const
{
if (!m_containment) {
return Plasma::Planar;
return Plasma::Types::Planar;
}
return m_containment.data()->formFactor();
}

View File

@ -47,11 +47,11 @@ public:
void setContainment(Plasma::Containment *cont);
Plasma::Containment *containment() const;
//FIXME: Plasma::Location should be something qml can understand
//FIXME: Plasma::Types::Location should be something qml can understand
int location() const;
void setLocation(int location);
Plasma::FormFactor formFactor() const;
Plasma::Types::FormFactor formFactor() const;
QRectF screenGeometry();
@ -59,8 +59,8 @@ protected Q_SLOTS:
void showConfigurationInterface(Plasma::Applet *applet);
Q_SIGNALS:
void locationChanged(Plasma::Location location);
void formFactorChanged(Plasma::FormFactor formFactor);
void locationChanged(Plasma::Types::Location location);
void formFactorChanged(Plasma::Types::FormFactor formFactor);
void containmentChanged();
void screenGeometryChanged();

View File

@ -60,10 +60,10 @@ public:
}
void initFilters();
void init(Plasma::Location loc);
void init(Plasma::Types::Location loc);
void initRunningApplets();
void containmentDestroyed();
void setLocation(Plasma::Location loc);
void setLocation(Plasma::Types::Location loc);
void finished();
/**
@ -78,7 +78,7 @@ public:
//this orientation is just for convenience, is the location that is important
Qt::Orientation orientation;
Plasma::Location location;
Plasma::Types::Location location;
WidgetExplorer *q;
QString application;
Plasma::Containment *containment;
@ -146,13 +146,13 @@ void WidgetExplorerPrivate::initFilters()
}
void WidgetExplorerPrivate::init(Plasma::Location loc)
void WidgetExplorerPrivate::init(Plasma::Types::Location loc)
{
// q->setFocusPolicy(Qt::StrongFocus);
//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);
@ -211,10 +211,10 @@ void WidgetExplorerPrivate::finished()
declarativeWidget->rootObject()->setProperty("extraActions", QVariant::fromValue(actionList));*/
}
void WidgetExplorerPrivate::setLocation(const Plasma::Location loc)
void WidgetExplorerPrivate::setLocation(const Plasma::Types::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;
@ -364,7 +364,7 @@ void WidgetExplorerPrivate::appletRemoved(Plasma::Applet *applet)
//WidgetExplorer
WidgetExplorer::WidgetExplorer(Plasma::Location loc, QObject *parent)
WidgetExplorer::WidgetExplorer(Plasma::Types::Location loc, QObject *parent)
:QObject(parent),
d(new WidgetExplorerPrivate(this))
{
@ -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()
@ -383,7 +383,7 @@ WidgetExplorer::~WidgetExplorer()
delete d;
}
void WidgetExplorer::setLocation(Plasma::Location loc)
void WidgetExplorer::setLocation(Plasma::Types::Location loc)
{
d->setLocation(loc);
emit(locationChanged(loc));
@ -425,7 +425,7 @@ void WidgetExplorer::setContainment(Plasma::Containment *containment)
if (d->containment) {
connect(d->containment, SIGNAL(destroyed(QObject*)), this, SLOT(containmentDestroyed()));
connect(d->containment, SIGNAL(immutabilityChanged(Plasma::ImmutabilityType)), this, SLOT(immutabilityChanged(Plasma::ImmutabilityType)));
connect(d->containment, SIGNAL(immutabilityChanged(Plasma::Types::ImmutabilityType)), this, SLOT(immutabilityChanged(Plasma::Types::ImmutabilityType)));
setLocation(containment->location());
}
@ -470,9 +470,9 @@ void WidgetExplorer::addApplet(const QString &pluginName)
}
}
void WidgetExplorer::immutabilityChanged(Plasma::ImmutabilityType type)
void WidgetExplorer::immutabilityChanged(Plasma::Types::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;

View File

@ -102,7 +102,7 @@ public:
RightEdge /**< Along the right side of the screen */
};
explicit WidgetExplorer(Plasma::Location loc, QObject *parent = 0);
explicit WidgetExplorer(Plasma::Types::Location loc, QObject *parent = 0);
explicit WidgetExplorer(QObject *parent = 0);
~WidgetExplorer();
@ -134,7 +134,7 @@ public:
Plasma::Corona *corona() const;
void setLocation(const Plasma::Location loc);
void setLocation(const Plasma::Types::Location loc);
//FIXME: it's asymmetric due to the problems of QML of exporting enums
WidgetExplorer::Location location();
@ -152,7 +152,7 @@ public:
//Q_INVOKABLE QPoint tooltipPosition(QGraphicsObject *item, int tipWidth, int tipHeight);
Q_SIGNALS:
void locationChanged(Plasma::Location loc);
void locationChanged(Plasma::Types::Location loc);
void orientationChanged();
void closeClicked();
void widgetsMenuActionsChanged();
@ -167,7 +167,7 @@ public Q_SLOTS:
void downloadWidgets(const QString &type);
protected Q_SLOTS:
void immutabilityChanged(Plasma::ImmutabilityType);
void immutabilityChanged(Plasma::Types::ImmutabilityType);
protected:
void keyPressEvent(QKeyEvent *e);