Merge branch 'locale-fixes'
This commit is contained in:
commit
56dec8f575
@ -69,6 +69,8 @@ LCLocaleDialog::LCLocaleDialog( const QString& guessedLCLocale,
|
|||||||
connect( dbb->button( QDialogButtonBox::Cancel ), &QPushButton::clicked,
|
connect( dbb->button( QDialogButtonBox::Cancel ), &QPushButton::clicked,
|
||||||
this, &QDialog::reject );
|
this, &QDialog::reject );
|
||||||
|
|
||||||
|
connect( m_localesWidget, &QListWidget::itemDoubleClicked,
|
||||||
|
this, &QDialog::accept );
|
||||||
connect( m_localesWidget, &QListWidget::itemSelectionChanged,
|
connect( m_localesWidget, &QListWidget::itemSelectionChanged,
|
||||||
[this, dbb]()
|
[this, dbb]()
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
*
|
*
|
||||||
* Copyright 2016, Teo Mrnjavac <teo@kde.org>
|
* Copyright 2016, Teo Mrnjavac <teo@kde.org>
|
||||||
|
* Copyright 2017, Adriaan de Groot <groot@kde.org>
|
||||||
*
|
*
|
||||||
* Calamares is free software: you can redistribute it and/or modify
|
* Calamares is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -20,6 +21,8 @@
|
|||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
|
|
||||||
LocaleConfiguration::LocaleConfiguration()
|
LocaleConfiguration::LocaleConfiguration()
|
||||||
|
: explicit_lang( false )
|
||||||
|
, explicit_lc( false )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
*
|
*
|
||||||
* Copyright 2016, Teo Mrnjavac <teo@kde.org>
|
* Copyright 2016, Teo Mrnjavac <teo@kde.org>
|
||||||
|
* Copyright 2017, Adriaan de Groot <groot@kde.org>
|
||||||
*
|
*
|
||||||
* Calamares is free software: you can redistribute it and/or modify
|
* Calamares is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -40,6 +41,10 @@ public:
|
|||||||
lc_telephone, lc_measurement, lc_identification;
|
lc_telephone, lc_measurement, lc_identification;
|
||||||
QString myLanguageLocaleBcp47;
|
QString myLanguageLocaleBcp47;
|
||||||
QMap< QString, QString > toMap();
|
QMap< QString, QString > toMap();
|
||||||
|
|
||||||
|
// If the user has explicitly selected language (from the dialog)
|
||||||
|
// or numbers format, set these to avoid implicit changes to them.
|
||||||
|
bool explicit_lang, explicit_lc;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LOCALECONFIGURATION_H
|
#endif // LOCALECONFIGURATION_H
|
||||||
|
@ -172,6 +172,7 @@ LocalePage::LocalePage( QWidget* parent )
|
|||||||
!dlg->selectedLCLocale().isEmpty() )
|
!dlg->selectedLCLocale().isEmpty() )
|
||||||
{
|
{
|
||||||
m_selectedLocaleConfiguration.lang = dlg->selectedLCLocale();
|
m_selectedLocaleConfiguration.lang = dlg->selectedLCLocale();
|
||||||
|
m_selectedLocaleConfiguration.explicit_lang = true;
|
||||||
this->updateLocaleLabels();
|
this->updateLocaleLabels();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,6 +202,7 @@ LocalePage::LocalePage( QWidget* parent )
|
|||||||
m_selectedLocaleConfiguration.lc_telephone = dlg->selectedLCLocale();
|
m_selectedLocaleConfiguration.lc_telephone = dlg->selectedLCLocale();
|
||||||
m_selectedLocaleConfiguration.lc_measurement = dlg->selectedLCLocale();
|
m_selectedLocaleConfiguration.lc_measurement = dlg->selectedLCLocale();
|
||||||
m_selectedLocaleConfiguration.lc_identification = dlg->selectedLCLocale();
|
m_selectedLocaleConfiguration.lc_identification = dlg->selectedLCLocale();
|
||||||
|
m_selectedLocaleConfiguration.explicit_lc = true;
|
||||||
|
|
||||||
this->updateLocaleLabels();
|
this->updateLocaleLabels();
|
||||||
}
|
}
|
||||||
@ -420,6 +422,13 @@ void
|
|||||||
LocalePage::onActivate()
|
LocalePage::onActivate()
|
||||||
{
|
{
|
||||||
m_regionCombo->setFocus();
|
m_regionCombo->setFocus();
|
||||||
|
if ( m_selectedLocaleConfiguration.isEmpty() ||
|
||||||
|
!m_selectedLocaleConfiguration.explicit_lang )
|
||||||
|
{
|
||||||
|
auto newLocale = guessLocaleConfiguration();
|
||||||
|
m_selectedLocaleConfiguration.lang = newLocale.lang;
|
||||||
|
updateLocaleLabels();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -478,6 +487,27 @@ LocalePage::updateGlobalStorage()
|
|||||||
location.region + '/' + location.zone } );
|
location.region + '/' + location.zone } );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_selectedLocaleConfiguration = guessLocaleConfiguration();
|
// Preserve those settings that have been made explicit.
|
||||||
|
auto newLocale = guessLocaleConfiguration();
|
||||||
|
if ( !m_selectedLocaleConfiguration.isEmpty() &&
|
||||||
|
m_selectedLocaleConfiguration.explicit_lang )
|
||||||
|
newLocale.lang = m_selectedLocaleConfiguration.lang;
|
||||||
|
if ( !m_selectedLocaleConfiguration.isEmpty() &&
|
||||||
|
m_selectedLocaleConfiguration.explicit_lc )
|
||||||
|
{
|
||||||
|
newLocale.lc_numeric = m_selectedLocaleConfiguration.lc_numeric;
|
||||||
|
newLocale.lc_time = m_selectedLocaleConfiguration.lc_time;
|
||||||
|
newLocale.lc_monetary = m_selectedLocaleConfiguration.lc_monetary;
|
||||||
|
newLocale.lc_paper = m_selectedLocaleConfiguration.lc_paper;
|
||||||
|
newLocale.lc_name = m_selectedLocaleConfiguration.lc_name;
|
||||||
|
newLocale.lc_address = m_selectedLocaleConfiguration.lc_address;
|
||||||
|
newLocale.lc_telephone = m_selectedLocaleConfiguration.lc_telephone;
|
||||||
|
newLocale.lc_measurement = m_selectedLocaleConfiguration.lc_measurement;
|
||||||
|
newLocale.lc_identification = m_selectedLocaleConfiguration.lc_identification;
|
||||||
|
}
|
||||||
|
newLocale.explicit_lang = m_selectedLocaleConfiguration.explicit_lang;
|
||||||
|
newLocale.explicit_lc = m_selectedLocaleConfiguration.explicit_lc;
|
||||||
|
|
||||||
|
m_selectedLocaleConfiguration = newLocale;
|
||||||
updateLocaleLabels();
|
updateLocaleLabels();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user