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

tdeabc

  • tdeabc
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 <tdeconfig.h>
23 #include <tdelocale.h>
24 
25 #include "addresseehelper.h"
26 
27 using namespace TDEABC;
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( "TDEABC::AddresseeHelper" )
43 {
44  initSettings();
45 
46  connectDCOPSignal( "kaddressbook", "TDEABC::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  TDEConfig config( "tdeabcrc", 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 }
TDEConfig
TDEABC
static data, shared by ALL addressee objects
Definition: address.h:48
tdelocale.h

tdeabc

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

tdeabc

Skip menu "tdeabc"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeabc by doxygen 1.8.8
This website is maintained by Timothy Pearson.