Reply
Thread Tools
Posts: 8 | Thanked: 0 times | Joined on Jun 2012 @ Germany
#1
I am write a app that will generate a fake message to inform user for some events and tried to make it notify the user through message.

I generate a new message, add it to store, and it's in the SMS_draftsFoler, there is no entry in the message UI, I tried to move it to SMS_InboxFolder using QMessageService::moveMessage(), but it always failed.
I checked the parentAccount of folder and message are the same: "ring/tel/ring"

The code basically looks like this:
Code:
Message message;
    message.setBody("message helo");
    message.setType(QMessage::Sms);
    message.setParentAccountId(QMessageAccount::defaultAccount(QMessage::Sms));
    message.setTo(QMessageAddress(QMessageAddress::Phone, "+491xxxxxxxxxx"));
    message.setFrom(QMessageAddress(QMessageAddress::Phone, "+491xxxxxxxxxx"));
    message.setReceivedDate(QDateTime::currentDateTime().toUTC());
    message.setStatus(QMessage::Incoming, false);


      QMessageFolderId *inbox = new QMessageFolderId("SMS_InboxFolder");

    if(inbox->isValid())
        qDebug() <<"Valid!" << inbox->toString();
    else
        qDebug() << "Invalid!";

    QMessageFolder *folder = new QMessageFolder(*inbox);

    QList<QMessageId> list;
    list << message.id();



    if(m_manager->addMessage(&message)) qDebug() << "Good";
    else qDebug() << "Bad";


    if(m_service->moveMessages(list, *inbox))
        qDebug() << "Move successfully!";
    else
        qDebug() << "Failed to move!";

    if(m_manager->updateMessage(&message)) qDebug() << "Update seccuessfl!";
    else qDebug() << "Updata failed";
    m_service->exportUpdates(QMessageAccount::defaultAccount(QMessage::Sms));
Thanks for any help!!

Last edited by nilsLee; 2012-09-06 at 09:42.
 
Posts: 8 | Thanked: 0 times | Joined on Jun 2012 @ Germany
#2
I found the moveMessages() method just works with QMF type of message, aka email, the messageId is startwith "QMF_", but the sms's messageId is startwith "SMS_", so in the moveMessages method it will always fail to do movement.
 
Posts: 3 | Thanked: 1 time | Joined on Mar 2010
#3
Did you ever get this working?

Im working on a project where I want to insert a QMessage and want it to show up in the Messaging application but I have yet to succed with this task.

My code looks like this (Python with pyside)
Code:
            acc = QMessageAccount().defaultAccount(QMessage.Sms)

            m = QMessage()
            m.setType(QMessage.Sms)
            m.setFrom(QMessageAddress(QMessageAddress.Phone, num))
            m.setBody(message)
            m.setParentAccountId(acc)
            m.setStatus(QMessage.Incoming, True)
            m.setDate(QtCore.QDateTime.currentDateTime())

            store = QMessageManager()
            srv = QMessageService()
	    store.addMessage(m)
            srv.exportUpdates(acc)
 
Posts: 8 | Thanked: 0 times | Joined on Jun 2012 @ Germany
#4
you mean you get it working or not? I think the addMessage will always add it into draf folder instead of incoming folder, so nothing will happen, no notification, nothing.
 
Posts: 8 | Thanked: 0 times | Joined on Jun 2012 @ Germany
#5
Originally Posted by adisbladis View Post
Did you ever get this working?

Im working on a project where I want to insert a QMessage and want it to show up in the Messaging application but I have yet to succed with this task.

My code looks like this (Python with pyside)
Code:
            acc = QMessageAccount().defaultAccount(QMessage.Sms)

            m = QMessage()
            m.setType(QMessage.Sms)
            m.setFrom(QMessageAddress(QMessageAddress.Phone, num))
            m.setBody(message)
            m.setParentAccountId(acc)
            m.setStatus(QMessage.Incoming, True)
            m.setDate(QtCore.QDateTime.currentDateTime())

            store = QMessageManager()
            srv = QMessageService()
	    store.addMessage(m)
            srv.exportUpdates(acc)

you mean you get it working or not? I think the addMessage will always add it into draf folder instead of incoming folder, so nothing will happen, no notification, nothing.
 
GreatGonzo's Avatar
Posts: 275 | Thanked: 389 times | Joined on Feb 2010 @ Sydney
#6
qmessageservice is half finished and buggy. I can't believe how bad it is on harmattan. tried out with busms and it put me off writing more harmattan stuff
__________________
Quick Widgets - http://wiki.maemo.org/Quick_Widgets
 
Reply


 
Forum Jump


All times are GMT. The time now is 01:32.