summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-09-15 17:48:36 (UTC)
committer ulf69 <ulf69>2004-09-15 17:48:36 (UTC)
commit0af70ae5fee7b71aecf5ac742fdd65e31237eb5a (patch) (unidiff)
tree08a51756744591056fd74f3658afe940f5823265
parentc151151ccaffe54510e58731dc6d8f9d441bd31c (diff)
downloadkdepimpi-0af70ae5fee7b71aecf5ac742fdd65e31237eb5a.zip
kdepimpi-0af70ae5fee7b71aecf5ac742fdd65e31237eb5a.tar.gz
kdepimpi-0af70ae5fee7b71aecf5ac742fdd65e31237eb5a.tar.bz2
small changes to accommodate pwManager
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kconfig.cpp26
-rw-r--r--microkde/kconfig.h3
-rw-r--r--microkde/kdecore/klocale.cpp51
-rw-r--r--microkde/kdecore/klocale.h11
4 files changed, 76 insertions, 15 deletions
diff --git a/microkde/kconfig.cpp b/microkde/kconfig.cpp
index 4cbec94..ba41f6c 100644
--- a/microkde/kconfig.cpp
+++ b/microkde/kconfig.cpp
@@ -96,32 +96,51 @@ int KConfig::readNumEntry( const QString & key, int def )
96 if ( ok ) 96 if ( ok )
97 return result; 97 return result;
98 return def; 98 return def;
99} 99}
100 100
101QString KConfig::readEntry( const QString &key, const QString &def ) 101QString KConfig::readEntry( const QString &key, const QString &def )
102{ 102{
103 QMap<QString,QString>::ConstIterator it = mStringMap.find( mGroup + key ); 103 QMap<QString,QString>::ConstIterator it = mStringMap.find( mGroup + key );
104 104
105 if ( it == mStringMap.end() ) { 105 if ( it == mStringMap.end() ) {
106 return def; 106 return def;
107 } 107 }
108 108
109 return *it; 109 return *it;
110} 110}
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 )
113{ 132{
114 QMap<QString,QString>::ConstIterator it = mStringMap.find( mGroup + key ); 133 QMap<QString,QString>::ConstIterator it = mStringMap.find( mGroup + key );
115 134
116 if ( it == mStringMap.end() ) { 135 if ( it == mStringMap.end() ) {
117 return QStringList(); 136 return QStringList();
118 } 137 }
119 return QStringList::split(":", *it ); 138 return QStringList::split(":", *it );
120 139
121} 140}
122 141
123bool KConfig::readBoolEntry( const QString &key, bool def ) 142bool KConfig::readBoolEntry( const QString &key, bool def )
124{ 143{
125 QMap<QString,bool>::ConstIterator it = mBoolMap.find( mGroup + key ); 144 QMap<QString,bool>::ConstIterator it = mBoolMap.find( mGroup + key );
126 145
127 if ( it == mBoolMap.end() ) { 146 if ( it == mBoolMap.end() ) {
@@ -209,32 +228,39 @@ void KConfig::writeEntry( const QString &key, const QStringList &value )
209void KConfig::writeEntry( const QString &key, bool value) 228void KConfig::writeEntry( const QString &key, bool value)
210{ 229{
211 mBoolMap.insert( mGroup + key, value ); 230 mBoolMap.insert( mGroup + key, value );
212 231
213 mDirty = true; 232 mDirty = true;
214} 233}
215 234
216void KConfig::writeEntry( const QString & e, const QColor & c ) 235void KConfig::writeEntry( const QString & e, const QColor & c )
217{ 236{
218 QStringList l; 237 QStringList l;
219 l.append( QString::number ( c.red() ) ); 238 l.append( QString::number ( c.red() ) );
220 l.append( QString::number ( c.green() ) ); 239 l.append( QString::number ( c.green() ) );
221 l.append( QString::number ( c.blue() ) ); 240 l.append( QString::number ( c.blue() ) );
222 writeEntry( e, l ); 241 writeEntry( e, l );
223} 242}
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 )
226{ 252{
227 QStringList font; 253 QStringList font;
228 font.append( f.family()); 254 font.append( f.family());
229 font.append( (!f.bold ()?"nonbold":"bold") ); 255 font.append( (!f.bold ()?"nonbold":"bold") );
230 font.append( QString::number ( f.pointSize () ) ); 256 font.append( QString::number ( f.pointSize () ) );
231 font.append( !f.italic ()?"nonitalic":"italic" ); 257 font.append( !f.italic ()?"nonitalic":"italic" );
232 writeEntry( e, font ); 258 writeEntry( e, font );
233} 259}
234 260
235void KConfig::writeEntry( const QString &key, const QDateTime &dt ) 261void KConfig::writeEntry( const QString &key, const QDateTime &dt )
236{ 262{
237 mDateTimeMap.insert( mGroup + key, dt ); 263 mDateTimeMap.insert( mGroup + key, dt );
238} 264}
239 265
240void KConfig::load() 266void KConfig::load()
diff --git a/microkde/kconfig.h b/microkde/kconfig.h
index a01b1a5..1a1038f 100644
--- a/microkde/kconfig.h
+++ b/microkde/kconfig.h
@@ -53,48 +53,49 @@ class KConfig
53 */ 53 */
54 bool hasGroup(const QString &group) const; 54 bool hasGroup(const QString &group) const;
55 55
56 56
57 QString getFileName(); 57 QString getFileName();
58 58
59//US added method readIntListEntry 59//US added method readIntListEntry
60 QValueList<int> readIntListEntry( const QString &); 60 QValueList<int> readIntListEntry( const QString &);
61 61
62 int readNumEntry( const QString &, int def=0 ); 62 int readNumEntry( const QString &, int def=0 );
63 QString readEntry( const QString &, const QString &def=QString::null ); 63 QString readEntry( const QString &, const QString &def=QString::null );
64 QStringList readListEntry( const QString & ); 64 QStringList readListEntry( const QString & );
65 bool readBoolEntry( const QString &, bool def=false ); 65 bool readBoolEntry( const QString &, bool def=false );
66 QColor readColorEntry( const QString &, QColor * ); 66 QColor readColorEntry( const QString &, QColor * );
67 QFont readFontEntry( const QString &, QFont * ); 67 QFont readFontEntry( const QString &, QFont * );
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 &);
71 71
72 void writeEntry( const QString &, const QValueList<int>& ); 72 void writeEntry( const QString &, const QValueList<int>& );
73 void writeEntry( const QString &, int ); 73 void writeEntry( const QString &, int );
74 void writeEntry( const QString &key , unsigned int value) { writeEntry( key, int( value ) ); } 74 void writeEntry( const QString &key , unsigned int value) { writeEntry( key, int( value ) ); }
75 void writeEntry( const char *key , unsigned int value) { writeEntry( QString( key ), value ); } 75 void writeEntry( const char *key , unsigned int value) { writeEntry( QString( key ), value ); }
76 void writeEntry( const char *key, int value ) { writeEntry( QString( key ), value ); } 76 void writeEntry( const char *key, int value ) { writeEntry( QString( key ), value ); }
77 void writeEntry( const QString &, const QString & ); 77 void writeEntry( const QString &, const QString & );
78 void writeEntry( const char *key, const QString &value ) { writeEntry( QString( key ), value ); } 78 void writeEntry( const char *key, const QString &value ) { writeEntry( QString( key ), value ); }
79 void writeEntry( const QString &, const QStringList & ); 79 void writeEntry( const QString &, const QStringList & );
80 void writeEntry( const QString &, bool ); 80 void writeEntry( const QString &, bool );
81 void writeEntry( const char *key, bool value ) { writeEntry( QString( key ), value ); } 81 void writeEntry( const char *key, bool value ) { writeEntry( QString( key ), value ); }
82 void writeEntry( const QString &, const QColor & ); 82 void writeEntry( const QString &, const QColor & );
83 void writeEntry( const QString &, const QFont & ); 83 void writeEntry( const QString &, const QFont & );
84 void writeEntry( const QString &, const QDateTime & ); 84 void writeEntry( const QString &, const QDateTime & );
85 void writeEntry( const QString &, const QSize & );
85 86
86 void deleteEntry( const QString &); 87 void deleteEntry( const QString &);
87 88
88 void load(); 89 void load();
89 void sync(); 90 void sync();
90 91
91 private: 92 private:
92 static QString mGroup; 93 static QString mGroup;
93 QString mTempGroup; 94 QString mTempGroup;
94 95
95 QString mFileName; 96 QString mFileName;
96 97
97 QMap<QString,bool> mBoolMap; 98 QMap<QString,bool> mBoolMap;
98 QMap<QString,QString> mStringMap; 99 QMap<QString,QString> mStringMap;
99 QMap<QString,QDateTime> mDateTimeMap; 100 QMap<QString,QDateTime> mDateTimeMap;
100 101
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
@@ -74,32 +74,33 @@ static int readInt(const QString &str, uint &pos)
74} 74}
75 75
76KLocale::KLocale() : mCalendarSystem( 0 ) 76KLocale::KLocale() : mCalendarSystem( 0 )
77{ 77{
78 78
79 m_decimalSymbol = "."; 79 m_decimalSymbol = ".";
80 m_positiveSign = ""; 80 m_positiveSign = "";
81 m_negativeSign = "-"; 81 m_negativeSign = "-";
82 m_thousandsSeparator = ","; 82 m_thousandsSeparator = ",";
83 83
84 84
85 85
86 86
87 mWeekStartsMonday = true; 87 mWeekStartsMonday = true;
88 mHourF24Format = true; 88 mHourF24Format = true;
89 mIntDateFormat = Default; 89 mIntDateFormat = Default;
90 mIntTimeFormat = Default;
90 mLanguage = 0; 91 mLanguage = 0;
91 mDateFormat = "%a %Y %b %d"; 92 mDateFormat = "%a %Y %b %d";
92 mDateFormatShort = "%Y-%m-%d"; 93 mDateFormatShort = "%Y-%m-%d";
93 mTimeZoneList << i18n ("-11:00 US/Samoa") 94 mTimeZoneList << i18n ("-11:00 US/Samoa")
94 << i18n ("-10:00 US/Hawaii") 95 << i18n ("-10:00 US/Hawaii")
95 << i18n ("-09:00 US/Alaska") 96 << i18n ("-09:00 US/Alaska")
96 << i18n ("-08:00 US/Pacific") 97 << i18n ("-08:00 US/Pacific")
97 << i18n ("-07:00 US/Mountain") 98 << i18n ("-07:00 US/Mountain")
98 << i18n ("-06:00 US/Central") 99 << i18n ("-06:00 US/Central")
99 << i18n ("-05:00 US/Eastern") 100 << i18n ("-05:00 US/Eastern")
100 << i18n ("-04:00 Brazil/West") 101 << i18n ("-04:00 Brazil/West")
101 << i18n ("-03:00 Brazil/East") 102 << i18n ("-03:00 Brazil/East")
102 << i18n ("-02:00 Brazil/DeNoronha") 103 << i18n ("-02:00 Brazil/DeNoronha")
103 << i18n ("-01:00 Atlantic/Azores") 104 << i18n ("-01:00 Atlantic/Azores")
104 << i18n (" 00:00 Europe/London(UTC)") 105 << i18n (" 00:00 Europe/London(UTC)")
105 << i18n ("+01:00 Europe/Oslo(CET)") 106 << i18n ("+01:00 Europe/Oslo(CET)")
@@ -126,58 +127,69 @@ void KLocale::setDateFormat( QString s )
126 mDateFormat = s; 127 mDateFormat = s;
127} 128}
128 129
129void KLocale::setDateFormatShort( QString s ) 130void KLocale::setDateFormatShort( QString s )
130{ 131{
131 mDateFormatShort = s; 132 mDateFormatShort = s;
132} 133}
133 134
134void KLocale::setHore24Format ( bool b ) 135void KLocale::setHore24Format ( bool b )
135{ 136{
136 mHourF24Format = b; 137 mHourF24Format = b;
137} 138}
138void KLocale::setWeekStartMonday( bool b ) 139void KLocale::setWeekStartMonday( bool b )
139{ 140{
140 mWeekStartsMonday = b; 141 mWeekStartsMonday = b;
141} 142}
143
142KLocale::IntDateFormat KLocale::getIntDateFormat( ) 144KLocale::IntDateFormat KLocale::getIntDateFormat( )
143{ 145{
144 return mIntDateFormat; 146 return mIntDateFormat;
145 147
146} 148}
147void KLocale::setIntDateFormat( KLocale::IntDateFormat i ) 149void KLocale::setIntDateFormat( KLocale::IntDateFormat i )
148{ 150{
149 mIntDateFormat = i; 151 mIntDateFormat = 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 )
152{ 164{
153 mLanguage = i; 165 mLanguage = i;
154} 166}
155QString KLocale::translate( const char *index ) const 167QString KLocale::translate( const char *index ) const
156{ 168{
157 return i18n( index ); 169 return i18n( index );
158} 170}
159 171
160QString KLocale::translate( const char *, const char *fallback) const 172QString KLocale::translate( const char *, const char *fallback) const
161{ 173{
162 return i18n( fallback ); 174 return i18n( fallback );
163} 175}
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
169 // only "pm/am" here can grow, the rest shrinks, but 181 // only "pm/am" here can grow, the rest shrinks, but
170 // I'm rather safe than sorry 182 // I'm rather safe than sorry
171 QChar *buffer = new QChar[rst.length() * 3 / 2 + 30]; 183 QChar *buffer = new QChar[rst.length() * 3 / 2 + 30];
172 184
173 uint index = 0; 185 uint index = 0;
174 bool escape = false; 186 bool escape = false;
175 int number = 0; 187 int number = 0;
176 188
177 for ( uint format_index = 0; format_index < rst.length(); format_index++ ) 189 for ( uint format_index = 0; format_index < rst.length(); format_index++ )
178 { 190 {
179 if ( !escape ) 191 if ( !escape )
180 { 192 {
181 if ( rst.at( format_index ).unicode() == '%' ) 193 if ( rst.at( format_index ).unicode() == '%' )
182 escape = true; 194 escape = true;
183 else 195 else
@@ -302,42 +314,43 @@ QString KLocale::formatDate(const QDate &pDate, bool shortFormat, IntDateFormat
302 put_it_in( buffer, index, weekDayName(pDate.dayOfWeek(), false) ); 314 put_it_in( buffer, index, weekDayName(pDate.dayOfWeek(), false) );
303 break; 315 break;
304 default: 316 default:
305 buffer[index++] = rst.at( format_index ); 317 buffer[index++] = rst.at( format_index );
306 break; 318 break;
307 } 319 }
308 escape = false; 320 escape = false;
309 } 321 }
310 } 322 }
311 QString ret( buffer, index ); 323 QString ret( buffer, index );
312 delete [] buffer; 324 delete [] buffer;
313 return ret; 325 return ret;
314} 326}
315 327
316QString KLocale::formatDateTime(const QDateTime &pDateTime, 328QString 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}
329 342
330QDate KLocale::readDate(const QString &intstr, bool* ok) const 343QDate KLocale::readDate(const QString &intstr, bool* ok) const
331{ 344{
332 QDate date; 345 QDate date;
333 date = readDate(intstr, true, ok); 346 date = readDate(intstr, true, ok);
334 if (date.isValid()) return date; 347 if (date.isValid()) return date;
335 return readDate(intstr, false, ok); 348 return readDate(intstr, false, ok);
336} 349}
337 350
338QDate KLocale::readDate(const QString &intstr, bool shortFormat, bool* ok) const 351QDate KLocale::readDate(const QString &intstr, bool shortFormat, bool* ok) const
339{ 352{
340 QString fmt = (shortFormat ? dateFormatShort() : dateFormat()).simplifyWhiteSpace(); 353 QString fmt = (shortFormat ? dateFormatShort() : dateFormat()).simplifyWhiteSpace();
341 return readDate( intstr, fmt, ok ); 354 return readDate( intstr, fmt, ok );
342} 355}
343 356
@@ -443,32 +456,33 @@ QDate KLocale::readDate(const QString &intstr, const QString &fmt, bool* ok) con
443QTime KLocale::readTime(const QString &intstr, bool *ok) const 456QTime KLocale::readTime(const QString &intstr, bool *ok) const
444{ 457{
445 QTime _time; 458 QTime _time;
446 _time = readTime(intstr, true, ok); 459 _time = readTime(intstr, true, ok);
447 if (_time.isValid()) return _time; 460 if (_time.isValid()) return _time;
448 return readTime(intstr, false, ok); 461 return readTime(intstr, false, ok);
449} 462}
450 463
451QTime KLocale::readTime(const QString &intstr, bool seconds, bool *ok) const 464QTime KLocale::readTime(const QString &intstr, bool seconds, bool *ok) const
452{ 465{
453 QString str = intstr.simplifyWhiteSpace().lower(); 466 QString str = intstr.simplifyWhiteSpace().lower();
454 QString Format = timeFormat().simplifyWhiteSpace(); 467 QString Format = timeFormat().simplifyWhiteSpace();
455 if (!seconds) 468 if (!seconds)
456 Format.replace(QRegExp(QString::fromLatin1(".%S")), QString::null); 469 Format.replace(QRegExp(QString::fromLatin1(".%S")), QString::null);
457 470
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;
460 bool pm = false; 474 bool pm = false;
461 uint strpos = 0; 475 uint strpos = 0;
462 uint Formatpos = 0; 476 uint Formatpos = 0;
463 477
464 while (Format.length() > Formatpos || str.length() > strpos) 478 while (Format.length() > Formatpos || str.length() > strpos)
465 { 479 {
466 if ( !(Format.length() > Formatpos && str.length() > strpos) ) goto error; 480 if ( !(Format.length() > Formatpos && str.length() > strpos) ) goto error;
467 481
468 QChar c = Format.at(Formatpos++); 482 QChar c = Format.at(Formatpos++);
469 483
470 if (c != '%') 484 if (c != '%')
471 { 485 {
472 if (c.isSpace()) 486 if (c.isSpace())
473 strpos++; 487 strpos++;
474 else if (c != str.at(strpos++)) 488 else if (c != str.at(strpos++))
@@ -669,37 +683,54 @@ QString KLocale::dateFormat(IntDateFormat intIntDateFormat) const
669 683
670QString KLocale::dateFormatShort(IntDateFormat intIntDateFormat) const 684QString KLocale::dateFormatShort(IntDateFormat intIntDateFormat) const
671{ 685{
672 const IntDateFormat dformat = (intIntDateFormat == Undefined)?mIntDateFormat:intIntDateFormat; 686 const IntDateFormat dformat = (intIntDateFormat == Undefined)?mIntDateFormat:intIntDateFormat;
673 687
674 if ( dformat == Default ) 688 if ( dformat == Default )
675 return "%d.%m.%Y"; 689 return "%d.%m.%Y";
676 else if ( dformat == Format1 ) 690 else if ( dformat == Format1 )
677 return "%m.%d.%Y"; 691 return "%m.%d.%Y";
678 else if ( dformat == ISODate ) // = Qt::ISODate 692 else if ( dformat == ISODate ) // = Qt::ISODate
679 return "%Y-%m-%d"; 693 return "%Y-%m-%d";
680 return mDateFormatShort ; 694 return mDateFormatShort ;
681 695
682} 696}
683 697
684 698
685QString KLocale::timeFormat() const 699QString KLocale::timeFormat(IntDateFormat intIntTimeFormat) const
686{ 700{
687 if ( mHourF24Format) 701 const IntDateFormat tformat = (intIntTimeFormat == Undefined)?mIntTimeFormat:intIntTimeFormat;
702
703 if ( tformat == Default )
704 if ( mHourF24Format)
705 return "%H:%M:%S";
706 else
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)
688 return "%H:%M:%S"; 717 return "%H:%M:%S";
689 return "%I:%M:%S%p"; 718 else
719 return "%I:%M:%S%p";
720
690} 721}
691 722
692void KLocale::insertCatalogue ( const QString & ) 723void KLocale::insertCatalogue ( const QString & )
693{ 724{
694} 725}
695 726
696KCalendarSystem *KLocale::calendar() 727KCalendarSystem *KLocale::calendar()
697{ 728{
698 if ( !mCalendarSystem ) { 729 if ( !mCalendarSystem ) {
699 mCalendarSystem = new KCalendarSystemGregorian; 730 mCalendarSystem = new KCalendarSystemGregorian;
700 } 731 }
701 732
702 return mCalendarSystem; 733 return mCalendarSystem;
703} 734}
704 735
705int KLocale::timezoneOffset( QString timeZone ) 736int KLocale::timezoneOffset( QString timeZone )
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
@@ -31,82 +31,85 @@ class KLocale
31 QString formatNumber(double num, int precision = -1) const; 31 QString formatNumber(double num, int precision = -1) const;
32 QString formatNumber(const QString &numStr) const; 32 QString formatNumber(const QString &numStr) const;
33 double readNumber(const QString &numStr, bool * ok = 0) const; 33 double readNumber(const QString &numStr, bool * ok = 0) const;
34 34
35 QString decimalSymbol() const; 35 QString decimalSymbol() const;
36 QString thousandsSeparator() const; 36 QString thousandsSeparator() const;
37 QString positiveSign() const; 37 QString positiveSign() const;
38 QString negativeSign() const; 38 QString negativeSign() const;
39 39
40 40
41 QString translate( const char *index ) const; 41 QString translate( const char *index ) const;
42 QString translate( const char *index, const char *fallback) const; 42 QString translate( const char *index, const char *fallback) const;
43 43
44 enum IntDateFormat { Undefined=-1, Default=0, Format1=1, ISODate=2, Userdefined=3 }; 44 enum IntDateFormat { Undefined=-1, Default=0, Format1=1, ISODate=2, Userdefined=3 };
45 45
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
53 QDate readDate(const QString &str, bool* ok = 0) const; 53 QDate readDate(const QString &str, bool* ok = 0) const;
54 QDate readDate( const QString &intstr, const QString &fmt, bool* ok = 0) const; 54 QDate readDate( const QString &intstr, const QString &fmt, bool* ok = 0) const;
55 QTime readTime(const QString &str, bool* ok = 0) const; 55 QTime readTime(const QString &str, bool* ok = 0) const;
56 56
57 bool use12Clock() const; 57 bool use12Clock() const;
58 bool weekStartsMonday() const; 58 bool weekStartsMonday() const;
59 int weekStartDay() const; 59 int weekStartDay() const;
60 60
61 QString weekDayName(int,bool=false) const; 61 QString weekDayName(int,bool=false) const;
62 QString monthName(int,bool=false) const; 62 QString monthName(int,bool=false) const;
63 63
64 QString country() const; 64 QString country() const;
65 65
66 QString dateFormat(IntDateFormat intIntDateFormat = Undefined) const; 66 QString dateFormat(IntDateFormat intIntDateFormat = Undefined) const;
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
70 void insertCatalogue ( const QString & ); 70 void insertCatalogue ( const QString & );
71 71
72 KCalendarSystem *calendar(); 72 KCalendarSystem *calendar();
73 void setHore24Format ( bool ); 73 void setHore24Format ( bool );
74 void setWeekStartMonday( bool ); 74 void setWeekStartMonday( bool );
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 );
78 void setDateFormat( QString ); 80 void setDateFormat( QString );
79 void setDateFormatShort( QString ); 81 void setDateFormatShort( QString );
80 82
81 QString m_decimalSymbol; 83 QString m_decimalSymbol;
82 QString m_thousandsSeparator; 84 QString m_thousandsSeparator;
83 QString m_currencySymbol; 85 QString m_currencySymbol;
84 QString m_monetaryDecimalSymbol; 86 QString m_monetaryDecimalSymbol;
85 QString m_monetaryThousandsSeparator; 87 QString m_monetaryThousandsSeparator;
86 QString m_positiveSign; 88 QString m_positiveSign;
87 QString m_negativeSign; 89 QString m_negativeSign;
88 90
89 int timezoneOffset( QString ); 91 int timezoneOffset( QString );
90 QStringList timeZoneList() const; 92 QStringList timeZoneList() const;
91 void setDaylightSaving( bool, int , int ); 93 void setDaylightSaving( bool, int , int );
92 int localTimeOffset(const QDateTime &); 94 int localTimeOffset(const QDateTime &);
93 void setTimezone( const QString &timeZone ); 95 void setTimezone( const QString &timeZone );
94 private: 96 private:
95 QTime readTime(const QString &str, bool seconds, bool *ok) const; 97 QTime readTime(const QString &str, bool seconds, bool *ok) const;
96 QDate readDate(const QString &str, bool shortFormat, bool *ok) const; 98 QDate readDate(const QString &str, bool shortFormat, bool *ok) const;
97 KCalendarSystem *mCalendarSystem; 99 KCalendarSystem *mCalendarSystem;
98 bool mWeekStartsMonday; 100 bool mWeekStartsMonday;
99 bool mHourF24Format; 101 bool mHourF24Format;
100 IntDateFormat mIntDateFormat; 102 IntDateFormat mIntDateFormat;
103 IntDateFormat mIntTimeFormat;
101 int mLanguage; 104 int mLanguage;
102 QString mDateFormat; 105 QString mDateFormat;
103 QString mDateFormatShort; 106 QString mDateFormatShort;
104 QStringList mTimeZoneList; 107 QStringList mTimeZoneList;
105 bool daylightEnabled; 108 bool daylightEnabled;
106 int mDaylightTZoffset; 109 int mDaylightTZoffset;
107 int mNondaylightTZoffset; 110 int mNondaylightTZoffset;
108 bool mSouthDaylight; 111 bool mSouthDaylight;
109 int daylightStart, daylightEnd, mTimeZoneOffset; 112 int daylightStart, daylightEnd, mTimeZoneOffset;
110}; 113};
111 114
112#endif 115#endif