my own kdatetime patches: toString with InvalidOffset; operator==

David Faure faure at kde.org
Fri Oct 26 17:23:05 UTC 2012


On Friday 26 October 2012 17:30:56 Jon Severinsson wrote:
> I'm no expert either, but I have picked up a few things over the last couple
> of weeks, and IMHO such a KDateTime should be invalid, but not null, and
> toString should result in a sensible, though invalid, string.

Sounds sensible, but please note that this isn't what your patch does.
The unittest still says
      QVERIFY(dateTimeInvalidTz.isValid());
therefore "such a KDateTime should be invalid" isn't implemented.

> I have therefore updated your patch (see attachment) to fix
> KDateTime::Spec::setType(KTimeZone)  as I proposed, changed the validation
> check at the top of toString() to "if (!d->dt().isValid())" and adapted your
> toString() fix to check for  "d->specType == Invalid" (as well as "offset
> == KTimeZone::InvalidOffset", just in case something has gone wrong with
> the time zone after the original check).
> 
> I also changed "+invalidtz" to "+EINVAL", as I think an error code makes
> more sence than an non-translatable error text.

All this sounds good.

Thanks!

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE, in particular KDE Frameworks 5
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20121026/7bbabec6/attachment.sig>


More information about the Kde-frameworks-devel mailing list