Send MMS using Qt Mobility
skumar_rao
(Talk | contribs) (Created page with 'Category:Qt for SymbianCategory:Qt for Symbian {|style="background:#eceff2" width="660px" border="1" cellpadding="5" cellspacing="0" |- |'''ID''' || |'''Creation date''…') |
(Added correct category) |
||
| Line 1: | Line 1: | ||
| − | [[Category:Qt | + | [[Category:Qt]][[Category:Qt for Symbian]][[Category:Qt Mobility]] |
{|style="background:#eceff2" width="660px" border="1" cellpadding="5" cellspacing="0" | {|style="background:#eceff2" width="660px" border="1" cellpadding="5" cellspacing="0" | ||
|- | |- | ||
Revision as of 10:35, 21 June 2010
| ID | Creation date | 28th Mar 2010 | |
| Platform | S60 5th Edition | Tested on devices | Nokia N97 Mini |
| Category | Qt for Symbian | Subcategory | Qt Mobility API |
| Keywords (APIs, classes, methods, functions): QMessageService |
Tip: Read this article before moving forward: Setting up environment for Qt Mobility API
Contents |
Overview
Send MMS using Qt Mobility
Keywords
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
#include <qmessage.h>
#include <qmessageservice.h>
public slots:
// QMessageService
void stateChanged(QMessageService::State s);
private:
bool sendMMS(QString picturePath, QString phoneNumber);
private:
QMessageService* m_service;
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
- 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)

