Corona::packageChanged() signal

views listen to it to know when to reload theirview qml file
This commit is contained in:
Marco Martin 2013-09-02 21:06:35 +02:00
parent 29042ed585
commit de6d0f12d0
4 changed files with 20 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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);