Hi,
Currently storing messages without an account is not supported.
There's some code in tests/auto/support for creating accounts that might be
helpful to you, (You could create your own account and store the messages
there). But this autotest support library is not a public part of the API, it's
not officially supported, and some functionality is not available on some
platforms (e.g. can't creating SMS accounts on Fremantle).
Please also be aware that running the qmessagestore autotest will erase any
messages on the device.
Kind regards,
Don Sanders
On 2010-08-19T02:55:17, ext James Ausmus wrote:
> Is it possible to use QtMessaging/QMessageManager purely as a message store,
> with no accounts configured, or no account specified for the message?
>
> I'm basically looking for an easy API to just store and retrieve arbitrary
> messages, using arbitrary QMessageAddress addresses. Here's what I've tried
> so
> far, but it always returns error 2, which is a
> QMessageManager::ConstraintFailure:
>
>
> QMessageManager *qmm = AccountManager::getInstance()-
> >getQMessageManager();
>
> if (!qmm) {
> qWarning() << QString("No QMessageManager!");
> return msg;
> }
>
> QMessageAddress *selfAddr = mAccount->getSelfMessageAddress();
> if (!selfAddr) {
> qWarning() << QString("No selfAddr for account");
> return msg;
> }
>
> QMessage *qmsg = new QMessage();
>
> qmsg->setFrom(*selfAddr);
> qmsg->setTo(*mQAddress);
> qmsg->setDate(msg->getDateTime());
> qmsg->setBody(msg->getText());
> qmsg->setStatus(QMessage::Read);
> qmsg->setType(QMessage::InstantMessage);
>
> if (!qmm->addMessage(qmsg)) {
> qWarning() << QString("Couldn't save sent message to history:
> %1!").arg(QString::number(qmm->error()));
> } else {
> qDebug() << QString("Success saving sent message to history!
> Woot!");
> }
>
>
> Any thoughts?
>
> Thanks!
>
> -James
> _______________________________________________
> Qt-mobility-feedback mailing list
> [email protected]
> http://lists.trolltech.com/mailman/listinfo/qt-mobility-feedback
>
_______________________________________________
Qt-mobility-feedback mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-mobility-feedback