manage the case a containment behaves as an applet

however loading mechanism should be changed to make applets in containments always be an Applet*
This commit is contained in:
Marco Martin 2013-03-21 19:05:53 +01:00
parent b8b3c0a89c
commit 395dc9b381
5 changed files with 11 additions and 5 deletions

View File

@ -262,8 +262,6 @@ Applet *ContainmentPrivate::createApplet(const QString &name, const QVariantList
applet->setLaunchErrorMessage(i18n("Could not find requested component: %1", name));
}
//kDebug() << applet->title() << "sizehint:" << applet->sizeHint() << "geometry:" << applet->geometry();
q->addApplet(applet);
return applet;
}

View File

@ -138,7 +138,7 @@ void AppletInterface::init()
//Create the ToolBox
Plasma::Containment *pc = qobject_cast<Plasma::Containment *>(applet());
if (pc) {
if (pc && !qobject_cast<Plasma::Applet *>(pc->parent())) {
KConfigGroup defaults;
if (pc->containmentType() == Plasma::DesktopContainment) {
defaults = KConfigGroup(KSharedConfig::openConfig(pc->corona()->package().filePath("defaults")), "Desktop");

View File

@ -233,10 +233,10 @@ Q_SIGNALS:
//it's important those slots are private because must not be invokable by qml
private Q_SLOTS:
void init();
void configureTriggered();
protected:
virtual void init();
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
void itemChange(ItemChange change, const ItemChangeData &value);
void setConfigurationInterfaceShown(bool show);

View File

@ -46,6 +46,13 @@ ContainmentInterface::ContainmentInterface(DeclarativeAppletScript *parent)
qmlRegisterType<ContainmentInterface>();
}
void ContainmentInterface::init()
{
AppletInterface::init();
connect(containment(), &Plasma::Containment::appletRemoved,
this, &ContainmentInterface::appletRemovedForward);
connect(containment(), &Plasma::Containment::appletAdded,

View File

@ -51,7 +51,7 @@ public:
};
ContainmentInterface(DeclarativeAppletScript *parent);
//Not for QML
inline Plasma::Containment *containment() const { return static_cast<Plasma::Containment *>(m_appletScriptEngine->applet()); }
inline Plasma::Containment *containment() const { return static_cast<Plasma::Containment *>(m_appletScriptEngine->applet()->containment()); }
inline WallpaperInterface *wallpaperInterface() const { return m_wallpaperInterface;}
@ -70,6 +70,7 @@ public:
Q_INVOKABLE QVariantList availableScreenRegion(int id) const;
protected:
void init();
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);