summaryrefslogtreecommitdiffabout
path: root/microkde/kdecore/klocale.cpp
Side-by-side diff
Diffstat (limited to 'microkde/kdecore/klocale.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdecore/klocale.cpp39
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 )
mWeekStartsMonday = true;
mHourF24Format = true;
- mIntDateFormat = 0;
+ mIntDateFormat = Default;
mLanguage = 0;
mDateFormat = "%a %Y %b %d";
mDateFormatShort = "%Y-%m-%d";
mTimeZoneList << i18n ("-11:00 US/Samoa")
@@ -138,14 +138,14 @@ void KLocale::setHore24Format ( bool b )
void KLocale::setWeekStartMonday( bool b )
{
mWeekStartsMonday = b;
}
-int KLocale::getIntDateFormat( )
+KLocale::IntDateFormat KLocale::getIntDateFormat( )
{
- return mIntDateFormat ;
+ return mIntDateFormat;
}
-void KLocale::setIntDateFormat( int i )
+void KLocale::setIntDateFormat( KLocale::IntDateFormat i )
{
mIntDateFormat = i;
}
void KLocale::setLanguage( int i )
@@ -240,11 +240,11 @@ QString KLocale::formatTime(const QTime &pTime, bool includeSecs) const
delete [] buffer;
return ret;
}
-QString KLocale::formatDate(const QDate &pDate, bool shortFormat) const
+QString KLocale::formatDate(const QDate &pDate, bool shortFormat, IntDateFormat intIntDateFormat) const
{
- const QString rst = shortFormat?dateFormatShort():dateFormat();
+ const QString rst = shortFormat?dateFormatShort(intIntDateFormat):dateFormat(intIntDateFormat);
// I'm rather safe than sorry
QChar *buffer = new QChar[rst.length() * 3 / 2 + 50];
@@ -643,37 +643,40 @@ QString KLocale::country() const
{
return QString::null;
}
-QString KLocale::dateFormat() const
-{
+QString KLocale::dateFormat(IntDateFormat intIntDateFormat) const
+{
+ const IntDateFormat dformat = (intIntDateFormat == Undefined)?mIntDateFormat:intIntDateFormat;
+
if ( QApplication::desktop()->width() < 480 ) {
- if ( mIntDateFormat == 0 )
+ if ( dformat == Default )
return "%a %d %b %Y";
- else if ( mIntDateFormat == 1 )
+ else if ( dformat == Format1 )
return "%a %b %d %Y";
- else if ( mIntDateFormat == 2 )
+ else if ( dformat == ISODate )
return "%a %Y %b %d";
} else {
- if ( mIntDateFormat == 0 )
+ if ( dformat == Default )
return "%A %d %B %Y";
- else if ( mIntDateFormat == 1 )
+ else if ( dformat == Format1 )
return "%A %B %d %Y";
- else if ( mIntDateFormat == 2 )
+ else if ( dformat == ISODate )
return "%A %Y %B %d";
}
return mDateFormat ;
}
-QString KLocale::dateFormatShort() const
+QString KLocale::dateFormatShort(IntDateFormat intIntDateFormat) const
{
+ const IntDateFormat dformat = (intIntDateFormat == Undefined)?mIntDateFormat:intIntDateFormat;
- if ( mIntDateFormat == 0 )
+ if ( dformat == Default )
return "%d.%m.%Y";
- else if ( mIntDateFormat == 1 )
+ else if ( dformat == Format1 )
return "%m.%d.%Y";
- else if ( mIntDateFormat == 2 )
+ else if ( dformat == ISODate ) // = Qt::ISODate
return "%Y-%m-%d";
return mDateFormatShort ;
}