[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs/plasma
From: Aaron J. Seigo <aseigo () kde ! org>
Date: 2009-03-31 23:51:53
Message-ID: 1238543513.158324.11684.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 947636 by aseigo:
abstract the bit of data engine management code out into a small class that the \
private classes can then subclass, and add dataEngine(const QString &) to Wallpaper
M +1 -15 applet.cpp
M +3 -2 private/applet_p.h
A private/dataengineconsumer_p.h [License: LGPL (v2+)]
M +9 -1 wallpaper.cpp
M +21 -0 wallpaper.h
--- trunk/KDE/kdelibs/plasma/applet.cpp #947635:947636
@@ -574,17 +574,7 @@
DataEngine *Applet::dataEngine(const QString &name) const
{
- int index = d->loadedEngines.indexOf(name);
- if (index != -1) {
- return DataEngineManager::self()->engine(name);
- }
-
- DataEngine *engine = DataEngineManager::self()->loadEngine(name);
- if (engine->isValid()) {
- d->loadedEngines.append(name);
- }
-
- return engine;
+ return d->dataEngine(name);
}
const Package *Applet::package() const
@@ -2035,10 +2025,6 @@
activationAction->forgetGlobalShortcut();
}
- foreach (const QString &engine, loadedEngines) {
- DataEngineManager::self()->unloadEngine(engine);
- }
-
if (extender) {
delete extender;
extender = 0;
--- trunk/KDE/kdelibs/plasma/private/applet_p.h #947635:947636
@@ -26,6 +26,8 @@
#include <kactioncollection.h>
+#include "plasma/private/dataengineconsumer_p.h"
+
class KKeySequenceWidget;
namespace Plasma
@@ -51,7 +53,7 @@
void overlayAnimationComplete();
};
-class AppletPrivate
+class AppletPrivate : public DataEngineConsumer
{
public:
AppletPrivate(KService::Ptr service, int uniqueID, Applet *applet);
@@ -107,7 +109,6 @@
AppletOverlayWidget *messageOverlay;
Plasma::BusyWidget *busyWidget;
QSet<QGraphicsItem*> registeredAsDragHandle;
- QStringList loadedEngines;
Plasma::FrameSvg *background;
AppletScript *script;
QVariantList args;
--- trunk/KDE/kdelibs/plasma/wallpaper.cpp #947635:947636
@@ -25,10 +25,12 @@
#include <version.h>
+#include "plasma/private/dataengineconsumer_p.h"
+
namespace Plasma
{
-class WallpaperPrivate
+class WallpaperPrivate : public DataEngineConsumer
{
public:
WallpaperPrivate(KService::Ptr service, Wallpaper *wallpaper) :
@@ -109,6 +111,7 @@
if (!wallpaper) {
kDebug() << "Couldn't load wallpaper \"" << wallpaperName << "\"! reason \
given: " << error; }
+
return wallpaper;
}
@@ -237,6 +240,11 @@
Q_UNUSED(event)
}
+DataEngine *Wallpaper::dataEngine(const QString &name) const
+{
+ return d->dataEngine(name);
+}
+
} // Plasma namespace
#include "wallpaper.moc"
--- trunk/KDE/kdelibs/plasma/wallpaper.h #947635:947636
@@ -28,6 +28,8 @@
namespace Plasma
{
+
+class DataEngine;
class WallpaperPrivate;
/**
@@ -204,6 +206,25 @@
*/
virtual void wheelEvent(QGraphicsSceneWheelEvent *event);
+ /**
+ * Loads the given DataEngine
+ *
+ * Tries to load the data engine given by @p name. Each engine is
+ * only loaded once, and that instance is re-used on all subsequent
+ * requests.
+ *
+ * If the data engine was not found, an invalid data engine is returned
+ * (see DataEngine::isValid()).
+ *
+ * Note that you should <em>not</em> delete the returned engine.
+ *
+ * @param name Name of the data engine to load
+ * @return pointer to the data engine if it was loaded,
+ * or an invalid data engine if the requested engine
+ * could not be loaded
+ */
+ Q_INVOKABLE DataEngine *dataEngine(const QString &name) const;
+
Q_SIGNALS:
/**
* This signal indicates that wallpaper needs to be repainted.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic