24 #include <tdeapplication.h>
25 #include <tdeconfig.h>
26 #include <tdeversion.h>
27 #include <tdeglobal.h>
28 #include <tdelocale.h>
29 #include <tdemessagebox.h>
30 #include <kstaticdeleter.h>
34 #include "locationmap.h"
36 LocationMap *LocationMap::mSelf = 0;
37 static KStaticDeleter<LocationMap> locationMapDeleter;
39 LocationMap::LocationMap()
43 LocationMap::~LocationMap()
47 LocationMap *LocationMap::instance()
50 locationMapDeleter.setObject( mSelf, new LocationMap );
55 void LocationMap::showAddress( const TDEABC::Address &addr )
57 KURL url( createUrl( addr ) );
61 kapp->invokeBrowser( url.url() );
64 TQString LocationMap::createUrl( const TDEABC::Address &addr )
75 TQString urlTemplate = KABPrefs::instance()->locationMapURL().arg( TDEGlobal::locale()->country() );
76 if ( urlTemplate.isEmpty() ) {
77 KMessageBox::error( 0, i18n( "No service provider available for map lookup!\nPlease add one in the configuration dialog." ) );
81 #if TDE_VERSION >= 319
82 return urlTemplate.replace( "%s", addr.street() ).
83 replace( "%r", addr.region() ).
84 replace( "%l", addr.locality() ).
85 replace( "%z", addr.postalCode() ).
86 replace( "%c", addr.countryToISO( addr.country() ) );
88 return urlTemplate.replace( "%s", addr.street() ).
89 replace( "%r", addr.region() ).
90 replace( "%l", addr.locality() ).
91 replace( "%z", addr.postalCode() ).
96 #include "locationmap.moc"
|