* Add translation support for runner and dataengine packages
* Use pladmoid package for runners too. svn path=/trunk/KDE/kdelibs/; revision=1047782
This commit is contained in:
parent
27a02128a5
commit
5b2b221562
@ -295,6 +295,7 @@ const Package* AbstractRunner::package() const
|
||||
void AbstractRunner::init()
|
||||
{
|
||||
if (d->script) {
|
||||
d->setupScriptSupport();
|
||||
d->script->init();
|
||||
}
|
||||
}
|
||||
@ -339,6 +340,27 @@ AbstractRunnerPrivate::~AbstractRunnerPrivate()
|
||||
package = 0;
|
||||
}
|
||||
|
||||
// put all setup routines for script here. at this point we can assume that
|
||||
// package exists and that we have a script engine
|
||||
void AbstractRunnerPrivate::setupScriptSupport()
|
||||
{
|
||||
if (!package) {
|
||||
return;
|
||||
}
|
||||
|
||||
kDebug() << "setting up script support, package is in" << package->path()
|
||||
<< "which is a" << package->structure()->type() << "package"
|
||||
<< ", main script is" << package->filePath("mainscript");
|
||||
|
||||
QString translationsPath = package->filePath("translations");
|
||||
if (!translationsPath.isEmpty()) {
|
||||
//FIXME: we should _probably_ use a KComponentData to segregate the applets
|
||||
// from each other; but I want to get the basics working first :)
|
||||
KGlobal::dirs()->addResourceDir("locale", translationsPath);
|
||||
KGlobal::locale()->insertCatalog(package->metadata().pluginName());
|
||||
}
|
||||
}
|
||||
|
||||
} // Plasma namespace
|
||||
|
||||
#include "abstractrunner.moc"
|
||||
|
@ -144,6 +144,7 @@ DataEngine::Data DataEngine::query(const QString &source) const
|
||||
void DataEngine::init()
|
||||
{
|
||||
if (d->script) {
|
||||
d->setupScriptSupport();
|
||||
d->script->init();
|
||||
} else {
|
||||
// kDebug() << "called";
|
||||
@ -693,6 +694,27 @@ void DataEnginePrivate::trimQueue()
|
||||
}
|
||||
}
|
||||
|
||||
// put all setup routines for script here. at this point we can assume that
|
||||
// package exists and that we have a script engine
|
||||
void DataEnginePrivate::setupScriptSupport()
|
||||
{
|
||||
if (!package) {
|
||||
return;
|
||||
}
|
||||
|
||||
kDebug() << "setting up script support, package is in" << package->path()
|
||||
<< "which is a" << package->structure()->type() << "package"
|
||||
<< ", main script is" << package->filePath("mainscript");
|
||||
|
||||
QString translationsPath = package->filePath("translations");
|
||||
if (!translationsPath.isEmpty()) {
|
||||
//FIXME: we should _probably_ use a KComponentData to segregate the applets
|
||||
// from each other; but I want to get the basics working first :)
|
||||
KGlobal::dirs()->addResourceDir("locale", translationsPath);
|
||||
KGlobal::locale()->insertCatalog(package->metadata().pluginName());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#include "dataengine.moc"
|
||||
|
@ -32,6 +32,7 @@ class AbstractRunnerPrivate
|
||||
public:
|
||||
AbstractRunnerPrivate(AbstractRunner *r, KService::Ptr service);
|
||||
~AbstractRunnerPrivate();
|
||||
void setupScriptSupport();
|
||||
|
||||
AbstractRunner::Priority priority;
|
||||
AbstractRunner::Speed speed;
|
||||
|
@ -43,6 +43,7 @@ class DataEnginePrivate
|
||||
DataContainer *requestSource(const QString &sourceName, bool *newSource = 0);
|
||||
void trimQueue();
|
||||
void internalUpdateSource(DataContainer*);
|
||||
void setupScriptSupport();
|
||||
|
||||
/**
|
||||
* Reference counting method. Calling this method increases the count
|
||||
@ -62,7 +63,7 @@ class DataEnginePrivate
|
||||
* @return true if the reference count is non-zero
|
||||
**/
|
||||
bool isUsed() const;
|
||||
|
||||
|
||||
/**
|
||||
* @param methods ways to announce this engine on the network.
|
||||
*/
|
||||
|
@ -253,16 +253,9 @@ PackageStructure::Ptr defaultPackageStructure(ComponentType type)
|
||||
case AppletComponent:
|
||||
case DataEngineComponent:
|
||||
case WallpaperComponent:
|
||||
case RunnerComponent:
|
||||
return PackageStructure::Ptr(new PlasmoidPackage());
|
||||
break;
|
||||
case RunnerComponent:
|
||||
{
|
||||
PackageStructure::Ptr structure(new PackageStructure());
|
||||
structure->addFileDefinition("mainscript", "code/main", i18n("Main Script File"));
|
||||
structure->setRequired("mainscript", true);
|
||||
return structure;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
// TODO: we don't have any special structures for other components yet
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user