Skip to content

Consistency and range checking for GEO data

Glen Ditchfield requested to merge gditchfield/kcalendarcore:geo-range into master

RFC5545 defines the GEO property as a pair of FLOATs. Incidence presents it as three getter/setter pairs, which allow inconsistent values. This patch provides a more error-resistant interface.

  • setGeoLatitude() and setGeoLongitude() perform range checks. Invalid values are logged and discarded, keeping the (presumed valid) current value.

  • If either of geoLatitude() or geoLongitude() return INVALID_LATLON, then both do, and hasGeo() returns false, regardless of member values.

  • setHasGeo(false) sets both coordinates to INVALID_LATLON, without requiring that the client set them.

  • setHasGeo(true) still requires the client to set valid coordinates, but hasGeo() will return false until it does.

Merge request reports