corona has a package() property
This commit is contained in:
parent
abcee7e0a3
commit
c9d9ccc857
@ -219,7 +219,7 @@ class PLASMA_EXPORT Applet : public QObject
|
||||
* Accessor for the associated Package object if any.
|
||||
* Generally, only Plasmoids come in a Package.
|
||||
*
|
||||
* @return the Package object, or 0 if none
|
||||
* @return the Package object, or an invalid one if none
|
||||
**/
|
||||
Package package() const;
|
||||
|
||||
|
@ -72,6 +72,11 @@ Corona::~Corona()
|
||||
delete d;
|
||||
}
|
||||
|
||||
Plasma::Package Corona::package() const
|
||||
{
|
||||
return d->package;
|
||||
}
|
||||
|
||||
void Corona::setAppletMimeType(const QString &type)
|
||||
{
|
||||
d->mimetype = type;
|
||||
@ -438,6 +443,10 @@ CoronaPrivate::CoronaPrivate(Corona *corona)
|
||||
configSyncTimer(new QTimer(corona)),
|
||||
actions(corona)
|
||||
{
|
||||
//TODO: make Package path configurable
|
||||
package = Plasma::PluginLoader::self()->loadPackage("Plasma/Generic");
|
||||
package.setPath("org.kde.homescreen.desktop");
|
||||
|
||||
if (QCoreApplication::instance()) {
|
||||
configName = QCoreApplication::instance()->applicationName() + "-appletsrc";
|
||||
} else {
|
||||
|
@ -50,6 +50,18 @@ public:
|
||||
explicit Corona(QObject * parent = 0);
|
||||
~Corona();
|
||||
|
||||
/**
|
||||
* Accessor for the associated Package object if any.
|
||||
* A Corona package defines how Containments are laid out in a View,
|
||||
* ToolBoxes, default layout, error messages
|
||||
* and in genelal all the furniture specific of a particular
|
||||
* device form factor.
|
||||
*
|
||||
* @return the Package object, or an invalid one if none
|
||||
* @since 5.0
|
||||
**/
|
||||
Plasma::Package package() const;
|
||||
|
||||
/**
|
||||
* Sets the mimetype of Drag/Drop items. Default is
|
||||
* text/x-plasmoidservicename
|
||||
|
@ -24,6 +24,8 @@
|
||||
|
||||
#include <kactioncollection.h>
|
||||
|
||||
#include "package.h"
|
||||
|
||||
class KShortcutsDialog;
|
||||
class QGraphicsWidget;
|
||||
|
||||
@ -52,6 +54,7 @@ public:
|
||||
static bool s_positioningContainments;
|
||||
|
||||
Corona *q;
|
||||
Package package;
|
||||
ImmutabilityType immutability;
|
||||
QString mimetype;
|
||||
QString configName;
|
||||
|
@ -176,7 +176,7 @@ void DesktopCorona::checkViews()
|
||||
return;
|
||||
} else if (m_views.count() < m_desktopWidget->screenCount()) {
|
||||
for (int i = m_views.count(); i < m_desktopWidget->screenCount(); ++i) {
|
||||
View *view = new View;
|
||||
View *view = new View(this);
|
||||
|
||||
m_views << view;
|
||||
}
|
||||
|
@ -24,18 +24,16 @@
|
||||
#include <QTimer>
|
||||
#include "plasma/pluginloader.h"
|
||||
|
||||
View::View(QWindow *parent)
|
||||
: QQuickView(parent)
|
||||
View::View(Plasma::Corona *corona, QWindow *parent)
|
||||
: QQuickView(parent),
|
||||
m_corona(corona)
|
||||
{
|
||||
m_package = Plasma::PluginLoader::self()->loadPackage("Plasma/Generic");
|
||||
m_package.setPath("org.kde.homescreen.desktop");
|
||||
|
||||
if (!m_package.isValid()) {
|
||||
if (!m_corona->package().isValid()) {
|
||||
qWarning() << "Invalid home screen package";
|
||||
}
|
||||
|
||||
setResizeMode(View::SizeRootObjectToView);
|
||||
setSource(QUrl::fromLocalFile(m_package.filePath("mainscript")));
|
||||
setSource(QUrl::fromLocalFile(m_corona->package().filePath("mainscript")));
|
||||
show();
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <QtQuick/QQuickView>
|
||||
|
||||
|
||||
#include "plasma/package.h"
|
||||
#include "plasma/corona.h"
|
||||
#include "plasma/containment.h"
|
||||
|
||||
|
||||
@ -31,14 +31,14 @@ class View : public QQuickView
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
View(QWindow *parent = 0);
|
||||
View(Plasma::Corona *corona, QWindow *parent = 0);
|
||||
virtual ~View();
|
||||
|
||||
void setContainment(Plasma::Containment *cont);
|
||||
Plasma::Containment *containment() const;
|
||||
|
||||
private:
|
||||
Plasma::Package m_package;
|
||||
Plasma::Corona *m_corona;
|
||||
QWeakPointer<Plasma::Containment> m_containment;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user