[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-pim
Subject: Re: [Kde-pim] About KOrganizer's timezone setting
From: Bruno Virlet <bruno () virlet ! org>
Date: 2007-07-30 14:38:31
Message-ID: 200707301638.31137.bvirlet () suse ! de
[Download RAW message or body]
> If there is something else that you don't think caters for KDateTime,
> please let me know.
In kcal a simple grep -iRn give pretty much only those ones and related ones
(eg. todos(QDate& date), journals(QDate &date) )
Apart from that, I think there is also a patch (attached) concerning
dtStartStr/dtEndStr which should be applied to allow to get these strings in
a given timespec (eg because KOrganizer will have a 'display' timezone)
Bruno
["kdepimlibs.1.patch" (text/x-diff)]
===================================================================
--- incidencebase.h (revision 694352)
+++ incidencebase.h (working copy)
@@ -304,24 +304,27 @@
to the user's locale settings.
@param shortfmt If set to true, use short date format, if set to false use
long format.
+ @param spec If set, return the time in the given spec, else use the system \
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.
+ @param spec If set, return the date in the given spec, else use the system \
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.
+ @param spec If set, return the date and time in the given spec, else use the \
system 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.
Index: event.h
===================================================================
--- event.h (revision 694352)
+++ event.h (working copy)
@@ -109,22 +109,25 @@
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 system \
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 system \
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 \
system 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.
Index: event.cpp
===================================================================
--- event.cpp (revision 694352)
+++ event.cpp (working copy)
@@ -132,23 +132,37 @@
}
}
-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
+ 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(),
+ 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 )
Index: incidencebase.cpp
===================================================================
--- incidencebase.cpp (revision 694352)
+++ incidencebase.cpp (working copy)
@@ -209,19 +209,28 @@
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
_______________________________________________
KDE PIM mailing list kde-pim@kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic