Reply
Thread Tools
sakya's Avatar
Posts: 533 | Thanked: 1,341 times | Joined on Dec 2010 @ Italy
#1
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's Avatar
Posts: 533 | Thanked: 1,341 times | Joined on Dec 2010 @ Italy
#2
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's Avatar
Posts: 533 | Thanked: 1,341 times | Joined on Dec 2010 @ Italy
#3
Answer: just set the uri to "sms:XXXXXXX, XXXXXXXX, XXXXXXX" to send an SMS to multiple numbers.
 

The Following 2 Users Say Thank You to sakya For This Useful Post:
Reply


 
Forum Jump


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