Home · All Classes · Main Classes · Deprecated
Public Member Functions | Static Public Member Functions

MCalendar Class Reference

MCalendar can hold date and time value for with different calendar systems. More...

List of all members.

Public Member Functions

 MCalendar (MLocale::CalendarType calendarType=MLocale::DefaultCalendar, const QString &timezone=QString())
 MCalendar (const MLocale &mLocale, const QString &timezone=QString())
 MCalendar (const MCalendar &other)
virtual ~MCalendar ()
MCalendaroperator= (const MCalendar &other)
bool isValid () const
MLocale::CalendarType type () const
void setDate (int year, int month, int day)
void setDate (const QDate &date)
void setDateTime (QDateTime datetime)
QDateTime qDateTime (Qt::TimeSpec spec=Qt::LocalTime) const
void setYear (int year)
void setMonth (int month)
void setDay (int day)
int dayOfYear () const
int weekOfYear () const
int month () const
int year () const
int yearOfWeek () const
int dayOfMonth () const
int dayOfWeek () const
void setTime (int hours, int minutes, int seconds)
void setHours (int hours)
void setMinutes (int minutes)
void setSeconds (int seconds)
int hour () const
int minute () const
int second () const
void addYears (int years)
void addMonths (int months)
void addDays (int days)
void addHours (int hours)
void addMinutes (int minutes)
void addSeconds (int seconds)
int firstDayOfMonth () const
int lastDayOfMonth () const
void setFirstDayOfWeek (int weekday)
int firstDayOfWeek () const
void setMinimalDaysInFirstWeek (int days)
int minimalDaysInFirstWeek () const
int weekNumber () const
int maximumWeeksInMonth () const
int daysInWeek () const
bool after (const MCalendar &other) const
bool before (const MCalendar &other) const
bool equals (const MCalendar &other) const
bool operator< (const MCalendar &other) const
bool operator<= (const MCalendar &other) const
bool operator== (const MCalendar &other) const
bool operator!= (const MCalendar &other) const
bool operator> (const MCalendar &other) const
bool operator>= (const MCalendar &other) const

Static Public Member Functions

static void setSystemTimeZone (const QString &timezone)
static QString systemTimeZone ()
static QStringList supportedTimeZones ()
static QStringList supportedTimeZones (const QString &country)

Detailed Description

MCalendar can hold date and time value for with different calendar systems.

Note:
insufficient information: default values are used. e.g. with gregorian calendar the epoch value (1970-1-1)
inconsistent information: preference is on fields set more recently

Constructor & Destructor Documentation

MCalendar::MCalendar ( MLocale::CalendarType  calendarType = MLocale::DefaultCalendar,
const QString timezone = QString() 
) [explicit]

Constructs a MCalendar with explicit calendar type.

Parameters:
calendar Calendar type. Default is the type used for default locale.
timezone Timezone to be used. Default is timezone of the default locale. Possible values: id, e.g. PST, country/city, e.g. Europe/Helsinki or GMT offset, e.g. GTM+2:00. supportedTimezones() can be used to enumerate choices.
MCalendar::MCalendar ( const MLocale mLocale,
const QString timezone = QString() 
) [explicit]

Constructs a MCalendar based on calendar system used by given MLocale.

MCalendar::MCalendar ( const MCalendar other  ) 

Copy constructor.

MCalendar::~MCalendar (  )  [virtual]

Destroys the calendar.


Member Function Documentation

void MCalendar::addDays ( int  days  ) 

Add number of days days to the current date.

void MCalendar::addHours ( int  hours  ) 

Add number of hours hours to the current time.

void MCalendar::addMinutes ( int  minutes  ) 

Add number of minutes minutes to the current time.

void MCalendar::addMonths ( int  months  ) 

Add number of months months to the current date.

void MCalendar::addSeconds ( int  seconds  ) 

Add number of seconds seconds to the current time.

void MCalendar::addYears ( int  years  ) 

Add number of years years to the current date.

bool MCalendar::after ( const MCalendar other  )  const

Returns true if the current date/time of this calendar is after other.

bool MCalendar::before ( const MCalendar other  )  const

Returns true if the current date/time of this calendar is before other.

int MCalendar::dayOfMonth (  )  const

