Ejemplo n.º 1
0
void PeopleApplication::callNumberToActiveService(const QString& number){

  // hard-coded details of the MeeGo Dialer application
  QDBusInterface dialer("com.meego.dialer", "com/meego/dialer",
			"com.meego.dialer");
  if (!dialer.isValid()) {
    qWarning() << "Dialing" << number << "- could not find dialer app";
    return;
  }

  QDBusReply<void> reply = dialer.call(QDBus::BlockWithGui, "call", number);
  if (!reply.isValid())
    qWarning() << "Dialing" << number << "failed:" <<
      reply.error().message();        
}
Ejemplo n.º 2
0
void SendSmsAction::sendSms( const KABC::PhoneNumber &phoneNumber )
{
    const QString number = phoneNumber.number().trimmed();

    QPointer<SmsDialog> dlg( new SmsDialog( number ) );
    if ( dlg->exec() != QDialog::Accepted ) { // the cancel button has been clicked
        delete dlg;
        return;
    }
    const QString message = ( dlg != 0 ? dlg->message() : QString() );
    delete dlg;

    // synchronize
    ContactActionsSettings::self()->readConfig();

    //   we handle skype separated
    if ( ContactActionsSettings::self()->sendSmsAction() == ContactActionsSettings::UseSkypeSms ) {
        QSkypeDialer dialer( QLatin1String( "AkonadiContacts" ) );
        if ( dialer.sendSms( number, message ) ) {
            // I'm not sure whether here should be a notification.
            // Skype can do a notification itself if whished.
        } else {
            KMessageBox::sorry( 0, dialer.errorMessage() );
        }

        return;
    }

    QString command = ContactActionsSettings::self()->smsCommand();

    if ( command.isEmpty() ) {
        KMessageBox::sorry( 0, i18n( "There is no application set which could be executed. Please go to the settings dialog and configure one." ) );
        return;
    }

    /*
     * %N the raw number
     * %n the number with all additional non-number characters removed
     */
    command = command.replace( QLatin1String( "%N" ), phoneNumber.number() );
    command = command.replace( QLatin1String( "%n" ), strippedSmsNumber( number ) );
    command = command.replace( QLatin1String( "%t" ), message );
    //Bug: 293232 In KDE3 We used %F to replace text
    command = command.replace( QLatin1String( "%F" ), message );
    KRun::runCommand( command, 0 );
}