akonadi
22 #include "showaddressaction.h"
24 #include "contactactionssettings.h"
26 #include <kabc/address.h>
28 #include <ktoolinvocation.h>
30 using namespace Akonadi;
32 static void replaceArguments(QString & templateStr,
const KABC::Address &address)
34 templateStr.replace( QLatin1String(
"%s" ), address.street() ).
35 replace( QLatin1String(
"%r" ), address.region() ).
36 replace( QLatin1String(
"%l" ), address.locality() ).
37 replace( QLatin1String(
"%z" ), address.postalCode() ).
38 replace( QLatin1String(
"%n" ), address.country() ).
39 replace( QLatin1String(
"%c" ), address.countryToISO( address.country() ) );
42 void ShowAddressAction::showAddress(
const KABC::Address &address )
45 ContactActionsSettings::self()->readConfig();
47 if ( ContactActionsSettings::self()->showAddressAction() == ContactActionsSettings::UseBrowser ) {
48 QString urlTemplate = ContactActionsSettings::self()->addressUrl();
49 replaceArguments(urlTemplate, address);
50 if ( !urlTemplate.isEmpty() ) {
51 KToolInvocation::invokeBrowser( urlTemplate );
54 QString commandTemplate = ContactActionsSettings::self()->addressCommand();
55 replaceArguments(commandTemplate, address);
57 if ( !commandTemplate.isEmpty() ) {
58 KRun::runCommand( commandTemplate, 0 );
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:00:27 by
doxygen 1.8.7 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.