mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	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>
This commit is contained in:
		
							parent
							
								
									b478d75303
								
							
						
					
					
						commit
						c47c3555f6
					
				
					 1 changed files with 11 additions and 0 deletions
				
			
		| 
						 | 
					@ -70,4 +70,15 @@ void PreferencesLanguage::syncSettings()
 | 
				
			||||||
	lang->setDateFormat(ui->dateFormatEntry->text());
 | 
						lang->setDateFormat(ui->dateFormatEntry->text());
 | 
				
			||||||
	lang->setDateFormatShort(ui->shortDateFormatEntry->text());
 | 
						lang->setDateFormatShort(ui->shortDateFormatEntry->text());
 | 
				
			||||||
	uiLanguage(NULL);
 | 
						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"));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue