Fix loading plasmoids by absolute path
We were not looking into the plugin directory when figuring out the applet path when it's load from an absolute path. Fixes configmodeltest REVIEW: 129101
This commit is contained in:
parent
4a9d5cff2a
commit
2ed819f37d
@ -29,7 +29,9 @@
|
|||||||
#include <qstandardpaths.h>
|
#include <qstandardpaths.h>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
|
#include <QDir>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QFileInfo>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
#include <klocalizedstring.h>
|
#include <klocalizedstring.h>
|
||||||
@ -113,8 +115,9 @@ AppletPrivate::~AppletPrivate()
|
|||||||
delete modificationsTimer;
|
delete modificationsTimer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppletPrivate::init(const QString &packagePath, const QVariantList &args)
|
void AppletPrivate::init(const QString &_packagePath, const QVariantList &args)
|
||||||
{
|
{
|
||||||
|
const QString packagePath = _packagePath.isEmpty() ? QFileInfo(appletDescription.metaDataFileName()).dir().path() : _packagePath;
|
||||||
// WARNING: do not access config() OR globalConfig() in this method!
|
// WARNING: do not access config() OR globalConfig() in this method!
|
||||||
// that requires a Corona, which is not available at this point
|
// that requires a Corona, which is not available at this point
|
||||||
q->setHasConfigurationInterface(true);
|
q->setHasConfigurationInterface(true);
|
||||||
|
@ -199,7 +199,9 @@ QVariant ConfigModel::data(const QModelIndex &index, int role) const
|
|||||||
const QString source = d->categories.at(index.row())->source();
|
const QString source = d->categories.at(index.row())->source();
|
||||||
// Quick check if source is an absolute path or not
|
// Quick check if source is an absolute path or not
|
||||||
if (d->appletInterface && !source.isEmpty() && !(source.startsWith('/') && source.endsWith(QLatin1String("qml")))) {
|
if (d->appletInterface && !source.isEmpty() && !(source.startsWith('/') && source.endsWith(QLatin1String("qml")))) {
|
||||||
return QUrl::fromLocalFile(d->appletInterface.data()->package().filePath("ui", source));
|
if(!d->appletInterface.data()->kPackage().isValid())
|
||||||
|
qWarning() << "wrong applet" << d->appletInterface.data()->pluginMetaData().name();
|
||||||
|
return QUrl::fromLocalFile(d->appletInterface.data()->kPackage().filePath("ui", source));
|
||||||
} else {
|
} else {
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user