aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets/preferences
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2016-10-22 23:38:23 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-10-28 07:30:22 -0700
commitc47c3555f63052a99e4866e42c4b0c3e9396a8a4 (patch)
tree2d6b9d80b9ca88bf66dc83cec65ad07515adb9d6 /desktop-widgets/preferences
parentb478d75303928bace456f16d46c40ceddacf2f1e (diff)
downloadsubsurface-c47c3555f63052a99e4866e42c4b0c3e9396a8a4.tar.gz
Warn user about wrong characters in date/time format strings
fixes #1098 Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets/preferences')
-rw-r--r--desktop-widgets/preferences/preferences_language.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/desktop-widgets/preferences/preferences_language.cpp b/desktop-widgets/preferences/preferences_language.cpp
index 3a6720b4f..dbcffccd8 100644
--- a/desktop-widgets/preferences/preferences_language.cpp
+++ b/desktop-widgets/preferences/preferences_language.cpp
@@ -70,4 +70,15 @@ void PreferencesLanguage::syncSettings()
lang->setDateFormat(ui->dateFormatEntry->text());
lang->setDateFormatShort(ui->shortDateFormatEntry->text());
uiLanguage(NULL);
+
+ QRegExp tfillegalchars("[^hHmszaApPt\\s:;\\.,]");
+ if (tfillegalchars.indexIn(ui->timeFormatEntry->text()) >= 0)
+ QMessageBox::warning(this, tr("Literal characters"),
+ tr("Non-special character(s) in time format.\nThese will be used as is. This might not be what you intended.\nSee http://doc.qt.io/qt-5/qdatetime.html#toString"));
+
+ QRegExp dfillegalchars("[^dMy/\\s:;\\.,]");
+ if (dfillegalchars.indexIn(ui->dateFormatEntry->text()) >= 0 ||
+ dfillegalchars.indexIn(ui->shortDateFormatEntry->text()) >= 0)
+ QMessageBox::warning(this, tr("Literal characters"),
+ tr("Non-special character(s) in time format.\nThese will be used as is. This might not be what you intended.\nSee http://doc.qt.io/qt-5/qdatetime.html#toString"));
}