summaryrefslogtreecommitdiffabout
path: root/microkde
Unidiff
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
@@ -111,2 +111,21 @@ QString KConfig::readEntry( const QString &key, const QString &def )
111 111
112QSize KConfig::readSizeEntry( const QString &key, QSize* def )
113{
114 QValueList<int> intlist = readIntListEntry(key);
115
116 if (intlist.count() < 2)
117 {
118 if (def)
119 return *def;
120 else
121 return QSize();
122 }
123
124 QSize ret;
125 ret.setWidth(intlist[0]);
126 ret.setHeight(intlist[1]);
127
128 return ret;
129}
130
112QStringList KConfig::readListEntry( const QString &key ) 131QStringList KConfig::readListEntry( const QString &key )
@@ -224,2 +243,9 @@ void KConfig::writeEntry( const QString & e, const QColor & c )
224 243
244void KConfig::writeEntry( const QString & e, const QSize & s )
245{
246 QValueList<int> intlist;
247 intlist << s.width() << s.height();
248 writeEntry( e, intlist );
249}
250
225void KConfig::writeEntry( const QString & e , const QFont & f ) 251void 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
@@ -68,3 +68,3 @@ class KConfig
68 QDateTime readDateTimeEntry( const QString &, const QDateTime *pDefault = 0 ); 68 QDateTime readDateTimeEntry( const QString &, const QDateTime *pDefault = 0 );
69 69 QSize readSizeEntry(const QString &, QSize* );
70 bool hasKey( const QString &); 70 bool hasKey( const QString &);
@@ -84,2 +84,3 @@ class KConfig
84 void writeEntry( const QString &, const QDateTime & ); 84 void writeEntry( const QString &, const QDateTime & );
85 void writeEntry( const QString &, const QSize & );
85 86
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 )
89 mIntDateFormat = Default; 89 mIntDateFormat = Default;
90 mIntTimeFormat = Default;
90 mLanguage = 0; 91 mLanguage = 0;
@@ -141,2 +142,3 @@ void KLocale::setWeekStartMonday( bool b )
141} 142}
143
142KLocale::IntDateFormat KLocale::getIntDateFormat( ) 144KLocale::IntDateFormat KLocale::getIntDateFormat( )
@@ -150,2 +152,12 @@ void KLocale::setIntDateFormat( KLocale::IntDateFormat i )
150} 152}
153KLocale::IntDateFormat KLocale::getIntTimeFormat( )
154{
155 return mIntTimeFormat;
156
157}
158void KLocale::setIntTimeFormat( KLocale::IntDateFormat i )
159{
160 mIntTimeFormat = i;
161}
162
151void KLocale::setLanguage( int i ) 163void KLocale::setLanguage( int i )
@@ -164,5 +176,5 @@ QString KLocale::translate( const char *, const char *fallback) const
164 176
165QString KLocale::formatTime(const QTime &pTime, bool includeSecs) const 177QString KLocale::formatTime(const QTime &pTime, bool includeSecs, IntDateFormat intIntDateFormat) const
166{ 178{
167 const QString rst = timeFormat(); 179 const QString rst = timeFormat(intIntDateFormat);
168 180
@@ -317,12 +329,13 @@ QString KLocale::formatDateTime(const QDateTime &pDateTime,
317 bool shortFormat, 329 bool shortFormat,
318 bool includeSeconds) const 330 bool includeSeconds,
331 IntDateFormat intIntDateFormat) const
319{ 332{
320 return QString( "%1 %2") 333 return QString( "%1 %2")
321 .arg( formatDate( pDateTime.date(), shortFormat ) ) 334 .arg( formatDate( pDateTime.date(), shortFormat, intIntDateFormat ) )
322 .arg( formatTime( pDateTime.time(), includeSeconds ) ); 335 .arg( formatTime( pDateTime.time(), includeSeconds , intIntDateFormat ) );
323} 336}
324 337
325QString KLocale::formatDateTime(const QDateTime &pDateTime) const 338QString KLocale::formatDateTime(const QDateTime &pDateTime, IntDateFormat intIntDateFormat) const
326{ 339{
327 return formatDateTime(pDateTime, true); 340 return formatDateTime(pDateTime, true, intIntDateFormat);
328} 341}
@@ -458,2 +471,3 @@ QTime KLocale::readTime(const QString &intstr, bool seconds, bool *ok) const
458 int hour = -1, minute = -1, second = seconds ? -1 : 0; // don't require seconds 471 int hour = -1, minute = -1, second = seconds ? -1 : 0; // don't require seconds
472
459 bool g_12h = false; 473 bool g_12h = false;
@@ -684,7 +698,24 @@ QString KLocale::dateFormatShort(IntDateFormat intIntDateFormat) const
684 698
685QString KLocale::timeFormat() const 699QString KLocale::timeFormat(IntDateFormat intIntTimeFormat) const
686{ 700{
701 const IntDateFormat tformat = (intIntTimeFormat == Undefined)?mIntTimeFormat:intIntTimeFormat;
702
703 if ( tformat == Default )
687 if ( mHourF24Format) 704 if ( mHourF24Format)
688 return "%H:%M:%S"; 705 return "%H:%M:%S";
706 else
689 return "%I:%M:%S%p"; 707 return "%I:%M:%S%p";
708
709 else if ( tformat == Format1 )
710 if ( mHourF24Format)
711 return "%H:%M:%S";
712 else
713 return "%I:%M:%S%p";
714
715 else if ( tformat == ISODate ) // = Qt::ISODate
716 if ( mHourF24Format)
717 return "%H:%M:%S";
718 else
719 return "%I:%M:%S%p";
720
690} 721}
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
46 QString formatDate(const QDate &pDate, bool shortFormat = false, IntDateFormat intIntDateFormat = Undefined) const; 46 QString formatDate(const QDate &pDate, bool shortFormat = false, IntDateFormat intIntDateFormat = Undefined) const;
47 QString formatTime(const QTime &pTime, bool includeSecs = false) const; 47 QString formatTime(const QTime &pTime, bool includeSecs = false, IntDateFormat intIntDateFormat = Undefined) const;
48 QString formatDateTime(const QDateTime &pDateTime) const; 48 QString formatDateTime(const QDateTime &pDateTime, IntDateFormat intIntDateFormat = Undefined) const;
49 QString formatDateTime(const QDateTime &pDateTime, 49 QString formatDateTime(const QDateTime &pDateTime,
50 bool shortFormat, 50 bool shortFormat,
51 bool includeSecs = false) const; 51 bool includeSecs = false, IntDateFormat intIntDateFormat = Undefined) const;
52 52
@@ -67,3 +67,3 @@ class KLocale
67 QString dateFormatShort(IntDateFormat intIntDateFormat = Undefined) const; 67 QString dateFormatShort(IntDateFormat intIntDateFormat = Undefined) const;
68 QString timeFormat() const; 68 QString timeFormat(IntDateFormat intIntDateFormat = Undefined) const;
69 69
@@ -75,3 +75,5 @@ class KLocale
75 void setIntDateFormat( IntDateFormat ); 75 void setIntDateFormat( IntDateFormat );
76 void setIntTimeFormat( IntDateFormat );
76 IntDateFormat getIntDateFormat( ); 77 IntDateFormat getIntDateFormat( );
78 IntDateFormat getIntTimeFormat( );
77 void setLanguage( int ); 79 void setLanguage( int );
@@ -100,2 +102,3 @@ class KLocale
100 IntDateFormat mIntDateFormat; 102 IntDateFormat mIntDateFormat;
103 IntDateFormat mIntTimeFormat;
101 int mLanguage; 104 int mLanguage;