API Documentation
Documentation for developing SailfishOS applicationsCallHistory Class
(Sailfish::Mdm::CallHistory)The CallHistory class provides access to phone call history. More...
Header: | #include <mdm-CallHistory.h> |
Public Types
Public Functions
CallHistory(QObject *parent = 0) | |
~CallHistory() | |
void | search(const Sailfish::Mdm::CallHistory::Filter &filter) |
Signals
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"; history->search(filter); 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.
Constant | Value | Description |
---|---|---|
Sailfish::Mdm::CallHistory::AnyCallType | 0 | Match any type of phone call. |
Sailfish::Mdm::CallHistory::OutgoingCall | 1 | Match phone calls that were dialed, i.e. outgoing calls. |
Sailfish::Mdm::CallHistory::MissedCall | 2 | Match phone calls that were not answered. |
Sailfish::Mdm::CallHistory::IncomingCall | 3 | Match phone calls that were received. |
Member Function Documentation
CallHistory::CallHistory(QObject *parent = 0)
Constructs a CallHistory instance with the given parent.
CallHistory::~CallHistory()
Destroys the CallHistory instance.
void CallHistory::search(const Sailfish::Mdm::CallHistory::Filter &filter)
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.