Reading times using KLocale::readTime()

Michael Leupold lemma at confuego.org
Fri Jul 17 00:30:26 BST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I'm currently in process of writing (trying to write) a QValidator for time 
input widgets. It's meant to allow input in locale defined, basic 24h as 
well as military format concurrently. For the locale part I'm using the 
KLocale's timeFormat and I can already detect if a string matches it.

Now I'm trying to perform a proper fixup() including adding seconds to a 
time in locale format that has been entered without (eg. user enteres 17:30 
and fixup() produces 17:30:30). My main problem is that I'd like to use 
KLocale::readTime() but it doesn't read as much as I'd like it to, eg. for 
12h time it will read "5:30 pm" but not "5:30pm".

I wondered if it would be possible to implement skipping the reading of 
spaces in readTime(). Basically I'm not certain which circumstances it's 
used in. If its purpose is just "reading user input times" (lax), then the 
change might be legal. If it is "read input times exactly matching the 
locale format" (strict), then it might be a change that breaks stuff 
elsewhere.

Regards,
Michael
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFKX7gUlfpzINIAlVsRAlcpAJ9US4wvCR4bDkFIC6tI5bI9wSHltACcDsom
8ILZ8AlWZxooa/of8hmTKz4=
=jCn/
-----END PGP SIGNATURE-----






More information about the kde-core-devel mailing list