summaryrefslogtreecommitdiffabout
path: root/microkde
Side-by-side diff
Diffstat (limited to 'microkde') (more/less context) (show whitespace changes)
-rw-r--r--microkde/kconfig.cpp26
-rw-r--r--microkde/kconfig.h3
-rw-r--r--microkde/kdecore/klocale.cpp47
-rw-r--r--microkde/kdecore/klocale.h11
4 files changed, 74 insertions, 13 deletions
diff --git a/microkde/kconfig.cpp b/microkde/kconfig.cpp
index 4cbec94..ba41f6c 100644
--- a/microkde/kconfig.cpp
+++ b/microkde/kconfig.cpp
@@ -110,4 +110,23 @@ QString KConfig::readEntry( const QString &key, const QString &def )
}
+QSize KConfig::readSizeEntry( const QString &key, QSize* def )
+{
+ QValueList<int> intlist = readIntListEntry(key);
+
+ if (intlist.count() < 2)
+ {
+ if (def)
+ return *def;
+ else
+ return QSize();
+ }
+
+ QSize ret;
+ ret.setWidth(intlist[0]);
+ ret.setHeight(intlist[1]);
+
+ return ret;
+}
+
QStringList KConfig::readListEntry( const QString &key )
{
@@ -223,4 +242,11 @@ void KConfig::writeEntry( const QString & e, const QColor & c )
}
+void KConfig::writeEntry( const QString & e, const QSize & s )
+{
+ QValueList<int> intlist;
+ intlist << s.width() << s.height();
+ writeEntry( e, intlist );
+}
+
void KConfig::writeEntry( const QString & e , const QFont & f )
{
diff --git a/microkde/kconfig.h b/microkde/kconfig.h
index a01b1a5..1a1038f 100644
--- a/microkde/kconfig.h
+++ b/microkde/kconfig.h
@@ -67,5 +67,5 @@ class KConfig
QFont readFontEntry( const QString &, QFont * );
QDateTime readDateTimeEntry( const QString &, const QDateTime *pDefault = 0 );
-
+ QSize readSizeEntry(const QString &, QSize* );
bool hasKey( const QString &);
@@ -83,4 +83,5 @@ class KConfig
void writeEntry( const QString &, const QFont & );
void writeEntry( const QString &, const QDateTime & );
+ void writeEntry( const QString &, const QSize & );
void deleteEntry( const QString &);
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
@@ -88,4 +88,5 @@ KLocale::KLocale() : mCalendarSystem( 0 )
mHourF24Format = true;
mIntDateFormat = Default;
+ mIntTimeFormat = Default;
mLanguage = 0;
mDateFormat = "%a %Y %b %d";
@@ -140,4 +141,5 @@ void KLocale::setWeekStartMonday( bool b )
mWeekStartsMonday = b;
}
+
KLocale::IntDateFormat KLocale::getIntDateFormat( )
{
@@ -149,4 +151,14 @@ 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 )
{
@@ -163,7 +175,7 @@ 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);
// only "pm/am" here can grow, the rest shrinks, but
@@ -316,14 +328,15 @@ QString KLocale::formatDate(const QDate &pDate, bool shortFormat, IntDateFormat
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);
}
@@ -457,4 +470,5 @@ 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;
bool pm = false;
@@ -683,9 +697,26 @@ QString KLocale::dateFormatShort(IntDateFormat intIntDateFormat) const
-QString KLocale::timeFormat() const
+QString KLocale::timeFormat(IntDateFormat intIntTimeFormat) const
{
+ 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";
+ 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
@@ -45,9 +45,9 @@ 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;
QDate readDate(const QString &str, bool* ok = 0) const;
@@ -66,5 +66,5 @@ class KLocale
QString dateFormat(IntDateFormat intIntDateFormat = Undefined) const;
QString dateFormatShort(IntDateFormat intIntDateFormat = Undefined) const;
- QString timeFormat() const;
+ QString timeFormat(IntDateFormat intIntDateFormat = Undefined) const;
void insertCatalogue ( const QString & );
@@ -74,5 +74,7 @@ class KLocale
void setWeekStartMonday( bool );
void setIntDateFormat( IntDateFormat );
+ void setIntTimeFormat( IntDateFormat );
IntDateFormat getIntDateFormat( );
+ IntDateFormat getIntTimeFormat( );
void setLanguage( int );
void setDateFormat( QString );
@@ -99,4 +101,5 @@ class KLocale
bool mHourF24Format;
IntDateFormat mIntDateFormat;
+ IntDateFormat mIntTimeFormat;
int mLanguage;
QString mDateFormat;