[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdepimlibs/kcal
From: Allen Winter <winter () kde ! org>
Date: 2007-07-31 21:11:06
Message-ID: 1185916266.318822.3107.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 694830 by winterz:
Commit Bruno's patch to provide dtStartStr/dtEndStr methods a timepec.
Also more IncidenceBase doxy.
M +26 -10 event.cpp
M +15 -3 event.h
M +24 -8 incidencebase.cpp
M +39 -26 incidencebase.h
M +26 -10 todo.cpp
M +12 -3 todo.h
--- trunk/KDE/kdepimlibs/kcal/event.cpp #694829:694830
@@ -132,23 +132,39 @@
}
}
-QString Event::dtEndTimeStr( bool shortfmt ) const
+QString Event::dtEndTimeStr( bool shortfmt, const KDateTime::Spec &spec ) const
{
- return KGlobal::locale()->formatTime( dtEnd().time(), shortfmt );
+ if ( spec.isValid() ) {
+ return KGlobal::locale()->formatTime( dtEnd().toTimeSpec( spec ).time(), shortfmt );
+ } else {
+ return KGlobal::locale()->formatTime( dtEnd().time(), shortfmt );
+ }
}
-QString Event::dtEndDateStr( bool shortfmt ) const
+QString Event::dtEndDateStr( bool shortfmt, const KDateTime::Spec &spec ) const
{
- return
- KGlobal::locale()->formatDate( dtEnd().date(),
- ( shortfmt ? KLocale::ShortDate : KLocale::LongDate ) );
+ if ( spec.isValid() ) {
+ return KGlobal::locale()->formatDate(
+ dtEnd().toTimeSpec( spec ).date(),
+ ( shortfmt ? KLocale::ShortDate : KLocale::LongDate ) );
+ } else {
+ return KGlobal::locale()->formatDate(
+ dtEnd().date(),
+ ( shortfmt ? KLocale::ShortDate : KLocale::LongDate ) );
+ }
}
-QString Event::dtEndStr( bool shortfmt ) const
+QString Event::dtEndStr( bool shortfmt, const KDateTime::Spec &spec ) const
{
- return
- KGlobal::locale()->formatDateTime( dtEnd().dateTime(),
- ( shortfmt ? KLocale::ShortDate : KLocale::LongDate ) );
+ if ( spec.isValid() ) {
+ return KGlobal::locale()->formatDateTime(
+ dtEnd().toTimeSpec( spec ).dateTime(),
+ ( shortfmt ? KLocale::ShortDate : KLocale::LongDate ) );
+ } else {
+ return KGlobal::locale()->formatDateTime(
+ dtEnd().dateTime(),
+ ( shortfmt ? KLocale::ShortDate : KLocale::LongDate ) );
+ }
}
void Event::setHasEndDate( bool b )
--- trunk/KDE/kdepimlibs/kcal/event.h #694829:694830
@@ -108,23 +108,35 @@
/**
Returns the event end time as a string formatted according to the
user's locale settings.
+
@param shortfmt If set, use short date format; else use long format.
+ @param spec If set, return the time in the given spec, else use the
+ event's current spec.
*/
- QString dtEndTimeStr( bool shortfmt = true ) const;
+ QString dtEndTimeStr( bool shortfmt = true,
+ const KDateTime::Spec &spec = KDateTime::Spec() ) const;
/**
Returns the event end date as a string formatted according to the
user's locale settings.
+
@param shortfmt If set, use short date format; else use long format.
+ @param spec If set, return the date in the given spec, else use the
+ event's current spec.
*/
- QString dtEndDateStr( bool shortfmt = true ) const;
+ QString dtEndDateStr( bool shortfmt = true,
+ const KDateTime::Spec &spec = KDateTime::Spec() ) const;
/**
Returns the event end date/time as string formatted according to the
user's locale settings.
+
@param shortfmt If set, use short date format; else use long format.
+ @param spec If set, return the date/time in the given spec, else use
+ the event's current spec.
*/
- QString dtEndStr( bool shortfmt = true ) const;
+ QString dtEndStr( bool shortfmt = true,
+ const KDateTime::Spec &spec = KDateTime::Spec() ) const;
/**
Sets whether the event has an end date/time.
--- trunk/KDE/kdepimlibs/kcal/incidencebase.cpp #694829:694830
@@ -214,21 +214,37 @@
return d->mDtStart;
}
-QString IncidenceBase::dtStartTimeStr( bool shortfmt ) const
+QString IncidenceBase::dtStartTimeStr( bool shortfmt, const KDateTime::Spec &spec ) const
{
- return KGlobal::locale()->formatTime( dtStart().time(), shortfmt );
+ if ( spec.isValid() ) {
+ return KGlobal::locale()->formatTime( dtStart().toTimeSpec( spec ).time(), shortfmt );
+ } else {
+ return KGlobal::locale()->formatTime( dtStart().time(), shortfmt );
+ }
}
-QString IncidenceBase::dtStartDateStr( bool shortfmt ) const
+QString IncidenceBase::dtStartDateStr( bool shortfmt, const KDateTime::Spec &spec ) const
{
- return KGlobal::locale()->formatDate(
- dtStart().date(), ( shortfmt ? KLocale::ShortDate : KLocale::LongDate ) );
+ if ( spec.isValid() ) {
+ return KGlobal::locale()->formatDate(
+ dtStart().toTimeSpec( spec ).date(), ( shortfmt ? KLocale::ShortDate : KLocale::LongDate ) );
+ } else {
+ return KGlobal::locale()->formatDate(
+ dtStart().date(), ( shortfmt ? KLocale::ShortDate : KLocale::LongDate ) );
+ }
}
-QString IncidenceBase::dtStartStr( bool shortfmt ) const
+QString IncidenceBase::dtStartStr( bool shortfmt, const KDateTime::Spec &spec ) const
{
- return KGlobal::locale()->formatDateTime(
- dtStart().dateTime(), ( shortfmt ? KLocale::ShortDate : KLocale::LongDate ) );
+ if ( spec.isValid() ) {
+ return KGlobal::locale()->formatDateTime(
+ dtStart().toTimeSpec( spec ).dateTime(),
+ ( shortfmt ? KLocale::ShortDate : KLocale::LongDate ) );
+ } else {
+ return KGlobal::locale()->formatDateTime(
+ dtStart().dateTime(),
+ ( shortfmt ? KLocale::ShortDate : KLocale::LongDate ) );
+ }
}
bool IncidenceBase::floats() const
--- trunk/KDE/kdepimlibs/kcal/incidencebase.h #694829:694830
@@ -127,21 +127,21 @@
/**
Reimplement this function in your concrete subclass of
IncidenceBase::Visitor to perform actions on a Todo object.
- @param event is a pointer to a valid Todo object.
+ @param todo is a pointer to a valid Todo object.
*/
virtual bool visit( Todo *todo );
/**
Reimplement this function in your concrete subclass of
IncidenceBase::Visitor to perform actions on an Journal object.
- @param event is a pointer to a valid Journal object.
+ @param journal is a pointer to a valid Journal object.
*/
virtual bool visit( Journal *journal );
/**
Reimplement this function in your concrete subclass of
IncidenceBase::Visitor to perform actions on a FreeBusy object.
- @param event is a pointer to a valid FreeBusy object.
+ @param freebusy is a pointer to a valid FreeBusy object.
*/
virtual bool visit( FreeBusy *freebusy );
@@ -193,7 +193,7 @@
/**
Compares this with IncidenceBase @p ib for equality.
- @p ib is the IncidenceBase to compare.
+ @param ib is the IncidenceBase to compare.
*/
bool operator==( const IncidenceBase &ib ) const;
@@ -305,26 +305,38 @@
/**
Returns an incidence's starting time as a string formatted according
to the user's locale settings.
+
@param shortfmt If set to true, use short date format, if set to false use
- long format.
+ long format.
+ @param spec If set, return the time in the given spec, else use the
+ incidence's current spec.
*/
- virtual QString dtStartTimeStr( bool shortfmt = true ) const;
+ virtual QString dtStartTimeStr( bool shortfmt = true,
+ const KDateTime::Spec &spec = KDateTime::Spec() ) const;
/**
Returns an incidence's starting date as a string formatted according
to the user's locale settings.
+
@param shortfmt If set to true, use short date format, if set to false use
- long format.
+ long format.
+ @param spec If set, return the date in the given spec, else use the
+ incidence's current spec.
*/
- virtual QString dtStartDateStr( bool shortfmt = true ) const;
+ virtual QString dtStartDateStr( bool shortfmt = true,
+ const KDateTime::Spec &spec = KDateTime::Spec() ) const;
/**
Returns an incidence's starting date and time as a string formatted
according to the user's locale settings.
+
@param shortfmt If set to true, use short date format, if set to false use
- long format.
+ long format.
+ @param spec If set, return the date and time in the given spec, else use
+ the incidence's current spec.
*/
- virtual QString dtStartStr( bool shortfmt = true ) const;
+ virtual QString dtStartStr( bool shortfmt = true,
+ const KDateTime::Spec &spec = KDateTime::Spec() ) const;
/**
Sets the incidence duration.
@@ -394,31 +406,31 @@
const KDateTime::Spec &newSpec );
/**
- Add a comment to this incidence.
+ Adds a comment to thieincidence. Does not add a linefeed character; simply
+ appends the text as specified.
- Does not add a linefeed character. Just appends the text as passed in.
-
- @param comment The comment to add.
+ @param comment is the QString containing the comment to add.
+ @see removeComment().
*/
void addComment( const QString &comment );
/**
- Remove a comment from the incidence.
+ Removes a comment from the incidence. Removes the first comment whose
+ string is an exact match for the specified string in @p comment.
- Removes first comment whose string is an exact match for the string
- passed in.
-
+ @param comment is the QString containing the comment to remove.
@return true if match found, false otherwise.
+ @see addComment().
*/
bool removeComment( const QString &comment );
/**
- Deletes all comments associated with this incidence.
+ Deletes all incidence comments.
*/
void clearComments();
/**
- Returns all comments associated with this incidence.
+ Returns all incidence comments as a list of strings.
*/
QStringList comments() const;
@@ -432,33 +444,34 @@
void addAttendee( Attendee *attendee, bool doUpdate = true );
/**
- Remove all Attendees.
+ Removes all attendees from the incidence.
*/
void clearAttendees();
/**
- Returns list of attendees.
+ Returns a list of incidence attendees.
*/
const Attendee::List &attendees() const;
/**
- Returns number of attendees.
+ Returns the number of incidence attendees.
*/
int attendeeCount() const;
/**
- Returns the Attendee with this email address.
+ Returns the attendee with this email address.
*/
Attendee *attendeeByMail( const QString &email ) const;
/**
- Returns first Attendee with one of the given email addresses.
+ Returns the first incidence attendee with one of the specified
+ email addresses.
*/
Attendee *attendeeByMails( const QStringList &emails,
const QString &email = QString() ) const;
/**
- Returns attendee with given uid.
+ Returns the incidence attendee with given uid.
*/
Attendee *attendeeByUid( const QString &uid ) const;
--- trunk/KDE/kdepimlibs/kcal/todo.cpp #694829:694830
@@ -156,23 +156,39 @@
return d->mDtDue;
}
-QString Todo::dtDueTimeStr( bool shortfmt ) const
+QString Todo::dtDueTimeStr( bool shortfmt, const KDateTime::Spec &spec ) const
{
- return KGlobal::locale()->formatTime( dtDue( !recurs() ).time(), shortfmt );
+ if ( spec.isValid() ) {
+ return KGlobal::locale()->formatTime( dtDue( !recurs() ).toTimeSpec( spec ).time(), shortfmt );
+ } else {
+ return KGlobal::locale()->formatTime( dtDue( !recurs() ).time(), shortfmt );
+ }
}
-QString Todo::dtDueDateStr( bool shortfmt ) const
+QString Todo::dtDueDateStr( bool shortfmt, const KDateTime::Spec &spec ) const
{
- return
- KGlobal::locale()->formatDate( dtDue( !recurs() ).date(),
- ( shortfmt ? KLocale::ShortDate : KLocale::LongDate ) );
+ if ( spec.isValid() ) {
+ return KGlobal::locale()->formatDate(
+ dtDue( !recurs() ).toTimeSpec( spec ).date(),
+ ( shortfmt ? KLocale::ShortDate : KLocale::LongDate ) );
+ } else {
+ return KGlobal::locale()->formatDate(
+ dtDue( !recurs() ).date(),
+ ( shortfmt ? KLocale::ShortDate : KLocale::LongDate ) );
+ }
}
-QString Todo::dtDueStr( bool shortfmt ) const
+QString Todo::dtDueStr( bool shortfmt, const KDateTime::Spec &spec ) const
{
- return
- KGlobal::locale()->formatDateTime( dtDue( !recurs() ).dateTime(),
- ( shortfmt ? KLocale::ShortDate : KLocale::LongDate ) );
+ if ( spec.isValid() ) {
+ return KGlobal::locale()->formatDateTime(
+ dtDue( !recurs() ).toTimeSpec( spec ).dateTime(),
+ ( shortfmt ? KLocale::ShortDate : KLocale::LongDate ) );
+ } else {
+ return KGlobal::locale()->formatDateTime(
+ dtDue( !recurs() ).dateTime(),
+ ( shortfmt ? KLocale::ShortDate : KLocale::LongDate ) );
+ }
}
bool Todo::hasDueDate() const
--- trunk/KDE/kdepimlibs/kcal/todo.h #694829:694830
@@ -100,24 +100,33 @@
settings.
@param shortfmt If set, use short date format; else use long format.
+ @param spec If set, return the time in the given spec, else use the
+ todo's current spec.
*/
- QString dtDueTimeStr( bool shortfmt = true ) const;
+ QString dtDueTimeStr( bool shortfmt = true,
+ const KDateTime::Spec &spec = KDateTime::Spec() ) const;
/**
Returns due date as string formatted according to the user's locale
settings.
@param shortfmt If set, use short date format; else use long format.
+ @param spec If set, return the date in the given spec, else use the
+ todo's current spec.
*/
- QString dtDueDateStr( bool shortfmt = true ) const;
+ QString dtDueDateStr( bool shortfmt = true,
+ const KDateTime::Spec &spec = KDateTime::Spec() ) const;
/**
Returns due date and time as string formatted according to the user's
locale settings.
@param shortfmt If set, use short date format; else use long format.
+ @param spec If set, return the date/time in the given spec, else use
+ the todo's current spec.
*/
- QString dtDueStr( bool shortfmt = true ) const;
+ QString dtDueStr( bool shortfmt = true,
+ const KDateTime::Spec &spec = KDateTime::Spec() ) const;
/**
Returns true if the todo has a due date, otherwise return false.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic