maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   How to send a SMS to multiple numbers using Qt? (https://talk.maemo.org/showthread.php?t=72533)

sakya 2011-04-26 18:46

How to send a SMS to multiple numbers using Qt?
 
Hi!

I tried to send a SMS to multiple numbers using this code:
Code:

QMessage message;
QMessageService service;

message.setType(QMessage::Sms);

QMessageAddressList receiver;
foreach(int id, toSend){
    Contact* c = CommonStatic::GetContact(id);
    if (c){
        QMessageAddress adr(QMessageAddress::Phone, c->Number);
        receiver.append(adr);
    }
}
message.setTo(receiver);
if (!service.compose(message)){
    CommonStatic::ErrorMessage(this, tr("Failed to compose SMS"));
}

The receiver list is correctly populated with QMessageAddress with the correct numbers, but the conversation window displays only one contact.

What's wrong with my code, or how can I send a SMS to multiple contacts?

Many thanks.

sakya 2011-04-27 13:47

Re: How to send a SMS to multiple numbers using Qt?
 
Ok, QtMobility just ignores all the adresses except the first:
Code:

QUrl smsUrl((QString("sms:%1").arg(message.to().first().addressee())));
smsUrl.addQueryItem("body",message.textContent());
hildon_uri_open(smsUrl.toString().toStdString().c_str(),NULL,NULL);

Is there some documentation about the syntax of the uri to pass to hildon_uri_open?

sakya 2011-04-30 14:51

Re: How to send a SMS to multiple numbers using Qt?
 
Answer: just set the uri to "sms:XXXXXXX, XXXXXXXX, XXXXXXX" to send an SMS to multiple numbers. ;)


All times are GMT. The time now is 09:26.

vBulletin® Version 3.8.8