akonadi/contact
22 #include "sendsmsaction.h"
24 #include "contactactionssettings.h"
25 #include "qskypedialer.h"
26 #include "smsdialog.h"
28 #include <kabc/phonenumber.h>
30 #include <kmessagebox.h>
33 static QString strippedSmsNumber(
const QString &number )
37 for (
int i = 0; i < number.length(); ++i ) {
38 const QChar character = number.at( i );
39 if ( character.isDigit() || (character == QLatin1Char(
'+' ) && i == 0) )
46 void SendSmsAction::sendSms(
const KABC::PhoneNumber &phoneNumber )
48 const QString number = phoneNumber.number().trimmed();
50 SmsDialog dlg( number );
55 ContactActionsSettings::self()->readConfig();
58 if ( ContactActionsSettings::self()->sendSmsAction() == ContactActionsSettings::UseSkypeSms ) {
59 QSkypeDialer dialer( QLatin1String(
"AkonadiContacts" ) );
60 if ( dialer.sendSms( number, dlg.message() ) ) {
64 KMessageBox::sorry( 0, dialer.errorMessage() );
70 QString command = ContactActionsSettings::self()->smsCommand();
72 if ( command.isEmpty() ) {
73 KMessageBox::sorry( 0, i18n(
"There is no application set which could be executed. Please go to the settings dialog and configure one." ) );
81 command = command.replace( QLatin1String(
"%N" ), phoneNumber.number() );
82 command = command.replace( QLatin1String(
"%n" ), strippedSmsNumber( number ) );
83 command = command.replace( QLatin1String(
"%t" ), dlg.message() );
85 command = command.replace( QLatin1String(
"%F" ), dlg.message() );
86 KRun::runCommand( command, 0 );
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Wed Nov 28 2012 21:55:24 by
doxygen 1.8.1.2 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.