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 ) ) {
47 void SendSmsAction::sendSms(
const KABC::PhoneNumber &phoneNumber )
49 const QString number = phoneNumber.number().trimmed();
51 SmsDialog dlg( number );
57 ContactActionsSettings::self()->readConfig();
60 if ( ContactActionsSettings::self()->sendSmsAction() == ContactActionsSettings::UseSkypeSms ) {
61 QSkypeDialer dialer( QLatin1String(
"AkonadiContacts" ) );
62 if ( dialer.sendSms( number, dlg.message() ) ) {
66 KMessageBox::sorry( 0, dialer.errorMessage() );
72 QString command = ContactActionsSettings::self()->smsCommand();
74 if ( command.isEmpty() ) {
75 KMessageBox::sorry( 0, i18n(
"There is no application set which could be executed. Please go to the settings dialog and configure one." ) );
83 command = command.replace( QLatin1String(
"%N" ), phoneNumber.number() );
84 command = command.replace( QLatin1String(
"%n" ), strippedSmsNumber( number ) );
85 command = command.replace( QLatin1String(
"%t" ), dlg.message() );
87 command = command.replace( QLatin1String(
"%F" ), dlg.message() );
88 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:43 by
doxygen 1.8.3.1 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.