Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Add SMS to the Inbox folder on N950?



  • Hi,
    I'm trying to add SMS to the Inbox folder (on Harmattan N950) but it goes to the drafts folder instead of the Inbox, here's my code to add the sms:

    @ QMessage sms;
    sms.setType(QMessage::Sms);
    sms.setParentAccountId(QMessageAccount::defaultAccount(QMessage::Sms));
    sms.setFrom(QMessageAddress(QMessageAddress::Phone,"123456"));
    sms.setTo(QMessageAddress(QMessageAddress::Phone,"1111"));
    sms.setBody("WELCOME TO QML");
    sms.setDate(QDateTime::currentDateTime());
    sms.setReceivedDate(QDateTime::currentDateTime());
    sms.setStatus(QMessage::Read);

    if (m_messageManager->addMessage(&sms)) {
        qDebug() << "Message is Added";
    } else {
        qDebug() << "Message is not added";
    }@
    

    Also I've tried to move all the SMS from the Drafts folder to the Inbox but it never work :

    @ foreach (QMessageFolderId folderId, m_messageManager->queryFolders(QMessageFolderFilter::byName("Inbox"))) {
    QMessageIdList messageList = m_messageManager->queryMessages(QMessageFilter::byStandardFolder(QMessage::DraftsFolder));
    if (m_messageService->moveMessages(messageList,folderId)) {
    qDebug() << "Message is moved to inbox" ;
    } else {
    qDebug() << "Message is not moved to inbox";
    }
    }@

    So what's wrong here and how I can add the SMS to the Inbox folder?

    Thanks in advance.


Log in to reply