Commit bb50cade authored by vfjpl's avatar vfjpl

fix timedate

parent 845224e9
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
* Kacper Piwiński
*
* Originally from the Manjaro Installation Framework
* by Roland Singer <roland@manjaro.org>
......@@ -25,7 +26,8 @@
QHash<QString, QHash<QString, QList<LocaleGlobal::Locale> > > LocaleGlobal::locales;
QHash<QString, QList<LocaleGlobal::Location> > LocaleGlobal::locations;
void LocaleGlobal::init()
void
LocaleGlobal::init()
{
// TODO: Error handling
initLocales();
......@@ -47,7 +49,8 @@ LocaleGlobal::getLocations()
}
void LocaleGlobal::initLocales()
void
LocaleGlobal::initLocales()
{
locales.clear();
......@@ -70,7 +73,11 @@ void LocaleGlobal::initLocales()
while ( !in.atEnd() )
{
QString line = in.readLine().trimmed();
QStringList split = line.split( commentChar, QString::KeepEmptyParts ).first().split( QRegExp( " (?=[^\"]*(\"[^\"]*\"[^\"]*)*$)" ), QString::SkipEmptyParts );
QStringList split = line
.split( commentChar, QString::KeepEmptyParts )
.first()
.split( QRegExp( " (?=[^\"]*(\"[^\"]*\"[^\"]*)*$)" ), QString::SkipEmptyParts );
if ( split.size() < 2 )
continue;
......@@ -96,7 +103,8 @@ void LocaleGlobal::initLocales()
}
void LocaleGlobal::initLocations()
void
LocaleGlobal::initLocations()
{
locations.clear();
QFile file( TZ_DATA_FILE );
......@@ -131,7 +139,8 @@ void LocaleGlobal::initLocations()
}
double LocaleGlobal::getRightGeoLocation( QString str )
double
LocaleGlobal::getRightGeoLocation( QString str )
{
double sign = 1, num = 0.00;
......
......@@ -2,6 +2,7 @@
* This file is part of Manjaro Settings Manager.
*
* Ramon Buldó <ramon@manjaro.org>
* Kacper Piwiński
*
* Manjaro Settings Manager is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -17,14 +18,12 @@
* along with Manjaro Settings Manager. If not, see <http://www.gnu.org/licenses/>.
*/
#include "TimeDateCommon.h"
#include "TimeZoneDialog.h"
#include <QtCore/QTimeZone>
#include <QDebug>
QString
TimeDateCommon::getName()
{
......@@ -91,15 +90,23 @@ void
TimeDateCommon::updateUi( Ui::PageTimeDate* ui, TimeDateService* timeDateService,
bool isTimeEdited, bool isDateEdited, QString currentTimeZone )
{
ui->isNtpEnabledCheckBox->blockSignals( true );
if ( timeDateService->canNtp() )
{
ui->isNtpEnabledCheckBox->setChecked( timeDateService->isNtpEnabled() );
ui->timeEdit->setEnabled( !ui->isNtpEnabledCheckBox->isChecked() );
ui->dateEdit->setEnabled( !ui->isNtpEnabledCheckBox->isChecked() );
}
else
{
ui->isNtpEnabledCheckBox->setChecked( false );
ui->isNtpEnabledCheckBox->setEnabled( false );
}
ui->isNtpEnabledCheckBox->blockSignals( false );
ui->isRtcLocalCheckBox->blockSignals( true );
ui->isRtcLocalCheckBox->setChecked( timeDateService->isRtcInLocalTimeZone() );
ui->isRtcLocalCheckBox->blockSignals( false );
QTimeZone timeZone = QTimeZone( currentTimeZone.toLatin1() );
if ( timeZone.isValid() )
......
/*
* Manjaro Settings Manager
* Ramon Buldó <ramon@manjaro.org>
* Kacper Piwiński
*
* Copyright (C) 2007 Free Software Foundation, Inc.
*
......@@ -43,7 +44,8 @@ TimeDateKcm::TimeDateKcm( QWidget* parent, const QVariantList& args ) :
hBoxLayout->addWidget( m_timeDateModule );
connect( m_timeDateModule, &TimeDateModule::changed, [this] ()
connect( m_timeDateModule, &TimeDateModule::changed,
[this] ()
{
emit changed();
} );
......@@ -52,20 +54,26 @@ TimeDateKcm::TimeDateKcm( QWidget* parent, const QVariantList& args ) :
TimeDateKcm::~TimeDateKcm()
{
delete m_timeDateModule;
}
void TimeDateKcm::load()
void
TimeDateKcm::load()
{
m_timeDateModule->load();
}
void TimeDateKcm::save()
void
TimeDateKcm::save()
{
m_timeDateModule->save();
}
void TimeDateKcm::defaults()
void
TimeDateKcm::defaults()
{
m_timeDateModule->defaults();
}
......
......@@ -2,6 +2,7 @@
* This file is part of Manjaro Settings Manager.
*
* Ramon Buldó <ramon@manjaro.org>
* Kacper Piwiński
*
* Manjaro Settings Manager is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -61,19 +62,22 @@ TimeDateModule::TimeDateModule( QWidget* parent, const QVariantList& args ) :
ui->setupUi( this );
connect( m_timeFieldsTimer, &QTimer::timeout,
[=] ( )
[this] ()
{
TimeDateCommon::updateTimeFields( ui, m_timeDateService, m_isTimeEdited, m_isDateEdited );
} );
connect( ui->isNtpEnabledCheckBox, &QCheckBox::toggled,
[=] ( bool checked )
[this] ( bool checked )
{
ui->timeEdit->setEnabled( !checked );
ui->dateEdit->setEnabled( !checked );
emit changed();
} );
connect( ui->timeZonePushButton, &QPushButton::clicked, [=] ( bool checked )
connect( ui->timeZonePushButton, &QPushButton::clicked,
[this] ()
{
Q_UNUSED( checked )
QString newTimeZone = TimeDateCommon::showTimeZoneSelector( m_timeZone );
if ( !newTimeZone.isEmpty() )
{
......@@ -82,18 +86,21 @@ TimeDateModule::TimeDateModule( QWidget* parent, const QVariantList& args ) :
emit changed();
}
} );
connect( ui->timeEdit, &QTimeEdit::timeChanged,
[this] ()
{
m_isTimeEdited = true;
emit changed();
} );
connect( ui->dateEdit, &QTimeEdit::dateChanged,
[this] ()
{
m_isDateEdited = true;
emit changed();
} );
connect( ui->isRtcLocalCheckBox, &QCheckBox::toggled,
[this] ()
{
......@@ -134,5 +141,4 @@ TimeDateModule::defaults()
load();
}
#include "TimeDateModule.moc"
......@@ -2,6 +2,7 @@
* This file is part of Manjaro Settings Manager.
*
* Ramon Buldó <ramon@manjaro.org>
* Kacper Piwiński
*
* Manjaro Settings Manager is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -29,7 +30,6 @@
#include <QtCore/QDateTime>
#include <QtCore/QTimer>
TimeDatePage::TimeDatePage( QWidget* parent ) :
PageWidget( parent ),
ui( new Ui::PageTimeDate ),
......@@ -43,20 +43,22 @@ TimeDatePage::TimeDatePage( QWidget* parent ) :
setName( TimeDateCommon::getName() );
connect( m_timeFieldsTimer, &QTimer::timeout,
[=] ( )
[this] ()
{
TimeDateCommon::updateTimeFields( ui, m_timeDateService, m_isTimeEdited, m_isDateEdited );
} );
connect( ui->isNtpEnabledCheckBox, &QCheckBox::toggled,
[=] ( bool checked )
[this] ( bool checked )
{
ui->timeEdit->setEnabled( !checked );
ui->dateEdit->setEnabled( !checked );
this -> setApplyEnabled( this, true );
} );
connect( ui->timeZonePushButton, &QPushButton::clicked,
[=] ( bool checked )
[this] ()
{
Q_UNUSED( checked )
QString newTimeZone = TimeDateCommon::showTimeZoneSelector( m_timeZone );
if ( !newTimeZone.isEmpty() )
{
......@@ -72,12 +74,14 @@ TimeDatePage::TimeDatePage( QWidget* parent ) :
m_isTimeEdited = true;
this -> setApplyEnabled( this, true );
} );
connect( ui->dateEdit, &QTimeEdit::dateChanged,
[this] ()
{
m_isDateEdited = true;
this -> setApplyEnabled( this, true );
} );
connect( ui->isRtcLocalCheckBox, &QCheckBox::toggled,
[this] ()
{
......
......@@ -2,6 +2,7 @@
* This file is part of Manjaro Settings Manager.
*
* Ramon Buldó <ramon@manjaro.org>
* Kacper Piwiński
*
* Manjaro Settings Manager is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -31,6 +32,7 @@ TimeDateService::TimeDateService( QObject* parent ) :
0 );
}
TimeDateService::~TimeDateService()
{
delete m_dbusInterface;
......
......@@ -2,6 +2,7 @@
* This file is part of Manjaro Settings Manager.
*
* Ramon Buldó <ramon@manjaro.org>
* Kacper Piwiński
*
* Manjaro Settings Manager is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......
......@@ -2,6 +2,7 @@
* This file is part of Manjaro Settings Manager.
*
* Ramon Buldó <ramon@manjaro.org>
* Kacper Piwiński
*
* Manjaro Settings Manager is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment