×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Nov 2010
    Location
    Phnom Penh
    Posts
    33

    how to implement QmessageService::compose in QT Mobility

    Hi all,
    I am new in QT Mobility. I want to send SMS by using QMessage and QMessageService class but when I run it in QT simulator it say that "QMessageService::compose not yet implemented"

    My source code here :

    Code:
        
    
    //////////// code below in mainwindow.h
    
    #ifndef MAINWINDOW_H
    #define MAINWINDOW_H
    
    #include <QMainWindow>
    #include "QMessage"
    #include "QMessageService"
    
    QTM_USE_NAMESPACE
    
    namespace Ui {
        class MainWindow;
    }
    
    class MainWindow : public QMainWindow
    {
        Q_OBJECT
    
    public:
        explicit MainWindow(QWidget *parent = 0);
        ~MainWindow();
    
    private:
        Ui::MainWindow *ui;
        QMessage message;
        QMessageService * m_service;
        
    
    private slots:
        void on_pushButton_clicked();
    };
    
    #endif // MAINWINDOW_H
    
    
    /////////////////////// code below in mainwindow.cpp
    
    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    #include "qmessage.h"
    
    
    MainWindow::MainWindow(QWidget *parent) :
        QMainWindow(parent),
        ui(new Ui::MainWindow)
    {
        ui->setupUi(this);
    }
    
    MainWindow::~MainWindow()
    {
        delete ui;
    }
    
    void MainWindow::on_pushButton_clicked()
    {
        message.setType(QMessage::Sms);
        QMessageAddress::Type addressType = QMessageAddress::Phone;
        QMessageAddressList to;
        QString body= "";
    
             to.append(QMessageAddress(addressType,"xxxxxxxxx"));
             message.setTo(to);
             body = "HELLO QT SMS";
    
             message.setBody(body);
             m_service = new QMessageService(this);
             m_service->compose(message);
    }
    how can I implement QMessageService::compose in my class?

    Thank

  2. #2
    Super Contributor
    Join Date
    Jan 2008
    Location
    Bangalore, India
    Posts
    777

    Re: how to implement QmessageService::compose in QT Mobility

    Regards
    $-Nitesh-$

  3. #3
    Registered User
    Join Date
    Nov 2010
    Location
    Phnom Penh
    Posts
    33

    Re: how to implement QmessageService::compose in QT Mobility

    Thank for reply.

    Now i can send sms in qt

  4. #4
    Registered User
    Join Date
    Jan 2011
    Posts
    3

    Re: how to implement QmessageService::compose in QT Mobility

    Hi,

    I am running into the same problem with Qt 4.7. I get the same error in the simulator ("QMessageService::compose not yet implemented"). I have tried to follow the example from the forum, but I am new and it does not make that much sense. Also, my sms_service.compose(message) is called from a JavaScript "bridge" class. The openSMS() is called when a user clicks a link in the QWebView.

    Here is my code:
    ------------h file--------------
    #ifndef BRIDGE_H
    #define BRIDGE_H

    #include <QtCore/QObject>
    #include <QtGui/QWidget>

    #include <qmessage.h>
    #include <qmessageservice.h>

    QTM_USE_NAMESPACE


    class Bridge : public QObject
    {
    Q_OBJECT
    public:
    Bridge(QWidget* parent);

    public slots:
    void openSMS();

    private:
    QMessage* message;
    QMessageService* sms_service;

    };

    -------cpp file-----
    #include "bridge.h"
    #include <qmessage.h>
    #include <qmessageservice.h>


    Bridge::Bridge(QWidget *parent) :
    QObject(parent)

    {
    sms_service = new QMessageService(this);

    }


    void Bridge:penSMS()
    {
    QMessage message;
    message.setTo(QMessageAddress(QMessageAddress::Phone,"123456"));
    message.setType(QMessage::Sms);
    message.setBody("Test");
    sms_service->compose(message);



    }


    Can you post the code that works for you to launch/compose an SMS? Any other thoughts will be appreciated.

    Thanks.

  5. #5
    Super Contributor
    Join Date
    Jan 2008
    Location
    Bangalore, India
    Posts
    777

    Re: how to implement QmessageService::compose in QT Mobility


    I am running into the same problem with Qt 4.7. I get the same error in the simulator ("QMessageService::compose not yet implemented").
    have you tried it on real device, AFAIK some API only works on real device.
    Regards
    $-Nitesh-$

  6. #6
    Registered User
    Join Date
    Jan 2011
    Posts
    3

    Re: how to implement QmessageService::compose in QT Mobility

    Thanks for your post. I have not. I will give that a try and report back.

  7. #7
    Registered User
    Join Date
    Jan 2011
    Posts
    3

    Re: how to implement QmessageService::compose in QT Mobility

    I have tested the code on a real device and it works. Thanks.

Similar Threads

  1. Qt Creator code completion not working with Qt Mobility for Symbian
    By ceefour in forum [Archived] Qt Mobility Project
    Replies: 4
    Last Post: 2011-09-10, 05:02
  2. Qt Mobility API not working with Nokia Qt SDK + incomplete docs
    By remy_david in forum [Archived] Qt Mobility Project
    Replies: 15
    Last Post: 2011-06-10, 14:38
  3. Installing Qt Mobility 1.1 on Ubuntu 10.04 and using it with Qt Creator
    By tkatva in forum [Archived] Qt Mobility Project
    Replies: 3
    Last Post: 2010-12-15, 03:18
  4. Qt Messaging: QMessageService::send(...) not working on Symbian^3
    By Maksim85 in forum [Archived] Qt Mobility Project
    Replies: 13
    Last Post: 2010-11-01, 15:27
  5. Replies: 3
    Last Post: 2010-06-30, 01:17

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×