From 7bf75f99a677f653e6c106a4b6a8a8b36e51dba5 Mon Sep 17 00:00:00 2001
From: "Robert C. Helling" <[email protected]>
Date: Sat, 22 Oct 2016 23:38:23 +0200
Subject: [PATCH] Warn user about wrong characters in date/time format strings
To: [email protected]

fixes #1098

Signed-off-by: Robert C. Helling <[email protected]>
---
 desktop-widgets/preferences/preferences_language.cpp | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/desktop-widgets/preferences/preferences_language.cpp 
b/desktop-widgets/preferences/preferences_language.cpp
index 3a6720b..1e0e80a 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("Illegal characters"),
+                       tr("Illegal character(s) in time format\n See 
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("Illegal characters"),
+                       tr("Illegal character(s) in date format\n See 
http://doc.qt.io/qt-5/qdatetime.html#toString";));
 }
-- 
2.8.4 (Apple Git-73)


Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to