summaryrefslogtreecommitdiffabout
path: root/kaddressbook/addresseeconfig.cpp
Unidiff
Diffstat (limited to 'kaddressbook/addresseeconfig.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/addresseeconfig.cpp94
1 files changed, 94 insertions, 0 deletions
diff --git a/kaddressbook/addresseeconfig.cpp b/kaddressbook/addresseeconfig.cpp
new file mode 100644
index 0000000..ea0436f
--- a/dev/null
+++ b/kaddressbook/addresseeconfig.cpp
@@ -0,0 +1,94 @@
1/*
2 This file is part of KAddressBook.
3 Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution.
22*/
23
24#include "addresseeconfig.h"
25#include "kabprefs.h"
26//US
27#include <kstandarddirs.h>
28#include <qfileinfo.h>
29
30using namespace KABC;
31
32static AddresseeConfig* extern_AddresseeConfig = 0;
33static KConfig * extern_Config = 0;
34
35AddresseeConfig::AddresseeConfig()
36{
37
38
39}
40AddresseeConfig::~AddresseeConfig()
41{
42 delete AddresseeConfig::config();
43}
44
45
46AddresseeConfig* AddresseeConfig::instance()
47{
48 if ( ! extern_AddresseeConfig )
49 extern_AddresseeConfig = new AddresseeConfig();
50 return extern_AddresseeConfig;
51}
52KConfig* AddresseeConfig::config()
53{
54 if ( ! extern_Config ) {
55 QString conf = locateLocal("config", "kaddressrc");
56 extern_Config= new KConfig( conf );
57 }
58 return extern_Config;
59}
60
61
62void AddresseeConfig::setUid( const QString & uid )
63{
64 AddresseeConfig::config()->setGroup( uid );
65 mUid = uid;
66}
67
68void AddresseeConfig::setAutomaticNameParsing( bool value )
69{
70 AddresseeConfig::config()->writeEntry( "AutomaticNameParsing", value );
71}
72
73 bool AddresseeConfig::automaticNameParsing()
74{
75
76 return AddresseeConfig::config()->readBoolEntry( "AutomaticNameParsing",
77 KABPrefs::instance()->mAutomaticNameParsing );
78}
79
80void AddresseeConfig::setNoDefaultAddrTypes( const QValueList<int> &types )
81{
82 AddresseeConfig::config()->writeEntry( "NoDefaultAddrTypes", types );
83 AddresseeConfig::config()->sync();
84}
85
86 QValueList<int> AddresseeConfig::noDefaultAddrTypes() const
87{
88 return AddresseeConfig::config()->readIntListEntry( "NoDefaultAddrTypes" );
89}
90
91void AddresseeConfig::remove( const QString & uid )
92{
93 AddresseeConfig::config()->deleteGroup( uid );
94}