get default containments and toolbox from package
This commit is contained in:
parent
9e2240bd8c
commit
3dee256411
@ -137,8 +137,15 @@ void AppletInterface::init()
|
||||
//Create the ToolBox
|
||||
Plasma::Containment *pc = qobject_cast<Plasma::Containment *>(applet());
|
||||
if (pc) {
|
||||
KConfigGroup defaults;
|
||||
if (pc->containmentType() == Plasma::DesktopContainment) {
|
||||
defaults = KConfigGroup(KSharedConfig::openConfig(pc->corona()->package().filePath("defaults")), "Desktop");
|
||||
} else if (pc->containmentType() == Plasma::PanelContainment) {
|
||||
defaults = KConfigGroup(KSharedConfig::openConfig(pc->corona()->package().filePath("defaults")), "Panel");
|
||||
}
|
||||
|
||||
Plasma::Package pkg = Plasma::PluginLoader::self()->loadPackage("Plasma/Generic");
|
||||
pkg.setPath("org.kde.toolbox");
|
||||
pkg.setPath(defaults.readEntry("ToolBox", "org.kde.toolbox"));
|
||||
|
||||
if (pkg.isValid()) {
|
||||
QObject *toolBoxObject = m_qmlObject->createObjectFromSource(QUrl::fromLocalFile(pkg.filePath("mainscript")));
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include <QDesktopWidget>
|
||||
#include <Plasma/Package>
|
||||
|
||||
#include "panelview.h"
|
||||
#include "view.h"
|
||||
@ -33,6 +34,8 @@ DesktopCorona::DesktopCorona(QObject *parent)
|
||||
: Plasma::Corona(parent),
|
||||
m_desktopWidget(QApplication::desktop())
|
||||
{
|
||||
m_desktopDefaultsConfig = KConfigGroup(KSharedConfig::openConfig(package().filePath("defaults")), "Desktop");
|
||||
|
||||
connect(m_desktopWidget, SIGNAL(resized(int)),
|
||||
this, SLOT(screenResized(int)));
|
||||
connect(m_desktopWidget, SIGNAL(screenCountChanged(int)),
|
||||
@ -53,6 +56,7 @@ DesktopCorona::~DesktopCorona()
|
||||
|
||||
void DesktopCorona::loadDefaultLayout()
|
||||
{
|
||||
//TODO: use Javascript here
|
||||
Plasma::Containment *cont = createContainment("org.kde.testcontainment");
|
||||
cont->setScreen(0);
|
||||
qDebug() << containmentForScreen(0);
|
||||
@ -118,7 +122,7 @@ void DesktopCorona::checkDesktop(/*Activity *activity,*/ bool signalWhenExists,
|
||||
|
||||
//TODO: remove following when activities are restored
|
||||
if (!c) {
|
||||
c = createContainment("desktop");
|
||||
c = createContainment(m_desktopDefaultsConfig.readEntry("Containment", "org.kde.testcontainment"));
|
||||
}
|
||||
|
||||
if (!c) {
|
||||
|
@ -76,6 +76,7 @@ private:
|
||||
QDesktopWidget *m_desktopWidget;
|
||||
QList <View *> m_views;
|
||||
QHash<Plasma::Containment *, PanelView *> m_panelViews;
|
||||
KConfigGroup m_desktopDefaultsConfig;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
15
src/shell/qmlpackages/desktop/contents/defaults
Normal file
15
src/shell/qmlpackages/desktop/contents/defaults
Normal file
@ -0,0 +1,15 @@
|
||||
[Desktop]
|
||||
Containment=org.kde.desktop
|
||||
ToolBox=org.kde.toolbox
|
||||
[Desktop][ContainmentActions]
|
||||
Ctrl;LeftButton=org.kde.standardmenu
|
||||
MiddleButton=org.kde.paste
|
||||
|
||||
[Panel]
|
||||
Containment=org.kde.panel
|
||||
ToolBox=org.kde.toolbox
|
||||
[Panel][ContainmentActions]
|
||||
Ctrl;LeftButton=org.kde.standardmenu
|
||||
|
||||
[Theme]
|
||||
Theme=default
|
@ -40,7 +40,7 @@ void ShellPackageStructure::initPackage(Plasma::Package *package)
|
||||
package->addFileDefinition("defaults", "defaults", i18n("Default plugins for containments, containmentActions etc"));
|
||||
|
||||
package->setMimeTypes("layout", QStringList() << "application/javascript");
|
||||
package->setMimeTypes("layout", QStringList() << "text/plain");
|
||||
package->setMimeTypes("defaults", QStringList() << "text/plain");
|
||||
|
||||
package->addFileDefinition("appleterror", "components/AppletError.qml", i18n("Error message shown when an applet fails loading"));
|
||||
package->addFileDefinition("compactapplet", "components/CompactApplet.qml", i18n("QML component that shows an applet in a popup"));
|
||||
|
Loading…
Reference in New Issue
Block a user