author | ulf69 <ulf69> | 2004-09-15 17:48:36 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-09-15 17:48:36 (UTC) |
commit | 0af70ae5fee7b71aecf5ac742fdd65e31237eb5a (patch) (unidiff) | |
tree | 08a51756744591056fd74f3658afe940f5823265 | |
parent | c151151ccaffe54510e58731dc6d8f9d441bd31c (diff) | |
download | kdepimpi-0af70ae5fee7b71aecf5ac742fdd65e31237eb5a.zip kdepimpi-0af70ae5fee7b71aecf5ac742fdd65e31237eb5a.tar.gz kdepimpi-0af70ae5fee7b71aecf5ac742fdd65e31237eb5a.tar.bz2 |
small changes to accommodate pwManager
-rw-r--r-- | microkde/kconfig.cpp | 26 | ||||
-rw-r--r-- | microkde/kconfig.h | 3 | ||||
-rw-r--r-- | microkde/kdecore/klocale.cpp | 51 | ||||
-rw-r--r-- | microkde/kdecore/klocale.h | 11 |
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 | |||
@@ -80,64 +80,83 @@ QValueList<int> KConfig::readIntListEntry( const QString & key) | |||
80 | } | 80 | } |
81 | 81 | ||
82 | if (ok2 == false) | 82 | if (ok2 == false) |
83 | { | 83 | { |
84 | 84 | ||
85 | qDebug("KConfig::readIntListEntry: error while reading one of the intvalues."); | 85 | qDebug("KConfig::readIntListEntry: error while reading one of the intvalues."); |
86 | } | 86 | } |
87 | 87 | ||
88 | return result; | 88 | return result; |
89 | } | 89 | } |
90 | 90 | ||
91 | int KConfig::readNumEntry( const QString & key, int def ) | 91 | int KConfig::readNumEntry( const QString & key, int def ) |
92 | { | 92 | { |
93 | QString res = readEntry(key, QString::number(def ) ); | 93 | QString res = readEntry(key, QString::number(def ) ); |
94 | bool ok = false; | 94 | bool ok = false; |
95 | int result = res.toInt(&ok); | 95 | int result = res.toInt(&ok); |
96 | if ( ok ) | 96 | if ( ok ) |
97 | return result; | 97 | return result; |
98 | return def; | 98 | return def; |
99 | } | 99 | } |
100 | 100 | ||
101 | QString KConfig::readEntry( const QString &key, const QString &def ) | 101 | QString 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 | ||
112 | QSize 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 | |||
112 | QStringList KConfig::readListEntry( const QString &key ) | 131 | QStringList 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 | ||
123 | bool KConfig::readBoolEntry( const QString &key, bool def ) | 142 | bool 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() ) { |
128 | return def; | 147 | return def; |
129 | } | 148 | } |
130 | 149 | ||
131 | return *it; | 150 | return *it; |
132 | } | 151 | } |
133 | 152 | ||
134 | QColor KConfig::readColorEntry( const QString & e, QColor *def ) | 153 | QColor KConfig::readColorEntry( const QString & e, QColor *def ) |
135 | { | 154 | { |
136 | 155 | ||
137 | QStringList l; | 156 | QStringList l; |
138 | l = readListEntry( e ); | 157 | l = readListEntry( e ); |
139 | if (l.count() != 3 ) { | 158 | if (l.count() != 3 ) { |
140 | if ( def ) | 159 | if ( def ) |
141 | return *def; | 160 | return *def; |
142 | else | 161 | else |
143 | return QColor(); | 162 | return QColor(); |
@@ -193,64 +212,71 @@ void KConfig::writeEntry( const QString & key , int num ) | |||
193 | } | 212 | } |
194 | 213 | ||
195 | void KConfig::writeEntry( const QString &key, const QString &value ) | 214 | void KConfig::writeEntry( const QString &key, const QString &value ) |
196 | { | 215 | { |
197 | mStringMap.insert( mGroup + key, value ); | 216 | mStringMap.insert( mGroup + key, value ); |
198 | 217 | ||
199 | mDirty = true; | 218 | mDirty = true; |
200 | } | 219 | } |
201 | 220 | ||
202 | void KConfig::writeEntry( const QString &key, const QStringList &value ) | 221 | void KConfig::writeEntry( const QString &key, const QStringList &value ) |
203 | { | 222 | { |
204 | mStringMap.insert( mGroup + key, value.join(":") ); | 223 | mStringMap.insert( mGroup + key, value.join(":") ); |
205 | 224 | ||
206 | mDirty = true; | 225 | mDirty = true; |
207 | } | 226 | } |
208 | 227 | ||
209 | void KConfig::writeEntry( const QString &key, bool value) | 228 | void 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 | ||
216 | void KConfig::writeEntry( const QString & e, const QColor & c ) | 235 | void 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 | ||
244 | void 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 | |||
225 | void KConfig::writeEntry( const QString & e , const QFont & f ) | 251 | void 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 | ||
235 | void KConfig::writeEntry( const QString &key, const QDateTime &dt ) | 261 | void 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 | ||
240 | void KConfig::load() | 266 | void KConfig::load() |
241 | { | 267 | { |
242 | 268 | ||
243 | 269 | ||
244 | QFile f( mFileName ); | 270 | QFile f( mFileName ); |
245 | if ( !f.open( IO_ReadOnly ) ) { | 271 | if ( !f.open( IO_ReadOnly ) ) { |
246 | qDebug("KConfig: could not open file %s ",mFileName.latin1() ); | 272 | qDebug("KConfig: could not open file %s ",mFileName.latin1() ); |
247 | return; | 273 | return; |
248 | } | 274 | } |
249 | 275 | ||
250 | mBoolMap.clear(); | 276 | mBoolMap.clear(); |
251 | mStringMap.clear(); | 277 | mStringMap.clear(); |
252 | 278 | ||
253 | QTextStream t( &f ); | 279 | QTextStream t( &f ); |
254 | 280 | ||
255 | QString line = t.readLine(); | 281 | QString line = t.readLine(); |
256 | 282 | ||
diff --git a/microkde/kconfig.h b/microkde/kconfig.h index a01b1a5..1a1038f 100644 --- a/microkde/kconfig.h +++ b/microkde/kconfig.h | |||
@@ -37,68 +37,69 @@ class KConfig | |||
37 | * deleted and false is returned. | 37 | * deleted and false is returned. |
38 | * If this group is the current group and it is deleted, the | 38 | * If this group is the current group and it is deleted, the |
39 | * current group is undefined and should be set with setGroup() | 39 | * current group is undefined and should be set with setGroup() |
40 | * before the next operation on the configuration object. | 40 | * before the next operation on the configuration object. |
41 | * | 41 | * |
42 | * @param group The name of the group | 42 | * @param group The name of the group |
43 | * returns true if we deleted at least one entry. | 43 | * returns true if we deleted at least one entry. |
44 | */ | 44 | */ |
45 | bool deleteGroup( const QString& group); | 45 | bool deleteGroup( const QString& group); |
46 | 46 | ||
47 | //US I took the following hasGroup method from a newer version from KDE. | 47 | //US I took the following hasGroup method from a newer version from KDE. |
48 | /** | 48 | /** |
49 | * Returns true if the specified group is known about. | 49 | * Returns true if the specified group is known about. |
50 | * | 50 | * |
51 | * @param group The group to search for. | 51 | * @param group The group to search for. |
52 | * @return Whether the group exists. | 52 | * @return Whether the group exists. |
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 | ||
101 | bool mDirty; | 102 | bool mDirty; |
102 | }; | 103 | }; |
103 | 104 | ||
104 | #endif | 105 | #endif |
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 | |||
@@ -58,142 +58,154 @@ inline void put_it_in( QChar *buffer, uint& index, int number ) | |||
58 | { | 58 | { |
59 | buffer[index++] = number / 10 + '0'; | 59 | buffer[index++] = number / 10 + '0'; |
60 | buffer[index++] = number % 10 + '0'; | 60 | buffer[index++] = number % 10 + '0'; |
61 | } | 61 | } |
62 | 62 | ||
63 | static int readInt(const QString &str, uint &pos) | 63 | static int readInt(const QString &str, uint &pos) |
64 | { | 64 | { |
65 | if (!str.at(pos).isDigit()) return -1; | 65 | if (!str.at(pos).isDigit()) return -1; |
66 | int result = 0; | 66 | int result = 0; |
67 | for (; str.length() > pos && str.at(pos).isDigit(); pos++) | 67 | for (; str.length() > pos && str.at(pos).isDigit(); pos++) |
68 | { | 68 | { |
69 | result *= 10; | 69 | result *= 10; |
70 | result += str.at(pos).digitValue(); | 70 | result += str.at(pos).digitValue(); |
71 | } | 71 | } |
72 | 72 | ||
73 | return result; | 73 | return result; |
74 | } | 74 | } |
75 | 75 | ||
76 | KLocale::KLocale() : mCalendarSystem( 0 ) | 76 | KLocale::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)") |
106 | << i18n ("+02:00 Europe/Helsinki") | 107 | << i18n ("+02:00 Europe/Helsinki") |
107 | << i18n ("+03:00 Europe/Moscow") | 108 | << i18n ("+03:00 Europe/Moscow") |
108 | << i18n ("+04:00 Indian/Mauritius") | 109 | << i18n ("+04:00 Indian/Mauritius") |
109 | << i18n ("+05:00 Indian/Maldives") | 110 | << i18n ("+05:00 Indian/Maldives") |
110 | << i18n ("+06:00 Indian/Chagos") | 111 | << i18n ("+06:00 Indian/Chagos") |
111 | << i18n ("+07:00 Asia/Bangkok") | 112 | << i18n ("+07:00 Asia/Bangkok") |
112 | << i18n ("+08:00 Asia/Hongkong") | 113 | << i18n ("+08:00 Asia/Hongkong") |
113 | << i18n ("+09:00 Asia/Tokyo") | 114 | << i18n ("+09:00 Asia/Tokyo") |
114 | << i18n ("+10:00 Asia/Vladivostok") | 115 | << i18n ("+10:00 Asia/Vladivostok") |
115 | << i18n ("+11:00 Asia/Magadan") | 116 | << i18n ("+11:00 Asia/Magadan") |
116 | << i18n ("+12:00 Asia/Kamchatka") | 117 | << i18n ("+12:00 Asia/Kamchatka") |
117 | // << i18n (" xx:xx User defined offset") | 118 | // << i18n (" xx:xx User defined offset") |
118 | << i18n (" Local Time"); | 119 | << i18n (" Local Time"); |
119 | mSouthDaylight = false; | 120 | mSouthDaylight = false; |
120 | mTimeZoneOffset = 0; | 121 | mTimeZoneOffset = 0; |
121 | daylightEnabled = false; | 122 | daylightEnabled = false; |
122 | } | 123 | } |
123 | 124 | ||
124 | void KLocale::setDateFormat( QString s ) | 125 | void KLocale::setDateFormat( QString s ) |
125 | { | 126 | { |
126 | mDateFormat = s; | 127 | mDateFormat = s; |
127 | } | 128 | } |
128 | 129 | ||
129 | void KLocale::setDateFormatShort( QString s ) | 130 | void KLocale::setDateFormatShort( QString s ) |
130 | { | 131 | { |
131 | mDateFormatShort = s; | 132 | mDateFormatShort = s; |
132 | } | 133 | } |
133 | 134 | ||
134 | void KLocale::setHore24Format ( bool b ) | 135 | void KLocale::setHore24Format ( bool b ) |
135 | { | 136 | { |
136 | mHourF24Format = b; | 137 | mHourF24Format = b; |
137 | } | 138 | } |
138 | void KLocale::setWeekStartMonday( bool b ) | 139 | void KLocale::setWeekStartMonday( bool b ) |
139 | { | 140 | { |
140 | mWeekStartsMonday = b; | 141 | mWeekStartsMonday = b; |
141 | } | 142 | } |
143 | |||
142 | KLocale::IntDateFormat KLocale::getIntDateFormat( ) | 144 | KLocale::IntDateFormat KLocale::getIntDateFormat( ) |
143 | { | 145 | { |
144 | return mIntDateFormat; | 146 | return mIntDateFormat; |
145 | 147 | ||
146 | } | 148 | } |
147 | void KLocale::setIntDateFormat( KLocale::IntDateFormat i ) | 149 | void KLocale::setIntDateFormat( KLocale::IntDateFormat i ) |
148 | { | 150 | { |
149 | mIntDateFormat = i; | 151 | mIntDateFormat = i; |
150 | } | 152 | } |
153 | KLocale::IntDateFormat KLocale::getIntTimeFormat( ) | ||
154 | { | ||
155 | return mIntTimeFormat; | ||
156 | |||
157 | } | ||
158 | void KLocale::setIntTimeFormat( KLocale::IntDateFormat i ) | ||
159 | { | ||
160 | mIntTimeFormat = i; | ||
161 | } | ||
162 | |||
151 | void KLocale::setLanguage( int i ) | 163 | void KLocale::setLanguage( int i ) |
152 | { | 164 | { |
153 | mLanguage = i; | 165 | mLanguage = i; |
154 | } | 166 | } |
155 | QString KLocale::translate( const char *index ) const | 167 | QString KLocale::translate( const char *index ) const |
156 | { | 168 | { |
157 | return i18n( index ); | 169 | return i18n( index ); |
158 | } | 170 | } |
159 | 171 | ||
160 | QString KLocale::translate( const char *, const char *fallback) const | 172 | QString KLocale::translate( const char *, const char *fallback) const |
161 | { | 173 | { |
162 | return i18n( fallback ); | 174 | return i18n( fallback ); |
163 | } | 175 | } |
164 | 176 | ||
165 | QString KLocale::formatTime(const QTime &pTime, bool includeSecs) const | 177 | QString 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 |
184 | buffer[index++] = rst.at( format_index ); | 196 | buffer[index++] = rst.at( format_index ); |
185 | } | 197 | } |
186 | else | 198 | else |
187 | { | 199 | { |
188 | switch ( rst.at( format_index ).unicode() ) | 200 | switch ( rst.at( format_index ).unicode() ) |
189 | { | 201 | { |
190 | case '%': | 202 | case '%': |
191 | buffer[index++] = '%'; | 203 | buffer[index++] = '%'; |
192 | break; | 204 | break; |
193 | case 'H': | 205 | case 'H': |
194 | put_it_in( buffer, index, pTime.hour() ); | 206 | put_it_in( buffer, index, pTime.hour() ); |
195 | break; | 207 | break; |
196 | case 'I': | 208 | case 'I': |
197 | put_it_in( buffer, index, ( pTime.hour() + 11) % 12 + 1 ); | 209 | put_it_in( buffer, index, ( pTime.hour() + 11) % 12 + 1 ); |
198 | break; | 210 | break; |
199 | case 'M': | 211 | case 'M': |
@@ -286,74 +298,75 @@ QString KLocale::formatDate(const QDate &pDate, bool shortFormat, IntDateFormat | |||
286 | case 'm': | 298 | case 'm': |
287 | put_it_in( buffer, index, pDate.month() ); | 299 | put_it_in( buffer, index, pDate.month() ); |
288 | break; | 300 | break; |
289 | case 'b': | 301 | case 'b': |
290 | put_it_in( buffer, index, monthName(pDate.month(), true) ); | 302 | put_it_in( buffer, index, monthName(pDate.month(), true) ); |
291 | break; | 303 | break; |
292 | case 'B': | 304 | case 'B': |
293 | put_it_in( buffer, index, monthName(pDate.month(), false) ); | 305 | put_it_in( buffer, index, monthName(pDate.month(), false) ); |
294 | break; | 306 | break; |
295 | case 'd': | 307 | case 'd': |
296 | put_it_in( buffer, index, pDate.day() ); | 308 | put_it_in( buffer, index, pDate.day() ); |
297 | break; | 309 | break; |
298 | case 'a': | 310 | case 'a': |
299 | put_it_in( buffer, index, weekDayName(pDate.dayOfWeek(), true) ); | 311 | put_it_in( buffer, index, weekDayName(pDate.dayOfWeek(), true) ); |
300 | break; | 312 | break; |
301 | case 'A': | 313 | case 'A': |
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 | ||
316 | QString KLocale::formatDateTime(const QDateTime &pDateTime, | 328 | 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 | ||
325 | QString KLocale::formatDateTime(const QDateTime &pDateTime) const | 338 | QString 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 | ||
330 | QDate KLocale::readDate(const QString &intstr, bool* ok) const | 343 | QDate 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 | ||
338 | QDate KLocale::readDate(const QString &intstr, bool shortFormat, bool* ok) const | 351 | QDate 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 | ||
344 | QDate KLocale::readDate(const QString &intstr, const QString &fmt, bool* ok) const | 357 | QDate KLocale::readDate(const QString &intstr, const QString &fmt, bool* ok) const |
345 | { | 358 | { |
346 | //kdDebug(173) << "KLocale::readDate intstr=" << intstr << " fmt=" << fmt << endl; | 359 | //kdDebug(173) << "KLocale::readDate intstr=" << intstr << " fmt=" << fmt << endl; |
347 | QString str = intstr.simplifyWhiteSpace().lower(); | 360 | QString str = intstr.simplifyWhiteSpace().lower(); |
348 | int day = -1, month = -1; | 361 | int day = -1, month = -1; |
349 | // allow the year to be omitted if not in the format | 362 | // allow the year to be omitted if not in the format |
350 | int year = QDate::currentDate().year(); | 363 | int year = QDate::currentDate().year(); |
351 | uint strpos = 0; | 364 | uint strpos = 0; |
352 | uint fmtpos = 0; | 365 | uint fmtpos = 0; |
353 | 366 | ||
354 | while (fmt.length() > fmtpos || str.length() > strpos) | 367 | while (fmt.length() > fmtpos || str.length() > strpos) |
355 | { | 368 | { |
356 | if ( !(fmt.length() > fmtpos && str.length() > strpos) ) | 369 | if ( !(fmt.length() > fmtpos && str.length() > strpos) ) |
357 | goto error; | 370 | goto error; |
358 | 371 | ||
359 | QChar c = fmt.at(fmtpos++); | 372 | QChar c = fmt.at(fmtpos++); |
@@ -427,64 +440,65 @@ QDate KLocale::readDate(const QString &intstr, const QString &fmt, bool* ok) con | |||
427 | year += 1900; | 440 | year += 1900; |
428 | 441 | ||
429 | break; | 442 | break; |
430 | } | 443 | } |
431 | } | 444 | } |
432 | //kdDebug(173) << "KLocale::readDate day=" << day << " month=" << month << " year=" << year << endl; | 445 | //kdDebug(173) << "KLocale::readDate day=" << day << " month=" << month << " year=" << year << endl; |
433 | if ( year != -1 && month != -1 && day != -1 ) | 446 | if ( year != -1 && month != -1 && day != -1 ) |
434 | { | 447 | { |
435 | if (ok) *ok = true; | 448 | if (ok) *ok = true; |
436 | return QDate(year, month, day); | 449 | return QDate(year, month, day); |
437 | } | 450 | } |
438 | error: | 451 | error: |
439 | if (ok) *ok = false; | 452 | if (ok) *ok = false; |
440 | return QDate(); // invalid date | 453 | return QDate(); // invalid date |
441 | } | 454 | } |
442 | 455 | ||
443 | QTime KLocale::readTime(const QString &intstr, bool *ok) const | 456 | QTime 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 | ||
451 | QTime KLocale::readTime(const QString &intstr, bool seconds, bool *ok) const | 464 | QTime 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++)) |
475 | goto error; | 489 | goto error; |
476 | continue; | 490 | continue; |
477 | } | 491 | } |
478 | 492 | ||
479 | // remove space at the begining | 493 | // remove space at the begining |
480 | if (str.length() > strpos && str.at(strpos).isSpace()) | 494 | if (str.length() > strpos && str.at(strpos).isSpace()) |
481 | strpos++; | 495 | strpos++; |
482 | 496 | ||
483 | c = Format.at(Formatpos++); | 497 | c = Format.at(Formatpos++); |
484 | switch (c) | 498 | switch (c) |
485 | { | 499 | { |
486 | case 'p': | 500 | case 'p': |
487 | { | 501 | { |
488 | QString s; | 502 | QString s; |
489 | s = i18n("pm").lower(); | 503 | s = i18n("pm").lower(); |
490 | int len = s.length(); | 504 | int len = s.length(); |
@@ -653,69 +667,86 @@ QString KLocale::dateFormat(IntDateFormat intIntDateFormat) const | |||
653 | return "%a %d %b %Y"; | 667 | return "%a %d %b %Y"; |
654 | else if ( dformat == Format1 ) | 668 | else if ( dformat == Format1 ) |
655 | return "%a %b %d %Y"; | 669 | return "%a %b %d %Y"; |
656 | else if ( dformat == ISODate ) | 670 | else if ( dformat == ISODate ) |
657 | return "%a %Y %b %d"; | 671 | return "%a %Y %b %d"; |
658 | } else { | 672 | } else { |
659 | 673 | ||
660 | if ( dformat == Default ) | 674 | if ( dformat == Default ) |
661 | return "%A %d %B %Y"; | 675 | return "%A %d %B %Y"; |
662 | else if ( dformat == Format1 ) | 676 | else if ( dformat == Format1 ) |
663 | return "%A %B %d %Y"; | 677 | return "%A %B %d %Y"; |
664 | else if ( dformat == ISODate ) | 678 | else if ( dformat == ISODate ) |
665 | return "%A %Y %B %d"; | 679 | return "%A %Y %B %d"; |
666 | } | 680 | } |
667 | return mDateFormat ; | 681 | return mDateFormat ; |
668 | } | 682 | } |
669 | 683 | ||
670 | QString KLocale::dateFormatShort(IntDateFormat intIntDateFormat) const | 684 | QString 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 | ||
685 | QString KLocale::timeFormat() const | 699 | QString 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 | ||
692 | void KLocale::insertCatalogue ( const QString & ) | 723 | void KLocale::insertCatalogue ( const QString & ) |
693 | { | 724 | { |
694 | } | 725 | } |
695 | 726 | ||
696 | KCalendarSystem *KLocale::calendar() | 727 | KCalendarSystem *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 | ||
705 | int KLocale::timezoneOffset( QString timeZone ) | 736 | int KLocale::timezoneOffset( QString timeZone ) |
706 | { | 737 | { |
707 | int ret = 1001; | 738 | int ret = 1001; |
708 | int index = mTimeZoneList.findIndex( timeZone ); | 739 | int index = mTimeZoneList.findIndex( timeZone ); |
709 | if ( index < 24 ) | 740 | if ( index < 24 ) |
710 | ret = ( index-11 ) * 60 ; | 741 | ret = ( index-11 ) * 60 ; |
711 | return ret; | 742 | return ret; |
712 | } | 743 | } |
713 | 744 | ||
714 | QStringList KLocale::timeZoneList() const | 745 | QStringList KLocale::timeZoneList() const |
715 | { | 746 | { |
716 | return mTimeZoneList; | 747 | return mTimeZoneList; |
717 | } | 748 | } |
718 | void KLocale::setTimezone( const QString &timeZone ) | 749 | void KLocale::setTimezone( const QString &timeZone ) |
719 | { | 750 | { |
720 | mTimeZoneOffset = timezoneOffset( timeZone ); | 751 | mTimeZoneOffset = timezoneOffset( timeZone ); |
721 | } | 752 | } |
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 | |||
@@ -15,98 +15,101 @@ void setLocaleDict( QDict<QString> * dict ); | |||
15 | QString i18n(const char *text); | 15 | QString i18n(const char *text); |
16 | QString i18n(const char *hint, const char *text); | 16 | QString i18n(const char *hint, const char *text); |
17 | QString i18n(const char *text1, const char *textn, int num); | 17 | QString i18n(const char *text1, const char *textn, int num); |
18 | 18 | ||
19 | // Qt3's uic generates i18n( "msg", "comment" ) calls which conflict | 19 | // Qt3's uic generates i18n( "msg", "comment" ) calls which conflict |
20 | // with our i18n method. we use uic -tr tr2i18n to redirect | 20 | // with our i18n method. we use uic -tr tr2i18n to redirect |
21 | // to the right i18n() function | 21 | // to the right i18n() function |
22 | inline QString tr2i18n(const char* message, const char* =0) { | 22 | inline QString tr2i18n(const char* message, const char* =0) { |
23 | return i18n( message); | 23 | return i18n( message); |
24 | } | 24 | } |
25 | 25 | ||
26 | class KLocale | 26 | class KLocale |
27 | { | 27 | { |
28 | public: | 28 | public: |
29 | KLocale(); | 29 | KLocale(); |
30 | 30 | ||
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 |