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

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
  • 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

  • Properties
  • Public Functions
  • Signals
  • Detailed Description

DateTimeSettings Class

(Sailfish::Mdm::DateTimeSettings)

The DateTimeSettings class controls the system date and time. More...

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

Properties

  • automaticDateTimeUpdate : bool
  • automaticTimeZoneUpdate : bool
  • ready : const bool
  • timeZone : QString

Public Functions

DateTimeSettings(QObject *parent = 0)
~DateTimeSettings()
bool automaticDateTimeUpdate() const
bool automaticTimeZoneUpdate() const
bool ready() const
void setAutomaticDateTimeUpdate(bool enable)
void setAutomaticTimeZoneUpdate(bool enable)
void setDate(const QDate &date)
void setTime(int hour, int minute)
void setTimeZone(const QString &timeZone)
QStringList supportedTimeZones()
QString timeZone() const

Signals

void automaticDateTimeUpdateChanged()
void automaticTimeZoneUpdateChanged()
void dateTimeChanged()
void readyChanged()
void timeZoneChanged()

Detailed Description

The DateTimeSettings class controls the system date and time.

The date/time properties are not valid, and cannot be modified, until ready is true.

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

 CONFIG += link_pkgconfig
 PKGCONFIG += sailfishmdm

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

Example of usage:

 #include <mdm-datetime.h>
 void updateDateTimeSettings(QObject *parent)
 {
     Sailfish::Mdm::DateTimeSettings *dateTime = new Sailfish::Mdm::DateTimeSettings(parent);

     QObject::connect(dateTime, &Sailfish::Mdm::DateTimeSettings::readyChanged, [dateTime]() {

         // Disable automatic time zone updates so that the time zone can be changed with setTimeZone()
         dateTime->setAutomaticTimeZoneUpdate(false);

         // Disable automatic time zone updates so that the date and time can be changed with
         // setDate() and setTime()
         dateTime->setAutomaticDateTimeUpdate(false);

         dateTime->setDate(QDate(2000, 12, 25));
         dateTime->setTime(15, 35);
     });
 }

Property Documentation

automaticDateTimeUpdate : bool

This property holds true if the system date/time is automatically updated from a time server.

Access functions:

bool automaticDateTimeUpdate() const
void setAutomaticDateTimeUpdate(bool enable)

Notifier signal:

void automaticDateTimeUpdateChanged()

automaticTimeZoneUpdate : bool

This property holds true if the system time zone is automatically updated from a time server.

Access functions:

bool automaticTimeZoneUpdate() const
void setAutomaticTimeZoneUpdate(bool enable)

Notifier signal:

void automaticTimeZoneUpdateChanged()

ready : const bool

This property holds true if the settings properties have been initialized and can be modified.

Access functions:

bool ready() const

Notifier signal:

void readyChanged()

timeZone : QString

This property holds the system time zone.

Access functions:

QString timeZone() const
void setTimeZone(const QString &timeZone)

Notifier signal:

void timeZoneChanged()

See also supportedTimeZones().

Member Function Documentation

DateTimeSettings::DateTimeSettings(QObject *parent = 0)

Default constructs an instance of DateTimeSettings.

DateTimeSettings::~DateTimeSettings()

Destroys the instance of DateTimeSettings.

[signal] void DateTimeSettings::automaticDateTimeUpdateChanged()

This signal is emitted when the automaticDateTimeUpdate value changes.

Note: Notifier signal for property automaticDateTimeUpdate.

See also automaticDateTimeUpdate().

[signal] void DateTimeSettings::automaticTimeZoneUpdateChanged()

This signal is emitted when the automaticTimeZoneUpdate changes.

Note: Notifier signal for property automaticTimeZoneUpdate.

See also automaticTimeZoneUpdate().

[signal] void DateTimeSettings::dateTimeChanged()

This signal is emitted when the system date/time changes.

See also setDate() and setTime().

void DateTimeSettings::setDate(const QDate &date)

Sets the system date to the given date.

void DateTimeSettings::setTime(int hour, int minute)

Sets the system time to the hour and minute in 24-hour mode.

QStringList DateTimeSettings::supportedTimeZones()

Returns a list of valid time zones.

[signal] void DateTimeSettings::timeZoneChanged()

This signal is emitted when the timeZone changes.

Note: Notifier signal for property timeZone.

See also timeZone().

  • Legal
  • Contact Us
  • Jollyboys Ltd © 2024

  • Facebook
  • Twitter
  • Mastodon
  • YouTube
  • LinkedIn