avoid infinite recursion

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=800035
This commit is contained in:
Aaron J. Seigo 2008-04-23 04:50:44 +00:00
parent 36bc2c4e97
commit 19b4f6c71f
2 changed files with 17 additions and 10 deletions

View File

@ -44,6 +44,7 @@ class Theme::Private
public:
Private()
: locolor(false),
isDefault(false),
compositingActive(KWindowSystem::compositingActive())
{
generalFont = QApplication::font();
@ -64,14 +65,15 @@ public:
static const char *defaultTheme;
static PackageStructure::Ptr packageStructure;
QString themeName;
QString app;
KSharedConfigPtr colors;
QFont generalFont;
bool locolor;
bool compositingActive;
QString themeName;
QString app;
KSharedConfigPtr colors;
QFont generalFont;
bool locolor;
bool compositingActive;
bool isDefault;
#ifdef Q_WS_X11
KSelectionWatcher *compositeWatch;
KSelectionWatcher *compositeWatch;
#endif
};
@ -81,6 +83,11 @@ const char *Theme::Private::defaultTheme = "default";
class ThemeSingleton
{
public:
ThemeSingleton()
{
self.d->isDefault = true;
}
Theme self;
};
@ -114,7 +121,6 @@ Theme::Theme(QObject* parent)
Theme::~Theme()
{
d->config().writeEntry("name", d->themeName);
delete d;
}
@ -195,8 +201,8 @@ void Theme::setThemeName(const QString &themeName)
d->colors = KSharedConfig::openConfig(colorsFile);
}
if (this == defaultTheme()) {
// we're the defualt theme, let's save our state
if (d->isDefault) {
// we're the default theme, let's save our state
KConfigGroup cg = d->config();
if (Private::defaultTheme == d->themeName) {
cg.deleteEntry("name");

View File

@ -154,6 +154,7 @@ class PLASMA_EXPORT Theme : public QObject
void colorsChanged();
private:
friend class ThemeSingleton;
class Private;
Private* const d;
};