×
Namespaces

Variants
Actions
(Difference between revisions)

Send MMS using Qt Mobility

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot update - Add ArticleMetaData)
hamishwillee (Talk | contribs)
m (Hamishwillee -)
 
(One intermediate revision by one user not shown)
Line 1: Line 1:
 +
[[Category:MeeGo Harmattan]][[Category:Symbian]][[Category:MMS]][[Category:Qt]]
 
{{ArticleMetaData <!-- v1.2 -->
 
{{ArticleMetaData <!-- v1.2 -->
 
|sourcecode= <!-- Link to example source code e.g. [[Media:The Code Example ZIP.zip]] -->
 
|sourcecode= <!-- Link to example source code e.g. [[Media:The Code Example ZIP.zip]] -->
 
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
|devices= <!-- Devices tested against - e.g. ''devices=Nokia 6131 NFC, Nokia C7-00'') -->
+
|devices= Nokia N97 Mini
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Qt SDK 1.1.4]) -->
+
|sdk= S60 5th Edition
 
|platform= <!-- Compatible platforms - e.g. Symbian^1 and later, Qt 4.6 and later -->
 
|platform= <!-- Compatible platforms - e.g. Symbian^1 and later, Qt 4.6 and later -->
 
|devicecompatability= <!-- Compatible devices e.g.: All* (must have internal GPS) -->
 
|devicecompatability= <!-- Compatible devices e.g.: All* (must have internal GPS) -->
Line 9: Line 10:
 
|signing= <!-- Signing requirements - empty or one of: Self-Signed, DevCert, Manufacturer -->
 
|signing= <!-- Signing requirements - empty or one of: Self-Signed, DevCert, Manufacturer -->
 
|capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
 
|capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
|keywords= <!-- APIs, classes and methods (e.g. QSystemScreenSaver, QList, CBase -->
+
|keywords= QMessageService
 
|language= <!-- Language category code for non-English topics - e.g. Lang-Chinese -->
 
|language= <!-- Language category code for non-English topics - e.g. Lang-Chinese -->
 
|translated-by= <!-- [[User:XXXX]] -->
 
|translated-by= <!-- [[User:XXXX]] -->
Line 21: Line 22:
 
|author= [[User:Skumar rao]]
 
|author= [[User:Skumar rao]]
 
}}
 
}}
[[Category:Messaging]][[Category:Qt Mobility]]
 
{|style="background:#eceff2" width="660px" border="1" cellpadding="5" cellspacing="0"
 
|-
 
|'''ID''' ||
 
|'''Creation date''' || 28th Mar 2010
 
|-
 
|'''Platform''' || S60 5th Edition
 
|'''Tested on devices''' || Nokia N97 Mini
 
|-
 
|'''Category''' || Qt
 
|'''Subcategory''' || Qt Mobility API
 
|-
 
|}
 
 
 
{|style="background:#eceff2" width="660px" border="1" cellpadding="5" cellspacing="0"
 
|-
 
|'''Keywords (APIs, classes, methods, functions)''': QMessageService
 
|}
 
 
  
 
== Overview ==  
 
== Overview ==  
Line 53: Line 34:
  
 
== Header File ==
 
== Header File ==
<code cpp>
+
<code cpp-qt>
 
#include <qmessage.h>
 
#include <qmessage.h>
 
#include <qmessageservice.h>
 
#include <qmessageservice.h>
Line 67: Line 48:
  
 
== 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 68:
 
</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) {
Line 108: Line 89:
 
* [http://qt.nokia.com/developer/qt-roadmap New Qt APIs Beta - Mobility Project]
 
* [http://qt.nokia.com/developer/qt-roadmap New Qt APIs Beta - Mobility Project]
 
* SDK help
 
* SDK help
--[[User:Skumar rao|Skumar rao]] 09:10, 28 March 2010 (UTC)[[Category:MeeGo Harmattan]] [[Category:Symbian]]
+
--[[User:Skumar rao|Skumar rao]] 09:10, 28 March 2010 (UTC)

Latest revision as of 09:49, 14 June 2013

Article Metadata
Tested with
SDK: S60 5th Edition
Devices(s): Nokia N97 Mini
Compatibility
Platform(s):
Symbian
Article
Keywords: QMessageService
Created: skumar_rao (28 Mar 2010)
Last edited: hamishwillee (14 Jun 2013)

Contents

[edit] Overview

This article demonstrate how to send MMS using Qt Mobility messaging API

[edit] Project configuration file (.Pro file)

  • Add the Qt Mobility project configuration option in the .Pro file as shown below
CONFIG += mobility
MOBILITY += messaging

[edit] 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;

[edit] 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");
}
}

[edit] Classes

  • QMessageService

[edit] Reference links

--skumar_rao 09:10, 28 March 2010 (UTC)

This page was last modified on 14 June 2013, at 09:49.
102 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×