20 #include <tqapplication.h>
22 #include <tdeconfig.h>
25 #include "addresseehelper.h"
29 AddresseeHelper * AddresseeHelper::s_self;
32 AddresseeHelper *AddresseeHelper::self()
35 s_self =
new AddresseeHelper();
40 AddresseeHelper::AddresseeHelper()
42 DCOPObject(
"TDEABC::AddresseeHelper" )
46 connectDCOPSignal(
"kaddressbook",
"TDEABC::AddressBookConfig",
47 "changed()",
"initSettings()",
false );
51 void AddresseeHelper::addToSet(
const TQStringList& list,
52 std::set<TQString>& container )
54 TQStringList::ConstIterator it;
55 for ( it = list.begin(); it != list.end(); ++it ) {
56 if ( !(*it).isEmpty() )
57 container.insert( *it );
61 void AddresseeHelper::initSettings()
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." ) );
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." ) );
80 mPrefixes.insert(
"van" );
81 mPrefixes.insert(
"von" );
82 mPrefixes.insert(
"de" );
84 TDEConfig config(
"tdeabcrc",
true,
false );
85 config.setGroup(
"General" );
87 addToSet( config.readListEntry(
"Prefixes" ), mTitles );
88 addToSet( config.readListEntry(
"Inclusions" ), mPrefixes );
89 addToSet( config.readListEntry(
"Suffixes" ), mSuffixes );
90 mTradeAsFamilyName = config.readBoolEntry(
"TradeAsFamilyName",
true );
93 bool AddresseeHelper::containsTitle(
const TQString& title )
const
95 return mTitles.find( title ) != mTitles.end();
98 bool AddresseeHelper::containsPrefix(
const TQString& prefix )
const
100 return mPrefixes.find( prefix ) != mPrefixes.end();
103 bool AddresseeHelper::containsSuffix(
const TQString& suffix )
const
105 return mSuffixes.find( suffix ) != mSuffixes.end();
108 bool AddresseeHelper::tradeAsFamilyName()
const
110 return mTradeAsFamilyName;
static data, shared by ALL addressee objects