* 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:
parent
b726b20d9e
commit
6433849559
@ -40,13 +40,13 @@
|
|||||||
K_PLUGIN_FACTORY(plasmaKPartFactory, registerPlugin<PlasmaKPart>();)
|
K_PLUGIN_FACTORY(plasmaKPartFactory, registerPlugin<PlasmaKPart>();)
|
||||||
K_EXPORT_PLUGIN(plasmaKPartFactory("plasma-kpart","plasma-kpart") )
|
K_EXPORT_PLUGIN(plasmaKPartFactory("plasma-kpart","plasma-kpart") )
|
||||||
|
|
||||||
PlasmaKPart::PlasmaKPart(QWidget *parentWidget, QObject *parent, const QVariantList& args)
|
PlasmaKPart::PlasmaKPart(QWidget *parentWidget, QObject *parent, const QVariantList &args)
|
||||||
: KParts::ReadOnlyPart(parent),
|
: KParts::ReadOnlyPart(parent),
|
||||||
m_corona(0),
|
m_corona(0),
|
||||||
m_view(0),
|
m_view(new PlasmaKPartView(0, 1, parentWidget)),
|
||||||
m_service(0)
|
m_service(0)
|
||||||
{
|
{
|
||||||
setComponentData( plasmaKPartFactory::componentData() );
|
setComponentData(plasmaKPartFactory::componentData());
|
||||||
|
|
||||||
KGlobal::locale()->insertCatalog("libplasma");
|
KGlobal::locale()->insertCatalog("libplasma");
|
||||||
KGlobal::locale()->insertCatalog("plasmagenericshell");
|
KGlobal::locale()->insertCatalog("plasmagenericshell");
|
||||||
@ -54,22 +54,19 @@ PlasmaKPart::PlasmaKPart(QWidget *parentWidget, QObject *parent, const QVariantL
|
|||||||
|
|
||||||
setThemeDefaults();
|
setThemeDefaults();
|
||||||
|
|
||||||
m_view = new PlasmaKPartView(0, 1, parentWidget);
|
|
||||||
m_view->installEventFilter(this);
|
|
||||||
setWidget(m_view);
|
setWidget(m_view);
|
||||||
|
|
||||||
// initialize the plugin loader
|
// initialize the plugin loader
|
||||||
if( args.length() > 0 )
|
if (args.length() > 0) {
|
||||||
{
|
Plasma::PluginLoader *loader = qVariantValue<Plasma::PluginLoader *>(args.first());
|
||||||
Plasma::PluginLoader* loader = qVariantValue<Plasma::PluginLoader*>( args.first() );
|
if (loader) {
|
||||||
if( loader )
|
Plasma::PluginLoader::setPluginLoader(loader);
|
||||||
{
|
|
||||||
Plasma::PluginLoader::setPluginLoader( loader );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( args.length() > 1 )
|
if (args.length() > 1) {
|
||||||
m_category = args.at(1).value<QString>();
|
m_category = args.at(1).value<QString>();
|
||||||
|
}
|
||||||
|
|
||||||
// this line initializes the corona.
|
// this line initializes the corona.
|
||||||
corona();
|
corona();
|
||||||
@ -164,14 +161,13 @@ Plasma::Containment* PlasmaKPart::containment()
|
|||||||
return corona()->containments().first();
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Plasma::PluginLoader::setPluginLoader( loader );
|
Plasma::PluginLoader::setPluginLoader(loader);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ class PlasmaKPartView;
|
|||||||
class PlasmaKPartCorona;
|
class PlasmaKPartCorona;
|
||||||
|
|
||||||
#include <Plasma/Containment>
|
#include <Plasma/Containment>
|
||||||
Q_DECLARE_METATYPE( Plasma::Containment* )
|
Q_DECLARE_METATYPE(Plasma::Containment *)
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
class Applet;
|
class Applet;
|
||||||
@ -43,16 +43,17 @@ class QVBoxLayout;
|
|||||||
|
|
||||||
class PlasmaKPart : public KParts::ReadOnlyPart
|
class PlasmaKPart : public KParts::ReadOnlyPart
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY( Plasma::Applet::List activeApplets READ listActiveApplets )
|
Q_PROPERTY(Plasma::Applet::List activeApplets READ listActiveApplets)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PlasmaKPart(QWidget* parentWidget, QObject* parent, const QVariantList&);
|
PlasmaKPart(QWidget *parentWidget, QObject *parent, const QVariantList &args);
|
||||||
~PlasmaKPart();
|
~PlasmaKPart();
|
||||||
|
|
||||||
void notifyStartup(bool completed);
|
void notifyStartup(bool completed);
|
||||||
|
|
||||||
PlasmaKPartCorona* corona();
|
PlasmaKPartCorona *corona();
|
||||||
Plasma::Containment* containment();
|
Plasma::Containment *containment();
|
||||||
QString category();
|
QString category();
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
@ -63,7 +64,7 @@ public Q_SLOTS:
|
|||||||
* @author Ryan Rix <ry@n.rix.si>
|
* @author Ryan Rix <ry@n.rix.si>
|
||||||
* @version 0.01
|
* @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
|
* Sets the application-specific plugin loader. This allows
|
||||||
@ -85,14 +86,17 @@ public Q_SLOTS:
|
|||||||
*
|
*
|
||||||
* @short Set application-specific plugin loader
|
* @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.
|
* Returns a list of active applets in the containment.
|
||||||
*
|
*
|
||||||
* @return A list of the containment's Applets
|
* @return A list of the containment's Applets
|
||||||
**/
|
**/
|
||||||
Plasma::Applet::List listActiveApplets( );
|
Plasma::Applet::List listActiveApplets();
|
||||||
|
|
||||||
|
Q_SIGNALS:
|
||||||
|
void viewCreated();
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void cleanup();
|
void cleanup();
|
||||||
@ -107,9 +111,6 @@ private:
|
|||||||
KService::Ptr m_service;
|
KService::Ptr m_service;
|
||||||
QHash<QString,Plasma::Applet*>* m_appletList;
|
QHash<QString,Plasma::Applet*>* m_appletList;
|
||||||
QVBoxLayout* m_configLayout;
|
QVBoxLayout* m_configLayout;
|
||||||
|
|
||||||
Q_SIGNALS:
|
|
||||||
void viewCreated();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // multiple inclusion guard
|
#endif // multiple inclusion guard
|
||||||
|
Loading…
Reference in New Issue
Block a user