Sailfish OS
  • Info
  • User Experience
  • Cases
  • Community
  • Developers
  • Contact
  • Get Sailfish OS
Select Page

API Documentation

Documentation for developing SailfishOS applications
  • API Documentation
  • Libsailfishapp
  • Sailfish Silica
    • Documentation
    • Icon Reference
  • Sailfish Components
    • Sailfish Accounts
    • Sailfish Bluetooth
    • Sailfish Contacts
    • Sailfish Crypto
    • Sailfish Gallery
    • Sailfish Media
    • Sailfish Pickers
    • Sailfish Secrets
    • Sailfish Share
    • Sailfish Telephony
    • Sailfish Webview
    • Amber Web Authorization
    • Amber MPRIS
  • Nemo QML Plugins
    • Configuration
    • Contacts
    • D-Bus
    • Keepalive
    • Notifications
    • Thumbnailer
  • Sailfish Middleware
    • MDM Framework
    • MDM Policy Framework
    • User Manager Daemon

Contents

  • Public Types
  • Public Functions
  • Signals
  • Detailed Description

CallStatistics Class

(Sailfish::Mdm::CallStatistics)

The CallStatistics class provides access to phone call statistics. More...

Header: #include <mdm-callstatistics.h>
  • List of all members, including inherited members

Public Types

class Filter
class Result
enum CallType { AnyCallType, OutgoingCall, MissedCall, IncomingCall }
enum TimeInterval { NoTimeInterval, Yearly, Monthly, Weekly, Daily }

Public Functions

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

Signals

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

Detailed Description

The CallStatistics class provides access to phone call statistics.

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

 CONFIG += link_pkgconfig
 PKGCONFIG += sailfishmdm

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

Example of usage:

 #include <mdm-callstatistics.h>

 using namespace Sailfish::Mdm;

 void printCallStatistics(QObject *parent)
 {
     CallStatistics filter;
     filter.callType = CallStatistics::MissedCall;
     filter.start = QDateTime(QDate(2000, 1, 1));

     CallStatistics *stats = new CallStatistics(parent);
     stats->search(filter);

     QString intervalFormat;
     switch (filter.timeInterval) {
     case CallStatistics::NoTimeInterval:
         break;
     case CallStatistics::Yearly:
         intervalFormat = "yyyy:";
         break;
     case CallStatistics::Monthly:
         intervalFormat = "yyyy MMM:";
         break;
     case CallStatistics::Weekly:
         intervalFormat = "Week starting yyyy-MM-ddd:";
         break;
     case CallStatistics::Daily:
         intervalFormat = "yyyy-MM-ddd:";
         break;
     }

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

Note this API currently provides statistics for cellular calls only.

Member Type Documentation

enum CallStatistics::CallType

Types of phone calls to match in a Filter.

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

enum CallStatistics::TimeInterval

The time interval used to group the results of a search.

This applies grouping to the search results emitted by searchFinished(). When an interval is set, each item in the list of results will correspond to the statistics for a single day, month or year.

ConstantValueDescription
Sailfish::Mdm::CallStatistics::NoTimeInterval0Do not group results. The list of results will consist of a single entry.
Sailfish::Mdm::CallStatistics::Yearly1Group results by year.
Sailfish::Mdm::CallStatistics::Monthly2Group results by month.
Sailfish::Mdm::CallStatistics::Weekly3Group results by week number.
Sailfish::Mdm::CallStatistics::Daily4Group results by day.

For example, if Filter::start is July 1, 2000 and Filter::end is June 30, 2002, the list of results would consist of:

  • For Yearly - 3 results: 2000-07-01 to 2000-12-31, 2001-01-01 to 2001-12-31, 2002-01-01 to 2002-06-30
  • For Monthly - 24 results, one for each month between the start and end times (inclusive).
  • For Weekly - 107 results, one for each week between the start and end times (inclusive), where each full week starts on a Monday. Due to the days of the week on which the first and last dates fall, the first and last results are less than one full week: the first entry is from 2000-07-1 to 2007-07-04 and the last entry is 2002-06-25 to 2002-06-30.
  • For Daily - 701 results, one for each day between the start and end times (inclusive).

Entries are included for each interval, regardless of whether there were any calls in that day/month/year.

Member Function Documentation

CallStatistics::CallStatistics(QObject *parent = 0)

Constructs a CallStatistics instance with the given parent.

CallStatistics::~CallStatistics()

Destroys the CallStatistics instance.

void CallStatistics::search(const Sailfish::Mdm::CallStatistics::Filter &filter)

Retrieves the number of phone calls that match the given filter.

Currently, only cellular phone call statistics are supported.

[signal] void CallStatistics::searchFinished(bool success, const QList<Sailfish::Mdm::CallStatistics::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.

  • Legal
  • Contact Us
  • Jolla Mobile Ltd © 2025

  • Facebook
  • Twitter
  • Mastodon
  • YouTube
  • LinkedIn