From cd2985f54b694be7894a1c778a9b8baeed42505e Mon Sep 17 00:00:00 2001 From: "vladimir%pobox.com" Date: Thu, 18 Nov 2004 07:06:43 +0000 Subject: [PATCH] calendar build fixes; also updated datetime impl for timezone handling on nativetime set --- calendar/base/build/Makefile.in | 12 +++++++++ calendar/base/public/calIDateTime.idl | 4 +-- calendar/base/src/calDateTime.cpp | 36 ++++++++++++++++++++++++--- calendar/base/src/calDateTime.h | 1 + 4 files changed, 48 insertions(+), 5 deletions(-) diff --git a/calendar/base/build/Makefile.in b/calendar/base/build/Makefile.in index 99d7f7e76e6..8087c88d8c3 100644 --- a/calendar/base/build/Makefile.in +++ b/calendar/base/build/Makefile.in @@ -64,4 +64,16 @@ CPPSRCS = calBaseModule.cpp \ LOCAL_INCLUDES = \ -I$(srcdir)/../src +SHARED_LIBRARY_LIBS = \ + $(DIST)/lib/$(LIB_PREFIX)calbase_s.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)mozical.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)mozicalss.$(LIB_SUFFIX) \ + $(NULL) + +EXTRA_DSO_LDOPTS += \ + $(LIBS_DIR) \ + $(EXTRA_DSO_LIBS) \ + $(MOZ_COMPONENT_LIBS) \ + $(NULL) + include $(topsrcdir)/config/rules.mk diff --git a/calendar/base/public/calIDateTime.idl b/calendar/base/public/calIDateTime.idl index d34d75c04b5..67305049bdb 100644 --- a/calendar/base/public/calIDateTime.idl +++ b/calendar/base/public/calIDateTime.idl @@ -89,9 +89,9 @@ interface calIDateTime : nsISupports attribute PRBool isUtc; // an associated timezone that's the preferred way of representing - // this object. If this is null, then there is no preferred + // this object. If this is null/empty, then there is no preferred // timezone, and UTC or localtime is assumed (based on isUtc). - attribute string timezone; + attribute AUTF8String timezone; // // computed values diff --git a/calendar/base/src/calDateTime.cpp b/calendar/base/src/calDateTime.cpp index 40fd76b5ac5..f68c807dcde 100644 --- a/calendar/base/src/calDateTime.cpp +++ b/calendar/base/src/calDateTime.cpp @@ -47,9 +47,19 @@ extern "C" { NS_IMPL_ISUPPORTS1(calDateTime, calIDateTime) calDateTime::calDateTime() - : mValid(PR_FALSE) + : mImmutable(PR_FALSE), + mValid(PR_FALSE) { - + mNativeTime = 0; + mYear = 0; + mMonth = 0; + mDay = 0; + mHour = 0; + mMinute = 0; + mSecond = 0; + mIsUtc = PR_FALSE; + mWeekday = 0; + mYearday = 0; } calDateTime::calDateTime(struct icaltimetype *atimeptr) @@ -108,7 +118,6 @@ calDateTime::Clone(calIDateTime **aResult) CAL_VALUETYPE_ATTR_GETTER(calDateTime, PRBool, Valid) -CAL_VALUETYPE_ATTR(calDateTime, PRTime, NativeTime) CAL_VALUETYPE_ATTR(calDateTime, PRInt16, Year) CAL_VALUETYPE_ATTR(calDateTime, PRInt16, Month) CAL_VALUETYPE_ATTR(calDateTime, PRInt16, Day) @@ -120,6 +129,27 @@ CAL_VALUETYPE_ATTR(calDateTime, PRBool, IsUtc) CAL_VALUETYPE_ATTR_GETTER(calDateTime, PRInt16, Weekday) CAL_VALUETYPE_ATTR_GETTER(calDateTime, PRInt16, Yearday) +CAL_STRINGTYPE_ATTR(calDateTime, nsACString, Timezone) + +NS_IMETHODIMP +calDateTime::GetNativeTime(PRTime *aResult) +{ + *aResult = mNativeTime; + return NS_OK; +} + +NS_IMETHODIMP +calDateTime::SetNativeTime(PRTime aNativeTime) +{ + if (mIsUtc) { + return SetTimeInTimezone (aNativeTime, "UTC"); + } else if (!mTimezone.IsEmpty()) { + return SetTimeInTimezone (aNativeTime, mTimezone.get()); + } else { + return SetTimeInTimezone (aNativeTime, NULL); + } +} + NS_IMETHODIMP calDateTime::Normalize() { diff --git a/calendar/base/src/calDateTime.h b/calendar/base/src/calDateTime.h index c459282fff2..36961f1a88e 100644 --- a/calendar/base/src/calDateTime.h +++ b/calendar/base/src/calDateTime.h @@ -72,6 +72,7 @@ protected: PRInt16 mSecond; PRBool mIsUtc; + nsCString mTimezone; PRInt16 mWeekday; PRInt16 mYearday;