addUrls becomes virtual, setUrls is dropped

This commit is contained in:
Aaron Seigo 2011-05-18 16:04:50 +02:00
parent 3e236c281a
commit cfdccb7968
4 changed files with 11 additions and 37 deletions

View File

@ -1590,13 +1590,13 @@ void ContainmentPrivate::mimeTypeRetrieved(KIO::Job *job, const QString &mimeTyp
//set wallpapery stuff
plugin = actionsToWallpapers.value(choice);
if (!wallpaper || plugin != wallpaper->pluginName()) {
kDebug() << "Wallpaper dropped:" << tjob->url();
//kDebug() << "Wallpaper dropped:" << tjob->url();
q->setWallpaper(plugin);
}
if (wallpaper) {
kDebug() << "Wallpaper dropped:" << tjob->url();
wallpaper->setUrls(KUrl::List() << tjob->url());
//kDebug() << "Wallpaper dropped:" << tjob->url();
wallpaper->addUrls(KUrl::List() << tjob->url());
}
} else {
addApplet(actionsToApplets[choice], args, QRectF(posi, QSize()));

View File

@ -58,7 +58,6 @@ public:
Wallpaper::ResizeMethod lastResizeMethod;
QSizeF targetSize;
WallpaperScript *script;
QList<KUrl> pendingUrls;
QList<QAction*> contextActions;
bool cacheRendering : 1;

View File

@ -132,17 +132,6 @@ void Wallpaper::addUrls(const KUrl::List &urls)
}
}
void Wallpaper::setUrls(const KUrl::List &urls)
{
if (!d->initialized) {
d->pendingUrls = urls;
} else if (d->script) {
d->script->addUrls(urls);
} else {
QMetaObject::invokeMethod(this, "addUrls", Q_ARG(KUrl::List, urls));
}
}
KPluginInfo::List Wallpaper::listWallpaperInfo(const QString &formFactor)
{
QString constraint;
@ -318,10 +307,6 @@ void Wallpaper::restore(const KConfigGroup &config)
{
init(config);
d->initialized = true;
if (!d->pendingUrls.isEmpty()) {
setUrls(d->pendingUrls);
d->pendingUrls.clear();
}
}
void Wallpaper::init(const KConfigGroup &config)

View File

@ -86,14 +86,6 @@ class PLASMA_EXPORT Wallpaper : public QObject
~Wallpaper();
/**
* Sets the urls for the wallpaper
* @param urls Urls of the selected images
* @since 4.7
*/
void setUrls(const KUrl::List &urls);
/**
* Returns a list of all known wallpapers.
*
@ -215,7 +207,14 @@ class PLASMA_EXPORT Wallpaper : public QObject
*/
void setBoundingRect(const QRectF &boundingRect);
/**
/**
* Can be Overriden by plugins which support setting Image URLs.
* This is triggered by events in the user interface such as
* drag and drop of files.
*/
virtual void addUrls(const KUrl::List &urls);
/**
* This method is called when the wallpaper should be painted.
*
* @param painter the QPainter to use to do the painting
@ -404,15 +403,6 @@ class PLASMA_EXPORT Wallpaper : public QObject
*/
void renderHintsChanged();
protected Q_SLOTS:
/**
* This method is invoked by setUrls(KUrl::List)
* Can be Overriden by Plugins which want to support setting Image URLs
* Will be changed to virtual method in libplasma2/KDE5
* @since 4.7
*/
void addUrls(const KUrl::List &urls);
protected:
/**
* This constructor is to be used with the plugin loading systems