maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   MeeGo / Harmattan (https://talk.maemo.org/forumdisplay.php?f=45)
-   -   any body get QMessageService::moveMessage() work? (https://talk.maemo.org/showthread.php?t=85492)

nilsLee 2012-07-14 07:36

any body get QMessageService::moveMessage() work?
 
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!!

nilsLee 2012-07-15 01:01

Re: any body get QMessageService::moveMessage() work?
 
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.

adisbladis 2012-07-21 15:41

Re: any body get QMessageService::moveMessage() work?
 
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)


nilsLee 2012-09-06 09:38

Re: any body get QMessageService::moveMessage() work?
 
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.

nilsLee 2012-09-06 09:39

Re: any body get QMessageService::moveMessage() work?
 
Quote:

Originally Posted by adisbladis (Post 1240852)
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 2012-09-06 10:00

Re: any body get QMessageService::moveMessage() work?
 
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


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

vBulletin® Version 3.8.8