×
Namespaces

Variants
Actions
(Difference between revisions)

Archived:Send SMS using Qt Mobility

From Nokia Developer Wiki
Jump to: navigation, search
skumar_rao (Talk | contribs)
(Created page with 'Category:Qt for Symbian {|style="background:#eceff2" width="660px" border="1" cellpadding="5" cellspacing="0" |- |'''ID''' || |'''Creation date''' || 15th Mar 2010 |- |'''P…')
 
skumar_rao (Talk | contribs)
Line 31: Line 31:
 
== Project configuration file (.Pro file) ==
 
== Project configuration file (.Pro file) ==
 
* Add the Qt Mobility project configuration option in the .Pro file as shown below
 
* Add the Qt Mobility project configuration option in the .Pro file as shown below
<code cpp>
+
<code>
 
CONFIG += mobility
 
CONFIG += mobility
 
MOBILITY += messaging
 
MOBILITY += messaging
Line 37: Line 37:
  
 
===Headers===
 
===Headers===
<code cpp>
+
<code>
 
#include <qtmessaging.h>
 
#include <qtmessaging.h>
<code cpp>
+
 
<code cpp>
+
 
private slots:
 
private slots:
 
     void messageStateChanged(QMessageServiceAction::State s);
 
     void messageStateChanged(QMessageServiceAction::State s);
Line 46: Line 45:
 
     QMessageServiceAction m_MessageServiceAction;
 
     QMessageServiceAction m_MessageServiceAction;
 
     QMessageId m_sendId;   
 
     QMessageId m_sendId;   
 
+
</code>
<code cpp>
+
 
+
=== Source file ===
+
  
<code cpp>
+
===Source file===
 +
<code>
 
// connect messageseives statechange signal to our slot, to get notification     
 
// connect messageseives statechange 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)));     
Line 78: Line 75:
 
         }
 
         }
 
     }
 
     }
<code cpp>
+
</code>
  
 
===Classes===
 
===Classes===

Revision as of 17:33, 15 March 2010

ID Creation date 15th 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): QMessageServiceAction, QMessageId


Underconstruction.pngUnder Construction: This article is under construction and it may have outstanding issues. If you have any comments please use the comments tab.

Tip.pngTip: Read this article before moving forward: Setting up environment for Qt Mobility API

Contents

Overview

The below code shows how to send a SMS 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

Headers

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

Source file

// connect messageseives statechange 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 successfull
}
else {
// message sending failed
}
}

Classes

  • QMessageServiceAction
  • QMessageId

Reference links

138 page views in the last 30 days.
×