author | ulf69 <ulf69> | 2004-09-15 17:48:36 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-09-15 17:48:36 (UTC) |
commit | 0af70ae5fee7b71aecf5ac742fdd65e31237eb5a (patch) (side-by-side diff) | |
tree | 08a51756744591056fd74f3658afe940f5823265 /microkde/kdecore | |
parent | c151151ccaffe54510e58731dc6d8f9d441bd31c (diff) | |
download | kdepimpi-0af70ae5fee7b71aecf5ac742fdd65e31237eb5a.zip kdepimpi-0af70ae5fee7b71aecf5ac742fdd65e31237eb5a.tar.gz kdepimpi-0af70ae5fee7b71aecf5ac742fdd65e31237eb5a.tar.bz2 |
small changes to accommodate pwManager
-rw-r--r-- | microkde/kdecore/klocale.cpp | 51 | ||||
-rw-r--r-- | microkde/kdecore/klocale.h | 11 |
2 files changed, 48 insertions, 14 deletions
diff --git a/microkde/kdecore/klocale.cpp b/microkde/kdecore/klocale.cpp index 9d7e60b..4960b9a 100644 --- a/microkde/kdecore/klocale.cpp +++ b/microkde/kdecore/klocale.cpp @@ -89,2 +89,3 @@ KLocale::KLocale() : mCalendarSystem( 0 ) mIntDateFormat = Default; + mIntTimeFormat = Default; mLanguage = 0; @@ -141,2 +142,3 @@ void KLocale::setWeekStartMonday( bool b ) } + KLocale::IntDateFormat KLocale::getIntDateFormat( ) @@ -150,2 +152,12 @@ void KLocale::setIntDateFormat( KLocale::IntDateFormat i ) } +KLocale::IntDateFormat KLocale::getIntTimeFormat( ) +{ + return mIntTimeFormat; + +} +void KLocale::setIntTimeFormat( KLocale::IntDateFormat i ) +{ + mIntTimeFormat = i; +} + void KLocale::setLanguage( int i ) @@ -164,5 +176,5 @@ QString KLocale::translate( const char *, const char *fallback) const -QString KLocale::formatTime(const QTime &pTime, bool includeSecs) const +QString KLocale::formatTime(const QTime &pTime, bool includeSecs, IntDateFormat intIntDateFormat) const { - const QString rst = timeFormat(); + const QString rst = timeFormat(intIntDateFormat); @@ -317,12 +329,13 @@ QString KLocale::formatDateTime(const QDateTime &pDateTime, bool shortFormat, - bool includeSeconds) const + bool includeSeconds, + IntDateFormat intIntDateFormat) const { return QString( "%1 %2") - .arg( formatDate( pDateTime.date(), shortFormat ) ) - .arg( formatTime( pDateTime.time(), includeSeconds ) ); + .arg( formatDate( pDateTime.date(), shortFormat, intIntDateFormat ) ) + .arg( formatTime( pDateTime.time(), includeSeconds , intIntDateFormat ) ); } -QString KLocale::formatDateTime(const QDateTime &pDateTime) const +QString KLocale::formatDateTime(const QDateTime &pDateTime, IntDateFormat intIntDateFormat) const { - return formatDateTime(pDateTime, true); + return formatDateTime(pDateTime, true, intIntDateFormat); } @@ -458,2 +471,3 @@ QTime KLocale::readTime(const QString &intstr, bool seconds, bool *ok) const int hour = -1, minute = -1, second = seconds ? -1 : 0; // don't require seconds + bool g_12h = false; @@ -684,7 +698,24 @@ QString KLocale::dateFormatShort(IntDateFormat intIntDateFormat) const -QString KLocale::timeFormat() const +QString KLocale::timeFormat(IntDateFormat intIntTimeFormat) const { - if ( mHourF24Format) + const IntDateFormat tformat = (intIntTimeFormat == Undefined)?mIntTimeFormat:intIntTimeFormat; + + if ( tformat == Default ) + if ( mHourF24Format) + return "%H:%M:%S"; + else + return "%I:%M:%S%p"; + + else if ( tformat == Format1 ) + if ( mHourF24Format) + return "%H:%M:%S"; + else + return "%I:%M:%S%p"; + + else if ( tformat == ISODate ) // = Qt::ISODate + if ( mHourF24Format) return "%H:%M:%S"; - return "%I:%M:%S%p"; + else + return "%I:%M:%S%p"; + } diff --git a/microkde/kdecore/klocale.h b/microkde/kdecore/klocale.h index f6c0253..153b12a 100644 --- a/microkde/kdecore/klocale.h +++ b/microkde/kdecore/klocale.h @@ -46,7 +46,7 @@ class KLocale QString formatDate(const QDate &pDate, bool shortFormat = false, IntDateFormat intIntDateFormat = Undefined) const; - QString formatTime(const QTime &pTime, bool includeSecs = false) const; - QString formatDateTime(const QDateTime &pDateTime) const; + QString formatTime(const QTime &pTime, bool includeSecs = false, IntDateFormat intIntDateFormat = Undefined) const; + QString formatDateTime(const QDateTime &pDateTime, IntDateFormat intIntDateFormat = Undefined) const; QString formatDateTime(const QDateTime &pDateTime, bool shortFormat, - bool includeSecs = false) const; + bool includeSecs = false, IntDateFormat intIntDateFormat = Undefined) const; @@ -67,3 +67,3 @@ class KLocale QString dateFormatShort(IntDateFormat intIntDateFormat = Undefined) const; - QString timeFormat() const; + QString timeFormat(IntDateFormat intIntDateFormat = Undefined) const; @@ -75,3 +75,5 @@ class KLocale void setIntDateFormat( IntDateFormat ); + void setIntTimeFormat( IntDateFormat ); IntDateFormat getIntDateFormat( ); + IntDateFormat getIntTimeFormat( ); void setLanguage( int ); @@ -100,2 +102,3 @@ class KLocale IntDateFormat mIntDateFormat; + IntDateFormat mIntTimeFormat; int mLanguage; |