API Documentation

Documentation for developing SailfishOS applications

SMSHistory Class

(Sailfish::Mdm::SMSHistory)

The SMSHistory class provides access to sms history. More...

Header: #include <mdm-SMSHistory.h>

Public Types

class Filter
class Result

Public Functions

SMSHistory(QObject *parent = 0)
~SMSHistory()
void search(const Sailfish::Mdm::SMSHistory::Filter &filter)

Signals

void searchFinished(bool success, const QList<Sailfish::Mdm::SMSHistory::Result> &results)

Detailed Description

The SMSHistory class provides access to sms history.

To use this class, clients must add the following to their qmake project:

 CONFIG += link_pkgconfig
 PKGCONFIG += sailfishmdm

and then #include <mdm-smshistory.h>.

Example of usage:

 #include <mdm-smshistory.h>

 using namespace Sailfish::Mdm;

 void printSMSHistory(QObject *parent)
 {
     SMSHistory filter;
     filter.start = QDateTime(QDate(2000, 1, 1));

     SMSHistory *history = new SMSHistory(parent);
     history->search(filter);

     QObject::connect(history, &SMSHistory::searchFinished, [history](bool success, const QList<Sailfish::Mdm::SMSHistory::Result> &results) {
         if (success) {
             for (const SMSHistory::Result &result : results) {
                 qInfo() << result.when.toString(intervalFormat) << "from" << result.phoneNumber;
             }
         } else {
             qInfo() << "Failed to fetch sms history";
         }
     });
 }

Member Function Documentation

SMSHistory::SMSHistory(QObject *parent = 0)

Constructs a SMSHistory instance with the given parent.

SMSHistory::~SMSHistory()

Destroys the SMSHistory instance.

Retrieves the number of sms that match the given filter.

[signal] void SMSHistory::searchFinished(bool success, const QList<Sailfish::Mdm::SMSHistory::Result> &results)

Emitted when a search completes after sms search().

success is true if the call succeeded, and results holds the list of matching results.

We use cookies to improve your user experience and to help us to develop our services. By continuing to browse the site, you approve of our use of cookies.