• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kabc
 

kabc

  • kabc
addresseehelper.cpp
1 /*
2  This file is part of the KDE libraries
3  Copyright (C) 2003 Carsten Pfeiffer <pfeiffer@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation, version 2.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #include <tqapplication.h>
21 
22 #include <kconfig.h>
23 #include <klocale.h>
24 
25 #include "addresseehelper.h"
26 
27 using namespace KABC;
28 
29 AddresseeHelper * AddresseeHelper::s_self;
30 
31 // static
32 AddresseeHelper *AddresseeHelper::self()
33 {
34  if ( !s_self )
35  s_self = new AddresseeHelper();
36 
37  return s_self;
38 }
39 
40 AddresseeHelper::AddresseeHelper()
41  : TQObject( tqApp ),
42  DCOPObject( "KABC::AddresseeHelper" )
43 {
44  initSettings();
45 
46  connectDCOPSignal( "kaddressbook", "KABC::AddressBookConfig",
47  "changed()", "initSettings()", false );
48 }
49 
50 // static
51 void AddresseeHelper::addToSet( const TQStringList& list,
52  std::set<TQString>& container )
53 {
54  TQStringList::ConstIterator it;
55  for ( it = list.begin(); it != list.end(); ++it ) {
56  if ( !(*it).isEmpty() )
57  container.insert( *it );
58  }
59 }
60 
61 void AddresseeHelper::initSettings()
62 {
63  mTitles.clear();
64  mSuffixes.clear();
65  mPrefixes.clear();
66 
67  mTitles.insert( i18n( "Dr." ) );
68  mTitles.insert( i18n( "Miss" ) );
69  mTitles.insert( i18n( "Mr." ) );
70  mTitles.insert( i18n( "Mrs." ) );
71  mTitles.insert( i18n( "Ms." ) );
72  mTitles.insert( i18n( "Prof." ) );
73 
74  mSuffixes.insert( i18n( "I" ) );
75  mSuffixes.insert( i18n( "II" ) );
76  mSuffixes.insert( i18n( "III" ) );
77  mSuffixes.insert( i18n( "Jr." ) );
78  mSuffixes.insert( i18n( "Sr." ) );
79 
80  mPrefixes.insert( "van" );
81  mPrefixes.insert( "von" );
82  mPrefixes.insert( "de" );
83 
84  KConfig config( "kabcrc", true, false ); // readonly, no kdeglobals
85  config.setGroup( "General" );
86 
87  addToSet( config.readListEntry( "Prefixes" ), mTitles );
88  addToSet( config.readListEntry( "Inclusions" ), mPrefixes );
89  addToSet( config.readListEntry( "Suffixes" ), mSuffixes );
90  mTradeAsFamilyName = config.readBoolEntry( "TradeAsFamilyName", true );
91 }
92 
93 bool AddresseeHelper::containsTitle( const TQString& title ) const
94 {
95  return mTitles.find( title ) != mTitles.end();
96 }
97 
98 bool AddresseeHelper::containsPrefix( const TQString& prefix ) const
99 {
100  return mPrefixes.find( prefix ) != mPrefixes.end();
101 }
102 
103 bool AddresseeHelper::containsSuffix( const TQString& suffix ) const
104 {
105  return mSuffixes.find( suffix ) != mSuffixes.end();
106 }
107 
108 bool AddresseeHelper::tradeAsFamilyName() const
109 {
110  return mTradeAsFamilyName;
111 }
klocale.h
KConfig

kabc

Skip menu "kabc"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kabc

Skip menu "kabc"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kabc by doxygen 1.8.6
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |