blokkalbehavioursettings.cpp
00001
00002
00003
00004 #include "blokkalbehavioursettings.h"
00005
00006 #include <kglobal.h>
00007 #include <QtCore/QFile>
00008
00009 using namespace Blokkal;
00010
00011 namespace Blokkal {
00012 class BehaviourSettingsHelper
00013 {
00014 public:
00015 BehaviourSettingsHelper() : q(0) {}
00016 ~BehaviourSettingsHelper() { delete q; }
00017 BehaviourSettings *q;
00018 };
00019 }
00020 K_GLOBAL_STATIC(BehaviourSettingsHelper, s_globalBehaviourSettings)
00021 BehaviourSettings *BehaviourSettings::self()
00022 {
00023 if (!s_globalBehaviourSettings->q) {
00024 new BehaviourSettings;
00025 s_globalBehaviourSettings->q->readConfig();
00026 }
00027
00028 return s_globalBehaviourSettings->q;
00029 }
00030
00031 BehaviourSettings::BehaviourSettings( )
00032 : KConfigSkeleton( QLatin1String( "blokkalrc" ) )
00033 {
00034 Q_ASSERT(!s_globalBehaviourSettings->q);
00035 s_globalBehaviourSettings->q = this;
00036 setCurrentGroup( QLatin1String( "Miscellaneous" ) );
00037
00038 mAutoConnectItem = new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String( "auto-connect" ), mAutoConnect, false );
00039 addItem( mAutoConnectItem, QLatin1String( "autoConnect" ) );
00040 QList<KConfigSkeleton::ItemEnum::Choice> valueswebPageLoadingPolicy;
00041 {
00042 KConfigSkeleton::ItemEnum::Choice choice;
00043 choice.name = QLatin1String( "LoadInDefaultBrowser" );
00044 valueswebPageLoadingPolicy.append( choice );
00045 }
00046 {
00047 KConfigSkeleton::ItemEnum::Choice choice;
00048 choice.name = QLatin1String( "LoadDisabled" );
00049 valueswebPageLoadingPolicy.append( choice );
00050 }
00051 mWebPageLoadingPolicyItem = new KConfigSkeleton::ItemEnum( currentGroup(), QLatin1String( "web-page-loading-policy" ), mWebPageLoadingPolicy, valueswebPageLoadingPolicy, EnumWebPageLoadingPolicy::LoadInDefaultBrowser );
00052 addItem( mWebPageLoadingPolicyItem, QLatin1String( "webPageLoadingPolicy" ) );
00053
00054 setCurrentGroup( QLatin1String( "MainWindow" ) );
00055
00056 mShowSystemTrayItem = new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String( "show-systemtray" ), mShowSystemTray, true );
00057 addItem( mShowSystemTrayItem, QLatin1String( "showSystemTray" ) );
00058 mStartHiddenItem = new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String( "start-hidden" ), mStartHidden, false );
00059 addItem( mStartHiddenItem, QLatin1String( "startHidden" ) );
00060 mAutoHideItem = new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String( "auto-hide" ), mAutoHide, false );
00061 addItem( mAutoHideItem, QLatin1String( "autoHide" ) );
00062 mAutoHideTimeoutItem = new KConfigSkeleton::ItemUInt( currentGroup(), QLatin1String( "auto-hide-timeout" ), mAutoHideTimeout, 30 );
00063 addItem( mAutoHideTimeoutItem, QLatin1String( "autoHideTimeout" ) );
00064 }
00065
00066 BehaviourSettings::~BehaviourSettings()
00067 {
00068 }
00069