Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[systemsettings] support updating 12/24h to timed
  • Loading branch information
pvuorela committed Oct 9, 2013
1 parent 4be54da commit 18d7198
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions rpm/nemo-qml-plugin-systemsettings.spec
Expand Up @@ -21,6 +21,7 @@ Requires(postun): /sbin/ldconfig
BuildRequires: pkgconfig(Qt5Qml)
BuildRequires: pkgconfig(Qt5SystemInfo)
BuildRequires: pkgconfig(qmsystem2-qt5)
BuildRequires: pkgconfig(timed-qt5)
BuildRequires: pkgconfig(profile)
BuildRequires: pkgconfig(mce)

Expand Down
10 changes: 10 additions & 0 deletions src/datetimesettings.cpp
Expand Up @@ -30,6 +30,8 @@
*/

#include "datetimesettings.h"
#include <timed-qt5/interface>
#include <timed-qt5/wallclock>
#include <QDebug>

DateTimeSettings::DateTimeSettings(QObject *parent)
Expand Down Expand Up @@ -101,6 +103,14 @@ void DateTimeSettings::setTimezone(const QString &tz)
m_time.setTimezone(tz);
}

void DateTimeSettings::setHourMode(DateTimeSettings::HourMode mode)
{
Maemo::Timed::Interface timedInterface;
Maemo::Timed::WallClock::Settings settings;
settings.setFlag24(mode == TwentyFourHours);
timedInterface.wall_clock_settings_async(settings);
}

void DateTimeSettings::handleTimeChanged(MeeGo::QmTime::WhatChanged what)
{
switch (what) {
Expand Down
8 changes: 8 additions & 0 deletions src/datetimesettings.h
Expand Up @@ -41,11 +41,17 @@ class DateTimeSettings: public QObject
{
Q_OBJECT

Q_ENUMS(HourMode)
Q_PROPERTY(bool automaticTimeUpdate READ automaticTimeUpdate WRITE setAutomaticTimeUpdate NOTIFY automaticTimeUpdateChanged)
Q_PROPERTY(bool automaticTimezoneUpdate READ automaticTimezoneUpdate WRITE setAutomaticTimezoneUpdate NOTIFY automaticTimezoneUpdateChanged)
Q_PROPERTY(QString timezone READ timezone WRITE setTimezone NOTIFY timezoneChanged)

public:
enum HourMode {
TwentyFourHours,
TwelveHours
};

explicit DateTimeSettings(QObject *parent = 0);
virtual ~DateTimeSettings();

Expand All @@ -61,6 +67,8 @@ class DateTimeSettings: public QObject
QString timezone() const;
void setTimezone(const QString &);

Q_INVOKABLE void setHourMode(HourMode mode);

signals:
void timeChanged();
void automaticTimeUpdateChanged();
Expand Down

0 comments on commit 18d7198

Please sign in to comment.