akonadi/contact
22 #include "dialphonenumberaction.h"
24 #include "contactactionssettings.h"
26 #include "qskypedialer.h"
28 #include "qwincedialer.h"
31 #include <kabc/phonenumber.h>
33 #include <kconfiggroup.h>
35 #include <kmessagebox.h>
38 using namespace Akonadi;
40 static QString strippedDialNumber(
const QString &number )
44 for (
int i = 0; i < number.length(); ++i ) {
45 const QChar character = number.at( i );
46 if ( character.isDigit() || ( character == QLatin1Char(
'+' ) && i == 0 ) ) {
54 void DialPhoneNumberAction::dialNumber(
const KABC::PhoneNumber &number )
57 ContactActionsSettings::self()->readConfig();
59 QDialer *dialer = NULL;
61 if ( ContactActionsSettings::self()->dialPhoneNumberAction() == ContactActionsSettings::UseSkype ) {
62 dialer =
new QSkypeDialer( QLatin1String(
"AkonadiContacts" ) );
65 else if ( ContactActionsSettings::self()->dialPhoneNumberAction() == ContactActionsSettings::UseWinCE ) {
66 dialer =
new QWinCEDialer( QLatin1String(
"AkonadiContacts" ) );
70 if ( !dialer->dialNumber( strippedDialNumber( number.number().trimmed() ) ) ) {
71 KMessageBox::sorry( 0, dialer->errorMessage() );
77 QString command = ContactActionsSettings::self()->phoneCommand();
79 if ( command.isEmpty() ) {
80 KMessageBox::sorry( 0, i18n(
"There is no application set which could be executed. Please go to the settings dialog and configure one." ) );
88 command = command.replace( QLatin1String(
"%N" ), number.number() );
89 command = command.replace( QLatin1String(
"%n" ), strippedDialNumber( number.number().trimmed() ) );
91 KRun::runCommand( command, 0 );
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Sat Jul 13 2013 01:28:42 by
doxygen 1.8.3.1 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.