SVN_SILENT let's just get this over with and reformant the classes that are pretty much expected to remain
svn path=/trunk/KDE/kdebase/workspace/plasma/lib/; revision=638722
This commit is contained in:
parent
1cdd84cc85
commit
736e81e422
101
applet.cpp
101
applet.cpp
@ -33,18 +33,17 @@ namespace Plasma
|
||||
class Applet::Private
|
||||
{
|
||||
public:
|
||||
Private(KService::Ptr appletDescription, int uniqueID)
|
||||
: id(uniqueID),
|
||||
globalConfig(0),
|
||||
appletConfig(0),
|
||||
Private( KService::Ptr appletDescription, int uniqueID )
|
||||
: id( uniqueID ),
|
||||
globalConfig( 0 ),
|
||||
appletConfig( 0 ),
|
||||
appletDescription(appletDescription)
|
||||
{ }
|
||||
|
||||
~Private()
|
||||
{
|
||||
foreach (const QString& engine, loadedEngines)
|
||||
{
|
||||
Interface::self()->unloadDataEngine(engine);
|
||||
foreach ( const QString& engine, loadedEngines ) {
|
||||
Interface::self()->unloadDataEngine( engine );
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,29 +55,28 @@ class Applet::Private
|
||||
QStringList loadedEngines;
|
||||
};
|
||||
|
||||
Applet::Applet(QGraphicsItem *parent,
|
||||
KService::Ptr appletDescription,
|
||||
int id)
|
||||
: QWidget(0),
|
||||
QGraphicsItemGroup(parent),
|
||||
d(new Private(appletDescription, id))
|
||||
Applet::Applet( QGraphicsItem *parent,
|
||||
KService::Ptr appletDescription,
|
||||
int id )
|
||||
: QWidget( 0 ),
|
||||
QGraphicsItemGroup( parent ),
|
||||
d( new Private( appletDescription, id ) )
|
||||
{
|
||||
}
|
||||
|
||||
Applet::~Applet()
|
||||
{
|
||||
needsFocus(false);
|
||||
needsFocus( false );
|
||||
delete d;
|
||||
}
|
||||
|
||||
KSharedConfig::Ptr Applet::appletConfig() const
|
||||
{
|
||||
if (!d->appletConfig)
|
||||
{
|
||||
QString file = KStandardDirs::locateLocal("appdata",
|
||||
if ( !d->appletConfig ) {
|
||||
QString file = KStandardDirs::locateLocal( "appdata",
|
||||
"applets/" + instanceName() + "rc",
|
||||
true);
|
||||
d->appletConfig = KSharedConfig::openConfig(file);
|
||||
true );
|
||||
d->appletConfig = KSharedConfig::openConfig( file );
|
||||
}
|
||||
|
||||
return d->appletConfig;
|
||||
@ -86,25 +84,22 @@ KSharedConfig::Ptr Applet::appletConfig() const
|
||||
|
||||
KSharedConfig::Ptr Applet::globalAppletConfig() const
|
||||
{
|
||||
if (!d->globalConfig)
|
||||
{
|
||||
QString file = KStandardDirs::locateLocal("config", "plasma_" + globalName() + "rc");
|
||||
d->globalConfig = KSharedConfig::openConfig(file);
|
||||
if ( !d->globalConfig ) {
|
||||
QString file = KStandardDirs::locateLocal( "config", "plasma_" + globalName() + "rc" );
|
||||
d->globalConfig = KSharedConfig::openConfig( file );
|
||||
}
|
||||
|
||||
return d->globalConfig;
|
||||
}
|
||||
|
||||
bool Applet::loadDataEngine(const QString& name)
|
||||
bool Applet::loadDataEngine( const QString& name )
|
||||
{
|
||||
if (d->loadedEngines.indexOf(name) != -1)
|
||||
{
|
||||
if ( d->loadedEngines.indexOf( name ) != -1 ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Plasma::Interface::self()->loadDataEngine(name))
|
||||
{
|
||||
d->loadedEngines.append(name);
|
||||
if ( Plasma::Interface::self()->loadDataEngine( name ) ) {
|
||||
d->loadedEngines.append( name );
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -122,54 +117,50 @@ QString Applet::globalName() const
|
||||
|
||||
QString Applet::instanceName() const
|
||||
{
|
||||
return d->appletDescription->library() + QString::number(d->id);
|
||||
return d->appletDescription->library() + QString::number( d->id );
|
||||
}
|
||||
|
||||
void Applet::watchForFocus(QObject *widget, bool watch)
|
||||
{
|
||||
if (!widget)
|
||||
if ( !widget ) {
|
||||
return;
|
||||
}
|
||||
|
||||
int index = d->watchedForFocus.indexOf(widget);
|
||||
if (watch)
|
||||
{
|
||||
if (index == -1)
|
||||
{
|
||||
d->watchedForFocus.append(widget);
|
||||
widget->installEventFilter(this);
|
||||
if ( watch ) {
|
||||
if ( index == -1 ) {
|
||||
d->watchedForFocus.append( widget );
|
||||
widget->installEventFilter( this );
|
||||
}
|
||||
}
|
||||
else if (index != -1)
|
||||
{
|
||||
d->watchedForFocus.removeAt(index);
|
||||
widget->removeEventFilter(this);
|
||||
} else if ( index != -1 ) {
|
||||
d->watchedForFocus.removeAt( index );
|
||||
widget->removeEventFilter( this );
|
||||
}
|
||||
}
|
||||
|
||||
void Applet::needsFocus(bool focus)
|
||||
void Applet::needsFocus( bool focus )
|
||||
{
|
||||
if (focus == QWidget::hasFocus() || focus == QGraphicsItem::hasFocus())
|
||||
if ( focus == QWidget::hasFocus() ||
|
||||
focus == QGraphicsItem::hasFocus() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
emit requestFocus(focus);
|
||||
}
|
||||
|
||||
bool Applet::eventFilter(QObject *o, QEvent * e)
|
||||
bool Applet::eventFilter( QObject *o, QEvent * e )
|
||||
{
|
||||
if (!d->watchedForFocus.contains(o))
|
||||
if ( !d->watchedForFocus.contains( o ) )
|
||||
{
|
||||
if (e->type() == QEvent::MouseButtonRelease ||
|
||||
e->type() == QEvent::FocusIn)
|
||||
{
|
||||
needsFocus(true);
|
||||
}
|
||||
else if (e->type() == QEvent::FocusOut)
|
||||
{
|
||||
needsFocus(false);
|
||||
if ( e->type() == QEvent::MouseButtonRelease ||
|
||||
e->type() == QEvent::FocusIn ) {
|
||||
needsFocus( true );
|
||||
} else if ( e->type() == QEvent::FocusOut ) {
|
||||
needsFocus( false );
|
||||
}
|
||||
}
|
||||
|
||||
return QWidget::eventFilter(o, e);
|
||||
return QWidget::eventFilter( o, e );
|
||||
}
|
||||
|
||||
} // Plasma namespace
|
||||
|
16
applet.h
16
applet.h
@ -37,9 +37,9 @@ class KDE_EXPORT Applet : public QWidget, public QGraphicsItemGroup
|
||||
public:
|
||||
typedef QList<Applet*> List;
|
||||
|
||||
Applet(QGraphicsItem* parent,
|
||||
KService::Ptr appletDescription,
|
||||
int id);
|
||||
Applet( QGraphicsItem* parent,
|
||||
KService::Ptr appletDescription,
|
||||
int id );
|
||||
~Applet();
|
||||
|
||||
/**
|
||||
@ -66,7 +66,7 @@ class KDE_EXPORT Applet : public QWidget, public QGraphicsItemGroup
|
||||
*
|
||||
* @return returns true on success, false on failure
|
||||
*/
|
||||
bool loadDataEngine(const QString& name);
|
||||
bool loadDataEngine( const QString& name );
|
||||
|
||||
/**
|
||||
* called when any of the geometry constraints have been updated
|
||||
@ -77,7 +77,7 @@ class KDE_EXPORT Applet : public QWidget, public QGraphicsItemGroup
|
||||
virtual void constraintsUpdated();
|
||||
|
||||
Q_SIGNALS:
|
||||
void requestFocus(bool focus);
|
||||
void requestFocus( bool focus );
|
||||
|
||||
protected:
|
||||
|
||||
@ -90,7 +90,7 @@ class KDE_EXPORT Applet : public QWidget, public QGraphicsItemGroup
|
||||
* @param widget the widget to watch for keyboard focus
|
||||
* @param watch whether to start watching the widget, or to stop doing so
|
||||
*/
|
||||
void watchForFocus(QObject *widget, bool watch = true);
|
||||
void watchForFocus( QObject *widget, bool watch = true );
|
||||
|
||||
/**
|
||||
* Call this whenever focus is needed or not needed. You do not have to
|
||||
@ -99,10 +99,10 @@ class KDE_EXPORT Applet : public QWidget, public QGraphicsItemGroup
|
||||
* @see watchForFocus
|
||||
* @param focus whether to or not to request focus
|
||||
*/
|
||||
void needsFocus(bool focus);
|
||||
void needsFocus( bool focus );
|
||||
|
||||
|
||||
bool eventFilter(QObject *o, QEvent *e);
|
||||
bool eventFilter( QObject *o, QEvent *e );
|
||||
|
||||
private:
|
||||
class Private;
|
||||
|
@ -31,8 +31,8 @@ class KDE_EXPORT Interface
|
||||
public:
|
||||
static Interface* self();
|
||||
|
||||
virtual bool loadDataEngine(const QString &name) = 0;
|
||||
virtual void unloadDataEngine(const QString &name) = 0;
|
||||
virtual bool loadDataEngine( const QString &name ) = 0;
|
||||
virtual void unloadDataEngine( const QString &name ) = 0;
|
||||
|
||||
protected:
|
||||
Interface();
|
||||
|
15
theme.cpp
15
theme.cpp
@ -29,7 +29,7 @@ class Theme::Private
|
||||
{
|
||||
public:
|
||||
Private()
|
||||
: themeName("default")
|
||||
: themeName( "default" )
|
||||
{
|
||||
}
|
||||
|
||||
@ -40,9 +40,9 @@ Theme::Theme(QObject* parent)
|
||||
: QObject(parent),
|
||||
d(new Private)
|
||||
{
|
||||
KConfig config("plasma");
|
||||
KConfigGroup group(&config, "Theme");
|
||||
d->themeName = group.readEntry("name", d->themeName);
|
||||
KConfig config( "plasmarc" );
|
||||
KConfigGroup group( &config, "Theme" );
|
||||
d->themeName = group.readEntry( "name", d->themeName );
|
||||
}
|
||||
|
||||
Theme::~Theme()
|
||||
@ -54,10 +54,11 @@ QString Theme::themeName() const
|
||||
return d->themeName;
|
||||
}
|
||||
|
||||
QString Theme::imagePath(const QString& name) const
|
||||
QString Theme::imagePath( const QString& name ) const
|
||||
{
|
||||
return KStandardDirs::locate("data", "desktoptheme/" + d->themeName
|
||||
+ "/" + name + ".svg");
|
||||
return KStandardDirs::locate( "data", "desktoptheme/" +
|
||||
d->themeName +
|
||||
"/" + name + ".svg" );
|
||||
}
|
||||
|
||||
}
|
||||
|
4
theme.h
4
theme.h
@ -31,11 +31,11 @@ class KDE_EXPORT Theme : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Theme(QObject* parent = 0);
|
||||
explicit Theme( QObject* parent = 0 );
|
||||
~Theme();
|
||||
|
||||
QString themeName() const;
|
||||
QString imagePath(const QString& name) const;
|
||||
QString imagePath( const QString& name ) const;
|
||||
|
||||
signals:
|
||||
void changed();
|
||||
|
Loading…
Reference in New Issue
Block a user