kaddressbook

addresseeconfig.cpp
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18
19 As a special exception, permission is given to link this program
20 with any edition of TQt, and distribute the resulting executable,
21 without including the source code for TQt in the source distribution.
22*/
23
24#include "addresseeconfig.h"
25#include "kabprefs.h"
26
27using namespace TDEABC;
28
29AddresseeConfig::AddresseeConfig()
30{
31 mAddressee = Addressee();
32}
33
34AddresseeConfig::AddresseeConfig( const Addressee &addr )
35{
36 mAddressee = addr;
37}
38
39void AddresseeConfig::setAddressee( const Addressee &addr )
40{
41 mAddressee = addr;
42}
43
44Addressee AddresseeConfig::addressee()
45{
46 return mAddressee;
47}
48
49void AddresseeConfig::setAutomaticNameParsing( bool value )
50{
51 TDEConfig config( "kaddressbook_addrconfig" );
52 config.setGroup( mAddressee.uid() );
53 config.writeEntry( "AutomaticNameParsing", value );
54 config.sync();
55}
56
57bool AddresseeConfig::automaticNameParsing()
58{
59 TDEConfig config( "kaddressbook_addrconfig" );
60 config.setGroup( mAddressee.uid() );
61 return config.readBoolEntry( "AutomaticNameParsing",
62 KABPrefs::instance()->automaticNameParsing() );
63}
64
65void AddresseeConfig::setNoDefaultAddrTypes( const TQValueList<int> &types )
66{
67 TDEConfig config( "kaddressbook_addrconfig" );
68 config.setGroup( mAddressee.uid() );
69 config.writeEntry( "NoDefaultAddrTypes", types );
70 config.sync();
71}
72
73TQValueList<int> AddresseeConfig::noDefaultAddrTypes() const
74{
75 TDEConfig config( "kaddressbook_addrconfig" );
76 config.setGroup( mAddressee.uid() );
77 return config.readIntListEntry( "NoDefaultAddrTypes" );
78}
79
80void AddresseeConfig::setCustomFields( const TQStringList &fields )
81{
82 TDEConfig config( "kaddressbook_addrconfig" );
83 config.setGroup( mAddressee.uid() );
84 config.writeEntry( "LocalCustomFields", fields );
85 config.sync();
86}
87
88TQStringList AddresseeConfig::customFields() const
89{
90 TDEConfig config( "kaddressbook_addrconfig" );
91 config.setGroup( mAddressee.uid() );
92 return config.readListEntry( "LocalCustomFields" );
93}
94
95void AddresseeConfig::remove()
96{
97 TDEConfig config( "kaddressbook_addrconfig" );
98 config.deleteGroup( mAddressee.uid() );
99}