summaryrefslogtreecommitdiffabout
path: root/microkde/kdecore/klocale.cpp
Side-by-side diff
Diffstat (limited to 'microkde/kdecore/klocale.cpp') (more/less context) (show whitespace changes)
-rw-r--r--microkde/kdecore/klocale.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/microkde/kdecore/klocale.cpp b/microkde/kdecore/klocale.cpp
index 673d845..3674f28 100644
--- a/microkde/kdecore/klocale.cpp
+++ b/microkde/kdecore/klocale.cpp
@@ -119,96 +119,100 @@ KLocale::KLocale() : mCalendarSystem( 0 )
<< i18n (" Local Time");
mSouthDaylight = false;
mTimeZoneOffset = 0;
daylightEnabled = false;
}
void KLocale::setDateFormat( QString s )
{
mDateFormat = s;
}
void KLocale::setDateFormatShort( QString s )
{
mDateFormatShort = s;
}
void KLocale::setHore24Format ( bool b )
{
mHourF24Format = b;
}
void KLocale::setWeekStartMonday( bool b )
{
mWeekStartsMonday = b;
}
KLocale::IntDateFormat KLocale::getIntDateFormat( )
{
return mIntDateFormat;
}
void KLocale::setIntDateFormat( KLocale::IntDateFormat i )
{
mIntDateFormat = i;
}
KLocale::IntDateFormat KLocale::getIntTimeFormat( )
{
return mIntTimeFormat;
}
void KLocale::setIntTimeFormat( KLocale::IntDateFormat i )
{
mIntTimeFormat = i;
}
void KLocale::setLanguage( int i )
{
mLanguage = i;
}
+int KLocale::language( )
+{
+ return mLanguage;
+}
QString KLocale::translate( const char *index ) const
{
return i18n( index );
}
QString KLocale::translate( const char *, const char *fallback) const
{
return i18n( fallback );
}
QString KLocale::formatTime(const QTime &pTime, bool includeSecs, IntDateFormat intIntDateFormat) const
{
const QString rst = timeFormat(intIntDateFormat);
// only "pm/am" here can grow, the rest shrinks, but
// I'm rather safe than sorry
QChar *buffer = new QChar[rst.length() * 3 / 2 + 30];
uint index = 0;
bool escape = false;
int number = 0;
for ( uint format_index = 0; format_index < rst.length(); format_index++ )
{
if ( !escape )
{
if ( rst.at( format_index ).unicode() == '%' )
escape = true;
else
buffer[index++] = rst.at( format_index );
}
else
{
switch ( rst.at( format_index ).unicode() )
{
case '%':
buffer[index++] = '%';
break;
case 'H':
put_it_in( buffer, index, pTime.hour() );
break;
case 'I':
put_it_in( buffer, index, ( pTime.hour() + 11) % 12 + 1 );
break;
case 'M':
put_it_in( buffer, index, pTime.minute() );
break;
case 'S':