korganizer

docprefs.cpp
1/*
2 This file is part of KOrganizer.
3
4 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
20 As a special exception, permission is given to link this program
21 with any edition of TQt, and distribute the resulting executable,
22 without including the source code for TQt in the source distribution.
23*/
24
25#include <ksimpleconfig.h>
26#include <tdestandarddirs.h>
27#include <kdebug.h>
28
29#include "docprefs.h"
30
31KSimpleConfig *DocPrefs::mConfig = 0;
32
33DocPrefs::DocPrefs( const TQString &type )
34{
35 if ( !mConfig ) {
36 mConfig = new KSimpleConfig( locateLocal( "data", "korganizer/docprefs." + type + ".tdeconfig" ) );
37 }
38}
39
40DocPrefs::~DocPrefs()
41{
42 mConfig->sync();
43}
44
45void DocPrefs::setDoc( const TQString &identifier )
46{
47 mDocId = identifier;
48}
49
50TQString DocPrefs::doc() const
51{
52 return mDocId;
53}
54
55bool DocPrefs::readBoolEntry( const TQString &id ) const
56{
57 mConfig->setGroup( mDocId );
58 bool result = mConfig->readBoolEntry( id, false );
59// kdDebug(5850) << "DocPrefs::readEntry(): " << id << " : " << (result ? "True" : "False" ) << endl;
60 return result;
61}
62
63void DocPrefs::writeEntry( const TQString &id, bool value )
64{
65// kdDebug(5850) << "DocPrefs::writeEntry(): " << id << " : " << (value ? "True" : "False" ) << endl;
66 mConfig->setGroup( mDocId );
67 mConfig->writeEntry( id, value );
68}