Diffstat (limited to 'microkde/kdecore/klocale.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | microkde/kdecore/klocale.cpp | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/microkde/kdecore/klocale.cpp b/microkde/kdecore/klocale.cpp index d77e251..9d7e60b 100644 --- a/microkde/kdecore/klocale.cpp +++ b/microkde/kdecore/klocale.cpp | |||
@@ -85,9 +85,9 @@ KLocale::KLocale() : mCalendarSystem( 0 ) | |||
85 | 85 | ||
86 | 86 | ||
87 | mWeekStartsMonday = true; | 87 | mWeekStartsMonday = true; |
88 | mHourF24Format = true; | 88 | mHourF24Format = true; |
89 | mIntDateFormat = 0; | 89 | mIntDateFormat = Default; |
90 | mLanguage = 0; | 90 | mLanguage = 0; |
91 | mDateFormat = "%a %Y %b %d"; | 91 | mDateFormat = "%a %Y %b %d"; |
92 | mDateFormatShort = "%Y-%m-%d"; | 92 | mDateFormatShort = "%Y-%m-%d"; |
93 | mTimeZoneList << i18n ("-11:00 US/Samoa") | 93 | mTimeZoneList << i18n ("-11:00 US/Samoa") |
@@ -138,14 +138,14 @@ void KLocale::setHore24Format ( bool b ) | |||
138 | void KLocale::setWeekStartMonday( bool b ) | 138 | void KLocale::setWeekStartMonday( bool b ) |
139 | { | 139 | { |
140 | mWeekStartsMonday = b; | 140 | mWeekStartsMonday = b; |
141 | } | 141 | } |
142 | int KLocale::getIntDateFormat( ) | 142 | KLocale::IntDateFormat KLocale::getIntDateFormat( ) |
143 | { | 143 | { |
144 | return mIntDateFormat ; | 144 | return mIntDateFormat; |
145 | 145 | ||
146 | } | 146 | } |
147 | void KLocale::setIntDateFormat( int i ) | 147 | void KLocale::setIntDateFormat( KLocale::IntDateFormat i ) |
148 | { | 148 | { |
149 | mIntDateFormat = i; | 149 | mIntDateFormat = i; |
150 | } | 150 | } |
151 | void KLocale::setLanguage( int i ) | 151 | void KLocale::setLanguage( int i ) |
@@ -240,11 +240,11 @@ QString KLocale::formatTime(const QTime &pTime, bool includeSecs) const | |||
240 | delete [] buffer; | 240 | delete [] buffer; |
241 | return ret; | 241 | return ret; |
242 | } | 242 | } |
243 | 243 | ||
244 | QString KLocale::formatDate(const QDate &pDate, bool shortFormat) const | 244 | QString KLocale::formatDate(const QDate &pDate, bool shortFormat, IntDateFormat intIntDateFormat) const |
245 | { | 245 | { |
246 | const QString rst = shortFormat?dateFormatShort():dateFormat(); | 246 | const QString rst = shortFormat?dateFormatShort(intIntDateFormat):dateFormat(intIntDateFormat); |
247 | 247 | ||
248 | // I'm rather safe than sorry | 248 | // I'm rather safe than sorry |
249 | QChar *buffer = new QChar[rst.length() * 3 / 2 + 50]; | 249 | QChar *buffer = new QChar[rst.length() * 3 / 2 + 50]; |
250 | 250 | ||
@@ -643,37 +643,40 @@ QString KLocale::country() const | |||
643 | { | 643 | { |
644 | return QString::null; | 644 | return QString::null; |
645 | } | 645 | } |
646 | 646 | ||
647 | QString KLocale::dateFormat() const | 647 | QString KLocale::dateFormat(IntDateFormat intIntDateFormat) const |
648 | { | 648 | { |
649 | const IntDateFormat dformat = (intIntDateFormat == Undefined)?mIntDateFormat:intIntDateFormat; | ||
650 | |||
649 | if ( QApplication::desktop()->width() < 480 ) { | 651 | if ( QApplication::desktop()->width() < 480 ) { |
650 | if ( mIntDateFormat == 0 ) | 652 | if ( dformat == Default ) |
651 | return "%a %d %b %Y"; | 653 | return "%a %d %b %Y"; |
652 | else if ( mIntDateFormat == 1 ) | 654 | else if ( dformat == Format1 ) |
653 | return "%a %b %d %Y"; | 655 | return "%a %b %d %Y"; |
654 | else if ( mIntDateFormat == 2 ) | 656 | else if ( dformat == ISODate ) |
655 | return "%a %Y %b %d"; | 657 | return "%a %Y %b %d"; |
656 | } else { | 658 | } else { |
657 | 659 | ||
658 | if ( mIntDateFormat == 0 ) | 660 | if ( dformat == Default ) |
659 | return "%A %d %B %Y"; | 661 | return "%A %d %B %Y"; |
660 | else if ( mIntDateFormat == 1 ) | 662 | else if ( dformat == Format1 ) |
661 | return "%A %B %d %Y"; | 663 | return "%A %B %d %Y"; |
662 | else if ( mIntDateFormat == 2 ) | 664 | else if ( dformat == ISODate ) |
663 | return "%A %Y %B %d"; | 665 | return "%A %Y %B %d"; |
664 | } | 666 | } |
665 | return mDateFormat ; | 667 | return mDateFormat ; |
666 | } | 668 | } |
667 | 669 | ||
668 | QString KLocale::dateFormatShort() const | 670 | QString KLocale::dateFormatShort(IntDateFormat intIntDateFormat) const |
669 | { | 671 | { |
672 | const IntDateFormat dformat = (intIntDateFormat == Undefined)?mIntDateFormat:intIntDateFormat; | ||
670 | 673 | ||
671 | if ( mIntDateFormat == 0 ) | 674 | if ( dformat == Default ) |
672 | return "%d.%m.%Y"; | 675 | return "%d.%m.%Y"; |
673 | else if ( mIntDateFormat == 1 ) | 676 | else if ( dformat == Format1 ) |
674 | return "%m.%d.%Y"; | 677 | return "%m.%d.%Y"; |
675 | else if ( mIntDateFormat == 2 ) | 678 | else if ( dformat == ISODate ) // = Qt::ISODate |
676 | return "%Y-%m-%d"; | 679 | return "%Y-%m-%d"; |
677 | return mDateFormatShort ; | 680 | return mDateFormatShort ; |
678 | 681 | ||
679 | } | 682 | } |