* don't install an event filter when there is no event filter implemented

* tidy

svn path=/trunk/KDE/kdebase/runtime/; revision=1214878
This commit is contained in:
Aaron J. Seigo 2011-01-16 19:12:25 +00:00
parent b726b20d9e
commit 6433849559
2 changed files with 28 additions and 31 deletions

View File

@ -40,13 +40,13 @@
K_PLUGIN_FACTORY(plasmaKPartFactory, registerPlugin<PlasmaKPart>();)
K_EXPORT_PLUGIN(plasmaKPartFactory("plasma-kpart","plasma-kpart") )
PlasmaKPart::PlasmaKPart(QWidget *parentWidget, QObject *parent, const QVariantList& args)
: KParts::ReadOnlyPart(parent),
m_corona(0),
m_view(0),
m_service(0)
PlasmaKPart::PlasmaKPart(QWidget *parentWidget, QObject *parent, const QVariantList &args)
: KParts::ReadOnlyPart(parent),
m_corona(0),
m_view(new PlasmaKPartView(0, 1, parentWidget)),
m_service(0)
{
setComponentData( plasmaKPartFactory::componentData() );
setComponentData(plasmaKPartFactory::componentData());
KGlobal::locale()->insertCatalog("libplasma");
KGlobal::locale()->insertCatalog("plasmagenericshell");
@ -54,22 +54,19 @@ PlasmaKPart::PlasmaKPart(QWidget *parentWidget, QObject *parent, const QVariantL
setThemeDefaults();
m_view = new PlasmaKPartView(0, 1, parentWidget);
m_view->installEventFilter(this);
setWidget(m_view);
// initialize the plugin loader
if( args.length() > 0 )
{
Plasma::PluginLoader* loader = qVariantValue<Plasma::PluginLoader*>( args.first() );
if( loader )
{
Plasma::PluginLoader::setPluginLoader( loader );
if (args.length() > 0) {
Plasma::PluginLoader *loader = qVariantValue<Plasma::PluginLoader *>(args.first());
if (loader) {
Plasma::PluginLoader::setPluginLoader(loader);
}
}
if ( args.length() > 1 )
if (args.length() > 1) {
m_category = args.at(1).value<QString>();
}
// this line initializes the corona.
corona();
@ -164,14 +161,13 @@ Plasma::Containment* PlasmaKPart::containment()
return corona()->containments().first();
}
bool PlasmaKPart::setPluginLoader( Plasma::PluginLoader* loader )
bool PlasmaKPart::setPluginLoader(Plasma::PluginLoader *loader)
{
if ( Plasma::PluginLoader::pluginLoader() ) {
if (Plasma::PluginLoader::pluginLoader()) {
return false;
}
Plasma::PluginLoader::setPluginLoader( loader );
Plasma::PluginLoader::setPluginLoader(loader);
return true;
}

View File

@ -27,7 +27,7 @@ class PlasmaKPartView;
class PlasmaKPartCorona;
#include <Plasma/Containment>
Q_DECLARE_METATYPE( Plasma::Containment* )
Q_DECLARE_METATYPE(Plasma::Containment *)
namespace Plasma
{
class Applet;
@ -43,16 +43,17 @@ class QVBoxLayout;
class PlasmaKPart : public KParts::ReadOnlyPart
{
Q_OBJECT
Q_PROPERTY( Plasma::Applet::List activeApplets READ listActiveApplets )
Q_OBJECT
Q_PROPERTY(Plasma::Applet::List activeApplets READ listActiveApplets)
public:
PlasmaKPart(QWidget* parentWidget, QObject* parent, const QVariantList&);
PlasmaKPart(QWidget *parentWidget, QObject *parent, const QVariantList &args);
~PlasmaKPart();
void notifyStartup(bool completed);
PlasmaKPartCorona* corona();
Plasma::Containment* containment();
PlasmaKPartCorona *corona();
Plasma::Containment *containment();
QString category();
public Q_SLOTS:
@ -63,7 +64,7 @@ public Q_SLOTS:
* @author Ryan Rix <ry@n.rix.si>
* @version 0.01
**/
void addApplet(const QString& pluginName, const QVariantList& args = QVariantList(), const QRectF& dimensions = QRectF());
void addApplet(const QString &pluginName, const QVariantList &args = QVariantList(), const QRectF &dimensions = QRectF());
/**
* Sets the application-specific plugin loader. This allows
@ -85,14 +86,17 @@ public Q_SLOTS:
*
* @short Set application-specific plugin loader
**/
bool setPluginLoader( Plasma::PluginLoader* loader );
bool setPluginLoader(Plasma::PluginLoader *loader);
/**
* Returns a list of active applets in the containment.
*
* @return A list of the containment's Applets
**/
Plasma::Applet::List listActiveApplets( );
Plasma::Applet::List listActiveApplets();
Q_SIGNALS:
void viewCreated();
private Q_SLOTS:
void cleanup();
@ -107,9 +111,6 @@ private:
KService::Ptr m_service;
QHash<QString,Plasma::Applet*>* m_appletList;
QVBoxLayout* m_configLayout;
Q_SIGNALS:
void viewCreated();
};
#endif // multiple inclusion guard