From f8b649fba9eb3a341d461d0c55ce9d41005b0277 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Wed, 5 Feb 2014 17:23:52 +0100 Subject: [PATCH] move AppletQuickItem in libplasmaquick --- src/plasmaquick/CMakeLists.txt | 2 ++ .../plasmoid => plasmaquick}/appletquickitem.cpp | 11 +++++++++++ .../plasmoid => plasmaquick}/appletquickitem.h | 16 ++++------------ .../private}/appletquickitem_p.h | 0 src/scriptengines/qml/CMakeLists.txt | 1 - src/scriptengines/qml/plasmoid/appletinterface.h | 2 +- 6 files changed, 18 insertions(+), 14 deletions(-) rename src/{scriptengines/qml/plasmoid => plasmaquick}/appletquickitem.cpp (97%) rename src/{scriptengines/qml/plasmoid => plasmaquick}/appletquickitem.h (90%) rename src/{scriptengines/qml/plasmoid => plasmaquick/private}/appletquickitem_p.h (100%) diff --git a/src/plasmaquick/CMakeLists.txt b/src/plasmaquick/CMakeLists.txt index 45260693e..03251bc07 100644 --- a/src/plasmaquick/CMakeLists.txt +++ b/src/plasmaquick/CMakeLists.txt @@ -1,6 +1,7 @@ project(PlasmaQuick) set(plasmaquick_LIB_SRC + appletquickitem.cpp plasmaquickview.cpp configmodel.cpp configview.cpp @@ -36,6 +37,7 @@ generate_export_header(KF5PlasmaQuick BASE_NAME PlasmaQuick) set(plasmaquick_LIB_INCLUDES ${CMAKE_CURRENT_BINARY_DIR}/plasmaquick_export.h + appletquickitem.h plasmaquickview.h configview.h configmodel.h diff --git a/src/scriptengines/qml/plasmoid/appletquickitem.cpp b/src/plasmaquick/appletquickitem.cpp similarity index 97% rename from src/scriptengines/qml/plasmoid/appletquickitem.cpp rename to src/plasmaquick/appletquickitem.cpp index 70e3ab64a..f6027730b 100644 --- a/src/scriptengines/qml/plasmoid/appletquickitem.cpp +++ b/src/plasmaquick/appletquickitem.cpp @@ -397,6 +397,17 @@ AppletQuickItem::~AppletQuickItem() AppletQuickItemPrivate::s_rootObjects.remove(d->qmlObject->engine()); } + AppletQuickItem *AppletQuickItem::qmlAttachedProperties(QObject *object) +{ + //at the moment of the attached object creation, the root item is the only one that hasn't a parent + //only way to avoid creation of this attached for everybody but the root item + if (!object->parent() && AppletQuickItemPrivate::s_rootObjects.contains(QtQml::qmlEngine(object))) { + return AppletQuickItemPrivate::s_rootObjects.value(QtQml::qmlEngine(object)); + } else { + return 0; + } +} + Plasma::Applet *AppletQuickItem::applet() const { return d->applet; diff --git a/src/scriptengines/qml/plasmoid/appletquickitem.h b/src/plasmaquick/appletquickitem.h similarity index 90% rename from src/scriptengines/qml/plasmoid/appletquickitem.h rename to src/plasmaquick/appletquickitem.h index ffd4ad051..0f4ace061 100644 --- a/src/scriptengines/qml/plasmoid/appletquickitem.h +++ b/src/plasmaquick/appletquickitem.h @@ -28,8 +28,9 @@ #include -#include "appletquickitem_p.h" +#include "private/appletquickitem_p.h" +#include namespace Plasma { class Applet; @@ -40,7 +41,7 @@ namespace KDeclarative { } -class AppletQuickItem : public QQuickItem +class PLASMAQUICK_EXPORT AppletQuickItem : public QQuickItem { Q_OBJECT @@ -105,16 +106,7 @@ public: void setExpanded(bool expanded); ////NEEDED BY QML TO CREATE ATTACHED PROPERTIES - static AppletQuickItem *qmlAttachedProperties(QObject *object) - { - //at the moment of the attached object creation, the root item is the only one that hasn't a parent - //only way to avoid creation of this attached for everybody but the root item - if (!object->parent() && AppletQuickItemPrivate::s_rootObjects.contains(QtQml::qmlEngine(object))) { - return AppletQuickItemPrivate::s_rootObjects.value(QtQml::qmlEngine(object)); - } else { - return 0; - } - } + static AppletQuickItem *qmlAttachedProperties(QObject *object); Q_SIGNALS: diff --git a/src/scriptengines/qml/plasmoid/appletquickitem_p.h b/src/plasmaquick/private/appletquickitem_p.h similarity index 100% rename from src/scriptengines/qml/plasmoid/appletquickitem_p.h rename to src/plasmaquick/private/appletquickitem_p.h diff --git a/src/scriptengines/qml/CMakeLists.txt b/src/scriptengines/qml/CMakeLists.txt index 150e4ab6d..b5497b377 100644 --- a/src/scriptengines/qml/CMakeLists.txt +++ b/src/scriptengines/qml/CMakeLists.txt @@ -10,7 +10,6 @@ endif() set(declarative_appletscript_SRCS plasmoid/declarativeappletscript.cpp - plasmoid/appletquickitem.cpp plasmoid/appletinterface.cpp plasmoid/containmentinterface.cpp plasmoid/declarativeappletscript.cpp diff --git a/src/scriptengines/qml/plasmoid/appletinterface.h b/src/scriptengines/qml/plasmoid/appletinterface.h index 92fbd60e0..7c0c3cd7c 100644 --- a/src/scriptengines/qml/plasmoid/appletinterface.h +++ b/src/scriptengines/qml/plasmoid/appletinterface.h @@ -29,7 +29,7 @@ #include #include -#include "appletquickitem.h" +#include #include "declarativeappletscript.h" class QAction;