create a Package if we have a scripted plasmoid on hand.

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=690104
This commit is contained in:
Aaron J. Seigo 2007-07-20 03:28:34 +00:00
parent 1b6070d807
commit 44fe05f668
2 changed files with 67 additions and 87 deletions

View File

@ -33,6 +33,8 @@
#include "plasma/corona.h"
#include "plasma/dataenginemanager.h"
#include "plasma/package.h"
#include "plasma/packages_p.h"
#include "plasma/plasma.h"
#include "plasma/svg.h"
@ -46,11 +48,12 @@ namespace Plasma
class Applet::Private
{
public:
Private( KService::Ptr appletDescription, int uniqueID )
Private(KService::Ptr service, int uniqueID)
: appletId(uniqueID),
globalConfig(0),
appletConfig(0),
appletDescription(appletDescription ? new KPluginInfo(appletDescription) : 0),
appletDescription(service ? new KPluginInfo(service) : 0),
package(0),
background(0),
failureText(0),
immutable(false),
@ -64,6 +67,22 @@ class Applet::Private
if (appletId > s_maxAppletId) {
s_maxAppletId = appletId;
}
if (appletDescription &&
!appletDescription->property("X-Plasma-Language").toString().isEmpty()) {
QString path = KStandardDirs::locate("appdata",
"plasmoids/" +
appletDescription->pluginName());
if (!path.isEmpty()) {
package = new Package(path,
appletDescription->pluginName(),
PlasmoidStructure());
if (!package->isValid()) {
delete package;
package = 0;
}
}
}
}
~Private()
@ -73,6 +92,7 @@ class Applet::Private
}
delete appletDescription;
delete background;
delete package;
}
static uint nextId()
@ -87,6 +107,7 @@ class Applet::Private
KSharedConfig::Ptr globalConfig;
KSharedConfig::Ptr appletConfig;
KPluginInfo* appletDescription;
Package* package;
QList<QObject*> watchedForFocus;
QStringList loadedEngines;
static uint s_maxAppletId;

View File

@ -1,41 +0,0 @@
/******************************************************************************
* Copyright (C) 2007 by Aaron Seigo <aseigo@kde.org> *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public License *
* along with this library; see the file COPYING.LIB. If not, write to *
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301, USA. *
*******************************************************************************/
#ifndef PLASMA_PACKAGES
#define PLASMA_PACKAGES
#include <plasma/packagestructure.h>
namespace Plasma
{
class PlasmoidStructure : public PackageStructure
{
public:
PlasmoidStructure();
};
class ThemePackageStructure : public PackageStructure
{
public:
ThemePackageStructure();
};
} // namespace Plasma
#endif