* can't call first on an empty list, so be careful with that

* clean ups

svn path=/trunk/KDE/kdebase/runtime/; revision=1214882
This commit is contained in:
Aaron J. Seigo 2011-01-16 19:17:00 +00:00
parent 6433849559
commit cfe5bdfe1c
2 changed files with 9 additions and 5 deletions

View File

@ -31,7 +31,7 @@
#include <qfile.h>
#include "scripting/scriptengine.h"
PlasmaKPartCorona::PlasmaKPartCorona(QObject* parent)
PlasmaKPartCorona::PlasmaKPartCorona(QObject *parent)
: Plasma::Corona(parent)
{
init();
@ -48,7 +48,7 @@ void PlasmaKPartCorona::loadDefaultLayout()
{
// used to force a save into the config file
KConfigGroup invalidConfig;
Plasma::Containment* c = addContainment(QString());
Plasma::Containment *c = addContainment(QString());
if (!c) {
// do some error reporting?
@ -87,9 +87,13 @@ void PlasmaKPartCorona::printScriptMessage(const QString &error)
Plasma::Containment* PlasmaKPartCorona::containment()
{
// We only have one containment, so just try and return the first one
QList<Plasma::Containment*> list = containments();
if (!list.isEmpty()) {
return list.first();
}
return list.first(); // We only have one containment
return 0;
}
#include "plasmakpartcorona.moc"

View File

@ -38,7 +38,7 @@ Q_OBJECT
public:
PlasmaKPartCorona(QObject* parent);
Plasma::Containment* containment();
Plasma::Containment *containment();
void loadDefaultLayout();
@ -51,7 +51,7 @@ private Q_SLOTS:
void printScriptMessage(const QString &error);
private:
Plasma::Applet* loadDefaultApplet(const QString &pluginName, Plasma::Containment *c);
Plasma::Applet *loadDefaultApplet(const QString &pluginName, Plasma::Containment *c);
};
#endif