Changeset View
Changeset View
Standalone View
Standalone View
src/scriptengines/qml/plasmoid/containmentinterface.cpp
Show First 20 Lines • Show All 815 Lines • ▼ Show 20 Line(s) | 813 | { | |||
---|---|---|---|---|---|
816 | } | 816 | } | ||
817 | 817 | | |||
818 | AppletInterface *appletGraphicObject = applet->property("_plasma_graphicObject").value<AppletInterface *>(); | 818 | AppletInterface *appletGraphicObject = applet->property("_plasma_graphicObject").value<AppletInterface *>(); | ||
819 | AppletInterface *contGraphicObject = m_containment->property("_plasma_graphicObject").value<AppletInterface *>(); | 819 | AppletInterface *contGraphicObject = m_containment->property("_plasma_graphicObject").value<AppletInterface *>(); | ||
820 | 820 | | |||
821 | // qDebug() << "Applet added on containment:" << m_containment->title() << contGraphicObject | 821 | // qDebug() << "Applet added on containment:" << m_containment->title() << contGraphicObject | ||
822 | // << "Applet: " << applet << applet->title() << appletGraphicObject; | 822 | // << "Applet: " << applet << applet->title() << appletGraphicObject; | ||
823 | 823 | | |||
824 | //Every applet should have a graphics object, otherwise don't disaplay anything | 824 | //applets can not have a graphic object if they don't have a script engine loaded | ||
825 | //this can happen if they were loaded with an invalid metadata | ||||
825 | if (!appletGraphicObject) { | 826 | if (!appletGraphicObject) { | ||
826 | return; | 827 | return; | ||
827 | } | 828 | } | ||
828 | 829 | | |||
829 | if (contGraphicObject) { | 830 | if (contGraphicObject) { | ||
830 | appletGraphicObject->setProperty("visible", false); | 831 | appletGraphicObject->setProperty("visible", false); | ||
831 | appletGraphicObject->setProperty("parent", QVariant::fromValue(contGraphicObject)); | 832 | appletGraphicObject->setProperty("parent", QVariant::fromValue(contGraphicObject)); | ||
832 | } | 833 | } | ||
833 | 834 | | |||
834 | m_appletInterfaces << appletGraphicObject; | 835 | m_appletInterfaces << appletGraphicObject; | ||
835 | connect(appletGraphicObject, &QObject::destroyed, this, | 836 | connect(appletGraphicObject, &QObject::destroyed, this, | ||
836 | [this](QObject *obj) { | 837 | [this](QObject *obj) { | ||
837 | m_appletInterfaces.removeAll(obj); | 838 | m_appletInterfaces.removeAll(obj); | ||
838 | }); | 839 | }); | ||
839 | emit appletAdded(appletGraphicObject, appletGraphicObject->m_positionBeforeRemoval.x(), appletGraphicObject->m_positionBeforeRemoval.y()); | 840 | emit appletAdded(appletGraphicObject, appletGraphicObject->m_positionBeforeRemoval.x(), appletGraphicObject->m_positionBeforeRemoval.y()); | ||
840 | emit appletsChanged(); | 841 | emit appletsChanged(); | ||
841 | } | 842 | } | ||
842 | 843 | | |||
843 | void ContainmentInterface::appletRemovedForward(Plasma::Applet *applet) | 844 | void ContainmentInterface::appletRemovedForward(Plasma::Applet *applet) | ||
844 | { | 845 | { | ||
845 | AppletInterface *appletGraphicObject = applet->property("_plasma_graphicObject").value<AppletInterface *>(); | 846 | AppletInterface *appletGraphicObject = applet->property("_plasma_graphicObject").value<AppletInterface *>(); | ||
847 | if (appletGraphicObject) { | ||||
846 | m_appletInterfaces.removeAll(appletGraphicObject); | 848 | m_appletInterfaces.removeAll(appletGraphicObject); | ||
847 | appletGraphicObject->m_positionBeforeRemoval = appletGraphicObject->mapToItem(this, QPointF()); | 849 | appletGraphicObject->m_positionBeforeRemoval = appletGraphicObject->mapToItem(this, QPointF()); | ||
850 | } | ||||
848 | emit appletRemoved(appletGraphicObject); | 851 | emit appletRemoved(appletGraphicObject); | ||
849 | emit appletsChanged(); | 852 | emit appletsChanged(); | ||
850 | } | 853 | } | ||
851 | 854 | | |||
852 | void ContainmentInterface::loadWallpaper() | 855 | void ContainmentInterface::loadWallpaper() | ||
853 | { | 856 | { | ||
854 | if (m_containment->containmentType() != Plasma::Types::DesktopContainment && | 857 | if (m_containment->containmentType() != Plasma::Types::DesktopContainment && | ||
855 | m_containment->containmentType() != Plasma::Types::CustomContainment) { | 858 | m_containment->containmentType() != Plasma::Types::CustomContainment) { | ||
▲ Show 20 Lines • Show All 333 Lines • Show Last 20 Lines |