Send MMS using Qt Mobility
hamishwillee
(Talk | contribs) m (Hamishwillee - Bot update - Add ArticleMetaData) |
hamishwillee
(Talk | contribs) m (Text replace - "<code cpp>" to "<code cpp-qt>") |
||
| Line 53: | Line 53: | ||
== Header File == | == Header File == | ||
| − | <code cpp> | + | <code cpp-qt> |
#include <qmessage.h> | #include <qmessage.h> | ||
#include <qmessageservice.h> | #include <qmessageservice.h> | ||
| Line 67: | Line 67: | ||
== Source File == | == Source File == | ||
| − | <code cpp> | + | <code cpp-qt> |
m_service = new QMessageService(this); | m_service = new QMessageService(this); | ||
connect(m_service, SIGNAL(stateChanged(QMessageService::State)), this, SLOT(stateChanged(QMessageService::State))); | connect(m_service, SIGNAL(stateChanged(QMessageService::State)), this, SLOT(stateChanged(QMessageService::State))); | ||
</code> | </code> | ||
| − | <code cpp> | + | <code cpp-qt> |
bool QtMMS::sendMMS(QString picturePath, QString phoneNumber) { | bool QtMMS::sendMMS(QString picturePath, QString phoneNumber) { | ||
// Send MMS | // Send MMS | ||
| Line 87: | Line 87: | ||
</code> | </code> | ||
| − | <code cpp> | + | <code cpp-qt> |
void QtMMS::stateChanged(QMessageService::State error) { | void QtMMS::stateChanged(QMessageService::State error) { | ||
if (error == QMessageService::FinishedState) { | if (error == QMessageService::FinishedState) { | ||
Latest revision as of 04:23, 11 October 2012
Article Metadata
| ID | Creation date | 28th Mar 2010 | |
| Platform | S60 5th Edition | Tested on devices | Nokia N97 Mini |
| Category | Qt | Subcategory | Qt Mobility API |
| Keywords (APIs, classes, methods, functions): QMessageService |
Contents |
Overview
This article demonstrate how to send MMS using Qt Mobility messaging API
Project configuration file (.Pro file)
- Add the Qt Mobility project configuration option in the .Pro file as shown below
CONFIG += mobility
MOBILITY += messaging
Header File
Source File
m_service = new QMessageService(this);
connect(m_service, SIGNAL(stateChanged(QMessageService::State)), this, SLOT(stateChanged(QMessageService::State)));
bool QtMMS::sendMMS(QString picturePath, QString phoneNumber) {
// Send MMS
QMessage message;
message.setType(QMessage::Mms);
message.setTo(QMessageAddress(QMessageAddress::Phone, phoneNumber));
QStringList paths;
paths << picturePath;
message.appendAttachments(paths);
return m_service->send(message);
}
void QtMMS::stateChanged(QMessageService::State error) {
if (error == QMessageService::FinishedState) {
QMessageBox::information(this, "MMS", "Message sent");
}
else if (error == QMessageService::CanceledState) {
QMessageBox::warning(this, "MMS", "Sending message failed");
}
}
Classes
- QMessageService
Reference links
- Read and send SMS messages using the Qt Messaging API
- Delete messages using Qt Mobility API
- Qt - cross-platform application and UI framework
- Qt Mobility API
- New Qt APIs Beta - Mobility Project
- SDK help
--skumar_rao 09:10, 28 March 2010 (UTC)

