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:
Aaron J. Seigo 2007-03-03 01:41:27 +00:00
parent 1cdd84cc85
commit 736e81e422
5 changed files with 66 additions and 74 deletions

View File

@ -42,8 +42,7 @@ class Applet::Private
~Private() ~Private()
{ {
foreach (const QString& engine, loadedEngines) foreach ( const QString& engine, loadedEngines ) {
{
Interface::self()->unloadDataEngine( engine ); Interface::self()->unloadDataEngine( engine );
} }
} }
@ -73,8 +72,7 @@ Applet::~Applet()
KSharedConfig::Ptr Applet::appletConfig() const KSharedConfig::Ptr Applet::appletConfig() const
{ {
if (!d->appletConfig) if ( !d->appletConfig ) {
{
QString file = KStandardDirs::locateLocal( "appdata", QString file = KStandardDirs::locateLocal( "appdata",
"applets/" + instanceName() + "rc", "applets/" + instanceName() + "rc",
true ); true );
@ -86,8 +84,7 @@ KSharedConfig::Ptr Applet::appletConfig() const
KSharedConfig::Ptr Applet::globalAppletConfig() const KSharedConfig::Ptr Applet::globalAppletConfig() const
{ {
if (!d->globalConfig) if ( !d->globalConfig ) {
{
QString file = KStandardDirs::locateLocal( "config", "plasma_" + globalName() + "rc" ); QString file = KStandardDirs::locateLocal( "config", "plasma_" + globalName() + "rc" );
d->globalConfig = KSharedConfig::openConfig( file ); d->globalConfig = KSharedConfig::openConfig( file );
} }
@ -97,13 +94,11 @@ KSharedConfig::Ptr Applet::globalAppletConfig() const
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; return true;
} }
if (Plasma::Interface::self()->loadDataEngine(name)) if ( Plasma::Interface::self()->loadDataEngine( name ) ) {
{
d->loadedEngines.append( name ); d->loadedEngines.append( name );
return true; return true;
} }
@ -127,20 +122,17 @@ QString Applet::instanceName() const
void Applet::watchForFocus(QObject *widget, bool watch) void Applet::watchForFocus(QObject *widget, bool watch)
{ {
if (!widget) if ( !widget ) {
return; return;
}
int index = d->watchedForFocus.indexOf(widget); int index = d->watchedForFocus.indexOf(widget);
if (watch) if ( watch ) {
{ if ( index == -1 ) {
if (index == -1)
{
d->watchedForFocus.append( widget ); d->watchedForFocus.append( widget );
widget->installEventFilter( this ); widget->installEventFilter( this );
} }
} } else if ( index != -1 ) {
else if (index != -1)
{
d->watchedForFocus.removeAt( index ); d->watchedForFocus.removeAt( index );
widget->removeEventFilter( this ); widget->removeEventFilter( this );
} }
@ -148,8 +140,10 @@ void Applet::watchForFocus(QObject *widget, bool watch)
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; return;
}
emit requestFocus(focus); emit requestFocus(focus);
} }
@ -159,12 +153,9 @@ bool Applet::eventFilter(QObject *o, QEvent * e)
if ( !d->watchedForFocus.contains( o ) ) if ( !d->watchedForFocus.contains( o ) )
{ {
if ( e->type() == QEvent::MouseButtonRelease || if ( e->type() == QEvent::MouseButtonRelease ||
e->type() == QEvent::FocusIn) e->type() == QEvent::FocusIn ) {
{
needsFocus( true ); needsFocus( true );
} } else if ( e->type() == QEvent::FocusOut ) {
else if (e->type() == QEvent::FocusOut)
{
needsFocus( false ); needsFocus( false );
} }
} }

View File

@ -40,7 +40,7 @@ Theme::Theme(QObject* parent)
: QObject(parent), : QObject(parent),
d(new Private) d(new Private)
{ {
KConfig config("plasma"); KConfig config( "plasmarc" );
KConfigGroup group( &config, "Theme" ); KConfigGroup group( &config, "Theme" );
d->themeName = group.readEntry( "name", d->themeName ); d->themeName = group.readEntry( "name", d->themeName );
} }
@ -56,8 +56,9 @@ QString Theme::themeName() const
QString Theme::imagePath( const QString& name ) const QString Theme::imagePath( const QString& name ) const
{ {
return KStandardDirs::locate("data", "desktoptheme/" + d->themeName return KStandardDirs::locate( "data", "desktoptheme/" +
+ "/" + name + ".svg"); d->themeName +
"/" + name + ".svg" );
} }
} }