rely on AppletPrivate::remoteLocation (removing the need for PackageMetadata) and make it a proper KUrl

This commit is contained in:
Aaron Seigo 2011-05-31 00:04:03 +02:00
parent be8b64f95c
commit b01348aa84
3 changed files with 6 additions and 17 deletions

View File

@ -671,12 +671,10 @@ ConfigLoader *Applet::configScheme() const
DataEngine *Applet::dataEngine(const QString &name) const DataEngine *Applet::dataEngine(const QString &name) const
{ {
if (!d->remoteLocation.isEmpty()) { if (d->remoteLocation.isEmpty()) {
return d->remoteDataEngine(KUrl(d->remoteLocation), name);
} else if (!package() || package()->metadata().remoteLocation().isEmpty()) {
return d->dataEngine(name); return d->dataEngine(name);
} else { } else {
return d->remoteDataEngine(KUrl(package()->metadata().remoteLocation()), name); return d->remoteDataEngine(d->remoteLocation, name);
} }
} }

View File

@ -196,7 +196,7 @@ public:
KKeySequenceWidget *shortcutEditor; //TODO: subclass KConfigDialog and encapsulate this in there KKeySequenceWidget *shortcutEditor; //TODO: subclass KConfigDialog and encapsulate this in there
ItemStatus itemStatus; ItemStatus itemStatus;
QString remoteLocation; KUrl remoteLocation;
Ui::publishWidget publishUI; Ui::publishWidget publishUI;
// the applet can change size policy by itself, so save the old one for eventual restore // the applet can change size policy by itself, so save the old one for eventual restore

View File

@ -76,7 +76,7 @@ public:
applet = Applet::load(pluginName); applet = Applet::load(pluginName);
if (applet) { if (applet) {
applet->d->remoteLocation = location.prettyUrl(); applet->d->remoteLocation = location;
} else { } else {
q->setError(-1); q->setError(-1);
q->setErrorText(i18n("The \"%1\" widget is not installed.", pluginName)); q->setErrorText(i18n("The \"%1\" widget is not installed.", pluginName));
@ -129,7 +129,6 @@ public:
int answer = KMessageBox::createKMessageBox(dialog, KIcon(iconName), message, int answer = KMessageBox::createKMessageBox(dialog, KIcon(iconName), message,
QStringList(), QString(), 0, QStringList(), QString(), 0,
KMessageBox::Dangerous); KMessageBox::Dangerous);
//int answer = KMessageBox::questionYesNo(0, message, i18n("Remote Widget"));
if (answer!=KDialog::Yes) { if (answer!=KDialog::Yes) {
q->setError(-1); q->setError(-1);
@ -138,17 +137,9 @@ public:
return; return;
} }
/**
QString metadataFilename = path + "/metadata.desktop";
KDesktopFile cfg(metadataFilename);
KConfigGroup config = cfg.desktopGroup();
config.writeEntry("EngineLocation", location.prettyUrl());
config.sync();
*/
applet = Applet::loadPlasmoid(path); applet = Applet::loadPlasmoid(path);
if (applet) { if (applet) {
applet->d->remoteLocation = location.prettyUrl(); applet->d->remoteLocation = location;
} else { } else {
q->setError(-1); q->setError(-1);
} }