Ejemplo n.º 1
0
NS_IMETHODIMP
calPeriod::SetIcalString(const nsACString& aIcalString)
{
    if (mImmutable)
        return NS_ERROR_OBJECT_IS_IMMUTABLE;
    struct icalperiodtype ip;
    ip = icalperiodtype_from_string(PromiseFlatCString(aIcalString).get());
    //XXX Shortcut. Assumes nobody tried to overrule our impl. of calIDateTime
    mStart = new calDateTime(&ip.start, nsnull);
    mEnd = new calDateTime(&ip.end, nsnull);
    return NS_OK;
}
Ejemplo n.º 2
0
NS_IMETHODIMP
calPeriod::SetIcalString(const nsACString &aIcalString) {
  if (mImmutable) return NS_ERROR_OBJECT_IS_IMMUTABLE;
  struct icalperiodtype ip;
  ip = icalperiodtype_from_string(PromiseFlatCString(aIcalString).get());
  // XXX Shortcut. Assumes nobody tried to overrule our impl. of calIDateTime
  mStart = new calDateTime(&ip.start, nullptr);
  if (icaltime_is_null_time(ip.end)) {
    struct icaltimetype end;
    end = icaltime_add(ip.start, ip.duration);
    mEnd = new calDateTime(&end, nullptr);
  } else {
    mEnd = new calDateTime(&ip.end, nullptr);
  }
  return NS_OK;
}