kjots
KJotsSettings.cpp
Go to the documentation of this file.00001
00002
00003
00004 #include "KJotsSettings.h"
00005
00006 #include <kglobal.h>
00007 #include <QtCore/QFile>
00008
00009 class KJotsSettingsHelper
00010 {
00011 public:
00012 KJotsSettingsHelper() : q(0) {}
00013 ~KJotsSettingsHelper() { delete q; }
00014 KJotsSettings *q;
00015 };
00016 K_GLOBAL_STATIC(KJotsSettingsHelper, s_globalKJotsSettings)
00017 KJotsSettings *KJotsSettings::self()
00018 {
00019 if (!s_globalKJotsSettings->q) {
00020 new KJotsSettings;
00021 s_globalKJotsSettings->q->readConfig();
00022 }
00023
00024 return s_globalKJotsSettings->q;
00025 }
00026
00027 KJotsSettings::KJotsSettings( )
00028 : KConfigSkeleton( QLatin1String( "kjotsrc" ) )
00029 {
00030 Q_ASSERT(!s_globalKJotsSettings->q);
00031 s_globalKJotsSettings->q = this;
00032 setCurrentGroup( QLatin1String( "kjots" ) );
00033
00034 QList<int> defaultSplitterSizes;
00035
00036 KConfigSkeleton::ItemIntList *itemSplitterSizes;
00037 itemSplitterSizes = new KConfigSkeleton::ItemIntList( currentGroup(), QLatin1String( "SplitterSizes" ), mSplitterSizes, defaultSplitterSizes );
00038 addItem( itemSplitterSizes, QLatin1String( "SplitterSizes" ) );
00039 KConfigSkeleton::ItemULongLong *itemCurrentSelection;
00040 itemCurrentSelection = new KConfigSkeleton::ItemULongLong( currentGroup(), QLatin1String( "CurrentSelection" ), mCurrentSelection );
00041 addItem( itemCurrentSelection, QLatin1String( "CurrentSelection" ) );
00042 KConfigSkeleton::ItemFont *itemFont;
00043 itemFont = new KConfigSkeleton::ItemFont( currentGroup(), QLatin1String( "Font" ), mFont, KGlobalSettings::generalFont() );
00044 addItem( itemFont, QLatin1String( "Font" ) );
00045 KConfigSkeleton::ItemBool *itemAutoSave;
00046 itemAutoSave = new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String( "AutoSave" ), mAutoSave, true );
00047 addItem( itemAutoSave, QLatin1String( "AutoSave" ) );
00048 KConfigSkeleton::ItemBool *itemUnicode;
00049 itemUnicode = new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String( "Unicode" ), mUnicode, false );
00050 addItem( itemUnicode, QLatin1String( "Unicode" ) );
00051 KConfigSkeleton::ItemInt *itemAutoSaveInterval;
00052 itemAutoSaveInterval = new KConfigSkeleton::ItemInt( currentGroup(), QLatin1String( "AutoSaveInterval" ), mAutoSaveInterval, 5 );
00053 addItem( itemAutoSaveInterval, QLatin1String( "AutoSaveInterval" ) );
00054 KConfigSkeleton::ItemULongLong *itemLastId;
00055 itemLastId = new KConfigSkeleton::ItemULongLong( currentGroup(), QLatin1String( "LastId" ), mLastId, 0 );
00056 addItem( itemLastId, QLatin1String( "LastId" ) );
00057 KConfigSkeleton::ItemString *itemBookshelfOrder;
00058 itemBookshelfOrder = new KConfigSkeleton::ItemString( currentGroup(), QLatin1String( "BookshelfOrder" ), mBookshelfOrder );
00059 addItem( itemBookshelfOrder, QLatin1String( "BookshelfOrder" ) );
00060 KConfigSkeleton::ItemBool *itemPageNamePrompt;
00061 itemPageNamePrompt = new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String( "PageNamePrompt" ), mPageNamePrompt, false );
00062 addItem( itemPageNamePrompt, QLatin1String( "PageNamePrompt" ) );
00063 }
00064
00065 KJotsSettings::~KJotsSettings()
00066 {
00067 }
00068