×
Namespaces

Variants
Actions
(Difference between revisions)

Archived:Send SMS using Qt Mobility

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
m (Hamishwillee - Add SMS category.)
hamishwillee (Talk | contribs)
m (moved Send SMS using Qt Mobility to Archived:Send SMS using Qt Mobility: Article no longer works with current SDKs)
 
(4 intermediate revisions by one user not shown)
Line 1: Line 1:
[[Category:Code Snippet]][[Category:Qt Mobility]][[Category:MeeGo]][[Category:Symbian]][[Category:SMS]][[Category:Qt]]
+
[[Category:Code Snippet]][[Category:Qt Mobility]][[Category:MeeGo Harmattan]][[Category:Symbian]][[Category:SMS]][[Category:Qt]]
 +
{{Archived|This example is outdated and may not compile with new sdks; see this for new examples [[Qt Mobility API Basic Examples Part 1]]'''}}
 +
{{Abstract|The following code shows how to send an SMS using Qt Mobility.}}
 
{{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]] -->
Line 24: Line 26:
 
|id= CS001616
 
|id= CS001616
 
}}
 
}}
{{Warning|This example is outdated and may not compile with new sdks; see this for new examples [[Qt Mobility API Basic Examples Part 1]]'''}}
+
{{SeeAlso|[[Archived:Setting up environment for Qt Mobility API]]}}
 
+
{{Tip| Read this article before moving forward: [[Setting up environment for Qt Mobility API]]}}
+
 
+
== Overview ==
+
The following code shows how to send an SMS using Qt Mobility.
+
 
+
== Keywords ==
+
  
 
== Project configuration file (.Pro file) ==
 
== Project configuration file (.Pro file) ==
Line 43: Line 38:
 
It also requires the [[Capabilities (Symbian Signed)/ReadDeviceData Capability|ReadDeviceData]] and [[Capabilities (Symbian Signed)/WriteDeviceData Capability|WriteDeviceData]] capabilities from the '''open signed online''' category. Read more about [[Capabilities]].
 
It also requires the [[Capabilities (Symbian Signed)/ReadDeviceData Capability|ReadDeviceData]] and [[Capabilities (Symbian Signed)/WriteDeviceData Capability|WriteDeviceData]] capabilities from the '''open signed online''' category. Read more about [[Capabilities]].
  
<code cpp>
+
<code cpp-qt>
 
symbian {
 
symbian {
 
TARGET.CAPABILITY = ReadUserData \
 
TARGET.CAPABILITY = ReadUserData \
Line 53: Line 48:
  
 
===Headers===
 
===Headers===
<code cpp>
+
<code cpp-qt>
 
#include <qtmessaging.h>
 
#include <qtmessaging.h>
  
Line 64: Line 59:
  
 
===Source file===
 
===Source file===
<code cpp>
+
<code cpp-qt>
 
// connect messages state-change signal to our slot, to get notification     
 
// connect messages state-change signal to our slot, to get notification     
 
connect(&m_MessageServiceAction, SIGNAL(stateChanged(QMessageServiceAction::State)), this, SLOT(messageStateChanged(QMessageServiceAction::State)));     
 
connect(&m_MessageServiceAction, SIGNAL(stateChanged(QMessageServiceAction::State)), this, SLOT(messageStateChanged(QMessageServiceAction::State)));     

Latest revision as of 01:24, 18 October 2012

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

This example is outdated and may not compile with new sdks; see this for new examples Qt Mobility API Basic Examples Part 1

The following code shows how to send an SMS using Qt Mobility.

Article Metadata
Tested with
Devices(s): Nokia N97 Mini, Nokia N900
Compatibility
Platform(s): S60 5th Edition, Maemo 5
Symbian
Platform Security
Signing Required: DevCert required
Capabilities: ReadUserData, WriteUserData, ReadDeviceData, WriteDeviceData
Article
Keywords: QMessageServiceAction, QMessageId
Created: skumar_rao (07 Jul 2010)
Last edited: hamishwillee (18 Oct 2012)

Contents

[edit] Project configuration file (.Pro file)

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

The use of Messaging requires the ReadUserData and WriteUserData capabilities from the user granted category. It also requires the ReadDeviceData and WriteDeviceData capabilities from the open signed online category. Read more about Capabilities.

symbian {
TARGET.CAPABILITY = ReadUserData \
WriteUserData \
ReadDeviceData \
WriteDeviceData
}

[edit] Headers

#include <qtmessaging.h>
 
private slots:
void messageStateChanged(QMessageServiceAction::State s);
private:
QMessageServiceAction m_MessageServiceAction;
QMessageId m_sendId;

[edit] Source file

// connect messages state-change signal to our slot, to get notification    
connect(&m_MessageServiceAction, SIGNAL(stateChanged(QMessageServiceAction::State)), this, SLOT(messageStateChanged(QMessageServiceAction::State)));
 
void send_sms::QtSendSMSMessage(QString address, QString body) {
// Prepare QMessage with address & body
QMessage message;
message.setType(QMessage::Sms);
message.setTo(QMessageAddress(address, QMessageAddress::Phone));
message.setBody(body);
 
if (iMessageServiceAction.send(message)) {
sendId = message.id();
}
else {
// message sending failed
}
}
 
void send_sms::messageStateChanged(QMessageServiceAction::State s) {
if (s == QMessageServiceAction::Successful) {
// message send successful
}
else {
// message sending failed
}
}

[edit] Classes

[edit] Reference links

This page was last modified on 18 October 2012, at 01:24.
100 page views in the last 30 days.
×