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 serviceoperationstatus.cpp
dataenginebindings.cpp dataenginebindings.cpp
iconitem.cpp iconitem.cpp
plasmanamespace.cpp
) )
add_library(corebindingsplugin SHARED ${corebindings_SRCS}) add_library(corebindingsplugin SHARED ${corebindings_SRCS})

View File

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

View File

@ -38,22 +38,22 @@
#include <QDebug> #include <QDebug>
// just for debugging purposes, FIXME: remove later // just for debugging purposes, FIXME: remove later
QString locString(const Plasma::Location l) { QString locString(const Plasma::Types::Location l) {
QString o = "Unknown: " + l; QString o = "Unknown: " + l;
if (l == Plasma::Floating) { if (l == Plasma::Types::Floating) {
o = "Floating"; o = "Floating";
} else if (l == Plasma::Desktop) { } else if (l == Plasma::Types::Desktop) {
o = "Desktop"; o = "Desktop";
} else if (l == Plasma::FullScreen) { } else if (l == Plasma::Types::FullScreen) {
o = "FullScreen"; o = "FullScreen";
} else if (l == Plasma::TopEdge) { } else if (l == Plasma::Types::TopEdge) {
o = "TopEdge"; o = "Types::TopEdge";
} else if (l == Plasma::BottomEdge) { } else if (l == Plasma::Types::BottomEdge) {
o = "BottomEdge"; o = "Types::BottomEdge";
} else if (l == Plasma::LeftEdge) { } else if (l == Plasma::Types::LeftEdge) {
o = "LeftEdge"; o = "Types::LeftEdge";
} else if (l == Plasma::RightEdge) { } else if (l == Plasma::Types::RightEdge) {
o = "RightEdge"; o = "Types::RightEdge";
} }
return o; return o;
} }
@ -61,7 +61,7 @@ QString locString(const Plasma::Location l) {
DialogProxy::DialogProxy(QQuickItem *parent) DialogProxy::DialogProxy(QQuickItem *parent)
: QQuickWindow(), : QQuickWindow(),
m_activeWindow(false), m_activeWindow(false),
m_location(Plasma::TopEdge) m_location(Plasma::Types::TopEdge)
{ {
QSurfaceFormat format; QSurfaceFormat format;
format.setAlphaBufferSize(8); format.setAlphaBufferSize(8);
@ -153,7 +153,7 @@ void DialogProxy::setVisible(const bool visible)
syncToMainItemSize(); syncToMainItemSize();
if (!m_visualParent.isNull() && m_visualParent.data()->window()) { if (!m_visualParent.isNull() && m_visualParent.data()->window()) {
avail = m_visualParent.data()->window()->screen()->availableGeometry(); avail = m_visualParent.data()->window()->screen()->availableGeometry();
if (location() == Plasma::FullScreen) { if (location() == Plasma::Types::FullScreen) {
m_frameSvgItem->setEnabledBorders(Plasma::FrameSvg::NoBorder); m_frameSvgItem->setEnabledBorders(Plasma::FrameSvg::NoBorder);
setGeometry(avail); 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, QPoint topPoint((item->boundingRect().width() - width())/2,
-height()); -height());
@ -228,13 +228,13 @@ QPoint DialogProxy::popupPosition(QQuickItem *item, Qt::AlignmentFlag alignment)
(item->boundingRect().height() - height())/2); (item->boundingRect().height() - height())/2);
QPoint offset(0, 0); QPoint offset(0, 0);
if (l == Plasma::BottomEdge) { if (l == Plasma::Types::BottomEdge) {
offset = bottomPoint; offset = bottomPoint;
} else if (l == Plasma::LeftEdge) { } else if (l == Plasma::Types::LeftEdge) {
offset = leftPoint; offset = leftPoint;
} else if (l == Plasma::RightEdge) { } else if (l == Plasma::Types::RightEdge) {
offset = rightPoint; offset = rightPoint;
} else { // TopEdge } else { // Types::TopEdge
offset = topPoint; offset = topPoint;
} }
@ -248,7 +248,7 @@ QPoint DialogProxy::popupPosition(QQuickItem *item, Qt::AlignmentFlag alignment)
if (menuPos.x() < leftMargin) { if (menuPos.x() < leftMargin) {
// popup hits lhs // popup hits lhs
if (l == Plasma::TopEdge || l == Plasma::BottomEdge) { if (l == Plasma::Types::TopEdge || l == Plasma::Types::BottomEdge) {
// move it // move it
menuPos.setX(0-leftMargin); menuPos.setX(0-leftMargin);
} else { } else {
@ -258,7 +258,7 @@ QPoint DialogProxy::popupPosition(QQuickItem *item, Qt::AlignmentFlag alignment)
} }
if (menuPos.x() + width() > avail.width() - rightMargin) { if (menuPos.x() + width() > avail.width() - rightMargin) {
// popup hits rhs // 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); menuPos.setX(avail.width() - item->boundingRect().width() + rightMargin);
} else { } else {
menuPos.setX(pos.x() + leftPoint.x()); menuPos.setX(pos.x() + leftPoint.x());
@ -266,7 +266,7 @@ QPoint DialogProxy::popupPosition(QQuickItem *item, Qt::AlignmentFlag alignment)
} }
if (menuPos.y() < topMargin) { if (menuPos.y() < topMargin) {
// hitting top // hitting top
if (l == Plasma::LeftEdge || l == Plasma::RightEdge) { if (l == Plasma::Types::LeftEdge || l == Plasma::Types::RightEdge) {
menuPos.setY(0); menuPos.setY(0);
} else { } else {
menuPos.setY(pos.y() + bottomPoint.y()); 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) { if (menuPos.y() + height() > avail.height() - bottomMargin) {
// hitting bottom // hitting bottom
if (l == Plasma::TopEdge || l == Plasma::BottomEdge) { if (l == Plasma::Types::TopEdge || l == Plasma::Types::BottomEdge) {
menuPos.setY(pos.y() + topPoint.y()); menuPos.setY(pos.y() + topPoint.y());
} else { } else {
menuPos.setY(avail.height() - item->boundingRect().height() + bottomMargin); menuPos.setY(avail.height() - item->boundingRect().height() + bottomMargin);
@ -316,7 +316,7 @@ void DialogProxy::setWindowFlags(const int flags)
int DialogProxy::location() const int DialogProxy::location() const
{ {
return (Plasma::Location)m_location; return (Plasma::Types::Location)m_location;
} }
void DialogProxy::setLocation(int location) void DialogProxy::setLocation(int location)
@ -324,7 +324,7 @@ void DialogProxy::setLocation(int location)
if (m_location == location) { if (m_location == location) {
return; return;
} }
m_location = (Plasma::Location)location; m_location = (Plasma::Types::Location)location;
emit locationChanged(); emit locationChanged();
} }

View File

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

View File

@ -37,22 +37,22 @@ FrameSvgItemMargins::FrameSvgItemMargins(Plasma::FrameSvg *frameSvg, QObject *pa
qreal FrameSvgItemMargins::left() const qreal FrameSvgItemMargins::left() const
{ {
return m_frameSvg->marginSize(LeftMargin); return m_frameSvg->marginSize(Types::LeftMargin);
} }
qreal FrameSvgItemMargins::top() const qreal FrameSvgItemMargins::top() const
{ {
return m_frameSvg->marginSize(TopMargin); return m_frameSvg->marginSize(Types::TopMargin);
} }
qreal FrameSvgItemMargins::right() const qreal FrameSvgItemMargins::right() const
{ {
return m_frameSvg->marginSize(RightMargin); return m_frameSvg->marginSize(Types::RightMargin);
} }
qreal FrameSvgItemMargins::bottom() const qreal FrameSvgItemMargins::bottom() const
{ {
return m_frameSvg->marginSize(BottomMargin); return m_frameSvg->marginSize(Types::BottomMargin);
} }
void FrameSvgItemMargins::update() void FrameSvgItemMargins::update()
@ -84,11 +84,11 @@ void FrameSvgItem::setImagePath(const QString &path)
m_frameSvg->setElementPrefix(m_prefix); m_frameSvg->setElementPrefix(m_prefix);
if (implicitWidth() <= 0) { 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) { 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(); emit imagePathChanged();
@ -114,11 +114,11 @@ void FrameSvgItem::setPrefix(const QString &prefix)
m_prefix = prefix; m_prefix = prefix;
if (implicitWidth() <= 0) { 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) { 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(); emit prefixChanged();
@ -167,11 +167,11 @@ void FrameSvgItem::geometryChanged(const QRectF &newGeometry,
void FrameSvgItem::doUpdate() void FrameSvgItem::doUpdate()
{ {
if (implicitWidth() <= 0) { 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) { 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(); 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 Q_OBJECT
public: public:
typedef Plasma::ImmutabilityType ImmutabilityType; typedef Plasma::Types::ImmutabilityType ImmutabilityType;
PlasmaKPartView(Plasma::Containment *containment, int uid, QWidget *parent = 0); PlasmaKPartView(Plasma::Containment *containment, int uid, QWidget *parent = 0);
~PlasmaKPartView(); ~PlasmaKPartView();

View File

@ -167,7 +167,7 @@ void Applet::save(KConfigGroup &g) const
void Applet::restore(KConfigGroup &group) 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"); KConfigGroup shortcutConfig(&group, "Shortcuts");
QString shortcutText = shortcutConfig.readEntryUntranslated("global", QString()); QString shortcutText = shortcutConfig.readEntryUntranslated("global", QString());
@ -257,7 +257,7 @@ KConfigGroup Applet::globalConfig() const
void Applet::destroy() void Applet::destroy()
{ {
if (immutability() != Mutable || d->transient || !d->started) { if (immutability() != Types::Mutable || d->transient || !d->started) {
return; //don't double delete return; //don't double delete
} }
@ -293,12 +293,12 @@ Package Applet::package() const
return d->package ? *d->package : Package(); return d->package ? *d->package : Package();
} }
void Applet::updateConstraints(Plasma::Constraints constraints) void Applet::updateConstraints(Plasma::Types::Constraints constraints)
{ {
d->scheduleConstraintsUpdate(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 //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 // as it will not get called for any applet that reimplements constraintsEvent
@ -344,24 +344,24 @@ KPluginInfo Applet::pluginInfo() const
return d->appletDescription; 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 // 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 // restrictive setting possible and will override anything that might be happening above it
// in the Corona->Containment->Applet hierarchy // in the Corona->Containment->Applet hierarchy
if (d->transient || (d->mainConfig && d->mainConfig->isImmutable())) { 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 //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(); Containment *cont = d->isContainment ? 0 : containment();
if (cont) { if (cont) {
upperImmutability = cont->immutability(); 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, // 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 // so upperImmutability is guaranteed to be as or more severe as this object's immutability
return upperImmutability; 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 // we do not store system immutability in d->immutability since that gets saved
// out to the config file; instead, we check with // out to the config file; instead, we check with
// the config group itself for this information at all times. this differs from // 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; d->immutability = immutable;
updateConstraints(ImmutableConstraint); updateConstraints(Types::ImmutableConstraint);
} }
QString Applet::launchErrorMessage() const QString Applet::launchErrorMessage() const
@ -409,12 +409,12 @@ void Applet::setConfigurationRequired(bool needsConfig, const QString &reason)
d->showConfigurationRequiredMessage(needsConfig, reason); d->showConfigurationRequiredMessage(needsConfig, reason);
} }
ItemStatus Applet::status() const Types::ItemStatus Applet::status() const
{ {
return d->itemStatus; return d->itemStatus;
} }
void Applet::setStatus(const ItemStatus status) void Applet::setStatus(const Types::ItemStatus status)
{ {
d->itemStatus = status; d->itemStatus = status;
emit statusChanged(status); emit statusChanged(status);
@ -422,7 +422,7 @@ void Applet::setStatus(const ItemStatus status)
void Applet::flushPendingConstraintsEvents() void Applet::flushPendingConstraintsEvents()
{ {
if (d->pendingConstraints == NoConstraint) { if (d->pendingConstraints == Types::NoConstraint) {
return; return;
} }
@ -431,12 +431,12 @@ void Applet::flushPendingConstraintsEvents()
} }
//kDebug() << "fushing constraints: " << d->pendingConstraints << "!!!!!!!!!!!!!!!!!!!!!!!!!!!"; //kDebug() << "fushing constraints: " << d->pendingConstraints << "!!!!!!!!!!!!!!!!!!!!!!!!!!!";
Plasma::Constraints c = d->pendingConstraints; Plasma::Types::Constraints c = d->pendingConstraints;
d->pendingConstraints = NoConstraint; d->pendingConstraints = Types::NoConstraint;
if (c & Plasma::StartupCompletedConstraint) { if (c & Plasma::Types::StartupCompletedConstraint) {
//common actions //common actions
bool unlocked = immutability() == Mutable; bool unlocked = immutability() == Types::Mutable;
QAction *closeApplet = d->actions->action("remove"); QAction *closeApplet = d->actions->action("remove");
if (closeApplet) { if (closeApplet) {
closeApplet->setEnabled(unlocked); closeApplet->setEnabled(unlocked);
@ -467,8 +467,8 @@ void Applet::flushPendingConstraintsEvents()
} }
} }
if (c & Plasma::ImmutableConstraint) { if (c & Plasma::Types::ImmutableConstraint) {
bool unlocked = immutability() == Mutable; bool unlocked = immutability() == Types::Mutable;
QAction *action = d->actions->action("remove"); QAction *action = d->actions->action("remove");
if (action) { if (action) {
action->setVisible(unlocked); action->setVisible(unlocked);
@ -494,7 +494,7 @@ void Applet::flushPendingConstraintsEvents()
// pass the constraint on to the actual subclass // pass the constraint on to the actual subclass
constraintsEvent(c); constraintsEvent(c);
if (c & StartupCompletedConstraint) { if (c & Types::StartupCompletedConstraint) {
// start up is done, we can now go do a mod timer // start up is done, we can now go do a mod timer
if (d->modificationsTimer) { if (d->modificationsTimer) {
if (d->modificationsTimer->isActive()) { if (d->modificationsTimer->isActive()) {
@ -517,7 +517,7 @@ KActionCollection *Applet::actions() const
return d->actions; return d->actions;
} }
FormFactor Applet::formFactor() const Types::FormFactor Applet::formFactor() const
{ {
Containment *c = containment(); Containment *c = containment();
QObject *pw = qobject_cast<QObject *>(parent()); QObject *pw = qobject_cast<QObject *>(parent());
@ -528,7 +528,7 @@ FormFactor Applet::formFactor() const
parentApplet = qobject_cast<Plasma::Applet *>(pw); 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 Containment *Applet::containment() const
@ -599,10 +599,10 @@ KShortcut Applet::globalShortcut() const
return KShortcut(); return KShortcut();
} }
Location Applet::location() const Types::Location Applet::location() const
{ {
Containment *c = containment(); Containment *c = containment();
return c ? c->d->location : Plasma::Desktop; return c ? c->d->location : Plasma::Types::Desktop;
} }
bool Applet::hasConfigurationInterface() const bool Applet::hasConfigurationInterface() const
@ -620,7 +620,7 @@ void Applet::setHasConfigurationInterface(bool hasInterface)
if (configAction) { if (configAction) {
bool enable = hasInterface; bool enable = hasInterface;
if (enable) { if (enable) {
const bool unlocked = immutability() == Mutable; const bool unlocked = immutability() == Types::Mutable;
enable = unlocked || KAuthorized::authorize("plasma/allow_configure_when_locked"); enable = unlocked || KAuthorized::authorize("plasma/allow_configure_when_locked");
} }
configAction->setEnabled(enable); configAction->setEnabled(enable);
@ -714,7 +714,7 @@ void Applet::timerEvent(QTimerEvent *event)
// Don't flushPendingConstraints if we're just starting up // Don't flushPendingConstraints if we're just starting up
// flushPendingConstraints will be called by Corona // flushPendingConstraints will be called by Corona
if(!(d->pendingConstraints & Plasma::StartupCompletedConstraint)) { if(!(d->pendingConstraints & Plasma::Types::StartupCompletedConstraint)) {
flushPendingConstraintsEvents(); flushPendingConstraintsEvents();
} }
} else if (d->modificationsTimer && event->timerId() == d->modificationsTimer->timerId()) { } 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 * @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 * 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 * @return the status of the applet
* @since 4.4 * @since 4.4
*/ */
ItemStatus status() const; Types::ItemStatus status() const;
/** /**
* Returns the current form factor the applet is being displayed in. * Returns the current form factor the applet is being displayed in.
* *
* @see Plasma::FormFactor * @see Plasma::FormFactor
*/ */
FormFactor formFactor() const; Types::FormFactor formFactor() const;
/** /**
* Returns the location of the scene which is displaying applet. * 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 //CONFIGURATION
/** /**
@ -225,7 +225,7 @@ class PLASMA_EXPORT Applet : public QObject
* *
* @param constraints the type of constraints that were updated * @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 //METADATA
@ -357,13 +357,13 @@ class PLASMA_EXPORT Applet : public QObject
* Emitted when the immutability changes * Emitted when the immutability changes
* @since 4.4 * @since 4.4
*/ */
void immutabilityChanged(Plasma::ImmutabilityType immutable); void immutabilityChanged(Plasma::Types::ImmutabilityType immutable);
/** /**
* Emitted when the applet status changes * Emitted when the applet status changes
* @since 4.4 * @since 4.4
*/ */
void statusChanged(Plasma::ItemStatus status); void statusChanged(Plasma::Types::ItemStatus status);
//CONFIGURATION //CONFIGURATION
/** /**
@ -407,7 +407,7 @@ class PLASMA_EXPORT Applet : public QObject
* user immutable or system immutable) * user immutable or system immutable)
* @param immutable the new immutability type of this applet * @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. * 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 * sets the status for this applet
* @since 4.4 * @since 4.4
*/ */
void setStatus(const ItemStatus stat); void setStatus(const Types::ItemStatus stat);
//CONFIGURATION //CONFIGURATION
/** /**
@ -546,7 +546,7 @@ class PLASMA_EXPORT Applet : public QObject
* @param constraints the type of constraints that were updated * @param constraints the type of constraints that were updated
* @property constraint * @property constraint
*/ */
virtual void constraintsEvent(Plasma::Constraints constraints); virtual void constraintsEvent(Plasma::Types::Constraints constraints);
//TODO: timerEvent should go into AppletPrivate //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! // WARNING: do not access config() OR globalConfig() in this method!
// that requires a scene, which is not available at this point // that requires a scene, which is not available at this point
setContainmentType(CustomContainment); setContainmentType(Types::CustomContainment);
setHasConfigurationInterface(true); setHasConfigurationInterface(true);
} }
@ -104,26 +104,26 @@ void Containment::init()
return; return;
} }
if (d->type == NoContainmentType) { if (d->type == Types::NoContainmentType) {
//setContainmentType(Plasma::DesktopContainment); //setContainmentType(Plasma::Types::DesktopContainment);
//Try to determine the containment type. It must be done as soon as possible //Try to determine the containment type. It must be done as soon as possible
QString type = pluginInfo().property("X-Plasma-ContainmentType").toString(); QString type = pluginInfo().property("X-Plasma-ContainmentType").toString();
if (type == "Panel") { if (type == "Panel") {
setContainmentType(Plasma::PanelContainment); setContainmentType(Plasma::Types::PanelContainment);
} else if (type == "Custom") { } else if (type == "Custom") {
setContainmentType(Plasma::CustomContainment); setContainmentType(Plasma::Types::CustomContainment);
} else if (type == "CustomPanel") { } else if (type == "CustomPanel") {
setContainmentType(Plasma::CustomPanelContainment); setContainmentType(Plasma::Types::CustomPanelContainment);
//default to desktop //default to desktop
} else { } else {
setContainmentType(Plasma::DesktopContainment); setContainmentType(Plasma::Types::DesktopContainment);
} }
} }
//connect actions //connect actions
ContainmentPrivate::addDefaultActions(actions(), this); ContainmentPrivate::addDefaultActions(actions(), this);
bool unlocked = immutability() == Mutable; bool unlocked = immutability() == Types::Mutable;
//fix the text of the actions that need title() //fix the text of the actions that need title()
//btw, do we really want to use title() when it's a desktopcontainment? //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())); connect(appletBrowserAction, SIGNAL(triggered()), this, SLOT(triggerShowAddWidgets()));
} }
if (immutability() != SystemImmutable && corona()) { if (immutability() != Types::SystemImmutable && corona()) {
QAction *lockDesktopAction = corona()->actions()->action("lock widgets"); QAction *lockDesktopAction = corona()->actions()->action("lock widgets");
//keep a pointer so nobody notices it moved to corona //keep a pointer so nobody notices it moved to corona
if (lockDesktopAction) { if (lockDesktopAction) {
@ -178,15 +178,15 @@ void Containment::restore(KConfigGroup &group)
return; return;
} }
setLocation((Plasma::Location)group.readEntry("location", (int)d->location)); setLocation((Plasma::Types::Location)group.readEntry("location", (int)d->location));
setFormFactor((Plasma::FormFactor)group.readEntry("formfactor", (int)d->formFactor)); setFormFactor((Plasma::Types::FormFactor)group.readEntry("formfactor", (int)d->formFactor));
//kDebug() << "setScreen from restore"; //kDebug() << "setScreen from restore";
d->setScreen(group.readEntry("screen", d->screen)); d->setScreen(group.readEntry("screen", d->screen));
d->activityId = group.readEntry("activityId", QString()); d->activityId = group.readEntry("activityId", QString());
flushPendingConstraintsEvents(); flushPendingConstraintsEvents();
restoreContents(group); restoreContents(group);
setImmutability((ImmutabilityType)group.readEntry("immutability", (int)Mutable)); setImmutability((Types::ImmutabilityType)group.readEntry("immutability", (int)Types::Mutable));
setWallpaper(group.readEntry("wallpaperplugin", ContainmentPrivate::defaultWallpaper)); setWallpaper(group.readEntry("wallpaperplugin", ContainmentPrivate::defaultWallpaper));
@ -202,9 +202,9 @@ void Containment::restore(KConfigGroup &group)
} }
} else { //shell defaults } else { //shell defaults
KConfigGroup defaultActionsCfg; KConfigGroup defaultActionsCfg;
if (d->type == Plasma::PanelContainment) { if (d->type == Plasma::Types::PanelContainment) {
defaultActionsCfg = KConfigGroup(KSharedConfig::openConfig(corona()->package().filePath("defaults")), "Panel"); defaultActionsCfg = KConfigGroup(KSharedConfig::openConfig(corona()->package().filePath("defaults")), "Panel");
//Plasma::DesktopContainment //Plasma::Types::DesktopContainment
} else { } else {
defaultActionsCfg = KConfigGroup(KSharedConfig::openConfig(corona()->package().filePath("defaults")), "Desktop"); 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; return d->type;
} }
void Containment::setContainmentType(Plasma::ContainmentType type) void Containment::setContainmentType(Plasma::Types::ContainmentType type)
{ {
if (d->type == type) { if (d->type == type) {
return; return;
@ -310,7 +310,7 @@ Corona *Containment::corona() const
return qobject_cast<Corona*>(parent()); return qobject_cast<Corona*>(parent());
} }
void Containment::setFormFactor(FormFactor formFactor) void Containment::setFormFactor(Types::FormFactor formFactor)
{ {
if (d->formFactor == formFactor) { if (d->formFactor == formFactor) {
return; return;
@ -319,7 +319,7 @@ void Containment::setFormFactor(FormFactor formFactor)
//kDebug() << "switching FF to " << formFactor; //kDebug() << "switching FF to " << formFactor;
d->formFactor = formFactor; d->formFactor = formFactor;
updateConstraints(Plasma::FormFactorConstraint); updateConstraints(Plasma::Types::FormFactorConstraint);
KConfigGroup c = config(); KConfigGroup c = config();
c.writeEntry("formfactor", (int)formFactor); c.writeEntry("formfactor", (int)formFactor);
@ -327,7 +327,7 @@ void Containment::setFormFactor(FormFactor formFactor)
emit formFactorChanged(formFactor); emit formFactorChanged(formFactor);
} }
void Containment::setLocation(Location location) void Containment::setLocation(Types::Location location)
{ {
if (d->location == location) { if (d->location == location) {
return; return;
@ -336,10 +336,10 @@ void Containment::setLocation(Location location)
d->location = location; d->location = location;
foreach (Applet *applet, d->applets) { foreach (Applet *applet, d->applets) {
applet->updateConstraints(Plasma::LocationConstraint); applet->updateConstraints(Plasma::Types::LocationConstraint);
} }
updateConstraints(Plasma::LocationConstraint); updateConstraints(Plasma::Types::LocationConstraint);
KConfigGroup c = config(); KConfigGroup c = config();
c.writeEntry("location", (int)location); c.writeEntry("location", (int)location);
@ -354,7 +354,7 @@ Applet *Containment::createApplet(const QString &name, const QVariantList &args)
void Containment::addApplet(Applet *applet) void Containment::addApplet(Applet *applet)
{ {
if (!isContainment() || immutability() != Mutable) { if (!isContainment() || immutability() != Types::Mutable) {
return; return;
} }
@ -397,7 +397,7 @@ void Containment::addApplet(Applet *applet)
connect(applet, SIGNAL(configNeedsSaving()), this, SIGNAL(configNeedsSaving())); connect(applet, SIGNAL(configNeedsSaving()), this, SIGNAL(configNeedsSaving()));
connect(applet, SIGNAL(releaseVisualFocus()), this, SIGNAL(releaseVisualFocus())); connect(applet, SIGNAL(releaseVisualFocus()), this, SIGNAL(releaseVisualFocus()));
connect(applet, SIGNAL(appletDeleted(Plasma::Applet*)), this, SLOT(appletDeleted(Plasma::Applet*))); 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())); connect(applet, SIGNAL(activate()), this, SIGNAL(activate()));
if (!currentContainment) { if (!currentContainment) {
@ -416,13 +416,13 @@ void Containment::addApplet(Applet *applet)
//FIXME: an on-appear animation would be nice to have again //FIXME: an on-appear animation would be nice to have again
} }
applet->updateConstraints(Plasma::AllConstraints); applet->updateConstraints(Plasma::Types::AllConstraints);
applet->flushPendingConstraintsEvents(); applet->flushPendingConstraintsEvents();
emit appletAdded(applet); emit appletAdded(applet);
if (!currentContainment) { if (!currentContainment) {
applet->updateConstraints(Plasma::StartupCompletedConstraint); applet->updateConstraints(Plasma::Types::StartupCompletedConstraint);
applet->flushPendingConstraintsEvents(); applet->flushPendingConstraintsEvents();
} }

View File

@ -100,7 +100,7 @@ class PLASMA_EXPORT Containment : public Applet
/** /**
* Returns the type of containment * 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 * Returns the Corona (if any) that this Containment is hosted by
@ -254,13 +254,13 @@ Q_SIGNALS:
* Emitted when the location has changed * Emitted when the location has changed
* @since 5.0 * @since 5.0
*/ */
void locationChanged(Plasma::Location location); void locationChanged(Plasma::Types::Location location);
/** /**
* Emitted when the formFactor has changed * Emitted when the formFactor has changed
* @since 5.0 * @since 5.0
*/ */
void formFactorChanged(Plasma::FormFactor formFactor); void formFactorChanged(Plasma::Types::FormFactor formFactor);
public Q_SLOTS: public Q_SLOTS:
/** /**
@ -270,19 +270,19 @@ Q_SIGNALS:
* *
* @param location the new location of this Corona * @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 * 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 * the arrangement of Applets as well as the display choices of individual
* Applets. * Applets.
*/ */
void setFormFactor(Plasma::FormFactor formFactor); void setFormFactor(Plasma::Types::FormFactor formFactor);
/** /**
* Sets the type of this containment. * Sets the type of this containment.
*/ */
void setContainmentType(Plasma::ContainmentType type); void setContainmentType(Plasma::Types::ContainmentType type);
/** /**
* Sets whether wallpaper is painted or not. * 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 appletDeleted(Plasma::Applet*))
Q_PRIVATE_SLOT(d, void triggerShowAddWidgets()) 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 Applet;
friend class AppletPrivate; friend class AppletPrivate;

View File

@ -92,8 +92,8 @@ void Corona::exportLayout(KConfigGroup &config, QList<Containment*> containments
} }
//temporarily unlock so that removal works //temporarily unlock so that removal works
ImmutabilityType oldImm = immutability(); Types::ImmutabilityType oldImm = immutability();
d->immutability = Mutable; d->immutability = Types::Mutable;
KConfigGroup dest(&config, "Containments"); KConfigGroup dest(&config, "Containments");
KConfigGroup dummy; KConfigGroup dummy;
@ -102,10 +102,10 @@ void Corona::exportLayout(KConfigGroup &config, QList<Containment*> containments
c->config().reparent(&dest); c->config().reparent(&dest);
//ensure the containment is unlocked //ensure the containment is unlocked
//this is done directly because we have to bypass any SystemImmutable checks //this is done directly because we have to bypass any Types::SystemImmutable checks
c->Applet::d->immutability = Mutable; c->Applet::d->immutability = Types::Mutable;
foreach (Applet *a, c->applets()) { foreach (Applet *a, c->applets()) {
a->d->immutability = Mutable; a->d->immutability = Types::Mutable;
} }
c->destroy(); c->destroy();
@ -161,8 +161,8 @@ Containment *Corona::containmentForScreen(int screen) const
{ {
foreach (Containment *containment, d->containments) { foreach (Containment *containment, d->containments) {
if (containment->screen() == screen && if (containment->screen() == screen &&
(containment->containmentType() == Plasma::DesktopContainment || (containment->containmentType() == Plasma::Types::DesktopContainment ||
containment->containmentType() == Plasma::CustomContainment)) { containment->containmentType() == Plasma::Types::CustomContainment)) {
return containment; return containment;
} }
} }
@ -186,7 +186,7 @@ KSharedConfigPtr Corona::config() const
Containment *Corona::createContainment(const QString &name, const QVariantList &args) Containment *Corona::createContainment(const QString &name, const QVariantList &args)
{ {
if (d->immutability == Mutable) { if (d->immutability == Types::Mutable) {
return d->addContainment(name, args, 0); return d->addContainment(name, args, 0);
} }
@ -213,14 +213,14 @@ void Corona::loadDefaultLayout()
//Default implementation does nothing //Default implementation does nothing
} }
ImmutabilityType Corona::immutability() const Types::ImmutabilityType Corona::immutability() const
{ {
return d->immutability; 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; return;
} }
@ -235,11 +235,11 @@ void Corona::setImmutability(const ImmutabilityType immutable)
//update our actions //update our actions
QAction *action = d->actions.action("lock widgets"); QAction *action = d->actions.action("lock widgets");
if (action) { if (action) {
if (d->immutability == SystemImmutable) { if (d->immutability == Types::SystemImmutable) {
action->setEnabled(false); action->setEnabled(false);
action->setVisible(false); action->setVisible(false);
} else { } else {
bool unlocked = d->immutability == Mutable; bool unlocked = d->immutability == Types::Mutable;
action->setText(unlocked ? i18n("Lock Widgets") : i18n("Unlock Widgets")); action->setText(unlocked ? i18n("Lock Widgets") : i18n("Unlock Widgets"));
action->setIcon(QIcon::fromTheme(unlocked ? "object-locked" : "object-unlocked")); action->setIcon(QIcon::fromTheme(unlocked ? "object-locked" : "object-unlocked"));
action->setEnabled(true); 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"); KConfigGroup cg(config(), "General");
// we call the dptr member directly for locked since isImmutable() // 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; QList<Plasma::Types::Location> freeEdges;
freeEdges << Plasma::TopEdge << Plasma::BottomEdge freeEdges << Plasma::Types::TopEdge << Plasma::Types::BottomEdge
<< Plasma::LeftEdge << Plasma::RightEdge; << Plasma::Types::LeftEdge << Plasma::Types::RightEdge;
foreach (Containment *containment, containments()) { foreach (Containment *containment, containments()) {
if (containment->screen() == screen && if (containment->screen() == screen &&
@ -280,7 +280,7 @@ KActionCollection *Corona::actions() const
CoronaPrivate::CoronaPrivate(Corona *corona) CoronaPrivate::CoronaPrivate(Corona *corona)
: q(corona), : q(corona),
immutability(Mutable), immutability(Types::Mutable),
config(0), config(0),
configSyncTimer(new QTimer(corona)), configSyncTimer(new QTimer(corona)),
actions(corona) actions(corona)
@ -317,7 +317,7 @@ void CoronaPrivate::init()
lockAction->setText(i18n("Lock Widgets")); lockAction->setText(i18n("Lock Widgets"));
lockAction->setAutoRepeat(true); lockAction->setAutoRepeat(true);
lockAction->setIcon(QIcon::fromTheme("object-locked")); lockAction->setIcon(QIcon::fromTheme("object-locked"));
lockAction->setData(Plasma::ControlAction); lockAction->setData(Plasma::Types::ControlAction);
lockAction->setShortcut(KShortcut("alt+d, l")); lockAction->setShortcut(KShortcut("alt+d, l"));
lockAction->setShortcutContext(Qt::ApplicationShortcut); lockAction->setShortcutContext(Qt::ApplicationShortcut);
@ -328,10 +328,10 @@ void CoronaPrivate::init()
void CoronaPrivate::toggleImmutability() void CoronaPrivate::toggleImmutability()
{ {
if (immutability == Mutable) { if (immutability == Types::Mutable) {
q->setImmutability(UserImmutable); q->setImmutability(Types::UserImmutable);
} else { } else {
q->setImmutability(Mutable); q->setImmutability(Types::Mutable);
} }
} }
@ -349,7 +349,7 @@ void CoronaPrivate::updateContainmentImmutability()
{ {
foreach (Containment *c, containments) { foreach (Containment *c, containments) {
// we need to tell each containment that immutability has been altered // 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 // 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 // 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(); containment->init();
KConfigGroup cg = containment->config(); KConfigGroup cg = containment->config();
containment->restore(cg); containment->restore(cg);
containment->updateConstraints(Plasma::StartupCompletedConstraint); containment->updateConstraints(Plasma::Types::StartupCompletedConstraint);
containment->save(cg); containment->save(cg);
q->requestConfigSync(); q->requestConfigSync();
containment->flushPendingConstraintsEvents(); containment->flushPendingConstraintsEvents();

View File

@ -127,7 +127,7 @@ public:
* @param screen the id of the screen to look for free edges. * @param screen the id of the screen to look for free edges.
* @returns a list of free edges not filled with panel type containments. * @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 * The actions assocated with this Corona
@ -173,14 +173,14 @@ public Q_SLOTS:
/** /**
* @return The type of immutability of this Corona * @return The type of immutability of this Corona
*/ */
ImmutabilityType immutability() const; Types::ImmutabilityType immutability() const;
/** /**
* Sets the immutability type for this Corona (not immutable, * Sets the immutability type for this Corona (not immutable,
* user immutable or system immutable) * user immutable or system immutable)
* @param immutable the new immutability type of this applet * @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 * 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. * 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. * 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: protected:
/** /**

View File

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

View File

@ -122,7 +122,7 @@ class PLASMA_EXPORT DataContainer : public QObject
* @param alignment the clock position to align updates to * @param alignment the clock position to align updates to
**/ **/
void connectVisualization(QObject *visualization, uint pollingInterval, void connectVisualization(QObject *visualization, uint pollingInterval,
Plasma::IntervalAlignment alignment); Plasma::Types::IntervalAlignment alignment);
/** /**
* sets this data container to be automatically stored. * 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, void DataEngine::connectSource(const QString &source, QObject *visualization,
uint pollingInterval, uint pollingInterval,
Plasma::IntervalAlignment intervalAlignment) const Plasma::Types::IntervalAlignment intervalAlignment) const
{ {
//kDebug() << "connectSource" << source; //kDebug() << "connectSource" << source;
bool newSource; bool newSource;
@ -117,7 +117,7 @@ void DataEngine::connectSource(const QString &source, QObject *visualization,
} }
void DataEngine::connectAllSources(QObject *visualization, uint pollingInterval, void DataEngine::connectAllSources(QObject *visualization, uint pollingInterval,
Plasma::IntervalAlignment intervalAlignment) const Plasma::Types::IntervalAlignment intervalAlignment) const
{ {
foreach (DataContainer *s, d->sources) { foreach (DataContainer *s, d->sources) {
d->connectSource(s, visualization, pollingInterval, intervalAlignment); 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, void DataEnginePrivate::connectSource(DataContainer *s, QObject *visualization,
uint pollingInterval, uint pollingInterval,
Plasma::IntervalAlignment align, Plasma::Types::IntervalAlignment align,
bool immediateCall) bool immediateCall)
{ {
//kDebug() << "connect source called" << s->objectName() << "with interval" << pollingInterval; //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( Q_INVOKABLE void connectSource(
const QString &source, QObject *visualization, const QString &source, QObject *visualization,
uint pollingInterval = 0, 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. * 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 * @param intervalAlignment the number of ms to align the interval to
**/ **/
Q_INVOKABLE void connectAllSources(QObject *visualization, uint pollingInterval = 0, Q_INVOKABLE void connectAllSources(QObject *visualization, uint pollingInterval = 0,
Plasma::IntervalAlignment intervalAlignment = Plasma::Types::IntervalAlignment intervalAlignment =
NoAlignment) const; Types::NoAlignment) const;
/** /**
* Disconnects a source from an object that was receiving data updates. * 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) { switch (location) {
case TopEdge: case Types::TopEdge:
setElementPrefix("north"); setElementPrefix("north");
break; break;
case BottomEdge: case Types::BottomEdge:
setElementPrefix("south"); setElementPrefix("south");
break; break;
case LeftEdge: case Types::LeftEdge:
setElementPrefix("west"); setElementPrefix("west");
break; break;
case RightEdge: case Types::RightEdge:
setElementPrefix("east"); setElementPrefix("east");
break; break;
default: 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 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) { switch (location) {
case TopEdge: case Types::TopEdge:
return hasElementPrefix("north"); return hasElementPrefix("north");
break; break;
case BottomEdge: case Types::BottomEdge:
return hasElementPrefix("south"); return hasElementPrefix("south");
break; break;
case LeftEdge: case Types::LeftEdge:
return hasElementPrefix("west"); return hasElementPrefix("west");
break; break;
case RightEdge: case Types::RightEdge:
return hasElementPrefix("east"); return hasElementPrefix("east");
break; break;
default: 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) { if (d->frames[d->prefix]->noBorderPadding) {
return .0; return .0;
} }
switch (edge) { switch (edge) {
case Plasma::TopMargin: case Plasma::Types::TopMargin:
return d->frames[d->prefix]->topMargin; return d->frames[d->prefix]->topMargin;
break; break;
case Plasma::LeftMargin: case Plasma::Types::LeftMargin:
return d->frames[d->prefix]->leftMargin; return d->frames[d->prefix]->leftMargin;
break; break;
case Plasma::RightMargin: case Plasma::Types::RightMargin:
return d->frames[d->prefix]->rightMargin; return d->frames[d->prefix]->rightMargin;
break; 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 * @param edge the margin edge we want, top, bottom, left or right
* @return the margin size * @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 * 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. * called successfully after setImagePath is called.
* @param location location in the UI this frame will be drawn * @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, * 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. * to draw a frame.
* @param location the given prefix we want to check if drawable * @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 * Returns the prefix for SVG elements of the FrameSvg

View File

@ -28,46 +28,55 @@
namespace Plasma namespace Plasma
{ {
Direction locationToDirection(Location location) Types::Types(QObject *parent)
: QObject(parent)
{ {
switch (location) {
case Floating:
case Desktop:
case TopEdge:
case 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 Down;
} }
Direction locationToInverseDirection(Location location) Types::~Types()
{
}
Types::Direction locationToDirection(Types::Location location)
{ {
switch (location) { switch (location) {
case Floating: case Types::Floating:
case Desktop: case Types::Desktop:
case TopEdge: case Types::TopEdge:
case FullScreen: case Types::FullScreen:
//TODO: should we be smarter for floating and planer? //TODO: should we be smarter for floating and planer?
// perhaps we should take a QRect and/or QPos as well? // perhaps we should take a QRect and/or QPos as well?
return Up; return Types::Down;
case BottomEdge: case Types::BottomEdge:
return Down; return Types::Up;
case LeftEdge: case Types::LeftEdge:
return Left; return Types::Right;
case RightEdge: case Types::RightEdge:
return Right; return Types::Left;
} }
return Up; return Types::Down;
}
Types::Direction locationToInverseDirection(Types::Location location)
{
switch (location) {
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 Types::Up;
case Types::BottomEdge:
return Types::Down;
case Types::LeftEdge:
return Types::Left;
case Types::RightEdge:
return Types::Right;
}
return Types::Up;
} }
} // Plasma namespace } // Plasma namespace

View File

@ -34,6 +34,12 @@ class QAction;
namespace Plasma namespace Plasma
{ {
class PLASMA_EXPORT Types : public QObject
{
Q_OBJECT
public:
~Types();
/** /**
* The Constraint enumeration lists the various constraints that Plasma * The Constraint enumeration lists the various constraints that Plasma
* objects have managed for them and which they may wish to react to, * objects have managed for them and which they may wish to react to,
@ -50,6 +56,7 @@ enum Constraint {
AllConstraints = FormFactorConstraint | LocationConstraint | ScreenConstraint | AllConstraints = FormFactorConstraint | LocationConstraint | ScreenConstraint |
ImmutableConstraint ImmutableConstraint
}; };
Q_ENUMS(Constraint)
Q_DECLARE_FLAGS(Constraints, 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, Application /**< The Applet lives in a plane and should be optimized to look as a full application,
for the desktop or the particular device. */ for the desktop or the particular device. */
}; };
Q_ENUMS(FormFactor)
/** /**
* This enumeration describes the type of the Containment. * This enumeration describes the type of the Containment.
@ -116,6 +124,7 @@ enum Direction {
Left, /**< Display to the left */ Left, /**< Display to the left */
Right /**< Display to the right */ Right /**< Display to the right */
}; };
Q_ENUMS(Direction)
/** /**
* The Location enumeration describes where on screen an element, such as an * 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 */ LeftEdge, /**< Along the left side of the screen */
RightEdge /**< Along the right side of the screen */ RightEdge /**< Along the right side of the screen */
}; };
Q_ENUMS(Location)
/** /**
* The position enumeration * The position enumeration
@ -144,12 +154,12 @@ enum Position {
BottomPositioned, /**< Positioned bottom */ BottomPositioned, /**< Positioned bottom */
CenterPositioned /**< Positioned in the center */ CenterPositioned /**< Positioned in the center */
}; };
Q_ENUMS(Position)
/** /**
* The popup position enumeration relatively to his attached widget * The popup position enumeration relatively to his attached widget
* *
**/ **/
enum PopupPlacement { enum PopupPlacement {
FloatingPopup = 0, /**< Free floating, non attached popup */ FloatingPopup = 0, /**< Free floating, non attached popup */
TopPosedLeftAlignedPopup, /**< Popup positioned on the top, aligned TopPosedLeftAlignedPopup, /**< Popup positioned on the top, aligned
@ -169,6 +179,7 @@ enum PopupPlacement {
RightPosedBottomAlignedPopup /**< Popup positioned on the right, aligned RightPosedBottomAlignedPopup /**< Popup positioned on the right, aligned
to the bottom of the widget */ to the bottom of the widget */
}; };
Q_ENUMS(PopupPlacement)
/** /**
* Flip enumeration * Flip enumeration
@ -178,6 +189,7 @@ enum FlipDirection {
HorizontalFlip = 1, /**< Flip horizontally */ HorizontalFlip = 1, /**< Flip horizontally */
VerticalFlip = 2 /**< Flip vertically */ VerticalFlip = 2 /**< Flip vertically */
}; };
Q_ENUMS(FlipDirection)
Q_DECLARE_FLAGS(Flip, FlipDirection) Q_DECLARE_FLAGS(Flip, FlipDirection)
/** /**
@ -188,6 +200,7 @@ enum IntervalAlignment {
AlignToMinute, /**< Align to the minute **/ AlignToMinute, /**< Align to the minute **/
AlignToHour /**< Align to the hour **/ AlignToHour /**< Align to the hour **/
}; };
Q_ENUMS(IntervalAlignment)
/** /**
* Defines the immutability of items like applets, corona and containments * 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 SystemImmutable = 4 /**< the item is locked down by the system, the user
can't unlock it **/ can't unlock it **/
}; };
Q_ENUMS(ImmutabilityType)
/** /**
* The ComonentType enumeration refers to the various types of components, * The ComonentType enumeration refers to the various types of components,
@ -215,6 +229,7 @@ enum ComponentType {
WallpaperComponent = 32, /**< Plasma::Wallpaper based plugins **/ WallpaperComponent = 32, /**< Plasma::Wallpaper based plugins **/
GenericComponent = 64 /** Generic repositories of files, usually they keep QML files and their assets **/ GenericComponent = 64 /** Generic repositories of files, usually they keep QML files and their assets **/
}; };
Q_ENUMS(ComponentType)
Q_DECLARE_FLAGS(ComponentTypes, ComponentType) Q_DECLARE_FLAGS(ComponentTypes, ComponentType)
enum MarginEdge { enum MarginEdge {
@ -223,15 +238,7 @@ enum MarginEdge {
LeftMargin, /**< The left margin **/ LeftMargin, /**< The left margin **/
RightMargin /**< The right margin **/ RightMargin /**< The right margin **/
}; };
Q_ENUMS(MarginEdge)
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)
/** /**
* Status of an applet * Status of an applet
@ -246,12 +253,6 @@ enum ItemStatus {
}; };
Q_ENUMS(ItemStatus) Q_ENUMS(ItemStatus)
enum AnnouncementMethod {
NoAnnouncement = 0, /**< No announcements **/
ZeroconfAnnouncement = 1 /**< Announcements via ZeroConf **/
};
Q_DECLARE_FLAGS(AnnouncementMethods, AnnouncementMethod)
enum TrustLevel { enum TrustLevel {
UnverifiableTrust = 0, /**< The trust of the object can not be verified, usually because no UnverifiableTrust = 0, /**< The trust of the object can not be verified, usually because no
trust information (e.g. a cryptographic signature) was provided */ trust information (e.g. a cryptographic signature) was provided */
@ -276,6 +277,10 @@ enum BackgroundHints {
}; };
Q_ENUMS(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 * 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. * 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 * @param location the location of the container the element will appear in
* @return the visual direction the element should be oriented 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 * 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 * @param location the location of the container the element will appear in
* @return the visual direction the element should be oriented 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 } // 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::Types::Constraints)
Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::MessageButtons) Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::Types::Flip)
Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::Types::ComponentTypes)
#endif // multiple inclusion guard #endif // multiple inclusion guard

View File

@ -50,16 +50,16 @@ namespace Plasma
AppletPrivate::AppletPrivate(KService::Ptr service, const KPluginInfo *info, int uniqueID, Applet *applet) AppletPrivate::AppletPrivate(KService::Ptr service, const KPluginInfo *info, int uniqueID, Applet *applet)
: appletId(uniqueID), : appletId(uniqueID),
q(applet), q(applet),
immutability(Mutable), immutability(Types::Mutable),
appletDescription(info ? *info : KPluginInfo(service)), appletDescription(info ? *info : KPluginInfo(service)),
mainConfig(0), mainConfig(0),
pendingConstraints(NoConstraint), pendingConstraints(Types::NoConstraint),
script(0), script(0),
package(0), package(0),
configLoader(0), configLoader(0),
actions(AppletPrivate::defaultActions(applet)), actions(AppletPrivate::defaultActions(applet)),
activationAction(0), activationAction(0),
itemStatus(UnknownStatus), itemStatus(Types::UnknownStatus),
modificationsTimer(0), modificationsTimer(0),
hasConfigurationInterface(false), hasConfigurationInterface(false),
isContainment(false), isContainment(false),
@ -202,14 +202,14 @@ KActionCollection* AppletPrivate::defaultActions(QObject *parent)
configAction->setText(i18n("Widget Settings")); configAction->setText(i18n("Widget Settings"));
configAction->setIcon(QIcon::fromTheme("configure")); configAction->setIcon(QIcon::fromTheme("configure"));
configAction->setShortcut(KShortcut("alt+d, s")); configAction->setShortcut(KShortcut("alt+d, s"));
configAction->setData(Plasma::ConfigureAction); configAction->setData(Plasma::Types::ConfigureAction);
KAction *closeApplet = actions->add<KAction>("remove"); KAction *closeApplet = actions->add<KAction>("remove");
closeApplet->setAutoRepeat(false); closeApplet->setAutoRepeat(false);
closeApplet->setText(i18n("Remove this Widget")); closeApplet->setText(i18n("Remove this Widget"));
closeApplet->setIcon(QIcon::fromTheme("edit-delete")); closeApplet->setIcon(QIcon::fromTheme("edit-delete"));
closeApplet->setShortcut(KShortcut("alt+d, r")); closeApplet->setShortcut(KShortcut("alt+d, r"));
closeApplet->setData(Plasma::DestructiveAction); closeApplet->setData(Plasma::Types::DestructiveAction);
KAction *runAssociatedApplication = actions->add<KAction>("run associated application"); KAction *runAssociatedApplication = actions->add<KAction>("run associated application");
runAssociatedApplication->setAutoRepeat(false); runAssociatedApplication->setAutoRepeat(false);
@ -218,7 +218,7 @@ KActionCollection* AppletPrivate::defaultActions(QObject *parent)
runAssociatedApplication->setShortcut(KShortcut("alt+d, t")); runAssociatedApplication->setShortcut(KShortcut("alt+d, t"));
runAssociatedApplication->setVisible(false); runAssociatedApplication->setVisible(false);
runAssociatedApplication->setEnabled(false); runAssociatedApplication->setEnabled(false);
runAssociatedApplication->setData(Plasma::ControlAction); runAssociatedApplication->setData(Plasma::Types::ControlAction);
return actions; return actions;
} }
@ -317,15 +317,15 @@ QString AppletPrivate::globalName() const
return appletDescription.service()->library(); 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 // Don't start up a timer if we're just starting up
// flushPendingConstraints will be called by Corona // 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); constraintsTimer.start(0, q);
} }
if (c & Plasma::StartupCompletedConstraint) { if (c & Plasma::Types::StartupCompletedConstraint) {
started = true; started = true;
} }

View File

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

View File

@ -69,7 +69,7 @@ void ContainmentPrivate::addDefaultActions(KActionCollection *actions, Containme
appletBrowserAction->setText(i18n("Add Widgets...")); appletBrowserAction->setText(i18n("Add Widgets..."));
appletBrowserAction->setIcon(QIcon::fromTheme("list-add")); appletBrowserAction->setIcon(QIcon::fromTheme("list-add"));
appletBrowserAction->setShortcut(KShortcut("alt+d, a")); appletBrowserAction->setShortcut(KShortcut("alt+d, a"));
appletBrowserAction->setData(Plasma::AddAction); appletBrowserAction->setData(Plasma::Types::AddAction);
} }
void ContainmentPrivate::setScreen(int newScreen) void ContainmentPrivate::setScreen(int newScreen)
@ -101,8 +101,8 @@ void ContainmentPrivate::setScreen(int newScreen)
//kDebug() << activity() << "setting screen to " << newScreen << "and type is" << type; //kDebug() << activity() << "setting screen to " << newScreen << "and type is" << type;
Containment *swapScreensWith(0); Containment *swapScreensWith(0);
const bool isDesktopContainment = type == Plasma::DesktopContainment || const bool isDesktopContainment = type == Plasma::Types::DesktopContainment ||
type == Plasma::CustomContainment; type == Plasma::Types::CustomContainment;
if (isDesktopContainment) { if (isDesktopContainment) {
if (newScreen > -1) { if (newScreen > -1) {
// sanity check to make sure someone else doesn't have this screen already! // 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; int oldScreen = screen;
screen = newScreen; screen = newScreen;
q->updateConstraints(Plasma::ScreenConstraint); q->updateConstraints(Plasma::Types::ScreenConstraint);
if (oldScreen != newScreen) { if (oldScreen != newScreen) {
/* /*
@ -161,7 +161,7 @@ void ContainmentPrivate::configChanged()
q->setWallpaper(group.readEntry("wallpaperplugin", defaultWallpaper)); q->setWallpaper(group.readEntry("wallpaperplugin", defaultWallpaper));
} }
void ContainmentPrivate::checkStatus(Plasma::ItemStatus appletStatus) void ContainmentPrivate::checkStatus(Plasma::Types::ItemStatus appletStatus)
{ {
//kDebug() << "================== "<< appletStatus << q->status(); //kDebug() << "================== "<< appletStatus << q->status();
if (appletStatus == q->status()) { if (appletStatus == q->status()) {
@ -187,16 +187,16 @@ void ContainmentPrivate::triggerShowAddWidgets()
emit q->showAddWidgetsInterface(QPointF()); emit q->showAddWidgetsInterface(QPointF());
} }
void ContainmentPrivate::containmentConstraintsEvent(Plasma::Constraints constraints) void ContainmentPrivate::containmentConstraintsEvent(Plasma::Types::Constraints constraints)
{ {
if (!q->isContainment()) { if (!q->isContainment()) {
return; return;
} }
//kDebug() << "got containmentConstraintsEvent" << constraints; //kDebug() << "got containmentConstraintsEvent" << constraints;
if (constraints & Plasma::ImmutableConstraint) { if (constraints & Plasma::Types::ImmutableConstraint) {
//update actions //update actions
const bool unlocked = q->immutability() == Mutable; const bool unlocked = q->immutability() == Types::Mutable;
QAction *action = q->actions()->action("remove"); QAction *action = q->actions()->action("remove");
if (action) { if (action) {
@ -213,21 +213,21 @@ void ContainmentPrivate::containmentConstraintsEvent(Plasma::Constraints constra
// tell the applets too // tell the applets too
foreach (Applet *a, applets) { foreach (Applet *a, applets) {
a->setImmutability(q->immutability()); a->setImmutability(q->immutability());
a->updateConstraints(ImmutableConstraint); a->updateConstraints(Types::ImmutableConstraint);
} }
} }
// pass on the constraints that are relevant here // pass on the constraints that are relevant here
Constraints appletConstraints = NoConstraint; Types::Constraints appletConstraints = Types::NoConstraint;
if (constraints & FormFactorConstraint) { if (constraints & Types::FormFactorConstraint) {
appletConstraints |= FormFactorConstraint; appletConstraints |= Types::FormFactorConstraint;
} }
if (constraints & ScreenConstraint) { if (constraints & Types::ScreenConstraint) {
appletConstraints |= ScreenConstraint; appletConstraints |= Types::ScreenConstraint;
} }
if (appletConstraints != NoConstraint) { if (appletConstraints != Types::NoConstraint) {
foreach (Applet *applet, applets) { foreach (Applet *applet, applets) {
applet->updateConstraints(appletConstraints); applet->updateConstraints(appletConstraints);
} }
@ -240,7 +240,7 @@ Applet *ContainmentPrivate::createApplet(const QString &name, const QVariantList
return 0; return 0;
} }
if (q->immutability() != Mutable) { if (q->immutability() != Types::Mutable) {
#ifndef NDEBUG #ifndef NDEBUG
kDebug() << "addApplet for" << name << "requested, but we're currently immutable!"; kDebug() << "addApplet for" << name << "requested, but we're currently immutable!";
#endif #endif
@ -271,7 +271,7 @@ void ContainmentPrivate::appletDeleted(Plasma::Applet *applet)
bool ContainmentPrivate::isPanelContainment() const 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: public:
ContainmentPrivate(Containment *c) ContainmentPrivate(Containment *c)
: q(c), : q(c),
formFactor(Planar), formFactor(Types::Planar),
location(Floating), location(Types::Floating),
screen(-1), // no screen screen(-1), // no screen
type(Plasma::NoContainmentType), type(Plasma::Types::NoContainmentType),
drawWallpaper(false) drawWallpaper(false)
{ {
} }
@ -65,7 +65,7 @@ public:
} }
void triggerShowAddWidgets(); void triggerShowAddWidgets();
void checkStatus(Plasma::ItemStatus status); void checkStatus(Plasma::Types::ItemStatus status);
void setScreen(int newScreen); void setScreen(int newScreen);
/** /**
@ -73,7 +73,7 @@ public:
* constraint services common to all containments. Containments should still * constraint services common to all containments. Containments should still
* implement their own constraintsEvent method * implement their own constraintsEvent method
*/ */
void containmentConstraintsEvent(Plasma::Constraints constraints); void containmentConstraintsEvent(Plasma::Types::Constraints constraints);
bool isPanelContainment() const; bool isPanelContainment() const;
void setLockToolText(); void setLockToolText();
@ -95,14 +95,14 @@ public:
static void addDefaultActions(KActionCollection *actions, Containment *c = 0); static void addDefaultActions(KActionCollection *actions, Containment *c = 0);
Containment *q; Containment *q;
FormFactor formFactor; Types::FormFactor formFactor;
Location location; Types::Location location;
QList<Applet *> applets; QList<Applet *> applets;
QString wallpaper; QString wallpaper;
QHash<QString, ContainmentActions*> localActionPlugins; QHash<QString, ContainmentActions*> localActionPlugins;
int screen; int screen;
QString activityId; QString activityId;
ContainmentType type; Types::ContainmentType type;
bool drawWallpaper : 1; bool drawWallpaper : 1;
static const char defaultWallpaper[]; static const char defaultWallpaper[];

View File

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

View File

@ -25,7 +25,7 @@ namespace Plasma
SignalRelay *DataContainerPrivate::signalRelay(const DataContainer *dc, QObject *visualization, SignalRelay *DataContainerPrivate::signalRelay(const DataContainer *dc, QObject *visualization,
uint pollingInterval, uint pollingInterval,
Plasma::IntervalAlignment align, Plasma::Types::IntervalAlignment align,
bool immediateUpdate) bool immediateUpdate)
{ {
QMap<uint, SignalRelay *>::const_iterator relayIt = relays.constFind(pollingInterval); QMap<uint, SignalRelay *>::const_iterator relayIt = relays.constFind(pollingInterval);
@ -56,7 +56,7 @@ bool DataContainerPrivate::hasUpdates()
} }
SignalRelay::SignalRelay(DataContainer *parent, DataContainerPrivate *data, uint ival, SignalRelay::SignalRelay(DataContainer *parent, DataContainerPrivate *data, uint ival,
Plasma::IntervalAlignment align, bool immediateUpdate) Plasma::Types::IntervalAlignment align, bool immediateUpdate)
: QObject(parent), : QObject(parent),
dc(parent), dc(parent),
d(data), d(data),
@ -67,7 +67,7 @@ SignalRelay::SignalRelay(DataContainer *parent, DataContainerPrivate *data, uint
{ {
//kDebug() << "signal relay with time of" << m_timerId << "being set up"; //kDebug() << "signal relay with time of" << m_timerId << "being set up";
m_timerId = startTimer(immediateUpdate ? 0 : m_interval); m_timerId = startTimer(immediateUpdate ? 0 : m_interval);
if (m_align != Plasma::NoAlignment) { if (m_align != Plasma::Types::NoAlignment) {
checkAlignment(); checkAlignment();
} }
} }
@ -87,12 +87,12 @@ void SignalRelay::checkAlignment()
int newTime = 0; int newTime = 0;
QTime t = QTime::currentTime(); QTime t = QTime::currentTime();
if (m_align == Plasma::AlignToMinute) { if (m_align == Plasma::Types::AlignToMinute) {
int seconds = t.second(); int seconds = t.second();
if (seconds > 2) { if (seconds > 2) {
newTime = ((60 - seconds) * 1000) + 500; newTime = ((60 - seconds) * 1000) + 500;
} }
} else if (m_align == Plasma::AlignToHour) { } else if (m_align == Plasma::Types::AlignToHour) {
int minutes = t.minute(); int minutes = t.minute();
int seconds = t.second(); int seconds = t.second();
if (minutes > 1 || seconds > 10) { if (minutes > 1 || seconds > 10) {
@ -147,7 +147,7 @@ void SignalRelay::timerEvent(QTimerEvent *event)
m_resetTimer = false; m_resetTimer = false;
} }
if (m_align != Plasma::NoAlignment) { if (m_align != Plasma::Types::NoAlignment) {
checkAlignment(); checkAlignment();
} }

View File

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

View File

@ -38,7 +38,7 @@ class DataEnginePrivate
~DataEnginePrivate(); ~DataEnginePrivate();
DataContainer *source(const QString &sourceName, bool createWhenMissing = true); DataContainer *source(const QString &sourceName, bool createWhenMissing = true);
void connectSource(DataContainer *s, QObject *visualization, uint pollingInterval, 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); DataContainer *requestSource(const QString &sourceName, bool *newSource = 0);
void internalUpdateSource(DataContainer*); void internalUpdateSource(DataContainer*);
void setupScriptSupport(); void setupScriptSupport();

View File

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

View File

@ -66,7 +66,7 @@ void AppletScript::paintInterface(QPainter *painter,
Q_UNUSED(contentsRect); Q_UNUSED(contentsRect);
} }
void AppletScript::constraintsEvent(Plasma::Constraints constraints) void AppletScript::constraintsEvent(Plasma::Types::Constraints constraints)
{ {
Q_UNUSED(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); Q_ASSERT(d->applet);
Plasma::Containment *cont = qobject_cast<Plasma::Containment *>(d->applet); Plasma::Containment *cont = qobject_cast<Plasma::Containment *>(d->applet);
if (cont) { if (cont) {
return cont->containmentType(); return cont->containmentType();
} else { } 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); Q_ASSERT(d->applet);
Plasma::Containment *cont = qobject_cast<Plasma::Containment *>(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 * @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. * Returns a list of context-related QAction instances.
@ -143,13 +143,13 @@ public:
* @see Containment * @see Containment
* @since 4.7 * @since 4.7
*/ */
Plasma::ContainmentType containmentType() const; Plasma::Types::ContainmentType containmentType() const;
/** /**
* @see Containment * @see Containment
* @since 4.7 * @since 4.7
*/ */
void setContainmentType(Plasma::ContainmentType type); void setContainmentType(Plasma::Types::ContainmentType type);
Q_SIGNALS: Q_SIGNALS:
/** /**

View File

@ -61,12 +61,12 @@ QString ScriptEngine::mainScript() const
return QString(); return QString();
} }
QStringList knownLanguages(ComponentTypes types) QStringList knownLanguages(Types::ComponentTypes types)
{ {
QString constraintTemplate = "'%1' in [X-Plasma-ComponentTypes]"; QString constraintTemplate = "'%1' in [X-Plasma-ComponentTypes]";
QString constraint; QString constraint;
if (types & AppletComponent) { if (types & Types::AppletComponent) {
// currently this if statement is not needed, but this future proofs // currently this if statement is not needed, but this future proofs
// the code against someone initializing constraint to something // the code against someone initializing constraint to something
// before we get here. // before we get here.
@ -77,7 +77,7 @@ QStringList knownLanguages(ComponentTypes types)
constraint.append(constraintTemplate.arg("Applet")); constraint.append(constraintTemplate.arg("Applet"));
} }
if (types & DataEngineComponent) { if (types & Types::DataEngineComponent) {
if (!constraint.isEmpty()) { if (!constraint.isEmpty()) {
constraint.append(" or "); constraint.append(" or ");
} }
@ -85,7 +85,7 @@ QStringList knownLanguages(ComponentTypes types)
constraint.append(constraintTemplate.arg("DataEngine")); constraint.append(constraintTemplate.arg("DataEngine"));
} }
if (types & RunnerComponent) { if (types & Types::RunnerComponent) {
if (!constraint.isEmpty()) { if (!constraint.isEmpty()) {
constraint.append(" or "); constraint.append(" or ");
} }
@ -108,7 +108,7 @@ QStringList knownLanguages(ComponentTypes types)
return languages; return languages;
} }
KService::List engineOffers(const QString &language, ComponentType type) KService::List engineOffers(const QString &language, Types::ComponentType type)
{ {
if (language.isEmpty()) { if (language.isEmpty()) {
return KService::List(); return KService::List();
@ -124,13 +124,13 @@ KService::List engineOffers(const QString &language, ComponentType type)
QString component; QString component;
switch (type) { switch (type) {
case AppletComponent: case Types::AppletComponent:
component = "Applet"; component = "Applet";
break; break;
case DataEngineComponent: case Types::DataEngineComponent:
component = "DataEngine"; component = "DataEngine";
break; break;
case RunnerComponent: case Types::RunnerComponent:
component = "Runner"; component = "Runner";
break; break;
default: default:
@ -152,7 +152,7 @@ KService::List engineOffers(const QString &language, ComponentType type)
return offers; 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); KService::List offers = engineOffers(language, type);
@ -162,13 +162,13 @@ ScriptEngine *loadEngine(const QString &language, ComponentType type, QObject *p
ScriptEngine *engine = 0; ScriptEngine *engine = 0;
foreach (const KService::Ptr &service, offers) { foreach (const KService::Ptr &service, offers) {
switch (type) { switch (type) {
case AppletComponent: case Types::AppletComponent:
engine = service->createInstance<Plasma::AppletScript>(parent, args, &error); engine = service->createInstance<Plasma::AppletScript>(parent, args, &error);
break; break;
case DataEngineComponent: case Types::DataEngineComponent:
engine = service->createInstance<Plasma::DataEngineScript>(parent, args, &error); engine = service->createInstance<Plasma::DataEngineScript>(parent, args, &error);
break; break;
case RunnerComponent: case Types::RunnerComponent:
engine = service->createInstance<Plasma::RunnerScript>(parent, args, &error); engine = service->createInstance<Plasma::RunnerScript>(parent, args, &error);
break; break;
default: default:
@ -195,7 +195,7 @@ ScriptEngine *loadEngine(const QString &language, ComponentType type, QObject *p
AppletScript *loadScriptEngine(const QString &language, Applet *applet) AppletScript *loadScriptEngine(const QString &language, Applet *applet)
{ {
AppletScript *engine = AppletScript *engine =
static_cast<AppletScript*>(loadEngine(language, AppletComponent, applet)); static_cast<AppletScript*>(loadEngine(language, Types::AppletComponent, applet));
if (engine) { if (engine) {
engine->setApplet(applet); engine->setApplet(applet);
@ -207,7 +207,7 @@ AppletScript *loadScriptEngine(const QString &language, Applet *applet)
DataEngineScript *loadScriptEngine(const QString &language, DataEngine *dataEngine) DataEngineScript *loadScriptEngine(const QString &language, DataEngine *dataEngine)
{ {
DataEngineScript *engine = DataEngineScript *engine =
static_cast<DataEngineScript*>(loadEngine(language, DataEngineComponent, dataEngine)); static_cast<DataEngineScript*>(loadEngine(language, Types::DataEngineComponent, dataEngine));
if (engine) { if (engine) {
engine->setDataEngine(dataEngine); engine->setDataEngine(dataEngine);
@ -218,7 +218,7 @@ DataEngineScript *loadScriptEngine(const QString &language, DataEngine *dataEngi
RunnerScript *loadScriptEngine(const QString &language, AbstractRunner *runner) 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) { if (engine) {
engine->setRunner(runner); engine->setRunner(runner);

View File

@ -85,7 +85,7 @@ private:
* language support for * language support for
* @return a list of all supported languages for the given type(s). * @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. * 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; return Plasma::UnverifiableTrust;
for (int i = (int)Plasma::UnverifiableTrust; i <= (int)Plasma::UltimatelyTrusted; ++i) { 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) { foreach(QByteArray key, tmp) {
if (key.contains(keyID.toAscii().data())) 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); * QString signer = m_auth->signerOf(plasmoidPath);
* *
* // If you need to know the authentication level associated with a specific signer, simply call: * // 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: * // If you need more details about a key with a given keyID, you have to call:
* QString info = m_auth->descriptiveString(keyID); * QString info = m_auth->descriptiveString(keyID);

View File

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

View File

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

View File

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

View File

@ -128,12 +128,12 @@ QScriptValue DataEngineReceiver::connectAllSources(QScriptContext *context, QScr
} }
int pollingInterval = 0; int pollingInterval = 0;
Plasma::IntervalAlignment intervalAlignment = Plasma::NoAlignment; Plasma::Types::IntervalAlignment intervalAlignment = Plasma::NoAlignment;
if (context->argumentCount() > 1) { if (context->argumentCount() > 1) {
pollingInterval = context->argument(2).toInt32(); pollingInterval = context->argument(2).toInt32();
if (context->argumentCount() > 2) { 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; int pollingInterval = 0;
Plasma::IntervalAlignment intervalAlignment = Plasma::NoAlignment; Plasma::Types::IntervalAlignment intervalAlignment = Plasma::NoAlignment;
if (context->argumentCount() > 2) { if (context->argumentCount() > 2) {
pollingInterval = context->argument(2).toInt32(); pollingInterval = context->argument(2).toInt32();
if (context->argumentCount() > 3) { 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), : QQuickItem(parent),
m_appletScriptEngine(script), m_appletScriptEngine(script),
m_actionSignals(0), m_actionSignals(0),
m_backgroundHints(Plasma::StandardBackground), m_backgroundHints(Plasma::Types::StandardBackground),
m_busy(false), m_busy(false),
m_expanded(false) m_expanded(false)
{ {
@ -65,8 +65,8 @@ AppletInterface::AppletInterface(DeclarativeAppletScript *script, QQuickItem *pa
connect(this, SIGNAL(releaseVisualFocus()), applet(), SIGNAL(releaseVisualFocus())); connect(this, SIGNAL(releaseVisualFocus()), applet(), SIGNAL(releaseVisualFocus()));
connect(this, SIGNAL(configNeedsSaving()), applet(), SIGNAL(configNeedsSaving())); connect(this, SIGNAL(configNeedsSaving()), applet(), SIGNAL(configNeedsSaving()));
connect(applet(), SIGNAL(immutabilityChanged(Plasma::ImmutabilityType)), this, SIGNAL(immutableChanged())); connect(applet(), SIGNAL(immutabilityChanged(Plasma::Types::ImmutabilityType)), this, SIGNAL(immutableChanged()));
connect(applet(), SIGNAL(statusChanged(Plasma::ItemStatus)), this, SIGNAL(statusChanged())); connect(applet(), SIGNAL(statusChanged(Plasma::Types::ItemStatus)), this, SIGNAL(statusChanged()));
connect(m_appletScriptEngine, SIGNAL(formFactorChanged()), connect(m_appletScriptEngine, SIGNAL(formFactorChanged()),
this, SIGNAL(formFactorChanged())); this, SIGNAL(formFactorChanged()));
connect(m_appletScriptEngine, SIGNAL(locationChanged()), connect(m_appletScriptEngine, SIGNAL(locationChanged()),
@ -135,9 +135,9 @@ void AppletInterface::init()
Plasma::Containment *pc = qobject_cast<Plasma::Containment *>(applet()); Plasma::Containment *pc = qobject_cast<Plasma::Containment *>(applet());
if (pc && !qobject_cast<Plasma::Applet *>(pc->parent())) { if (pc && !qobject_cast<Plasma::Applet *>(pc->parent())) {
KConfigGroup defaults; KConfigGroup defaults;
if (pc->containmentType() == Plasma::DesktopContainment) { if (pc->containmentType() == Plasma::Types::DesktopContainment) {
defaults = KConfigGroup(KSharedConfig::openConfig(pc->corona()->package().filePath("defaults")), "Desktop"); 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"); defaults = KConfigGroup(KSharedConfig::openConfig(pc->corona()->package().filePath("defaults")), "Panel");
} }
@ -179,14 +179,14 @@ void AppletInterface::init()
emit busyChanged(); 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 QString AppletInterface::currentActivity() const
@ -256,18 +256,18 @@ void AppletInterface::setExpanded(bool expanded)
emit expandedChanged(); 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; return;
} }
m_backgroundHints = (Plasma::BackgroundHints)hint; m_backgroundHints = hint;
emit backgroundHintsChanged(); emit backgroundHintsChanged();
} }
@ -447,7 +447,7 @@ QAction *AppletInterface::action(QString name) const
bool AppletInterface::immutable() const bool AppletInterface::immutable() const
{ {
return applet()->immutability() != Plasma::Mutable; return applet()->immutability() != Plasma::Types::Mutable;
} }
bool AppletInterface::userConfiguring() const bool AppletInterface::userConfiguring() const
@ -482,14 +482,14 @@ QString AppletInterface::associatedApplication() const
return applet()->associatedApplication(); 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) QString AppletInterface::downloadPath(const QString &file)

View File

@ -49,30 +49,23 @@ namespace Plasma
class AppletInterface : public QQuickItem class AppletInterface : public QQuickItem
{ {
Q_OBJECT 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) Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
//TODO: writable icon //TODO: writable icon
Q_PROPERTY(QString icon READ icon CONSTANT) Q_PROPERTY(QString icon READ icon CONSTANT)
Q_PROPERTY(uint id READ id CONSTANT) Q_PROPERTY(uint id READ id CONSTANT)
Q_PROPERTY(FormFactor formFactor READ formFactor NOTIFY formFactorChanged) Q_PROPERTY(Plasma::Types::FormFactor formFactor READ formFactor NOTIFY formFactorChanged)
Q_PROPERTY(Location location READ location NOTIFY locationChanged) Q_PROPERTY(Plasma::Types::Location location READ location NOTIFY locationChanged)
Q_PROPERTY(QString currentActivity READ currentActivity NOTIFY contextChanged) Q_PROPERTY(QString currentActivity READ currentActivity NOTIFY contextChanged)
Q_PROPERTY(QObject* configuration READ configuration CONSTANT) Q_PROPERTY(QObject* configuration READ configuration CONSTANT)
Q_PROPERTY(QString activeConfig WRITE setActiveConfig READ activeConfig) Q_PROPERTY(QString activeConfig WRITE setActiveConfig READ activeConfig)
Q_PROPERTY(bool busy WRITE setBusy READ isBusy NOTIFY busyChanged) Q_PROPERTY(bool busy WRITE setBusy READ isBusy NOTIFY busyChanged)
Q_PROPERTY(bool expanded WRITE setExpanded READ isExpanded NOTIFY expandedChanged) 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 immutable READ immutable NOTIFY immutableChanged)
Q_PROPERTY(bool userConfiguring READ userConfiguring) // @since 4.5 Q_PROPERTY(bool userConfiguring READ userConfiguring) // @since 4.5
Q_PROPERTY(int apiVersion READ apiVersion CONSTANT) 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) Q_PROPERTY(QString associatedApplication WRITE setAssociatedApplication READ associatedApplication)
public: public:
@ -82,73 +75,6 @@ public:
//API not intended for the QML part //API not intended for the QML part
QmlObject *qmlObject(); 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------------------------------------------------------------------- //QML API-------------------------------------------------------------------
Q_INVOKABLE void setConfigurationRequired(bool needsConfiguring, const QString &reason = QString()); Q_INVOKABLE void setConfigurationRequired(bool needsConfiguring, const QString &reason = QString());
@ -186,9 +112,9 @@ enum IntervalAlignment {
uint id() const; uint id() const;
FormFactor formFactor() const; Plasma::Types::FormFactor formFactor() const;
Location location() const; Plasma::Types::Location location() const;
QString currentActivity() const; QString currentActivity() const;
@ -200,14 +126,14 @@ enum IntervalAlignment {
bool isExpanded() const; bool isExpanded() const;
void setExpanded(bool expanded); void setExpanded(bool expanded);
BackgroundHints backgroundHints() const; Plasma::Types::BackgroundHints backgroundHints() const;
void setBackgroundHints(BackgroundHints hint); void setBackgroundHints(Plasma::Types::BackgroundHints hint);
void setAssociatedApplication(const QString &string); void setAssociatedApplication(const QString &string);
QString associatedApplication() const; QString associatedApplication() const;
void setStatus(const ItemStatus &status); void setStatus(const Plasma::Types::ItemStatus &status);
ItemStatus status() const; Plasma::Types::ItemStatus status() const;
QString activeConfig() const; QString activeConfig() const;
void setActiveConfig(const QString &name); void setActiveConfig(const QString &name);
@ -253,7 +179,7 @@ private:
QTimer *m_creationTimer; QTimer *m_creationTimer;
Plasma::BackgroundHints m_backgroundHints; Plasma::Types::BackgroundHints m_backgroundHints;
bool m_busy : 1; bool m_busy : 1;
bool m_expanded : 1; bool m_expanded : 1;
}; };

View File

@ -97,7 +97,7 @@ ContainmentInterface::Type ContainmentInterface::containmentType() const
void ContainmentInterface::setContainmentType(ContainmentInterface::Type type) void ContainmentInterface::setContainmentType(ContainmentInterface::Type type)
{ {
m_appletScriptEngine->setContainmentType((Plasma::ContainmentType)type); m_appletScriptEngine->setContainmentType((Plasma::Types::ContainmentType)type);
} }
int ContainmentInterface::screen() const 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"); QAction *closeApplet = applet->actions()->action("remove");
//kDebug() << "checking for removal" << closeApplet; //kDebug() << "checking for removal" << closeApplet;
if (closeApplet) { if (closeApplet) {
@ -298,7 +298,7 @@ void ContainmentInterface::addAppletActions(KMenu &desktopMenu, Plasma::Applet *
void ContainmentInterface::addContainmentActions(KMenu &desktopMenu, QEvent *event) 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")) { !KAuthorized::authorizeKAction("plasma/containment_actions")) {
//kDebug() << "immutability"; //kDebug() << "immutability";
return; return;
@ -329,8 +329,8 @@ void ContainmentInterface::addContainmentActions(KMenu &desktopMenu, QEvent *eve
if (actions.isEmpty()) { if (actions.isEmpty()) {
//it probably didn't bother implementing the function. give the user a chance to set //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... //a better plugin. note that if the user sets no-plugin this won't happen...
if ((containment()->containmentType() != Plasma::PanelContainment && if ((containment()->containmentType() != Plasma::Types::PanelContainment &&
containment()->containmentType() != Plasma::CustomPanelContainment) && containment()->containmentType() != Plasma::Types::CustomPanelContainment) &&
containment()->actions()->action("configure")) { containment()->actions()->action("configure")) {
desktopMenu.addAction(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(); emit formFactorChanged();
} }
if (constraints & Plasma::LocationConstraint) { if (constraints & Plasma::Types::LocationConstraint) {
emit locationChanged(); emit locationChanged();
} }
if (constraints & Plasma::ContextConstraint) { if (constraints & Plasma::Types::ContextConstraint) {
emit contextChanged(); emit contextChanged();
} }
} }

View File

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

View File

@ -146,9 +146,9 @@ void DesktopCorona::checkScreen(int screen, bool signalWhenExists)
continue; continue;
} }
Plasma::ContainmentType t = c->containmentType(); Plasma::Types::ContainmentType t = c->containmentType();
if (t == Plasma::PanelContainment || if (t == Plasma::Types::PanelContainment ||
t == Plasma::CustomPanelContainment) { t == Plasma::Types::CustomPanelContainment) {
emit containmentAdded(c); 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(); qDebug() << "Was screen" << wasScreen << "Is screen" << isScreen <<"Containment" << containment << containment->title();
if (containment->formFactor() == Plasma::Horizontal || if (containment->formFactor() == Plasma::Types::Horizontal ||
containment->formFactor() == Plasma::Vertical) { containment->formFactor() == Plasma::Types::Vertical) {
if (isScreen >= 0) { if (isScreen >= 0) {
m_panelViews[containment] = new PanelView(this); m_panelViews[containment] = new PanelView(this);

View File

@ -68,21 +68,21 @@ void PanelConfigView::syncGeometry()
return; return;
} }
if (m_containment->formFactor() == Plasma::Vertical) { if (m_containment->formFactor() == Plasma::Types::Vertical) {
resize(rootObject()->implicitWidth(), screen()->size().height()); 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()); 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()); setPosition(screen()->geometry().right() - width() - m_panelView->thickness(), screen()->geometry().top());
} }
} else { } else {
resize(screen()->size().width(), rootObject()->implicitHeight()); 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()); 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()); 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("offset", m_offset);
config().writeEntry("max", m_maxLength); config().writeEntry("max", m_maxLength);
config().writeEntry("min", m_minLength); config().writeEntry("min", m_minLength);
if (formFactor() == Plasma::Vertical) { if (formFactor() == Plasma::Types::Vertical) {
config().writeEntry("length", size().height()); config().writeEntry("length", size().height());
config().writeEntry("thickness", size().width()); config().writeEntry("thickness", size().width());
} else { } else {
@ -85,8 +85,8 @@ KConfigGroup PanelView::config() const
KConfigGroup views(m_corona->applicationConfig(), "PlasmaViews"); KConfigGroup views(m_corona->applicationConfig(), "PlasmaViews");
views = KConfigGroup(&views, QString("Panel %1").arg(containment()->id())); views = KConfigGroup(&views, QString("Panel %1").arg(containment()->id()));
if (containment()->formFactor() == Plasma::Vertical) { if (containment()->formFactor() == Plasma::Types::Vertical) {
return KConfigGroup(&views, "Vertical" + QString::number(screen()->size().height())); return KConfigGroup(&views, "Types::Vertical" + QString::number(screen()->size().height()));
//treat everything else as horizontal //treat everything else as horizontal
} else { } else {
return KConfigGroup(&views, "Horizontal" + QString::number(screen()->size().width())); return KConfigGroup(&views, "Horizontal" + QString::number(screen()->size().width()));
@ -150,7 +150,7 @@ void PanelView::setThickness(int value)
return; return;
} }
if (formFactor() == Plasma::Vertical) { if (formFactor() == Plasma::Types::Vertical) {
setWidth(value); setWidth(value);
} else { } else {
setHeight(value); setHeight(value);
@ -162,7 +162,7 @@ void PanelView::setThickness(int value)
int PanelView::length() const int PanelView::length() const
{ {
if (formFactor() == Plasma::Vertical) { if (formFactor() == Plasma::Types::Vertical) {
config().readEntry<int>("length", screen()->size().height()); config().readEntry<int>("length", screen()->size().height());
} else { } else {
config().readEntry<int>("length", screen()->size().width()); config().readEntry<int>("length", screen()->size().width());
@ -175,7 +175,7 @@ void PanelView::setLength(int value)
return; return;
} }
if (formFactor() == Plasma::Vertical) { if (formFactor() == Plasma::Types::Vertical) {
setHeight(value); setHeight(value);
} else { } else {
setWidth(value); setWidth(value);
@ -200,7 +200,7 @@ void PanelView::setMaximumLength(int length)
setMinimumLength(length); setMinimumLength(length);
} }
if (formFactor() == Plasma::Vertical) { if (formFactor() == Plasma::Types::Vertical) {
setMaximumHeight(length); setMaximumHeight(length);
} else { } else {
setMaximumWidth(length); setMaximumWidth(length);
@ -227,7 +227,7 @@ void PanelView::setMinimumLength(int length)
setMaximumLength(length); setMaximumLength(length);
} }
if (formFactor() == Plasma::Vertical) { if (formFactor() == Plasma::Types::Vertical) {
setMinimumHeight(length); setMinimumHeight(length);
} else { } else {
setMinimumWidth(length); setMinimumWidth(length);
@ -249,8 +249,8 @@ void PanelView::positionPanel()
const int oldThickness = thickness(); const int oldThickness = thickness();
switch (containment()->location()) { switch (containment()->location()) {
case Plasma::TopEdge: case Plasma::Types::TopEdge:
containment()->setFormFactor(Plasma::Horizontal); containment()->setFormFactor(Plasma::Types::Horizontal);
restore(); restore();
switch (m_alignment) { switch (m_alignment) {
@ -266,8 +266,8 @@ void PanelView::positionPanel()
} }
break; break;
case Plasma::LeftEdge: case Plasma::Types::LeftEdge:
containment()->setFormFactor(Plasma::Vertical); containment()->setFormFactor(Plasma::Types::Vertical);
restore(); restore();
switch (m_alignment) { switch (m_alignment) {
case Qt::AlignCenter: case Qt::AlignCenter:
@ -282,8 +282,8 @@ void PanelView::positionPanel()
} }
break; break;
case Plasma::RightEdge: case Plasma::Types::RightEdge:
containment()->setFormFactor(Plasma::Vertical); containment()->setFormFactor(Plasma::Types::Vertical);
restore(); restore();
switch (m_alignment) { switch (m_alignment) {
case Qt::AlignCenter: case Qt::AlignCenter:
@ -298,9 +298,9 @@ void PanelView::positionPanel()
} }
break; break;
case Plasma::BottomEdge: case Plasma::Types::BottomEdge:
default: default:
containment()->setFormFactor(Plasma::Horizontal); containment()->setFormFactor(Plasma::Types::Horizontal);
restore(); restore();
switch (m_alignment) { switch (m_alignment) {
case Qt::AlignCenter: case Qt::AlignCenter:
@ -340,7 +340,7 @@ void PanelView::restore()
//FIXME: an invalid size doesn't work with QWindows //FIXME: an invalid size doesn't work with QWindows
setMaximumSize(screen()->size()); setMaximumSize(screen()->size());
if (containment()->formFactor() == Plasma::Vertical) { if (containment()->formFactor() == Plasma::Types::Vertical) {
const int maxSize = screen()->size().height() - m_offset; const int maxSize = screen()->size().height() - m_offset;
m_maxLength = qBound<int>(MINSIZE, m_maxLength, maxSize); m_maxLength = qBound<int>(MINSIZE, m_maxLength, maxSize);
m_minLength = qBound<int>(MINSIZE, m_minLength, maxSize); m_minLength = qBound<int>(MINSIZE, m_minLength, maxSize);
@ -371,7 +371,7 @@ void PanelView::restore()
void PanelView::resizeEvent(QResizeEvent *ev) void PanelView::resizeEvent(QResizeEvent *ev)
{ {
if (containment()->formFactor() == Plasma::Vertical) { if (containment()->formFactor() == Plasma::Types::Vertical) {
config().writeEntry("length", ev->size().height()); config().writeEntry("length", ev->size().height());
config().writeEntry("thickness", ev->size().width()); config().writeEntry("thickness", ev->size().width());
if (ev->size().height() != ev->oldSize().height()) { if (ev->size().height() != ev->oldSize().height()) {

View File

@ -144,12 +144,12 @@ int AppInterface::multiheadScreen() const
void AppInterface::lockCorona(bool locked) 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 bool AppInterface::coronaLocked() const
{ {
return m_env->corona()->immutability() != Plasma::Mutable; return m_env->corona()->immutability() != Plasma::Types::Mutable;
} }
void AppInterface::sleep(int ms) void AppInterface::sleep(int ms)

View File

@ -232,7 +232,7 @@ void Applet::setLocked(bool locked)
return; return;
} }
app->setImmutability(locked ? Plasma::UserImmutable : Plasma::Mutable); app->setImmutability(locked ? Plasma::Types::UserImmutable : Plasma::Types::Mutable);
KConfigGroup cg = app->config(); KConfigGroup cg = app->config();
if (!app->isContainment()) { if (!app->isContainment()) {
cg = cg.parent(); cg = cg.parent();
@ -247,10 +247,10 @@ bool Applet::locked() const
{ {
Plasma::Applet *app = applet(); Plasma::Applet *app = applet();
if (!app) { if (!app) {
return Plasma::Mutable; return Plasma::Types::Mutable;
} }
return app->immutability() != Plasma::Mutable; return app->immutability() != Plasma::Types::Mutable;
} }
bool Applet::wallpaperConfigDirty() const bool Applet::wallpaperConfigDirty() const

View File

@ -117,19 +117,19 @@ QString Containment::formFactor() const
} }
switch (d->containment.data()->formFactor()) { switch (d->containment.data()->formFactor()) {
case Plasma::Planar: case Plasma::Types::Planar:
return "planar"; return "planar";
break; break;
case Plasma::MediaCenter: case Plasma::Types::MediaCenter:
return "mediacenter"; return "mediacenter";
break; break;
case Plasma::Horizontal: case Plasma::Types::Horizontal:
return "horizontal"; return "horizontal";
break; break;
case Plasma::Vertical: case Plasma::Types::Vertical:
return "vertical"; return "vertical";
break; break;
case Plasma::Application: case Plasma::Types::Application:
return "application"; return "application";
break; break;
} }

View File

@ -52,25 +52,25 @@ QString Panel::location() const
} }
switch (c->location()) { switch (c->location()) {
case Plasma::Floating: case Plasma::Types::Floating:
return "floating"; return "floating";
break; break;
case Plasma::Desktop: case Plasma::Types::Desktop:
return "desktop"; return "desktop";
break; break;
case Plasma::FullScreen: case Plasma::Types::FullScreen:
return "fullscreen"; return "fullscreen";
break; break;
case Plasma::TopEdge: case Plasma::Types::TopEdge:
return "top"; return "top";
break; break;
case Plasma::BottomEdge: case Plasma::Types::BottomEdge:
return "bottom"; return "bottom";
break; break;
case Plasma::LeftEdge: case Plasma::Types::LeftEdge:
return "left"; return "left";
break; break;
case Plasma::RightEdge: case Plasma::Types::RightEdge:
return "right"; return "right";
break; break;
} }
@ -86,24 +86,24 @@ void Panel::setLocation(const QString &locationString)
} }
const QString lower = locationString.toLower(); const QString lower = locationString.toLower();
Plasma::Location loc = Plasma::Floating; Plasma::Types::Location loc = Plasma::Types::Floating;
Plasma::FormFactor ff = Plasma::Planar; Plasma::Types::FormFactor ff = Plasma::Types::Planar;
if (lower == "desktop") { if (lower == "desktop") {
loc = Plasma::Desktop; loc = Plasma::Types::Desktop;
} else if (lower == "fullscreen") { } else if (lower == "fullscreen") {
loc = Plasma::FullScreen; loc = Plasma::Types::FullScreen;
} else if (lower == "top") { } else if (lower == "top") {
loc = Plasma::TopEdge; loc = Plasma::Types::TopEdge;
ff = Plasma::Horizontal; ff = Plasma::Types::Horizontal;
} else if (lower == "bottom") { } else if (lower == "bottom") {
loc = Plasma::BottomEdge; loc = Plasma::Types::BottomEdge;
ff = Plasma::Horizontal; ff = Plasma::Types::Horizontal;
} else if (lower == "left") { } else if (lower == "left") {
loc = Plasma::LeftEdge; loc = Plasma::Types::LeftEdge;
ff = Plasma::Vertical; ff = Plasma::Types::Vertical;
} else if (lower == "right") { } else if (lower == "right") {
loc = Plasma::RightEdge; loc = Plasma::Types::RightEdge;
ff = Plasma::Vertical; ff = Plasma::Types::Vertical;
} }
c->setLocation(loc); c->setLocation(loc);
@ -199,7 +199,7 @@ void Panel::setOffset(int pixels)
QRectF screen = v->screen()->geometry(); QRectF screen = v->screen()->geometry();
QSizeF size(graphicObject->width(), graphicObject->height()); QSizeF size(graphicObject->width(), graphicObject->height());
if (c->formFactor() == Plasma::Vertical) { if (c->formFactor() == Plasma::Types::Vertical) {
if (pixels > screen.height()) { if (pixels > screen.height()) {
return; return;
} }
@ -234,7 +234,7 @@ int Panel::length() const
return 0; return 0;
} }
if (c->formFactor() == Plasma::Vertical) { if (c->formFactor() == Plasma::Types::Vertical) {
return graphicObject->height(); return graphicObject->height();
} else { } else {
return graphicObject->width(); return graphicObject->width();
@ -259,7 +259,7 @@ void Panel::setLength(int pixels)
QRectF screen = v->screen()->geometry(); QRectF screen = v->screen()->geometry();
QSizeF s(graphicObject->width(), graphicObject->height()); QSizeF s(graphicObject->width(), graphicObject->height());
if (c->formFactor() == Plasma::Vertical) { if (c->formFactor() == Plasma::Types::Vertical) {
if (pixels > screen.height() - v->offset()) { if (pixels > screen.height() - v->offset()) {
return; return;
} }
@ -291,7 +291,7 @@ int Panel::height() const
return 0; return 0;
} }
return c->formFactor() == Plasma::Vertical ? graphicObject->width() return c->formFactor() == Plasma::Types::Vertical ? graphicObject->width()
: graphicObject->height(); : graphicObject->height();
} }
@ -312,10 +312,10 @@ void Panel::setHeight(int height)
if (v) { if (v) {
QRect screen = v->screen()->geometry(); QRect screen = v->screen()->geometry();
QSizeF size(graphicObject->width(), graphicObject->height()); 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); height = qBound(16, height, max);
if (c->formFactor() == Plasma::Vertical) { if (c->formFactor() == Plasma::Types::Vertical) {
size.setWidth(height); size.setWidth(height);
} else { } else {
size.setHeight(height); size.setHeight(height);

View File

@ -142,11 +142,11 @@ QScriptValue ScriptEngine::createContainment(const QString &type, const QString
if (c) { if (c) {
if (type == "Panel") { if (type == "Panel") {
// some defaults // some defaults
c->setFormFactor(Plasma::Horizontal); c->setFormFactor(Plasma::Types::Horizontal);
c->setLocation(Plasma::TopEdge); c->setLocation(Plasma::Types::TopEdge);
c->setScreen(env->defaultPanelScreen()); c->setScreen(env->defaultPanelScreen());
} }
c->updateConstraints(Plasma::AllConstraints | Plasma::StartupCompletedConstraint); c->updateConstraints(Plasma::Types::AllConstraints | Plasma::Types::StartupCompletedConstraint);
c->flushPendingConstraintsEvents(); c->flushPendingConstraintsEvents();
} }
@ -626,8 +626,8 @@ bool ScriptEngine::isPanel(const Plasma::Containment *c)
return false; return false;
} }
return c->containmentType() == Plasma::PanelContainment || return c->containmentType() == Plasma::Types::PanelContainment ||
c->containmentType() == Plasma::CustomPanelContainment; c->containmentType() == Plasma::Types::CustomPanelContainment;
} }
QScriptValue ScriptEngine::activities(QScriptContext *context, QScriptEngine *engine) QScriptValue ScriptEngine::activities(QScriptContext *context, QScriptEngine *engine)

View File

@ -75,8 +75,8 @@ void View::init()
void View::setContainment(Plasma::Containment *cont) void View::setContainment(Plasma::Containment *cont)
{ {
Plasma::Location oldLoc = (Plasma::Location)location(); Plasma::Types::Location oldLoc = (Plasma::Types::Location)location();
Plasma::FormFactor oldForm = formFactor(); Plasma::Types::FormFactor oldForm = formFactor();
if (m_containment) { if (m_containment) {
disconnect(m_containment.data(), 0, this, 0); disconnect(m_containment.data(), 0, this, 0);
@ -90,7 +90,7 @@ void View::setContainment(Plasma::Containment *cont)
m_containment = cont; m_containment = cont;
if (oldLoc != location()) { if (oldLoc != location()) {
emit locationChanged((Plasma::Location)location()); emit locationChanged((Plasma::Types::Location)location());
} }
if (oldForm != formFactor()) { if (oldForm != formFactor()) {
emit formFactorChanged(formFactor()); emit formFactorChanged(formFactor());
@ -116,8 +116,8 @@ void View::setContainment(Plasma::Containment *cont)
//graphicObject->setProperty("visible", false); //graphicObject->setProperty("visible", false);
graphicObject->setProperty("drawWallpaper", graphicObject->setProperty("drawWallpaper",
(cont->containmentType() == Plasma::DesktopContainment || (cont->containmentType() == Plasma::Types::DesktopContainment ||
cont->containmentType() == Plasma::CustomContainment)); cont->containmentType() == Plasma::Types::CustomContainment));
graphicObject->setProperty("parent", QVariant::fromValue(rootObject())); graphicObject->setProperty("parent", QVariant::fromValue(rootObject()));
rootObject()->setProperty("containment", QVariant::fromValue(graphicObject)); rootObject()->setProperty("containment", QVariant::fromValue(graphicObject));
} else { } else {
@ -133,22 +133,22 @@ Plasma::Containment *View::containment() const
//FIXME: wrong types //FIXME: wrong types
void View::setLocation(int location) void View::setLocation(int location)
{ {
m_containment.data()->setLocation((Plasma::Location)location); m_containment.data()->setLocation((Plasma::Types::Location)location);
} }
//FIXME: wrong types //FIXME: wrong types
int View::location() const int View::location() const
{ {
if (!m_containment) { if (!m_containment) {
return Plasma::Desktop; return Plasma::Types::Desktop;
} }
return m_containment.data()->location(); return m_containment.data()->location();
} }
Plasma::FormFactor View::formFactor() const Plasma::Types::FormFactor View::formFactor() const
{ {
if (!m_containment) { if (!m_containment) {
return Plasma::Planar; return Plasma::Types::Planar;
} }
return m_containment.data()->formFactor(); return m_containment.data()->formFactor();
} }

View File

@ -47,11 +47,11 @@ public:
void setContainment(Plasma::Containment *cont); void setContainment(Plasma::Containment *cont);
Plasma::Containment *containment() const; 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; int location() const;
void setLocation(int location); void setLocation(int location);
Plasma::FormFactor formFactor() const; Plasma::Types::FormFactor formFactor() const;
QRectF screenGeometry(); QRectF screenGeometry();
@ -59,8 +59,8 @@ protected Q_SLOTS:
void showConfigurationInterface(Plasma::Applet *applet); void showConfigurationInterface(Plasma::Applet *applet);
Q_SIGNALS: Q_SIGNALS:
void locationChanged(Plasma::Location location); void locationChanged(Plasma::Types::Location location);
void formFactorChanged(Plasma::FormFactor formFactor); void formFactorChanged(Plasma::Types::FormFactor formFactor);
void containmentChanged(); void containmentChanged();
void screenGeometryChanged(); void screenGeometryChanged();

View File

@ -60,10 +60,10 @@ public:
} }
void initFilters(); void initFilters();
void init(Plasma::Location loc); void init(Plasma::Types::Location loc);
void initRunningApplets(); void initRunningApplets();
void containmentDestroyed(); void containmentDestroyed();
void setLocation(Plasma::Location loc); void setLocation(Plasma::Types::Location loc);
void finished(); void finished();
/** /**
@ -78,7 +78,7 @@ public:
//this orientation is just for convenience, is the location that is important //this orientation is just for convenience, is the location that is important
Qt::Orientation orientation; Qt::Orientation orientation;
Plasma::Location location; Plasma::Types::Location location;
WidgetExplorer *q; WidgetExplorer *q;
QString application; QString application;
Plasma::Containment *containment; 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); // q->setFocusPolicy(Qt::StrongFocus);
//init widgets //init widgets
location = loc; 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 = new QGraphicsLinearLayout(Qt::Vertical);
// mainLayout->setContentsMargins(0, 0, 0, 0); // mainLayout->setContentsMargins(0, 0, 0, 0);
// mainLayout->setSpacing(0); // mainLayout->setSpacing(0);
@ -211,10 +211,10 @@ void WidgetExplorerPrivate::finished()
declarativeWidget->rootObject()->setProperty("extraActions", QVariant::fromValue(actionList));*/ 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; Qt::Orientation orient;
if (loc == Plasma::LeftEdge || loc == Plasma::RightEdge) { if (loc == Plasma::Types::LeftEdge || loc == Plasma::Types::RightEdge) {
orient = Qt::Vertical; orient = Qt::Vertical;
} else { } else {
orient = Qt::Horizontal; orient = Qt::Horizontal;
@ -364,7 +364,7 @@ void WidgetExplorerPrivate::appletRemoved(Plasma::Applet *applet)
//WidgetExplorer //WidgetExplorer
WidgetExplorer::WidgetExplorer(Plasma::Location loc, QObject *parent) WidgetExplorer::WidgetExplorer(Plasma::Types::Location loc, QObject *parent)
:QObject(parent), :QObject(parent),
d(new WidgetExplorerPrivate(this)) d(new WidgetExplorerPrivate(this))
{ {
@ -375,7 +375,7 @@ WidgetExplorer::WidgetExplorer(QObject *parent)
:QObject(parent), :QObject(parent),
d(new WidgetExplorerPrivate(this)) d(new WidgetExplorerPrivate(this))
{ {
d->init(Plasma::LeftEdge); d->init(Plasma::Types::LeftEdge);
} }
WidgetExplorer::~WidgetExplorer() WidgetExplorer::~WidgetExplorer()
@ -383,7 +383,7 @@ WidgetExplorer::~WidgetExplorer()
delete d; delete d;
} }
void WidgetExplorer::setLocation(Plasma::Location loc) void WidgetExplorer::setLocation(Plasma::Types::Location loc)
{ {
d->setLocation(loc); d->setLocation(loc);
emit(locationChanged(loc)); emit(locationChanged(loc));
@ -425,7 +425,7 @@ void WidgetExplorer::setContainment(Plasma::Containment *containment)
if (d->containment) { if (d->containment) {
connect(d->containment, SIGNAL(destroyed(QObject*)), this, SLOT(containmentDestroyed())); 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()); 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(); emit closeClicked();
} }
} }
@ -639,7 +639,7 @@ QPoint WidgetExplorer::tooltipPosition(QGraphicsObject *item, int tipWidth, int
item->boundingRect().size().toSize()); item->boundingRect().size().toSize());
QPoint pos; QPoint pos;
switch (d->location) { switch (d->location) {
case Plasma::LeftEdge: case Plasma::Types::LeftEdge:
pos.setX(itemRect.right()); pos.setX(itemRect.right());
pos.setY(itemRect.top() + (itemRect.height() - tipHeight) / 2); pos.setY(itemRect.top() + (itemRect.height() - tipHeight) / 2);
break; break;
@ -647,7 +647,7 @@ QPoint WidgetExplorer::tooltipPosition(QGraphicsObject *item, int tipWidth, int
pos.setX(itemRect.left() + (itemRect.width() - tipWidth) / 2); pos.setX(itemRect.left() + (itemRect.width() - tipWidth) / 2);
pos.setY(itemRect.bottom()); pos.setY(itemRect.bottom());
break; break;
case Plasma::RightEdge: case Plasma::Types::RightEdge:
pos.setX(itemRect.left() - tipWidth); pos.setX(itemRect.left() - tipWidth);
pos.setY(itemRect.top() + (itemRect.height() - tipHeight) / 2); pos.setY(itemRect.top() + (itemRect.height() - tipHeight) / 2);
break; break;

View File

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