Returns day of month.

int MCalendar::dayOfWeek (  )  const

Returns day of week. Monday = 1.

int MCalendar::dayOfYear (  )  const

returns day number of the year. returns zero on error.

int MCalendar::daysInWeek (  )  const

Returns the maximum number of days in a week.

bool MCalendar::equals ( const MCalendar other  )  const

Returns true if the current date/time of this calendar is equal to other.

int MCalendar::firstDayOfMonth (  )  const

Returns first day of a month.

int MCalendar::firstDayOfWeek (  )  const

Returns the first day of a week.

int MCalendar::hour (  )  const

Returns the current hours.

bool MCalendar::isValid (  )  const

checks the validity of the information of the calendar. Returns true if calendar is valid.

int MCalendar::lastDayOfMonth (  )  const

Returns last day of a month.

int MCalendar::maximumWeeksInMonth (  )  const

Returns the maximum number of weeks in a month.

int MCalendar::minimalDaysInFirstWeek (  )  const

returns the number of days required for the first week in the year

int MCalendar::minute (  )  const

Returns the current minutes.

int MCalendar::month (  )  const

Returns month number.

bool MCalendar::operator!= ( const MCalendar other  )  const

Returns true if the current date/time of this calendar is different than other.

bool MCalendar::operator< ( const MCalendar other  )  const

Returns true if the current date/time of this calendar is before other.

bool MCalendar::operator<= ( const MCalendar other  )  const

Returns true if the current date/time of this calendar is equal or before other.

MCalendar & MCalendar::operator= ( const MCalendar other  ) 

Assignment operator.

bool MCalendar::operator== ( const MCalendar other  )  const

Returns true if the current date/time of this calendar is equal to other.

bool MCalendar::operator> ( const MCalendar other  )  const

Returns true if the current date/time of this calendar is after other.

bool MCalendar::operator>= ( const MCalendar other  )  const

Returns true if the current date/time of this calendar is equal or after other.

QDateTime MCalendar::qDateTime ( Qt::TimeSpec  spec = Qt::LocalTime  )  const

Converts calendar into QDate.

Parameters:
spec (optional) specification for resulting QDateTime, Qt::LocalTime (default) or Qt::UTC
int MCalendar::second (  )  const

Returns the current seconds.

void MCalendar::setDate ( int  year,
int  month,
int  day 
)

Sets the calendar date. Parameters self explanatory.

void MCalendar::setDate ( const QDate date  ) 

Sets the calendar date from QDate.

void MCalendar::setDateTime ( QDateTime  datetime  ) 

Sets the calendar according to given QDate.

void MCalendar::setDay ( int  day  ) 

Set the day of the date to day.

void MCalendar::setFirstDayOfWeek ( int  weekday  ) 

Sets the first day of the week to weekday.

void MCalendar::setHours ( int  hours  ) 

Set the hours of the date/time to hours.

void MCalendar::setMinimalDaysInFirstWeek ( int  days  ) 

sets what is the required amount of days for the first week of the year.

void MCalendar::setMinutes ( int  minutes  ) 

Set the minutes of the time to minutes.

void MCalendar::setMonth ( int  month  ) 

Set the month of the date to month.

void MCalendar::setSeconds ( int  seconds  ) 

Set the seconds of the time to seconds.

void MCalendar::setSystemTimeZone ( const QString timezone  )  [static]
void MCalendar::setTime ( int  hours,
int  minutes,
int  seconds 
)

Set calendar time of the day.

void MCalendar::setYear ( int  year  ) 

Set the year of the date to year.

QStringList MCalendar::supportedTimeZones ( const QString country  )  [static]
QStringList MCalendar::supportedTimeZones (  )  [static]
QString MCalendar::systemTimeZone (  )  [static]
MLocale::CalendarType MCalendar::type (  )  const

returns the used calendar system

int MCalendar::weekNumber (  )  const

Returns the current week number.

int MCalendar::weekOfYear (  )  const

Returns week number in the year.

int MCalendar::year (  )  const

Returns year number.

int MCalendar::yearOfWeek (  )  const

returns the year the current week "belongs to".


Copyright © 2010 Nokia Corporation
MeeGo Touch