desktop: refresh date/time format when switching to system defaults

When switching to system defaults, refresh the fields in the preferences
UI so that the user can tell how the fields will be formatted.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2020-05-22 09:39:48 +02:00 committed by Dirk Hohndel
parent 757a4fa146
commit fb1cf8d0e5

View file

@ -90,6 +90,10 @@ void PreferencesLanguage::syncSettings()
qPrefLanguage::set_date_format_short(ui->shortDateFormatEntry->text());
initUiLanguage();
// When switching to system defaults, initUiLanguage() will reset the date and time formats.
// Therefore, refresh the UI fields to give the user a visual feedback of the new formats.
refreshSettings();
QString qDateTimeWeb = tr("These will be used as is. This might not be what you intended.\nSee http://doc.qt.io/qt-5/qdatetime.html#toString");
QRegExp tfillegalchars("[^hHmszaApPt\\s:;\\.,]");
if (tfillegalchars.indexIn(ui->timeFormatEntry->currentText()) >= 0)