API Documentation

Documentation for developing SailfishOS applications

CallHistory Class


The CallHistory class provides access to phone call history. More...

Header: #include <mdm-CallHistory.h>

Public Types

class Filter
class Result
enum CallType { AnyCallType, OutgoingCall, MissedCall, IncomingCall }

Public Functions

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


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

Detailed Description

The CallHistory class provides access to phone call history.

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

 CONFIG += link_pkgconfig
 PKGCONFIG += sailfishmdm

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

Example of usage:

 #include <mdm-callhistory.h>

 using namespace Sailfish::Mdm;

 void printCallHistory(QObject *parent)
     CallHistory filter;
     filter.callType = CallHistory::MissedCall;
     filter.start = QDateTime(QDate(2000, 1, 1));

     CallHistory *history = new CallHistory(parent);
     QString fileName = "/tmp/callhistory.log";

     QObject::connect(stats, &CallHistory::searchFinished, [stats, &intervalFormat](bool success, const QList<Sailfish::Mdm::CallHistory::Result> &results) {
         if (success) {
             for (const CallHistory::Result &result : results) {
                 qInfo() << result.when.toString(intervalFormat) << result.finish.toString(intervalFormat) << result.phoneNumber << "calls";
             qInfo() << "Success to get CallHistory";
         } else {
             qInfo() << "Failed to fetch call history!";

Note this API currently provides history for cellular calls only.

Member Type Documentation

enum CallHistory::CallType

Types of phone calls to match in a Filter.

Sailfish::Mdm::CallHistory::AnyCallType0Match any type of phone call.
Sailfish::Mdm::CallHistory::OutgoingCall1Match phone calls that were dialed, i.e. outgoing calls.
Sailfish::Mdm::CallHistory::MissedCall2Match phone calls that were not answered.
Sailfish::Mdm::CallHistory::IncomingCall3Match phone calls that were received.

Member Function Documentation

CallHistory::CallHistory(QObject *parent = 0)

Constructs a CallHistory instance with the given parent.


Destroys the CallHistory instance.

Retrieves the callhistory to fileName

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

Emitted when a search completes after calling 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.