diff --git a/src/plasma/corona.cpp b/src/plasma/corona.cpp index f9a3f9c76..f72dfd5c2 100644 --- a/src/plasma/corona.cpp +++ b/src/plasma/corona.cpp @@ -73,6 +73,7 @@ Plasma::Package Corona::package() const void Corona::setPackage(const Plasma::Package &package) { d->package = package; + emit packageChanged(package); } void Corona::saveLayout(const QString &configName) const diff --git a/src/plasma/corona.h b/src/plasma/corona.h index 7176c1b9f..927d801d3 100644 --- a/src/plasma/corona.h +++ b/src/plasma/corona.h @@ -235,6 +235,14 @@ Q_SIGNALS: */ void immutabilityChanged(Plasma::Types::ImmutabilityType immutability); + /** + * Emitted when the package for this corona has been changed. + * Shells must support changing the shell package on the fly (for instance due to device form factor changing) + * + * @param package the new package that defines the Corona furniture and behavior + */ + void packageChanged(const Plasma::Package &package); + protected: /** * Loads the default (system wide) layout for this user diff --git a/src/shell/view.cpp b/src/shell/view.cpp index df3d6a16d..6e9c6c766 100644 --- a/src/shell/view.cpp +++ b/src/shell/view.cpp @@ -52,6 +52,8 @@ View::View(Plasma::Corona *corona, QWindow *parent) setResizeMode(View::SizeRootObjectToView); setSource(QUrl::fromLocalFile(m_corona->package().filePath("views", "Desktop.qml"))); + connect(m_corona, &Plasma::Corona::packageChanged, + this, &View::coronaPackageChanged); } View::~View() @@ -188,4 +190,10 @@ void View::showConfigurationInterface(Plasma::Applet *applet) m_configView.data()->show(); } +void View::coronaPackageChanged(const Plasma::Package &package) +{ + setContainment(0); + setSource(QUrl::fromLocalFile(package.filePath("views", "Desktop.qml"))); +} + #include "moc_view.cpp" diff --git a/src/shell/view.h b/src/shell/view.h index 7e6b2d969..af708e2f0 100644 --- a/src/shell/view.h +++ b/src/shell/view.h @@ -55,6 +55,9 @@ public: protected Q_SLOTS: void showConfigurationInterface(Plasma::Applet *applet); +private Q_SLOTS: + void coronaPackageChanged(const Plasma::Package &package); + Q_SIGNALS: void locationChanged(Plasma::Types::Location location); void formFactorChanged(Plasma::Types::FormFactor formFactor);