00001
00002
00003
00004 #include "blokkalappearancesettings.h"
00005
00006 #include <kglobal.h>
00007 #include <QtCore/QFile>
00008
00009 using namespace Blokkal;
00010
00011 namespace Blokkal {
00012 class AppearanceSettingsHelper
00013 {
00014 public:
00015 AppearanceSettingsHelper() : q(0) {}
00016 ~AppearanceSettingsHelper() { delete q; }
00017 AppearanceSettings *q;
00018 };
00019 }
00020 K_GLOBAL_STATIC(AppearanceSettingsHelper, s_globalAppearanceSettings)
00021 AppearanceSettings *AppearanceSettings::self()
00022 {
00023 if (!s_globalAppearanceSettings->q) {
00024 new AppearanceSettings;
00025 s_globalAppearanceSettings->q->readConfig();
00026 }
00027
00028 return s_globalAppearanceSettings->q;
00029 }
00030
00031 AppearanceSettings::AppearanceSettings( )
00032 : KConfigSkeleton( QLatin1String( "blokkalrc" ) )
00033 {
00034 Q_ASSERT(!s_globalAppearanceSettings->q);
00035 s_globalAppearanceSettings->q = this;
00036 setCurrentGroup( QLatin1String( "SyntaxHighlightingSpelling" ) );
00037
00038 mHighlightSyntaxItem = new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String( "highlight-syntax" ), mHighlightSyntax, true );
00039 addItem( mHighlightSyntaxItem, QLatin1String( "highlightSyntax" ) );
00040 mHighlightTagBoldItem = new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String( "highlight-tag-bold" ), mHighlightTagBold, true );
00041 addItem( mHighlightTagBoldItem, QLatin1String( "highlightTagBold" ) );
00042 mHighlightTagItalicItem = new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String( "highlight-tag-italic" ), mHighlightTagItalic, false );
00043 addItem( mHighlightTagItalicItem, QLatin1String( "highlightTagItalic" ) );
00044 mHighlightTagColorItem = new KConfigSkeleton::ItemColor( currentGroup(), QLatin1String( "highlight-tag-color" ), mHighlightTagColor, QColor( "darkblue" ) );
00045 addItem( mHighlightTagColorItem, QLatin1String( "highlightTagColor" ) );
00046 mHighlightStringBoldItem = new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String( "highlight-string-bold" ), mHighlightStringBold, false );
00047 addItem( mHighlightStringBoldItem, QLatin1String( "highlightStringBold" ) );
00048 mHighlightStringItalicItem = new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String( "highlight-string-italic" ), mHighlightStringItalic, false );
00049 addItem( mHighlightStringItalicItem, QLatin1String( "highlightStringItalic" ) );
00050 mHighlightStringColorItem = new KConfigSkeleton::ItemColor( currentGroup(), QLatin1String( "highlight-string-color" ), mHighlightStringColor, QColor( "darkgreen" ) );
00051 addItem( mHighlightStringColorItem, QLatin1String( "highlightStringColor" ) );
00052 mHighlightValueBoldItem = new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String( "highlight-value-bold" ), mHighlightValueBold, true );
00053 addItem( mHighlightValueBoldItem, QLatin1String( "highlightValueBold" ) );
00054 mHighlightValueItalicItem = new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String( "highlight-value-italic" ), mHighlightValueItalic, false );
00055 addItem( mHighlightValueItalicItem, QLatin1String( "highlightValueItalic" ) );
00056 mHighlightValueColorItem = new KConfigSkeleton::ItemColor( currentGroup(), QLatin1String( "highlight-value-color" ), mHighlightValueColor, QColor( "purple" ) );
00057 addItem( mHighlightValueColorItem, QLatin1String( "highlightValueColor" ) );
00058 mCheckSpellingItem = new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String( "check-spelling" ), mCheckSpelling, true );
00059 addItem( mCheckSpellingItem, QLatin1String( "checkSpelling" ) );
00060 }
00061
00062 AppearanceSettings::~AppearanceSettings()
00063 {
00064 }
00065
00066 void AppearanceSettings::usrWriteConfig()
00067 {
00068 KConfigSkeleton::usrWriteConfig();
00069
00070 if ( mSettingsChanged & signalAppearanceSettingsChanged )
00071 emit appearanceSettingsChanged();
00072
00073 mSettingsChanged = 0;
00074 }
00075
00076 #include "blokkalappearancesettings.moc"
00077