Hi,
I have used code like this (QtMobility-1.0.0-beta1).
I declare the manager as a class member in the .h file.
Code:
QMessageManager m_messageManager;
In the constructor I setup the manager and connect the messageAdded-signal to my handler-slot.
Code:
m_messageManager.registerNotificationFilter(QMessageFilter::byStandardFolder(QMessage::InboxFolder));
connect(&m_messageManager,
SIGNAL(messageAdded(const QMessageId&, const QMessageManager::NotificationFilterIdSet&)),
this, SLOT(receiveMessage(const QMessageId&)));
and my handler-slot looks like this.
Code:
void MainWindow::receiveMessage(const QMessageId& id)
{
qDebug() << "Receive message " << id.toString();
// TODO: You must find more sophisticated approach than this while -loop here.
while (m_messageManager.message(id).type() == QMessage::NoType);
QMessage message(m_messageManager.message(id));
QString subject = message.subject();
if (subject.length() == 0) {
subject = message.textContent(); // This function was not documented
// (when I last looked the API documents)
}
qDebug() << message.type() << message.from().recipient() << subject;
}
I hope that this code snippet put you in right path.