From 55d973385e9510e3893155c3cf46f059d166e3a9 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Tue, 3 Sep 2013 15:44:13 +0200 Subject: [PATCH] convert location to Plasma::Types::Location --- src/shell/panelconfigview.h | 2 -- .../desktop/contents/configuration/PanelConfiguration.qml | 2 +- .../configuration/panelconfiguration/EdgeHandle.qml | 4 +++- src/shell/qmlpackages/desktop/contents/views/Panel.qml | 3 +++ src/shell/view.cpp | 8 +++----- src/shell/view.h | 7 +++---- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/shell/panelconfigview.h b/src/shell/panelconfigview.h index df6b797a7..6ed60c426 100644 --- a/src/shell/panelconfigview.h +++ b/src/shell/panelconfigview.h @@ -36,8 +36,6 @@ namespace Plasma { class Containment; } -//TODO: this should be a subclass of ConfigView currently in the scriptengine -//TODO: that class should be moved here class PanelConfigView : public ConfigView { Q_OBJECT diff --git a/src/shell/qmlpackages/desktop/contents/configuration/PanelConfiguration.qml b/src/shell/qmlpackages/desktop/contents/configuration/PanelConfiguration.qml index edfc5c3dc..c739532b9 100644 --- a/src/shell/qmlpackages/desktop/contents/configuration/PanelConfiguration.qml +++ b/src/shell/qmlpackages/desktop/contents/configuration/PanelConfiguration.qml @@ -106,11 +106,11 @@ PlasmaCore.FrameSvgItem { } duration: 150 } + NumberAnimation { target: configDialog properties: (panel.location == 5 || panel.location == 6) ? "x" : "y" to: { - panel.height switch (panel.location) { //TopEdge case 3: diff --git a/src/shell/qmlpackages/desktop/contents/configuration/panelconfiguration/EdgeHandle.qml b/src/shell/qmlpackages/desktop/contents/configuration/panelconfiguration/EdgeHandle.qml index 868e62555..14db7e479 100644 --- a/src/shell/qmlpackages/desktop/contents/configuration/panelconfiguration/EdgeHandle.qml +++ b/src/shell/qmlpackages/desktop/contents/configuration/panelconfiguration/EdgeHandle.qml @@ -107,6 +107,8 @@ PlasmaComponents.ToolButton { panel.location = newLocation print("New Location: " + newLocation); } - onReleased: panelResetAnimation.running = true + onReleased: { + panelResetAnimation.running = true + } } } diff --git a/src/shell/qmlpackages/desktop/contents/views/Panel.qml b/src/shell/qmlpackages/desktop/contents/views/Panel.qml index f57327829..c5da6c950 100644 --- a/src/shell/qmlpackages/desktop/contents/views/Panel.qml +++ b/src/shell/qmlpackages/desktop/contents/views/Panel.qml @@ -31,6 +31,9 @@ PlasmaCore.FrameSvgItem { property Item containment function adjustBorders() { + if (!containment) { + return; + } var borders = PlasmaCore.FrameSvg.AllBorders; switch (containment.location) { diff --git a/src/shell/view.cpp b/src/shell/view.cpp index 6e9c6c766..7e2f15bf5 100644 --- a/src/shell/view.cpp +++ b/src/shell/view.cpp @@ -136,14 +136,12 @@ Plasma::Containment *View::containment() const return m_containment.data(); } -//FIXME: wrong types -void View::setLocation(int location) +void View::setLocation(Plasma::Types::Location location) { - m_containment.data()->setLocation((Plasma::Types::Location)location); + m_containment.data()->setLocation(location); } -//FIXME: wrong types -int View::location() const +Plasma::Types::Location View::location() const { if (!m_containment) { return Plasma::Types::Desktop; diff --git a/src/shell/view.h b/src/shell/view.h index af708e2f0..91174d95b 100644 --- a/src/shell/view.h +++ b/src/shell/view.h @@ -30,7 +30,7 @@ class View : public QQuickView { Q_OBJECT - Q_PROPERTY(int location READ location WRITE setLocation NOTIFY locationChanged) + Q_PROPERTY(Plasma::Types::Location location READ location WRITE setLocation NOTIFY locationChanged) Q_PROPERTY(QRectF screenGeometry READ screenGeometry NOTIFY screenGeometryChanged) public: @@ -44,9 +44,8 @@ public: void setContainment(Plasma::Containment *cont); Plasma::Containment *containment() const; - //FIXME: Plasma::Types::Location should be something qml can understand - int location() const; - void setLocation(int location); + Plasma::Types::Location location() const; + void setLocation(Plasma::Types::Location location); Plasma::Types::FormFactor formFactor() const;