<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en_US" xml:lang="en_US"> <head> <title>kdecore: klocale.cpp Source File (kdecore)</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="pics-label" content='(pics-1.1 "http://www.icra.org/ratingsv02.html" comment "ICRAonline DE v2.0" l gen true for "http://www.kde.org" r (nz 1 vz 1 lz 1 oz 1 cb 1) "http://www.rsac.org/ratingsv01.html" l gen true for "http://www.kde.org" r (n 0 s 0 v 0 l 0))' /> <meta name="trademark" content="KDE e.V." /> <meta name="description" content="K Desktop Environment Homepage, KDE.org" /> <meta name="MSSmartTagsPreventParsing" content="true" /> <meta name="robots" content="all" /> <link rel="shortcut icon" href="../../favicon.ico" /> <link rel="stylesheet" media="screen" type="text/css" title="APIDOX" href="doxygen.css" /> </head> <body> <div id="nav_header_top" align="right"> <a href="#content" class="doNotDisplay" accesskey="2">Skip to main content ::</a> <a href="../.."><img id="nav_header_logo" alt="Home" align="left" src="../../kde_gear_64.png" border="0" /></a> <span class="doNotDisplay">::</span> <div id="nav_header_title" align="left">KDE API Reference</div> </div> <div id="nav_header_bottom" align="right"> <span class="doNotDisplay">:: <a href="#navigation" accesskey="5">Skip to Link Menu</a><br/></span> <div id="nav_header_bottom_right" style="text-align: left;"> / <a href="../..">API Reference</a> / <a href=".">kdecore</a> </div> </div> <table id="main" border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td valign="top" class="menuheader" height="0"></td> <td id="contentcolumn" valign="top" rowspan="2" > <div id="content" style="padding-top: 0px;"><div style="width:100%; margin: 0px; padding: 0px;"> <a name="content"></a> <!-- Generated by Doxygen 1.7.4 --> <div class="header"> <div class="headertitle"> <div class="title">klocale.cpp</div> </div> </div> <div class="contents"> <div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// -*- c-basic-offset: 2 -*-</span> <a name="l00002"></a>00002 <span class="comment">/* This file is part of the KDE libraries</span> <a name="l00003"></a>00003 <span class="comment"> Copyright (c) 1997,2001 Stephan Kulow <coolo@kde.org></span> <a name="l00004"></a>00004 <span class="comment"> Copyright (c) 1999 Preston Brown <pbrown@kde.org></span> <a name="l00005"></a>00005 <span class="comment"> Copyright (c) 1999-2002 Hans Petter Bieker <bieker@kde.org></span> <a name="l00006"></a>00006 <span class="comment"> Copyright (c) 2002 Lukas Tinkl <lukas@kde.org></span> <a name="l00007"></a>00007 <span class="comment"></span> <a name="l00008"></a>00008 <span class="comment"> This library is free software; you can redistribute it and/or</span> <a name="l00009"></a>00009 <span class="comment"> modify it under the terms of the GNU Library General Public</span> <a name="l00010"></a>00010 <span class="comment"> License as published by the Free Software Foundation; either</span> <a name="l00011"></a>00011 <span class="comment"> version 2 of the License, or (at your option) any later version.</span> <a name="l00012"></a>00012 <span class="comment"></span> <a name="l00013"></a>00013 <span class="comment"> This library is distributed in the hope that it will be useful,</span> <a name="l00014"></a>00014 <span class="comment"> but WITHOUT ANY WARRANTY; without even the implied warranty of</span> <a name="l00015"></a>00015 <span class="comment"> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span> <a name="l00016"></a>00016 <span class="comment"> Library General Public License for more details.</span> <a name="l00017"></a>00017 <span class="comment"></span> <a name="l00018"></a>00018 <span class="comment"> You should have received a copy of the GNU Library General Public License</span> <a name="l00019"></a>00019 <span class="comment"> along with this library; see the file COPYING.LIB. If not, write to</span> <a name="l00020"></a>00020 <span class="comment"> the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,</span> <a name="l00021"></a>00021 <span class="comment"> Boston, MA 02110-1301, USA.</span> <a name="l00022"></a>00022 <span class="comment">*/</span> <a name="l00023"></a>00023 <a name="l00024"></a>00024 <span class="preprocessor">#include <config.h></span> <a name="l00025"></a>00025 <a name="l00026"></a>00026 <span class="preprocessor">#include <stdlib.h></span> <span class="comment">// getenv</span> <a name="l00027"></a>00027 <a name="l00028"></a>00028 <span class="preprocessor">#include <qtextcodec.h></span> <a name="l00029"></a>00029 <span class="preprocessor">#include <qfile.h></span> <a name="l00030"></a>00030 <span class="preprocessor">#include <qprinter.h></span> <a name="l00031"></a>00031 <span class="preprocessor">#include <qdatetime.h></span> <a name="l00032"></a>00032 <span class="preprocessor">#include <qfileinfo.h></span> <a name="l00033"></a>00033 <span class="preprocessor">#include <qregexp.h></span> <a name="l00034"></a>00034 <a name="l00035"></a>00035 <span class="preprocessor">#include "kcatalogue.h"</span> <a name="l00036"></a>00036 <span class="preprocessor">#include "kglobal.h"</span> <a name="l00037"></a>00037 <span class="preprocessor">#include "kstandarddirs.h"</span> <a name="l00038"></a>00038 <span class="preprocessor">#include "ksimpleconfig.h"</span> <a name="l00039"></a>00039 <span class="preprocessor">#include "kinstance.h"</span> <a name="l00040"></a>00040 <span class="preprocessor">#include "kconfig.h"</span> <a name="l00041"></a>00041 <span class="preprocessor">#include "kdebug.h"</span> <a name="l00042"></a>00042 <span class="preprocessor">#include "kcalendarsystem.h"</span> <a name="l00043"></a>00043 <span class="preprocessor">#include "kcalendarsystemfactory.h"</span> <a name="l00044"></a>00044 <span class="preprocessor">#include "<a class="code" href="klocale_8h.html">klocale.h</a>"</span> <a name="l00045"></a>00045 <a name="l00046"></a>00046 <span class="preprocessor">#ifdef Q_WS_WIN</span> <a name="l00047"></a>00047 <span class="preprocessor"></span><span class="preprocessor">#include <windows.h></span> <a name="l00048"></a>00048 <span class="preprocessor">#endif</span> <a name="l00049"></a>00049 <span class="preprocessor"></span> <a name="l00050"></a>00050 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> * <span class="keyword">const</span> SYSTEM_MESSAGES = <span class="stringliteral">"kdelibs"</span>; <a name="l00051"></a>00051 <a name="l00052"></a>00052 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *maincatalogue = 0; <a name="l00053"></a>00053 <a name="l00054"></a>00054 <span class="keyword">class </span>KLocalePrivate <a name="l00055"></a>00055 { <a name="l00056"></a>00056 <span class="keyword">public</span>: <a name="l00057"></a>00057 <span class="keywordtype">int</span> weekStartDay; <a name="l00058"></a>00058 <span class="keywordtype">bool</span> nounDeclension; <a name="l00059"></a>00059 <span class="keywordtype">bool</span> dateMonthNamePossessive; <a name="l00060"></a>00060 <a class="codeRef" href="qstringlist.html">QStringList</a> languageList; <a name="l00061"></a>00061 <a class="codeRef" href="qstringlist.html">QStringList</a> catalogNames; <span class="comment">// list of all catalogs (regardless of language)</span> <a name="l00062"></a>00062 <a class="codeRef" href="qvaluelist.html">QValueList<KCatalogue></a> catalogues; <span class="comment">// list of all loaded catalogs, contains one instance per catalog name and language</span> <a name="l00063"></a>00063 <a class="codeRef" href="qstring.html">QString</a> encoding; <a name="l00064"></a>00064 <a class="codeRef" href="qtextcodec.html">QTextCodec</a> * codecForEncoding; <a name="l00065"></a>00065 <a class="code" href="classKConfig.html" title="Access KDE Configuration entries.">KConfig</a> * config; <a name="l00066"></a>00066 <span class="keywordtype">bool</span> formatInited; <a name="l00067"></a>00067 <span class="keywordtype">int</span> <span class="comment">/*QPrinter::PageSize*/</span> pageSize; <a name="l00068"></a>00068 <a class="code" href="classKLocale.html#a9f3b163a356a322afde1820878b97118" title="The Metric system will give you information in mm, while the Imperial system will give you informatio...">KLocale::MeasureSystem</a> measureSystem; <a name="l00069"></a>00069 <a class="codeRef" href="qstringlist.html">QStringList</a> langTwoAlpha; <a name="l00070"></a>00070 <a class="code" href="classKConfig.html" title="Access KDE Configuration entries.">KConfig</a> *languages; <a name="l00071"></a>00071 <a name="l00072"></a>00072 <a class="codeRef" href="qstring.html">QString</a> calendarType; <a name="l00073"></a>00073 <a class="code" href="classKCalendarSystem.html" title="CalendarSystem abstract class, default derived kde gregorian class and factory class.">KCalendarSystem</a> * calendar; <a name="l00074"></a>00074 <span class="keywordtype">bool</span> utf8FileEncoding; <a name="l00075"></a>00075 <a class="codeRef" href="qstring.html">QString</a> appName; <a name="l00076"></a>00076 <span class="preprocessor">#ifdef Q_WS_WIN</span> <a name="l00077"></a>00077 <span class="preprocessor"></span> <span class="keywordtype">char</span> win32SystemEncoding[3+7]; <span class="comment">//"cp " + lang ID</span> <a name="l00078"></a>00078 <span class="preprocessor">#endif</span> <a name="l00079"></a>00079 <span class="preprocessor"></span>}; <a name="l00080"></a>00080 <a name="l00081"></a>00081 <span class="keyword">static</span> <a class="code" href="classKLocale.html" title="KLocale provides support for country specific stuff like the national language.">KLocale</a> *this_klocale = 0; <a name="l00082"></a>00082 <a name="l00083"></a><a class="code" href="classKLocale.html#a71368e476693c57f754bbad641ac35f5">00083</a> <a class="code" href="classKLocale.html#a71368e476693c57f754bbad641ac35f5" title="Constructs a KLocale with the given catalog name.">KLocale::KLocale</a>( <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> & catalog, <a class="code" href="classKConfig.html" title="Access KDE Configuration entries.">KConfig</a> * config ) <a name="l00084"></a>00084 { <a name="l00085"></a>00085 d = <span class="keyword">new</span> KLocalePrivate; <a name="l00086"></a>00086 d->config = config; <a name="l00087"></a>00087 d->languages = 0; <a name="l00088"></a>00088 d->calendar = 0; <a name="l00089"></a>00089 d->formatInited = <span class="keyword">false</span>; <a name="l00090"></a>00090 <a name="l00091"></a>00091 initEncoding(0); <a name="l00092"></a>00092 initFileNameEncoding(0); <a name="l00093"></a>00093 <a name="l00094"></a>00094 <a class="code" href="classKConfig.html" title="Access KDE Configuration entries.">KConfig</a> *cfg = d->config; <a name="l00095"></a>00095 this_klocale = <span class="keyword">this</span>; <a name="l00096"></a>00096 <span class="keywordflow">if</span> (!cfg) cfg = <a class="code" href="classKGlobal.html#a7005487680376266c61372ea7ff3c080" title="Returns the global instance.">KGlobal::instance</a>()-><a class="code" href="classKInstance.html#a45c9e6b3a643cf421c274581910f89bf" title="Returns the general config object ("appnamerc").">config</a>(); <a name="l00097"></a>00097 this_klocale = 0; <a name="l00098"></a>00098 Q_ASSERT( cfg ); <a name="l00099"></a>00099 <a name="l00100"></a>00100 d->appName = catalog; <a name="l00101"></a>00101 initLanguageList( cfg, config == 0); <a name="l00102"></a>00102 initMainCatalogues(catalog); <a name="l00103"></a>00103 } <a name="l00104"></a>00104 <a name="l00105"></a>00105 <a class="codeRef" href="qstring.html">QString</a> KLocale::_initLanguage(<a class="code" href="classKConfigBase.html" title="KDE Configuration Management abstract base class.">KConfigBase</a> *config) <a name="l00106"></a>00106 { <a name="l00107"></a>00107 <span class="keywordflow">if</span> (this_klocale) <a name="l00108"></a>00108 { <a name="l00109"></a>00109 <span class="comment">// ### HPB Why this cast??</span> <a name="l00110"></a>00110 this_klocale->initLanguageList((<a class="code" href="classKConfig.html" title="Access KDE Configuration entries.">KConfig</a> *) config, <span class="keyword">true</span>); <a name="l00111"></a>00111 <span class="comment">// todo: adapt current catalog list: remove unused languages, insert main catalogs, if not already found</span> <a name="l00112"></a>00112 <span class="keywordflow">return</span> this_klocale-><a class="code" href="classKLocale.html#aba800e1c9ded357356e130d6092593a8" title="Returns the language used by this object.">language</a>(); <a name="l00113"></a>00113 } <a name="l00114"></a>00114 <span class="keywordflow">return</span> QString::null; <a name="l00115"></a>00115 } <a name="l00116"></a>00116 <a name="l00117"></a>00117 <span class="keywordtype">void</span> KLocale::initMainCatalogues(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> & catalog) <a name="l00118"></a>00118 { <a name="l00119"></a>00119 <span class="comment">// Use the first non-null string.</span> <a name="l00120"></a>00120 <a class="codeRef" href="qstring.html">QString</a> mainCatalogue = catalog; <a name="l00121"></a>00121 <span class="keywordflow">if</span> (maincatalogue) <a name="l00122"></a>00122 mainCatalogue = <a class="codeRef" href="qstring.html#fromLatin1">QString::fromLatin1</a>(maincatalogue); <a name="l00123"></a>00123 <a name="l00124"></a>00124 <span class="keywordflow">if</span> (mainCatalogue.<a class="codeRef" href="qstring.html#isEmpty">isEmpty</a>()) { <a name="l00125"></a>00125 kdDebug(173) << <span class="stringliteral">"KLocale instance created called without valid "</span> <a name="l00126"></a>00126 << <span class="stringliteral">"catalog! Give an argument or call setMainCatalogue "</span> <a name="l00127"></a>00127 << <span class="stringliteral">"before init"</span> << <a class="code" href="group__kdebug.html#ga313d520ed8f8f6b46eeef22cfb3b082a" title="Does nothing.">endl</a>; <a name="l00128"></a>00128 } <a name="l00129"></a>00129 <span class="keywordflow">else</span> { <a name="l00130"></a>00130 <span class="comment">// do not use insertCatalogue here, that would already trigger updateCatalogs</span> <a name="l00131"></a>00131 d->catalogNames.append( mainCatalogue ); <span class="comment">// application catalog</span> <a name="l00132"></a>00132 d->catalogNames.append( SYSTEM_MESSAGES ); <span class="comment">// always include kdelibs.mo</span> <a name="l00133"></a>00133 d->catalogNames.append( <span class="stringliteral">"kio"</span> ); <span class="comment">// always include kio.mo</span> <a name="l00134"></a>00134 updateCatalogues(); <span class="comment">// evaluate this for all languages</span> <a name="l00135"></a>00135 } <a name="l00136"></a>00136 } <a name="l00137"></a>00137 <a name="l00138"></a>00138 <span class="keywordtype">void</span> KLocale::initLanguageList(<a class="code" href="classKConfig.html" title="Access KDE Configuration entries.">KConfig</a> * config, <span class="keywordtype">bool</span> useEnv) <a name="l00139"></a>00139 { <a name="l00140"></a>00140 <a class="code" href="classKConfigGroupSaver.html" title="Helper class to facilitate working with KConfig / KSimpleConfig groups.">KConfigGroupSaver</a> saver(config, <span class="stringliteral">"Locale"</span>); <a name="l00141"></a>00141 <a name="l00142"></a>00142 m_country = config-><a class="code" href="classKConfigBase.html#a955d1210aeb86d7ec5265557333ab338" title="Reads the value of an entry specified by pKey in the current group.">readEntry</a>( <span class="stringliteral">"Country"</span> ); <a name="l00143"></a>00143 <span class="keywordflow">if</span> ( m_country.<a class="codeRef" href="qstring.html#isEmpty">isEmpty</a>() ) { <a name="l00144"></a>00144 <a class="codeRef" href="qstring.html">QString</a> ln, ct, chrset; <a name="l00145"></a>00145 <a class="code" href="classKLocale.html#a9dd4f44d048e36111792ed52a7d775d2" title="Returns the parts of the parameter str understood as language setting the format is language_COUNTRY...">splitLocale</a>(<a class="codeRef" href="qstring.html">QString</a>(::getenv(<span class="stringliteral">"LANG"</span>)), ln, ct, chrset); <a name="l00146"></a>00146 m_country = (ct.<a class="codeRef" href="qstring.html#isEmpty">isEmpty</a>()) ? <a class="code" href="classKLocale.html#ab33058526a3fb1e26561d38c1f076896" title="Returns the name of the default country.">defaultCountry</a>() : ct.<a class="codeRef" href="qstring.html#lower">lower</a>(); <a name="l00147"></a>00147 } <a name="l00148"></a>00148 <span class="comment">// Reset the list and add the new languages</span> <a name="l00149"></a>00149 <a class="codeRef" href="qstringlist.html">QStringList</a> <a class="code" href="classKLocale.html#a53da146b33285ca9cbcdca8306039eb2" title="Returns the languages selected by user.">languageList</a>; <a name="l00150"></a>00150 <span class="keywordflow">if</span> ( useEnv ) <a name="l00151"></a>00151 languageList += <a class="codeRef" href="qstringlist.html#split">QStringList::split</a> <a name="l00152"></a>00152 (<span class="charliteral">':'</span>, <a class="codeRef" href="qfile.html#decodeName">QFile::decodeName</a>( ::getenv(<span class="stringliteral">"KDE_LANG"</span>) )); <a name="l00153"></a>00153 <a name="l00154"></a>00154 languageList += config-><a class="code" href="classKConfigBase.html#ac44dfc4886fd5247b6740493baa7c197" title="Reads a list of strings.">readListEntry</a>(<span class="stringliteral">"Language"</span>, <span class="charliteral">':'</span>); <a name="l00155"></a>00155 <a name="l00156"></a>00156 <span class="comment">// same order as setlocale use</span> <a name="l00157"></a>00157 <span class="keywordflow">if</span> ( useEnv ) <a name="l00158"></a>00158 { <a name="l00159"></a>00159 <span class="comment">// HPB: Only run splitLocale on the environment variables..</span> <a name="l00160"></a>00160 <a class="codeRef" href="qstringlist.html">QStringList</a> langs; <a name="l00161"></a>00161 <a name="l00162"></a>00162 langs << <a class="codeRef" href="qfile.html#decodeName">QFile::decodeName</a>( ::getenv(<span class="stringliteral">"LC_ALL"</span>) ); <a name="l00163"></a>00163 langs << <a class="codeRef" href="qfile.html#decodeName">QFile::decodeName</a>( ::getenv(<span class="stringliteral">"LC_MESSAGES"</span>) ); <a name="l00164"></a>00164 langs << <a class="codeRef" href="qfile.html#decodeName">QFile::decodeName</a>( ::getenv(<span class="stringliteral">"LANG"</span>) ); <a name="l00165"></a>00165 <a name="l00166"></a>00166 <span class="keywordflow">for</span> ( QStringList::Iterator it = langs.begin(); <a name="l00167"></a>00167 it != langs.end(); <a name="l00168"></a>00168 ++it ) <a name="l00169"></a>00169 { <a name="l00170"></a>00170 <a class="codeRef" href="qstring.html">QString</a> ln, ct, chrset; <a name="l00171"></a>00171 <a class="code" href="classKLocale.html#a9dd4f44d048e36111792ed52a7d775d2" title="Returns the parts of the parameter str understood as language setting the format is language_COUNTRY...">splitLocale</a>(*it, ln, ct, chrset); <a name="l00172"></a>00172 <a name="l00173"></a>00173 <span class="keywordflow">if</span> (!ct.<a class="codeRef" href="qstring.html#isEmpty">isEmpty</a>()) { <a name="l00174"></a>00174 langs.insert(it, ln + <span class="charliteral">'_'</span> + ct); <a name="l00175"></a>00175 <span class="keywordflow">if</span> (!chrset.<a class="codeRef" href="qstring.html#isEmpty">isEmpty</a>()) <a name="l00176"></a>00176 langs.insert(it, ln + <span class="charliteral">'_'</span> + ct + <span class="charliteral">'.'</span> + chrset); <a name="l00177"></a>00177 } <a name="l00178"></a>00178 <a name="l00179"></a>00179 langs.insert(it, ln); <a name="l00180"></a>00180 } <a name="l00181"></a>00181 <a name="l00182"></a>00182 languageList += langs; <a name="l00183"></a>00183 } <a name="l00184"></a>00184 <a name="l00185"></a>00185 <span class="comment">// now we have a language list -- let's use the first OK language</span> <a name="l00186"></a>00186 <a class="code" href="classKLocale.html#ac652db1621c1609b217fe51f0e476ba9" title="Changes the current language.">setLanguage</a>( languageList ); <a name="l00187"></a>00187 } <a name="l00188"></a>00188 <a name="l00189"></a>00189 <span class="keywordtype">void</span> KLocale::initPluralTypes() <a name="l00190"></a>00190 { <a name="l00191"></a>00191 <span class="keywordflow">for</span> ( <a class="codeRef" href="qvaluelist.html">QValueList<KCatalogue>::Iterator</a> it = d->catalogues.begin(); <a name="l00192"></a>00192 it != d->catalogues.end(); <a name="l00193"></a>00193 ++it ) <a name="l00194"></a>00194 { <a name="l00195"></a>00195 <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#aba800e1c9ded357356e130d6092593a8" title="Returns the language used by this object.">language</a> = (*it).language(); <a name="l00196"></a>00196 <span class="keywordtype">int</span> pt = pluralType( language ); <a name="l00197"></a>00197 (*it).setPluralType( pt ); <a name="l00198"></a>00198 } <a name="l00199"></a>00199 } <a name="l00200"></a>00200 <a name="l00201"></a>00201 <a name="l00202"></a>00202 <span class="keywordtype">int</span> KLocale::pluralType( <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> & language ) <a name="l00203"></a>00203 { <a name="l00204"></a>00204 <span class="keywordflow">for</span> ( <a class="codeRef" href="qvaluelist.html">QValueList<KCatalogue>::ConstIterator</a> it = d->catalogues.begin(); <a name="l00205"></a>00205 it != d->catalogues.end(); <a name="l00206"></a>00206 ++it ) <a name="l00207"></a>00207 { <a name="l00208"></a>00208 <span class="keywordflow">if</span> ( ((*it).name() == SYSTEM_MESSAGES ) && ((*it).language() == <a class="code" href="classKLocale.html#aba800e1c9ded357356e130d6092593a8" title="Returns the language used by this object.">language</a> )) { <a name="l00209"></a>00209 <span class="keywordflow">return</span> pluralType( *it ); <a name="l00210"></a>00210 } <a name="l00211"></a>00211 } <a name="l00212"></a>00212 <span class="comment">// kdelibs.mo does not seem to exist for this language</span> <a name="l00213"></a>00213 <span class="keywordflow">return</span> -1; <a name="l00214"></a>00214 } <a name="l00215"></a>00215 <a name="l00216"></a>00216 <span class="keywordtype">int</span> KLocale::pluralType( <span class="keyword">const</span> <a class="code" href="classKCatalogue.html" title="This class abstracts a gettext message catalog.">KCatalogue</a>& catalog ) <a name="l00217"></a>00217 { <a name="l00218"></a>00218 <span class="keyword">const</span> <span class="keywordtype">char</span>* pluralFormString = <a name="l00219"></a>00219 <a class="code" href="classKLocale.html#a6732233f7a886e4ff93575ab13ed161e">I18N_NOOP</a>(<span class="stringliteral">"_: Dear translator, please do not translate this string "</span> <a name="l00220"></a>00220 <span class="stringliteral">"in any form, but pick the _right_ value out of "</span> <a name="l00221"></a>00221 <span class="stringliteral">"NoPlural/TwoForms/French... If not sure what to do mail "</span> <a name="l00222"></a>00222 <span class="stringliteral">"thd@kde.org and coolo@kde.org, they will tell you. "</span> <a name="l00223"></a>00223 <span class="stringliteral">"Better leave that out if unsure, the programs will "</span> <a name="l00224"></a>00224 <span class="stringliteral">"crash!!\nDefinition of PluralForm - to be set by the "</span> <a name="l00225"></a>00225 <span class="stringliteral">"translator of kdelibs.po"</span>); <a name="l00226"></a>00226 <a class="codeRef" href="qstring.html">QString</a> pf (catalog.<a class="code" href="classKCatalogue.html#aba16acb76bed5eba17f79fa9a3d5cc52" title="Retrieves a translation of the specified message id.">translate</a>( pluralFormString)); <a name="l00227"></a>00227 <span class="keywordflow">if</span> ( pf.isEmpty() ) { <a name="l00228"></a>00228 <span class="keywordflow">return</span> -1; <a name="l00229"></a>00229 } <a name="l00230"></a>00230 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( pf == <span class="stringliteral">"NoPlural"</span> ) <a name="l00231"></a>00231 <span class="keywordflow">return</span> 0; <a name="l00232"></a>00232 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( pf == <span class="stringliteral">"TwoForms"</span> ) <a name="l00233"></a>00233 <span class="keywordflow">return</span> 1; <a name="l00234"></a>00234 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( pf == <span class="stringliteral">"French"</span> ) <a name="l00235"></a>00235 <span class="keywordflow">return</span> 2; <a name="l00236"></a>00236 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( pf == <span class="stringliteral">"OneTwoRest"</span> ) <a name="l00237"></a>00237 <span class="keywordflow">return</span> 3; <a name="l00238"></a>00238 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( pf == <span class="stringliteral">"Russian"</span> ) <a name="l00239"></a>00239 <span class="keywordflow">return</span> 4; <a name="l00240"></a>00240 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( pf == <span class="stringliteral">"Polish"</span> ) <a name="l00241"></a>00241 <span class="keywordflow">return</span> 5; <a name="l00242"></a>00242 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( pf == <span class="stringliteral">"Slovenian"</span> ) <a name="l00243"></a>00243 <span class="keywordflow">return</span> 6; <a name="l00244"></a>00244 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( pf == <span class="stringliteral">"Lithuanian"</span> ) <a name="l00245"></a>00245 <span class="keywordflow">return</span> 7; <a name="l00246"></a>00246 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( pf == <span class="stringliteral">"Czech"</span> ) <a name="l00247"></a>00247 <span class="keywordflow">return</span> 8; <a name="l00248"></a>00248 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( pf == <span class="stringliteral">"Slovak"</span> ) <a name="l00249"></a>00249 <span class="keywordflow">return</span> 9; <a name="l00250"></a>00250 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( pf == <span class="stringliteral">"Maltese"</span> ) <a name="l00251"></a>00251 <span class="keywordflow">return</span> 10; <a name="l00252"></a>00252 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( pf == <span class="stringliteral">"Arabic"</span> ) <a name="l00253"></a>00253 <span class="keywordflow">return</span> 11; <a name="l00254"></a>00254 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( pf == <span class="stringliteral">"Balcan"</span> ) <a name="l00255"></a>00255 <span class="keywordflow">return</span> 12; <a name="l00256"></a>00256 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( pf == <span class="stringliteral">"Macedonian"</span> ) <a name="l00257"></a>00257 <span class="keywordflow">return</span> 13; <a name="l00258"></a>00258 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( pf == <span class="stringliteral">"Gaeilge"</span> ) <a name="l00259"></a>00259 <span class="keywordflow">return</span> 14; <a name="l00260"></a>00260 <span class="keywordflow">else</span> { <a name="l00261"></a>00261 kdWarning(173) << <span class="stringliteral">"Definition of PluralForm is none of "</span> <a name="l00262"></a>00262 << <span class="stringliteral">"NoPlural/"</span> <a name="l00263"></a>00263 << <span class="stringliteral">"TwoForms/"</span> <a name="l00264"></a>00264 << <span class="stringliteral">"French/"</span> <a name="l00265"></a>00265 << <span class="stringliteral">"OneTwoRest/"</span> <a name="l00266"></a>00266 << <span class="stringliteral">"Russian/"</span> <a name="l00267"></a>00267 << <span class="stringliteral">"Polish/"</span> <a name="l00268"></a>00268 << <span class="stringliteral">"Slovenian/"</span> <a name="l00269"></a>00269 << <span class="stringliteral">"Lithuanian/"</span> <a name="l00270"></a>00270 << <span class="stringliteral">"Czech/"</span> <a name="l00271"></a>00271 << <span class="stringliteral">"Slovak/"</span> <a name="l00272"></a>00272 << <span class="stringliteral">"Arabic/"</span> <a name="l00273"></a>00273 << <span class="stringliteral">"Balcan/"</span> <a name="l00274"></a>00274 << <span class="stringliteral">"Macedonian/"</span> <a name="l00275"></a>00275 << <span class="stringliteral">"Gaeilge/"</span> <a name="l00276"></a>00276 << <span class="stringliteral">"Maltese: "</span> << pf << <a class="code" href="group__kdebug.html#ga313d520ed8f8f6b46eeef22cfb3b082a" title="Does nothing.">endl</a>; <a name="l00277"></a>00277 exit(1); <a name="l00278"></a>00278 } <a name="l00279"></a>00279 } <a name="l00280"></a>00280 <a name="l00281"></a>00281 <span class="keywordtype">void</span> KLocale::doFormatInit()<span class="keyword"> const</span> <a name="l00282"></a>00282 <span class="keyword"></span>{ <a name="l00283"></a>00283 <span class="keywordflow">if</span> ( d->formatInited ) <span class="keywordflow">return</span>; <a name="l00284"></a>00284 <a name="l00285"></a>00285 <a class="code" href="classKLocale.html" title="KLocale provides support for country specific stuff like the national language.">KLocale</a> * that = <span class="keyword">const_cast<</span><a class="code" href="classKLocale.html" title="KLocale provides support for country specific stuff like the national language.">KLocale</a> *<span class="keyword">></span>(<span class="keyword">this</span>); <a name="l00286"></a>00286 that->initFormat(); <a name="l00287"></a>00287 <a name="l00288"></a>00288 d->formatInited = <span class="keyword">true</span>; <a name="l00289"></a>00289 } <a name="l00290"></a>00290 <a name="l00291"></a>00291 <span class="keywordtype">void</span> KLocale::initFormat() <a name="l00292"></a>00292 { <a name="l00293"></a>00293 <a class="code" href="classKConfig.html" title="Access KDE Configuration entries.">KConfig</a> *config = d->config; <a name="l00294"></a>00294 <span class="keywordflow">if</span> (!config) config = <a class="code" href="classKGlobal.html#a7005487680376266c61372ea7ff3c080" title="Returns the global instance.">KGlobal::instance</a>()-><a class="code" href="classKInstance.html#a45c9e6b3a643cf421c274581910f89bf" title="Returns the general config object ("appnamerc").">config</a>(); <a name="l00295"></a>00295 Q_ASSERT( config ); <a name="l00296"></a>00296 <a name="l00297"></a>00297 kdDebug(173) << <span class="stringliteral">"KLocale::initFormat"</span> << <a class="code" href="group__kdebug.html#ga313d520ed8f8f6b46eeef22cfb3b082a" title="Does nothing.">endl</a>; <a name="l00298"></a>00298 <a name="l00299"></a>00299 <span class="comment">// make sure the config files are read using the correct locale</span> <a name="l00300"></a>00300 <span class="comment">// ### Why not add a KConfigBase::setLocale( const KLocale * )?</span> <a name="l00301"></a>00301 <span class="comment">// ### Then we could remove this hack</span> <a name="l00302"></a>00302 <a class="code" href="classKLocale.html" title="KLocale provides support for country specific stuff like the national language.">KLocale</a> *lsave = KGlobal::_locale; <a name="l00303"></a>00303 KGlobal::_locale = <span class="keyword">this</span>; <a name="l00304"></a>00304 <a name="l00305"></a>00305 <a class="code" href="classKConfigGroupSaver.html" title="Helper class to facilitate working with KConfig / KSimpleConfig groups.">KConfigGroupSaver</a> saver(config, <span class="stringliteral">"Locale"</span>); <a name="l00306"></a>00306 <a name="l00307"></a>00307 <a class="code" href="classKSimpleConfig.html" title="KDE Configuration entries.">KSimpleConfig</a> entry(locate(<span class="stringliteral">"locale"</span>, <a name="l00308"></a>00308 <a class="codeRef" href="qstring.html#fromLatin1">QString::fromLatin1</a>(<span class="stringliteral">"l10n/%1/entry.desktop"</span>) <a name="l00309"></a>00309 .arg(m_country)), <span class="keyword">true</span>); <a name="l00310"></a>00310 entry.setGroup(<span class="stringliteral">"KCM Locale"</span>); <a name="l00311"></a>00311 <a name="l00312"></a>00312 <span class="comment">// Numeric</span> <a name="l00313"></a>00313 <span class="preprocessor">#define readConfigEntry(key, default, save) \</span> <a name="l00314"></a>00314 <span class="preprocessor"> save = entry.readEntry(key, QString::fromLatin1(default)); \</span> <a name="l00315"></a>00315 <span class="preprocessor"> save = config->readEntry(key, save);</span> <a name="l00316"></a>00316 <span class="preprocessor"></span> <a name="l00317"></a>00317 <span class="preprocessor">#define readConfigNumEntry(key, default, save, type) \</span> <a name="l00318"></a>00318 <span class="preprocessor"> save = (type)entry.readNumEntry(key, default); \</span> <a name="l00319"></a>00319 <span class="preprocessor"> save = (type)config->readNumEntry(key, save);</span> <a name="l00320"></a>00320 <span class="preprocessor"></span> <a name="l00321"></a>00321 <span class="preprocessor">#define readConfigBoolEntry(key, default, save) \</span> <a name="l00322"></a>00322 <span class="preprocessor"> save = entry.readBoolEntry(key, default); \</span> <a name="l00323"></a>00323 <span class="preprocessor"> save = config->readBoolEntry(key, save);</span> <a name="l00324"></a>00324 <span class="preprocessor"></span> <a name="l00325"></a>00325 readConfigEntry(<span class="stringliteral">"DecimalSymbol"</span>, <span class="stringliteral">"."</span>, m_decimalSymbol); <a name="l00326"></a>00326 readConfigEntry(<span class="stringliteral">"ThousandsSeparator"</span>, <span class="stringliteral">","</span>, m_thousandsSeparator); <a name="l00327"></a>00327 m_thousandsSeparator.<a class="codeRef" href="qstring.html#replace">replace</a>( <a class="codeRef" href="qstring.html#fromLatin1">QString::fromLatin1</a>(<span class="stringliteral">"$0"</span>), QString::null ); <a name="l00328"></a>00328 <span class="comment">//kdDebug(173) << "m_thousandsSeparator=" << m_thousandsSeparator << endl;</span> <a name="l00329"></a>00329 <a name="l00330"></a>00330 readConfigEntry(<span class="stringliteral">"PositiveSign"</span>, <span class="stringliteral">""</span>, m_positiveSign); <a name="l00331"></a>00331 readConfigEntry(<span class="stringliteral">"NegativeSign"</span>, <span class="stringliteral">"-"</span>, m_negativeSign); <a name="l00332"></a>00332 <a name="l00333"></a>00333 <span class="comment">// Monetary</span> <a name="l00334"></a>00334 readConfigEntry(<span class="stringliteral">"CurrencySymbol"</span>, <span class="stringliteral">"$"</span>, m_currencySymbol); <a name="l00335"></a>00335 readConfigEntry(<span class="stringliteral">"MonetaryDecimalSymbol"</span>, <span class="stringliteral">"."</span>, m_monetaryDecimalSymbol); <a name="l00336"></a>00336 readConfigEntry(<span class="stringliteral">"MonetaryThousandsSeparator"</span>, <span class="stringliteral">","</span>, <a name="l00337"></a>00337 m_monetaryThousandsSeparator); <a name="l00338"></a>00338 m_monetaryThousandsSeparator.<a class="codeRef" href="qstring.html#replace">replace</a>(<a class="codeRef" href="qstring.html#fromLatin1">QString::fromLatin1</a>(<span class="stringliteral">"$0"</span>), QString::null); <a name="l00339"></a>00339 <a name="l00340"></a>00340 readConfigNumEntry(<span class="stringliteral">"FracDigits"</span>, 2, m_fracDigits, <span class="keywordtype">int</span>); <a name="l00341"></a>00341 readConfigBoolEntry(<span class="stringliteral">"PositivePrefixCurrencySymbol"</span>, <span class="keyword">true</span>, <a name="l00342"></a>00342 m_positivePrefixCurrencySymbol); <a name="l00343"></a>00343 readConfigBoolEntry(<span class="stringliteral">"NegativePrefixCurrencySymbol"</span>, <span class="keyword">true</span>, <a name="l00344"></a>00344 m_negativePrefixCurrencySymbol); <a name="l00345"></a>00345 readConfigNumEntry(<span class="stringliteral">"PositiveMonetarySignPosition"</span>, (<span class="keywordtype">int</span>)BeforeQuantityMoney, <a name="l00346"></a>00346 m_positiveMonetarySignPosition, <a class="code" href="classKLocale.html#a2871a581bfe0179b1068a3ebfb6cbc51" title="Various positions for where to place the positive or negative sign when they are related to a monetar...">SignPosition</a>); <a name="l00347"></a>00347 readConfigNumEntry(<span class="stringliteral">"NegativeMonetarySignPosition"</span>, (<span class="keywordtype">int</span>)ParensAround, <a name="l00348"></a>00348 m_negativeMonetarySignPosition, <a class="code" href="classKLocale.html#a2871a581bfe0179b1068a3ebfb6cbc51" title="Various positions for where to place the positive or negative sign when they are related to a monetar...">SignPosition</a>); <a name="l00349"></a>00349 <a name="l00350"></a>00350 <a name="l00351"></a>00351 <span class="comment">// Date and time</span> <a name="l00352"></a>00352 readConfigEntry(<span class="stringliteral">"TimeFormat"</span>, <span class="stringliteral">"%H:%M:%S"</span>, m_timeFormat); <a name="l00353"></a>00353 readConfigEntry(<span class="stringliteral">"DateFormat"</span>, <span class="stringliteral">"%A %d %B %Y"</span>, m_dateFormat); <a name="l00354"></a>00354 readConfigEntry(<span class="stringliteral">"DateFormatShort"</span>, <span class="stringliteral">"%Y-%m-%d"</span>, m_dateFormatShort); <a name="l00355"></a>00355 readConfigNumEntry(<span class="stringliteral">"WeekStartDay"</span>, 1, d->weekStartDay, <span class="keywordtype">int</span>); <a name="l00356"></a>00356 <a name="l00357"></a>00357 <span class="comment">// other</span> <a name="l00358"></a>00358 readConfigNumEntry(<span class="stringliteral">"PageSize"</span>, (<span class="keywordtype">int</span>)QPrinter::A4, d->pageSize, <span class="keywordtype">int</span>); <a name="l00359"></a>00359 readConfigNumEntry(<span class="stringliteral">"MeasureSystem"</span>, (<span class="keywordtype">int</span>)Metric, d->measureSystem, <a name="l00360"></a>00360 <a class="code" href="classKLocale.html#a9f3b163a356a322afde1820878b97118" title="The Metric system will give you information in mm, while the Imperial system will give you informatio...">MeasureSystem</a>); <a name="l00361"></a>00361 readConfigEntry(<span class="stringliteral">"CalendarSystem"</span>, <span class="stringliteral">"gregorian"</span>, d->calendarType); <a name="l00362"></a>00362 <span class="keyword">delete</span> d->calendar; <a name="l00363"></a>00363 d->calendar = 0; <span class="comment">// ### HPB Is this the correct place?</span> <a name="l00364"></a>00364 <a name="l00365"></a>00365 <span class="comment">//Grammatical</span> <a name="l00366"></a>00366 <span class="comment">//Precedence here is l10n / i18n / config file</span> <a name="l00367"></a>00367 <a class="code" href="classKSimpleConfig.html" title="KDE Configuration entries.">KSimpleConfig</a> <a class="code" href="classKLocale.html#aba800e1c9ded357356e130d6092593a8" title="Returns the language used by this object.">language</a>(locate(<span class="stringliteral">"locale"</span>, <a name="l00368"></a>00368 <a class="codeRef" href="qstring.html#fromLatin1">QString::fromLatin1</a>(<span class="stringliteral">"%1/entry.desktop"</span>) <a name="l00369"></a>00369 .arg(m_language)), <span class="keyword">true</span>); <a name="l00370"></a>00370 language.setGroup(<span class="stringliteral">"KCM Locale"</span>); <a name="l00371"></a>00371 <span class="preprocessor">#define read3ConfigBoolEntry(key, default, save) \</span> <a name="l00372"></a>00372 <span class="preprocessor"> save = entry.readBoolEntry(key, default); \</span> <a name="l00373"></a>00373 <span class="preprocessor"> save = language.readBoolEntry(key, save); \</span> <a name="l00374"></a>00374 <span class="preprocessor"> save = config->readBoolEntry(key, save);</span> <a name="l00375"></a>00375 <span class="preprocessor"></span> <a name="l00376"></a>00376 read3ConfigBoolEntry(<span class="stringliteral">"NounDeclension"</span>, <span class="keyword">false</span>, d->nounDeclension); <a name="l00377"></a>00377 read3ConfigBoolEntry(<span class="stringliteral">"DateMonthNamePossessive"</span>, <span class="keyword">false</span>, <a name="l00378"></a>00378 d->dateMonthNamePossessive); <a name="l00379"></a>00379 <a name="l00380"></a>00380 <span class="comment">// end of hack</span> <a name="l00381"></a>00381 KGlobal::_locale = lsave; <a name="l00382"></a>00382 } <a name="l00383"></a>00383 <a name="l00384"></a><a class="code" href="classKLocale.html#ada64c1c7cb41c65c76899fdb7e9b31f2">00384</a> <span class="keywordtype">bool</span> <a class="code" href="classKLocale.html#ada64c1c7cb41c65c76899fdb7e9b31f2" title="Changes the current country.">KLocale::setCountry</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> & country) <a name="l00385"></a>00385 { <a name="l00386"></a>00386 <span class="comment">// Check if the file exists too??</span> <a name="l00387"></a>00387 <span class="keywordflow">if</span> ( country.<a class="codeRef" href="qstring.html#isEmpty">isEmpty</a>() ) <a name="l00388"></a>00388 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00389"></a>00389 <a name="l00390"></a>00390 m_country = <a class="code" href="classKLocale.html#acc3c8ad59fb2a4818094624e83025ad3" title="Returns the country code of the country where the user lives.">country</a>; <a name="l00391"></a>00391 <a name="l00392"></a>00392 d->formatInited = <span class="keyword">false</span>; <a name="l00393"></a>00393 <a name="l00394"></a>00394 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l00395"></a>00395 } <a name="l00396"></a>00396 <a name="l00397"></a>00397 <a class="codeRef" href="qstring.html">QString</a> KLocale::catalogueFileName(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> & language, <a name="l00398"></a>00398 <span class="keyword">const</span> <a class="code" href="classKCatalogue.html" title="This class abstracts a gettext message catalog.">KCatalogue</a> & catalog) <a name="l00399"></a>00399 { <a name="l00400"></a>00400 <a class="codeRef" href="qstring.html">QString</a> path = <a class="codeRef" href="qstring.html#fromLatin1">QString::fromLatin1</a>(<span class="stringliteral">"%1/LC_MESSAGES/%2.mo"</span>) <a name="l00401"></a>00401 .arg( language ) <a name="l00402"></a>00402 .arg( catalog.<a class="code" href="classKCatalogue.html#a0d1661d19435bf585bb197bd586df53a" title="Returns the name of the catalog.">name</a>() ); <a name="l00403"></a>00403 <a name="l00404"></a>00404 <span class="keywordflow">return</span> locate( <span class="stringliteral">"locale"</span>, path ); <a name="l00405"></a>00405 } <a name="l00406"></a>00406 <a name="l00407"></a><a class="code" href="classKLocale.html#ac652db1621c1609b217fe51f0e476ba9">00407</a> <span class="keywordtype">bool</span> <a class="code" href="classKLocale.html#ac652db1621c1609b217fe51f0e476ba9" title="Changes the current language.">KLocale::setLanguage</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> & language) <a name="l00408"></a>00408 { <a name="l00409"></a>00409 <span class="keywordflow">if</span> ( d->languageList.contains( language ) ) { <a name="l00410"></a>00410 d->languageList.remove( language ); <a name="l00411"></a>00411 } <a name="l00412"></a>00412 d->languageList.prepend( language ); <span class="comment">// let us consider this language to be the most important one</span> <a name="l00413"></a>00413 <a name="l00414"></a>00414 m_language = <a class="code" href="classKLocale.html#aba800e1c9ded357356e130d6092593a8" title="Returns the language used by this object.">language</a>; <span class="comment">// remember main language for shortcut evaluation</span> <a name="l00415"></a>00415 <a name="l00416"></a>00416 <span class="comment">// important when called from the outside and harmless when called before populating the</span> <a name="l00417"></a>00417 <span class="comment">// catalog name list</span> <a name="l00418"></a>00418 updateCatalogues(); <a name="l00419"></a>00419 <a name="l00420"></a>00420 d->formatInited = <span class="keyword">false</span>; <a name="l00421"></a>00421 <a name="l00422"></a>00422 <span class="keywordflow">return</span> <span class="keyword">true</span>; <span class="comment">// Maybe the mo-files for this language are empty, but in principle we can speak all languages</span> <a name="l00423"></a>00423 } <a name="l00424"></a>00424 <a name="l00425"></a><a class="code" href="classKLocale.html#a8249084e19254e349d8bc281b6778abc">00425</a> <span class="keywordtype">bool</span> <a class="code" href="classKLocale.html#ac652db1621c1609b217fe51f0e476ba9" title="Changes the current language.">KLocale::setLanguage</a>(<span class="keyword">const</span> <a class="codeRef" href="qstringlist.html">QStringList</a> & languages) <a name="l00426"></a>00426 { <a name="l00427"></a>00427 <a class="codeRef" href="qstringlist.html">QStringList</a> <a class="code" href="classKLocale.html#a53da146b33285ca9cbcdca8306039eb2" title="Returns the languages selected by user.">languageList</a>( languages ); <a name="l00428"></a>00428 <span class="comment">// This list might contain</span> <a name="l00429"></a>00429 <span class="comment">// 1) some empty strings that we have to eliminate</span> <a name="l00430"></a>00430 <span class="comment">// 2) duplicate entries like in de:fr:de, where we have to keep the first occurrance of a language in order</span> <a name="l00431"></a>00431 <span class="comment">// to preserve the order of precenence of the user => iterate backwards</span> <a name="l00432"></a>00432 <span class="comment">// 3) languages into which the application is not translated. For those languages we should not even load kdelibs.mo or kio.po.</span> <a name="l00433"></a>00433 <span class="comment">// these langugage have to be dropped. Otherwise we get strange side effects, e.g. with Hebrew:</span> <a name="l00434"></a>00434 <span class="comment">// the right/left switch for languages that write from</span> <a name="l00435"></a>00435 <span class="comment">// right to left (like Hebrew or Arabic) is set in kdelibs.mo. If you only have kdelibs.mo</span> <a name="l00436"></a>00436 <span class="comment">// but nothing from appname.mo, you get a mostly English app with layout from right to left.</span> <a name="l00437"></a>00437 <span class="comment">// That was considered to be a bug by the Hebrew translators.</span> <a name="l00438"></a>00438 <span class="keywordflow">for</span>( QStringList::Iterator it = languageList.fromLast(); <a name="l00439"></a>00439 it != languageList.begin(); --it ) <a name="l00440"></a>00440 { <a name="l00441"></a>00441 <span class="comment">// kdDebug() << "checking " << (*it) << endl;</span> <a name="l00442"></a>00442 <span class="keywordtype">bool</span> bIsTranslated = isApplicationTranslatedInto( *it ); <a name="l00443"></a>00443 <span class="keywordflow">if</span> ( languageList.contains(*it) > 1 || (*it).isEmpty() || (!bIsTranslated) ) { <a name="l00444"></a>00444 <span class="comment">// kdDebug() << "removing " << (*it) << endl;</span> <a name="l00445"></a>00445 it = languageList.remove( it ); <a name="l00446"></a>00446 } <a name="l00447"></a>00447 } <a name="l00448"></a>00448 <span class="comment">// now this has left the first element of the list unchecked.</span> <a name="l00449"></a>00449 <span class="comment">// The question why this is the case is left as an exercise for the reader...</span> <a name="l00450"></a>00450 <span class="comment">// Besides the list might have been empty all the way, so check that too.</span> <a name="l00451"></a>00451 <span class="keywordflow">if</span> ( languageList.begin() != languageList.end() ) { <a name="l00452"></a>00452 QStringList::Iterator it = languageList.begin(); <span class="comment">// now pointing to the first element</span> <a name="l00453"></a>00453 <span class="comment">// kdDebug() << "checking " << (*it) << endl;</span> <a name="l00454"></a>00454 <span class="keywordflow">if</span>( (*it).isEmpty() || !(isApplicationTranslatedInto( *it )) ) { <a name="l00455"></a>00455 <span class="comment">// kdDebug() << "removing " << (*it) << endl;</span> <a name="l00456"></a>00456 languageList.remove( it ); <span class="comment">// that's what the iterator was for...</span> <a name="l00457"></a>00457 } <a name="l00458"></a>00458 } <a name="l00459"></a>00459 <a name="l00460"></a>00460 <span class="keywordflow">if</span> ( languageList.isEmpty() ) { <a name="l00461"></a>00461 <span class="comment">// user picked no language, so we assume he/she speaks English.</span> <a name="l00462"></a>00462 languageList.append( <a class="code" href="classKLocale.html#ac44bcb4778c651d35b5cce6048b63da2" title="Returns the name of the internal language.">defaultLanguage</a>() ); <a name="l00463"></a>00463 } <a name="l00464"></a>00464 m_language = languageList.first(); <span class="comment">// keep this for shortcut evaluations</span> <a name="l00465"></a>00465 <a name="l00466"></a>00466 d->languageList = <a class="code" href="classKLocale.html#a53da146b33285ca9cbcdca8306039eb2" title="Returns the languages selected by user.">languageList</a>; <span class="comment">// keep this new list of languages to use</span> <a name="l00467"></a>00467 d->langTwoAlpha.clear(); <span class="comment">// Flush cache</span> <a name="l00468"></a>00468 <a name="l00469"></a>00469 <span class="comment">// important when called from the outside and harmless when called before populating the</span> <a name="l00470"></a>00470 <span class="comment">// catalog name list</span> <a name="l00471"></a>00471 updateCatalogues(); <a name="l00472"></a>00472 <a name="l00473"></a>00473 <span class="keywordflow">return</span> <span class="keyword">true</span>; <span class="comment">// we found something. Maybe it's only English, but we found something</span> <a name="l00474"></a>00474 } <a name="l00475"></a>00475 <a name="l00476"></a>00476 <span class="keywordtype">bool</span> KLocale::isApplicationTranslatedInto( <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> & language) <a name="l00477"></a>00477 { <a name="l00478"></a>00478 <span class="keywordflow">if</span> ( language.<a class="codeRef" href="qstring.html#isEmpty">isEmpty</a>() ) { <a name="l00479"></a>00479 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00480"></a>00480 } <a name="l00481"></a>00481 <a name="l00482"></a>00482 <span class="keywordflow">if</span> ( language == <a class="code" href="classKLocale.html#ac44bcb4778c651d35b5cce6048b63da2" title="Returns the name of the internal language.">defaultLanguage</a>() ) { <a name="l00483"></a>00483 <span class="comment">// en_us is always "installed"</span> <a name="l00484"></a>00484 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l00485"></a>00485 } <a name="l00486"></a>00486 <a name="l00487"></a>00487 <a class="codeRef" href="qstring.html">QString</a> appName = d->appName; <a name="l00488"></a>00488 <span class="keywordflow">if</span> (maincatalogue) { <a name="l00489"></a>00489 appName = <a class="codeRef" href="qstring.html#fromLatin1">QString::fromLatin1</a>(maincatalogue); <a name="l00490"></a>00490 } <a name="l00491"></a>00491 <span class="comment">// sorry, catalogueFileName requires catalog object,k which we do not have here</span> <a name="l00492"></a>00492 <span class="comment">// path finding was supposed to be moved completely to KCatalogue. The interface cannot</span> <a name="l00493"></a>00493 <span class="comment">// be changed that far during deep freeze. So in order to fix the bug now, we have</span> <a name="l00494"></a>00494 <span class="comment">// duplicated code for file path evaluation. Cleanup will follow later. We could have e.g.</span> <a name="l00495"></a>00495 <span class="comment">// a static method in KCataloge that can translate between these file names.</span> <a name="l00496"></a>00496 <span class="comment">// a stat</span> <a name="l00497"></a>00497 <a class="codeRef" href="qstring.html">QString</a> sFileName = <a class="codeRef" href="qstring.html#fromLatin1">QString::fromLatin1</a>(<span class="stringliteral">"%1/LC_MESSAGES/%2.mo"</span>) <a name="l00498"></a>00498 .arg( language ) <a name="l00499"></a>00499 .arg( appName ); <a name="l00500"></a>00500 <span class="comment">// kdDebug() << "isApplicationTranslatedInto: filename " << sFileName << endl;</span> <a name="l00501"></a>00501 <a name="l00502"></a>00502 <a class="codeRef" href="qstring.html">QString</a> sAbsFileName = locate( <span class="stringliteral">"locale"</span>, sFileName ); <a name="l00503"></a>00503 <span class="comment">// kdDebug() << "isApplicationTranslatedInto: absname " << sAbsFileName << endl;</span> <a name="l00504"></a>00504 <span class="keywordflow">return</span> ! sAbsFileName.<a class="codeRef" href="qstring.html#isEmpty">isEmpty</a>(); <a name="l00505"></a>00505 } <a name="l00506"></a>00506 <a name="l00507"></a><a class="code" href="classKLocale.html#a9dd4f44d048e36111792ed52a7d775d2">00507</a> <span class="keywordtype">void</span> <a class="code" href="classKLocale.html#a9dd4f44d048e36111792ed52a7d775d2" title="Returns the parts of the parameter str understood as language setting the format is language_COUNTRY...">KLocale::splitLocale</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> & aStr, <a name="l00508"></a>00508 <a class="codeRef" href="qstring.html">QString</a> & language, <a name="l00509"></a>00509 <a class="codeRef" href="qstring.html">QString</a> & country, <a name="l00510"></a>00510 <a class="codeRef" href="qstring.html">QString</a> & chrset) <a name="l00511"></a>00511 { <a name="l00512"></a>00512 <a class="codeRef" href="qstring.html">QString</a> str = aStr; <a name="l00513"></a>00513 <a name="l00514"></a>00514 <span class="comment">// just in case, there is another language appended</span> <a name="l00515"></a>00515 <span class="keywordtype">int</span> f = str.<a class="codeRef" href="qstring.html#find">find</a>(<span class="charliteral">':'</span>); <a name="l00516"></a>00516 <span class="keywordflow">if</span> (f >= 0) <a name="l00517"></a>00517 str.<a class="codeRef" href="qstring.html#truncate">truncate</a>(f); <a name="l00518"></a>00518 <a name="l00519"></a>00519 country = QString::null; <a name="l00520"></a>00520 chrset = QString::null; <a name="l00521"></a>00521 language = QString::null; <a name="l00522"></a>00522 <a name="l00523"></a>00523 f = str.<a class="codeRef" href="qstring.html#find">find</a>(<span class="charliteral">'.'</span>); <a name="l00524"></a>00524 <span class="keywordflow">if</span> (f >= 0) <a name="l00525"></a>00525 { <a name="l00526"></a>00526 chrset = str.<a class="codeRef" href="qstring.html#mid">mid</a>(f + 1); <a name="l00527"></a>00527 str.<a class="codeRef" href="qstring.html#truncate">truncate</a>(f); <a name="l00528"></a>00528 } <a name="l00529"></a>00529 <a name="l00530"></a>00530 f = str.<a class="codeRef" href="qstring.html#find">find</a>(<span class="charliteral">'_'</span>); <a name="l00531"></a>00531 <span class="keywordflow">if</span> (f >= 0) <a name="l00532"></a>00532 { <a name="l00533"></a>00533 country = str.<a class="codeRef" href="qstring.html#mid">mid</a>(f + 1); <a name="l00534"></a>00534 str.<a class="codeRef" href="qstring.html#truncate">truncate</a>(f); <a name="l00535"></a>00535 } <a name="l00536"></a>00536 <a name="l00537"></a>00537 language = str; <a name="l00538"></a>00538 } <a name="l00539"></a>00539 <a name="l00540"></a><a class="code" href="classKLocale.html#aba800e1c9ded357356e130d6092593a8">00540</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#aba800e1c9ded357356e130d6092593a8" title="Returns the language used by this object.">KLocale::language</a>()<span class="keyword"> const</span> <a name="l00541"></a>00541 <span class="keyword"></span>{ <a name="l00542"></a>00542 <span class="keywordflow">return</span> m_language; <a name="l00543"></a>00543 } <a name="l00544"></a>00544 <a name="l00545"></a><a class="code" href="classKLocale.html#acc3c8ad59fb2a4818094624e83025ad3">00545</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#acc3c8ad59fb2a4818094624e83025ad3" title="Returns the country code of the country where the user lives.">KLocale::country</a>()<span class="keyword"> const</span> <a name="l00546"></a>00546 <span class="keyword"></span>{ <a name="l00547"></a>00547 <span class="keywordflow">return</span> m_country; <a name="l00548"></a>00548 } <a name="l00549"></a>00549 <a name="l00550"></a><a class="code" href="classKLocale.html#a41ea28a1068006a4eabcd7e049335aa5">00550</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#a41ea28a1068006a4eabcd7e049335aa5">KLocale::monthName</a>(<span class="keywordtype">int</span> i, <span class="keywordtype">bool</span> shortName)<span class="keyword"> const</span> <a name="l00551"></a>00551 <span class="keyword"></span>{ <a name="l00552"></a>00552 <span class="keywordflow">if</span> ( shortName ) <a name="l00553"></a>00553 <span class="keywordflow">switch</span> ( i ) <a name="l00554"></a>00554 { <a name="l00555"></a>00555 <span class="keywordflow">case</span> 1: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"January"</span>, <span class="stringliteral">"Jan"</span>); <a name="l00556"></a>00556 <span class="keywordflow">case</span> 2: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"February"</span>, <span class="stringliteral">"Feb"</span>); <a name="l00557"></a>00557 <span class="keywordflow">case</span> 3: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"March"</span>, <span class="stringliteral">"Mar"</span>); <a name="l00558"></a>00558 <span class="keywordflow">case</span> 4: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"April"</span>, <span class="stringliteral">"Apr"</span>); <a name="l00559"></a>00559 <span class="keywordflow">case</span> 5: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"May short"</span>, <span class="stringliteral">"May"</span>); <a name="l00560"></a>00560 <span class="keywordflow">case</span> 6: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"June"</span>, <span class="stringliteral">"Jun"</span>); <a name="l00561"></a>00561 <span class="keywordflow">case</span> 7: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"July"</span>, <span class="stringliteral">"Jul"</span>); <a name="l00562"></a>00562 <span class="keywordflow">case</span> 8: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"August"</span>, <span class="stringliteral">"Aug"</span>); <a name="l00563"></a>00563 <span class="keywordflow">case</span> 9: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"September"</span>, <span class="stringliteral">"Sep"</span>); <a name="l00564"></a>00564 <span class="keywordflow">case</span> 10: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"October"</span>, <span class="stringliteral">"Oct"</span>); <a name="l00565"></a>00565 <span class="keywordflow">case</span> 11: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"November"</span>, <span class="stringliteral">"Nov"</span>); <a name="l00566"></a>00566 <span class="keywordflow">case</span> 12: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"December"</span>, <span class="stringliteral">"Dec"</span>); <a name="l00567"></a>00567 } <a name="l00568"></a>00568 <span class="keywordflow">else</span> <a name="l00569"></a>00569 <span class="keywordflow">switch</span> (i) <a name="l00570"></a>00570 { <a name="l00571"></a>00571 <span class="keywordflow">case</span> 1: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"January"</span>); <a name="l00572"></a>00572 <span class="keywordflow">case</span> 2: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"February"</span>); <a name="l00573"></a>00573 <span class="keywordflow">case</span> 3: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"March"</span>); <a name="l00574"></a>00574 <span class="keywordflow">case</span> 4: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"April"</span>); <a name="l00575"></a>00575 <span class="keywordflow">case</span> 5: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"May long"</span>, <span class="stringliteral">"May"</span>); <a name="l00576"></a>00576 <span class="keywordflow">case</span> 6: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"June"</span>); <a name="l00577"></a>00577 <span class="keywordflow">case</span> 7: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"July"</span>); <a name="l00578"></a>00578 <span class="keywordflow">case</span> 8: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"August"</span>); <a name="l00579"></a>00579 <span class="keywordflow">case</span> 9: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"September"</span>); <a name="l00580"></a>00580 <span class="keywordflow">case</span> 10: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"October"</span>); <a name="l00581"></a>00581 <span class="keywordflow">case</span> 11: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"November"</span>); <a name="l00582"></a>00582 <span class="keywordflow">case</span> 12: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"December"</span>); <a name="l00583"></a>00583 } <a name="l00584"></a>00584 <a name="l00585"></a>00585 <span class="keywordflow">return</span> QString::null; <a name="l00586"></a>00586 } <a name="l00587"></a>00587 <a name="l00588"></a><a class="code" href="classKLocale.html#a412755b26ce67d66d2b46983b024cc8c">00588</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#a412755b26ce67d66d2b46983b024cc8c">KLocale::monthNamePossessive</a>(<span class="keywordtype">int</span> i, <span class="keywordtype">bool</span> shortName)<span class="keyword"> const</span> <a name="l00589"></a>00589 <span class="keyword"></span>{ <a name="l00590"></a>00590 <span class="keywordflow">if</span> ( shortName ) <a name="l00591"></a>00591 <span class="keywordflow">switch</span> ( i ) <a name="l00592"></a>00592 { <a name="l00593"></a>00593 <span class="keywordflow">case</span> 1: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"of January"</span>, <span class="stringliteral">"of Jan"</span>); <a name="l00594"></a>00594 <span class="keywordflow">case</span> 2: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"of February"</span>, <span class="stringliteral">"of Feb"</span>); <a name="l00595"></a>00595 <span class="keywordflow">case</span> 3: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"of March"</span>, <span class="stringliteral">"of Mar"</span>); <a name="l00596"></a>00596 <span class="keywordflow">case</span> 4: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"of April"</span>, <span class="stringliteral">"of Apr"</span>); <a name="l00597"></a>00597 <span class="keywordflow">case</span> 5: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"of May short"</span>, <span class="stringliteral">"of May"</span>); <a name="l00598"></a>00598 <span class="keywordflow">case</span> 6: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"of June"</span>, <span class="stringliteral">"of Jun"</span>); <a name="l00599"></a>00599 <span class="keywordflow">case</span> 7: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"of July"</span>, <span class="stringliteral">"of Jul"</span>); <a name="l00600"></a>00600 <span class="keywordflow">case</span> 8: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"of August"</span>, <span class="stringliteral">"of Aug"</span>); <a name="l00601"></a>00601 <span class="keywordflow">case</span> 9: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"of September"</span>, <span class="stringliteral">"of Sep"</span>); <a name="l00602"></a>00602 <span class="keywordflow">case</span> 10: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"of October"</span>, <span class="stringliteral">"of Oct"</span>); <a name="l00603"></a>00603 <span class="keywordflow">case</span> 11: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"of November"</span>, <span class="stringliteral">"of Nov"</span>); <a name="l00604"></a>00604 <span class="keywordflow">case</span> 12: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"of December"</span>, <span class="stringliteral">"of Dec"</span>); <a name="l00605"></a>00605 } <a name="l00606"></a>00606 <span class="keywordflow">else</span> <a name="l00607"></a>00607 <span class="keywordflow">switch</span> (i) <a name="l00608"></a>00608 { <a name="l00609"></a>00609 <span class="keywordflow">case</span> 1: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"of January"</span>); <a name="l00610"></a>00610 <span class="keywordflow">case</span> 2: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"of February"</span>); <a name="l00611"></a>00611 <span class="keywordflow">case</span> 3: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"of March"</span>); <a name="l00612"></a>00612 <span class="keywordflow">case</span> 4: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"of April"</span>); <a name="l00613"></a>00613 <span class="keywordflow">case</span> 5: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"of May long"</span>, <span class="stringliteral">"of May"</span>); <a name="l00614"></a>00614 <span class="keywordflow">case</span> 6: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"of June"</span>); <a name="l00615"></a>00615 <span class="keywordflow">case</span> 7: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"of July"</span>); <a name="l00616"></a>00616 <span class="keywordflow">case</span> 8: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"of August"</span>); <a name="l00617"></a>00617 <span class="keywordflow">case</span> 9: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"of September"</span>); <a name="l00618"></a>00618 <span class="keywordflow">case</span> 10: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"of October"</span>); <a name="l00619"></a>00619 <span class="keywordflow">case</span> 11: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"of November"</span>); <a name="l00620"></a>00620 <span class="keywordflow">case</span> 12: <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"of December"</span>); <a name="l00621"></a>00621 } <a name="l00622"></a>00622 <a name="l00623"></a>00623 <span class="keywordflow">return</span> QString::null; <a name="l00624"></a>00624 } <a name="l00625"></a>00625 <a name="l00626"></a><a class="code" href="classKLocale.html#a11d04f0f19b11c768451f1baba84650c">00626</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#a11d04f0f19b11c768451f1baba84650c">KLocale::weekDayName</a> (<span class="keywordtype">int</span> i, <span class="keywordtype">bool</span> shortName)<span class="keyword"> const</span> <a name="l00627"></a>00627 <span class="keyword"></span>{ <a name="l00628"></a>00628 <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#a0bfd055c66b769eef7005bd970cab326" title="Returns a pointer to the calendar system object.">calendar</a>()-><a class="code" href="classKCalendarSystem.html#a06dd24136f979dad84aa5be2d8c5b785" title="Gets specific calendar type week day name If an invalid week day is specified, QString::null is retur...">weekDayName</a>(i, shortName); <a name="l00629"></a>00629 } <a name="l00630"></a>00630 <a name="l00631"></a><a class="code" href="classKLocale.html#af14d084c90a004164fa037458377740e">00631</a> <span class="keywordtype">void</span> <a class="code" href="classKLocale.html#af14d084c90a004164fa037458377740e" title="Adds another catalog to search for translation lookup.">KLocale::insertCatalogue</a>( <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> & catalog ) <a name="l00632"></a>00632 { <a name="l00633"></a>00633 <span class="keywordflow">if</span> ( !d->catalogNames.contains( catalog) ) { <a name="l00634"></a>00634 d->catalogNames.append( catalog ); <a name="l00635"></a>00635 } <a name="l00636"></a>00636 updateCatalogues( ); <span class="comment">// evaluate the changed list and generate the neccessary KCatalog objects</span> <a name="l00637"></a>00637 } <a name="l00638"></a>00638 <a name="l00639"></a>00639 <span class="keywordtype">void</span> KLocale::updateCatalogues( ) <a name="l00640"></a>00640 { <a name="l00641"></a>00641 <span class="comment">// some changes have occured. Maybe we have learned or forgotten some languages.</span> <a name="l00642"></a>00642 <span class="comment">// Maybe the language precedence has changed.</span> <a name="l00643"></a>00643 <span class="comment">// Maybe we have learned or forgotten some catalog names.</span> <a name="l00644"></a>00644 <span class="comment">// Now examine the list of KCatalogue objects and change it according to the new circumstances.</span> <a name="l00645"></a>00645 <a name="l00646"></a>00646 <span class="comment">// this could be optimized: try to reuse old KCatalog objects, but remember that the order of</span> <a name="l00647"></a>00647 <span class="comment">// catalogs might have changed: e.g. in this fashion</span> <a name="l00648"></a>00648 <span class="comment">// 1) move all catalogs into a temporary list</span> <a name="l00649"></a>00649 <span class="comment">// 2) iterate over all languages and catalog names</span> <a name="l00650"></a>00650 <span class="comment">// 3.1) pick the catalog from the saved list, if it already exists</span> <a name="l00651"></a>00651 <span class="comment">// 3.2) else create a new catalog.</span> <a name="l00652"></a>00652 <span class="comment">// but we will do this later.</span> <a name="l00653"></a>00653 <a name="l00654"></a>00654 <span class="keywordflow">for</span> ( <a class="codeRef" href="qvaluelist.html">QValueList<KCatalogue>::Iterator</a> it = d->catalogues.begin(); <a name="l00655"></a>00655 it != d->catalogues.end(); ) <a name="l00656"></a>00656 { <a name="l00657"></a>00657 it = d->catalogues.remove(it); <a name="l00658"></a>00658 } <a name="l00659"></a>00659 <a name="l00660"></a>00660 <span class="comment">// now iterate over all languages and all wanted catalog names and append or create them in the right order</span> <a name="l00661"></a>00661 <span class="comment">// the sequence must be e.g. nds/appname nds/kdelibs nds/kio de/appname de/kdelibs de/kio etc.</span> <a name="l00662"></a>00662 <span class="comment">// and not nds/appname de/appname nds/kdelibs de/kdelibs etc. Otherwise we would be in trouble with a language</span> <a name="l00663"></a>00663 <span class="comment">// sequende nds,en_US, de. In this case en_US must hide everything below in the language list.</span> <a name="l00664"></a>00664 <span class="keywordflow">for</span> ( QStringList::ConstIterator itLangs = d->languageList.begin(); <a name="l00665"></a>00665 itLangs != d->languageList.end(); ++itLangs) <a name="l00666"></a>00666 { <a name="l00667"></a>00667 <span class="keywordflow">for</span> ( QStringList::ConstIterator itNames = d->catalogNames.begin(); <a name="l00668"></a>00668 itNames != d->catalogNames.end(); ++itNames) <a name="l00669"></a>00669 { <a name="l00670"></a>00670 <a class="code" href="classKCatalogue.html" title="This class abstracts a gettext message catalog.">KCatalogue</a> cat( *itNames, *itLangs ); <span class="comment">// create Catalog for this name and this language</span> <a name="l00671"></a>00671 d->catalogues.append( cat ); <a name="l00672"></a>00672 } <a name="l00673"></a>00673 } <a name="l00674"></a>00674 initPluralTypes(); <span class="comment">// evaluate the plural type for all languages and remember this in each KCatalogue</span> <a name="l00675"></a>00675 } <a name="l00676"></a>00676 <a name="l00677"></a>00677 <a name="l00678"></a>00678 <a name="l00679"></a>00679 <a name="l00680"></a><a class="code" href="classKLocale.html#a654a986cdf66791a2f0379af9a9ee1a7">00680</a> <span class="keywordtype">void</span> <a class="code" href="classKLocale.html#a654a986cdf66791a2f0379af9a9ee1a7" title="Removes a catalog for translation lookup.">KLocale::removeCatalogue</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> &catalog) <a name="l00681"></a>00681 { <a name="l00682"></a>00682 <span class="keywordflow">if</span> ( d->catalogNames.contains( catalog )) { <a name="l00683"></a>00683 d->catalogNames.remove( catalog ); <a name="l00684"></a>00684 <span class="keywordflow">if</span> (KGlobal::_instance) <a name="l00685"></a>00685 updateCatalogues(); <span class="comment">// walk through the KCatalogue instances and weed out everything we no longer need</span> <a name="l00686"></a>00686 } <a name="l00687"></a>00687 } <a name="l00688"></a>00688 <a name="l00689"></a><a class="code" href="classKLocale.html#ae0a18a05ff11bc9c9e12143546148ba7">00689</a> <span class="keywordtype">void</span> <a class="code" href="classKLocale.html#ae0a18a05ff11bc9c9e12143546148ba7" title="Sets the active catalog for translation lookup.">KLocale::setActiveCatalogue</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> &catalog) <a name="l00690"></a>00690 { <a name="l00691"></a>00691 <span class="keywordflow">if</span> ( d->catalogNames.contains( catalog ) ) { <a name="l00692"></a>00692 d->catalogNames.remove( catalog ); <a name="l00693"></a>00693 d->catalogNames.prepend( catalog ); <a name="l00694"></a>00694 updateCatalogues(); <span class="comment">// walk through the KCatalogue instances and adapt to the new order</span> <a name="l00695"></a>00695 } <a name="l00696"></a>00696 } <a name="l00697"></a>00697 <a name="l00698"></a><a class="code" href="classKLocale.html#ae16f0041df1757f335d698f0c3d20375">00698</a> <a class="code" href="classKLocale.html#ae16f0041df1757f335d698f0c3d20375" title="Destructor.">KLocale::~KLocale</a>() <a name="l00699"></a>00699 { <a name="l00700"></a>00700 <span class="keyword">delete</span> d->calendar; <a name="l00701"></a>00701 <span class="keyword">delete</span> d->languages; <a name="l00702"></a>00702 <span class="keyword">delete</span> d; <a name="l00703"></a>00703 d = 0L; <a name="l00704"></a>00704 } <a name="l00705"></a>00705 <a name="l00706"></a>00706 <a class="codeRef" href="qstring.html">QString</a> KLocale::translate_priv(<span class="keyword">const</span> <span class="keywordtype">char</span> *msgid, <a name="l00707"></a>00707 <span class="keyword">const</span> <span class="keywordtype">char</span> *fallback, <a name="l00708"></a>00708 <span class="keyword">const</span> <span class="keywordtype">char</span> **translated, <a name="l00709"></a>00709 <span class="keywordtype">int</span>* pluralType )<span class="keyword"> const</span> <a name="l00710"></a>00710 <span class="keyword"></span>{ <a name="l00711"></a>00711 <span class="keywordflow">if</span> ( pluralType) { <a name="l00712"></a>00712 *pluralType = -1; <span class="comment">// unless we find something more precise</span> <a name="l00713"></a>00713 } <a name="l00714"></a>00714 <span class="keywordflow">if</span> (!msgid || !msgid[0]) <a name="l00715"></a>00715 { <a name="l00716"></a>00716 kdWarning() << <span class="stringliteral">"KLocale: trying to look up \"\" in catalog. "</span> <a name="l00717"></a>00717 << <span class="stringliteral">"Fix the program"</span> << <a class="code" href="group__kdebug.html#ga313d520ed8f8f6b46eeef22cfb3b082a" title="Does nothing.">endl</a>; <a name="l00718"></a>00718 <span class="keywordflow">return</span> QString::null; <a name="l00719"></a>00719 } <a name="l00720"></a>00720 <a name="l00721"></a>00721 <span class="keywordflow">if</span> ( useDefaultLanguage() ) { <span class="comment">// shortcut evaluation if en_US is main language: do not consult the catalogs</span> <a name="l00722"></a>00722 <span class="keywordflow">return</span> <a class="codeRef" href="qstring.html#fromUtf8">QString::fromUtf8</a>( fallback ); <a name="l00723"></a>00723 } <a name="l00724"></a>00724 <a name="l00725"></a>00725 <span class="keywordflow">for</span> ( <a class="codeRef" href="qvaluelist.html">QValueList<KCatalogue>::ConstIterator</a> it = d->catalogues.begin(); <a name="l00726"></a>00726 it != d->catalogues.end(); <a name="l00727"></a>00727 ++it ) <a name="l00728"></a>00728 { <a name="l00729"></a>00729 <span class="comment">// shortcut evaluation: once we have arrived at en_US (default language) we cannot consult</span> <a name="l00730"></a>00730 <span class="comment">// the catalog as it will not have an assiciated mo-file. For this default language we can</span> <a name="l00731"></a>00731 <span class="comment">// immediately pick the fallback string.</span> <a name="l00732"></a>00732 <span class="keywordflow">if</span> ( (*it).language() == <a class="code" href="classKLocale.html#ac44bcb4778c651d35b5cce6048b63da2" title="Returns the name of the internal language.">defaultLanguage</a>() ) { <a name="l00733"></a>00733 <span class="keywordflow">return</span> <a class="codeRef" href="qstring.html#fromUtf8">QString::fromUtf8</a>( fallback ); <a name="l00734"></a>00734 } <a name="l00735"></a>00735 <a name="l00736"></a>00736 <span class="keyword">const</span> <span class="keywordtype">char</span> * text = (*it).translate( msgid ); <a name="l00737"></a>00737 <a name="l00738"></a>00738 <span class="keywordflow">if</span> ( text ) <a name="l00739"></a>00739 { <a name="l00740"></a>00740 <span class="comment">// we found it</span> <a name="l00741"></a>00741 <span class="keywordflow">if</span> (translated) { <a name="l00742"></a>00742 *translated = text; <a name="l00743"></a>00743 } <a name="l00744"></a>00744 <span class="keywordflow">if</span> ( pluralType) { <a name="l00745"></a>00745 *pluralType = (*it).pluralType(); <span class="comment">// remember the plural type information from the catalog that was used</span> <a name="l00746"></a>00746 } <a name="l00747"></a>00747 <span class="keywordflow">return</span> <a class="codeRef" href="qstring.html#fromUtf8">QString::fromUtf8</a>( text ); <a name="l00748"></a>00748 } <a name="l00749"></a>00749 } <a name="l00750"></a>00750 <a name="l00751"></a>00751 <span class="comment">// Always use UTF-8 if the string was not found</span> <a name="l00752"></a>00752 <span class="keywordflow">return</span> <a class="codeRef" href="qstring.html#fromUtf8">QString::fromUtf8</a>( fallback ); <a name="l00753"></a>00753 } <a name="l00754"></a>00754 <a name="l00755"></a><a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927">00755</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">KLocale::translate</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* msgid)<span class="keyword"> const</span> <a name="l00756"></a>00756 <span class="keyword"></span>{ <a name="l00757"></a>00757 <span class="keywordflow">return</span> translate_priv(msgid, msgid); <a name="l00758"></a>00758 } <a name="l00759"></a>00759 <a name="l00760"></a><a class="code" href="classKLocale.html#a9f847d40b92df2d77dd36cd6009262a2">00760</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">KLocale::translate</a>( <span class="keyword">const</span> <span class="keywordtype">char</span> *index, <span class="keyword">const</span> <span class="keywordtype">char</span> *fallback)<span class="keyword"> const</span> <a name="l00761"></a>00761 <span class="keyword"></span>{ <a name="l00762"></a>00762 <span class="keywordflow">if</span> (!index || !index[0] || !fallback || !fallback[0]) <a name="l00763"></a>00763 { <a name="l00764"></a>00764 kdDebug(173) << <span class="stringliteral">"KLocale: trying to look up \"\" in catalog. "</span> <a name="l00765"></a>00765 << <span class="stringliteral">"Fix the program"</span> << <a class="code" href="group__kdebug.html#ga313d520ed8f8f6b46eeef22cfb3b082a" title="Does nothing.">endl</a>; <a name="l00766"></a>00766 <span class="keywordflow">return</span> QString::null; <a name="l00767"></a>00767 } <a name="l00768"></a>00768 <a name="l00769"></a>00769 <span class="keywordflow">if</span> ( useDefaultLanguage() ) <a name="l00770"></a>00770 <span class="keywordflow">return</span> <a class="codeRef" href="qstring.html#fromUtf8">QString::fromUtf8</a>( fallback ); <a name="l00771"></a>00771 <a name="l00772"></a>00772 <span class="keywordtype">char</span> *newstring = <span class="keyword">new</span> <span class="keywordtype">char</span>[strlen(index) + strlen(fallback) + 5]; <a name="l00773"></a>00773 sprintf(newstring, <span class="stringliteral">"_: %s\n%s"</span>, index, fallback); <a name="l00774"></a>00774 <span class="comment">// as copying QString is very fast, it looks slower as it is ;/</span> <a name="l00775"></a>00775 <a class="codeRef" href="qstring.html">QString</a> r = translate_priv(newstring, fallback); <a name="l00776"></a>00776 <span class="keyword">delete</span> [] newstring; <a name="l00777"></a>00777 <a name="l00778"></a>00778 <span class="keywordflow">return</span> r; <a name="l00779"></a>00779 } <a name="l00780"></a>00780 <a name="l00781"></a>00781 <span class="keyword">static</span> <a class="codeRef" href="qstring.html">QString</a> put_n_in(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> &orig, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> n) <a name="l00782"></a>00782 { <a name="l00783"></a>00783 <a class="codeRef" href="qstring.html">QString</a> ret = orig; <a name="l00784"></a>00784 <span class="keywordtype">int</span> index = ret.<a class="codeRef" href="qstring.html#find">find</a>(<span class="stringliteral">"%n"</span>); <a name="l00785"></a>00785 <span class="keywordflow">if</span> (index == -1) <a name="l00786"></a>00786 <span class="keywordflow">return</span> ret; <a name="l00787"></a>00787 ret.<a class="codeRef" href="qstring.html#replace">replace</a>(index, 2, <a class="codeRef" href="qstring.html#number">QString::number</a>(n)); <a name="l00788"></a>00788 <span class="keywordflow">return</span> ret; <a name="l00789"></a>00789 } <a name="l00790"></a>00790 <a name="l00791"></a>00791 <span class="preprocessor">#define EXPECT_LENGTH(x) \</span> <a name="l00792"></a>00792 <span class="preprocessor"> if (forms.count() != x) { \</span> <a name="l00793"></a>00793 <span class="preprocessor"> kdError() << "translation of \"" << singular << "\" doesn't contain " << x << " different plural forms as expected\n"; \</span> <a name="l00794"></a>00794 <span class="preprocessor"> return QString( "BROKEN TRANSLATION %1" ).arg( singular ); }</span> <a name="l00795"></a>00795 <span class="preprocessor"></span> <a name="l00796"></a><a class="code" href="classKLocale.html#a5532d8d4a83bdb1bfb70b8cac9d89271">00796</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">KLocale::translate</a>( <span class="keyword">const</span> <span class="keywordtype">char</span> *singular, <span class="keyword">const</span> <span class="keywordtype">char</span> *plural, <a name="l00797"></a>00797 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> n )<span class="keyword"> const</span> <a name="l00798"></a>00798 <span class="keyword"></span>{ <a name="l00799"></a>00799 <span class="keywordflow">if</span> (!singular || !singular[0] || !plural || !plural[0]) <a name="l00800"></a>00800 { <a name="l00801"></a>00801 kdWarning() << <span class="stringliteral">"KLocale: trying to look up \"\" in catalog. "</span> <a name="l00802"></a>00802 << <span class="stringliteral">"Fix the program"</span> << <a class="code" href="group__kdebug.html#ga313d520ed8f8f6b46eeef22cfb3b082a" title="Does nothing.">endl</a>; <a name="l00803"></a>00803 <span class="keywordflow">return</span> QString::null; <a name="l00804"></a>00804 } <a name="l00805"></a>00805 <a name="l00806"></a>00806 <span class="keywordtype">char</span> *newstring = <span class="keyword">new</span> <span class="keywordtype">char</span>[strlen(singular) + strlen(plural) + 6]; <a name="l00807"></a>00807 sprintf(newstring, <span class="stringliteral">"_n: %s\n%s"</span>, singular, plural); <a name="l00808"></a>00808 <span class="comment">// as copying QString is very fast, it looks slower as it is ;/</span> <a name="l00809"></a>00809 <span class="keywordtype">int</span> pluralType = -1; <a name="l00810"></a>00810 <a class="codeRef" href="qstring.html">QString</a> r = translate_priv(newstring, 0, 0, &pluralType); <a name="l00811"></a>00811 <span class="keyword">delete</span> [] newstring; <a name="l00812"></a>00812 <a name="l00813"></a>00813 <span class="keywordflow">if</span> ( r.<a class="codeRef" href="qstring.html#isEmpty">isEmpty</a>() || useDefaultLanguage() || pluralType == -1) { <a name="l00814"></a>00814 <span class="keywordflow">if</span> ( n == 1 ) { <a name="l00815"></a>00815 <span class="keywordflow">return</span> put_n_in( <a class="codeRef" href="qstring.html#fromUtf8">QString::fromUtf8</a>( singular ), n ); <a name="l00816"></a>00816 } <span class="keywordflow">else</span> { <a name="l00817"></a>00817 <a class="codeRef" href="qstring.html">QString</a> tmp = <a class="codeRef" href="qstring.html#fromUtf8">QString::fromUtf8</a>( plural ); <a name="l00818"></a>00818 <span class="preprocessor">#ifndef NDEBUG</span> <a name="l00819"></a>00819 <span class="preprocessor"></span> <span class="keywordflow">if</span> (tmp.<a class="codeRef" href="qstring.html#find">find</a>(<span class="stringliteral">"%n"</span>) == -1) { <a name="l00820"></a>00820 kdDebug() << <span class="stringliteral">"the message for i18n should contain a '%n'! "</span> << plural << <a class="code" href="group__kdebug.html#ga313d520ed8f8f6b46eeef22cfb3b082a" title="Does nothing.">endl</a>; <a name="l00821"></a>00821 } <a name="l00822"></a>00822 <span class="preprocessor">#endif</span> <a name="l00823"></a>00823 <span class="preprocessor"></span> <span class="keywordflow">return</span> put_n_in( tmp, n ); <a name="l00824"></a>00824 } <a name="l00825"></a>00825 } <a name="l00826"></a>00826 <a name="l00827"></a>00827 <a class="codeRef" href="qstringlist.html">QStringList</a> forms = <a class="codeRef" href="qstringlist.html#split">QStringList::split</a>( <span class="stringliteral">"\n"</span>, r, <span class="keyword">false</span> ); <a name="l00828"></a>00828 <span class="keywordflow">switch</span> ( pluralType ) { <a name="l00829"></a>00829 <span class="keywordflow">case</span> 0: <span class="comment">// NoPlural</span> <a name="l00830"></a>00830 EXPECT_LENGTH( 1 ); <a name="l00831"></a>00831 <span class="keywordflow">return</span> put_n_in( forms[0], n); <a name="l00832"></a>00832 <span class="keywordflow">case</span> 1: <span class="comment">// TwoForms</span> <a name="l00833"></a>00833 EXPECT_LENGTH( 2 ); <a name="l00834"></a>00834 <span class="keywordflow">if</span> ( n == 1 ) <a name="l00835"></a>00835 <span class="keywordflow">return</span> put_n_in( forms[0], n); <a name="l00836"></a>00836 <span class="keywordflow">else</span> <a name="l00837"></a>00837 <span class="keywordflow">return</span> put_n_in( forms[1], n); <a name="l00838"></a>00838 <span class="keywordflow">case</span> 2: <span class="comment">// French</span> <a name="l00839"></a>00839 EXPECT_LENGTH( 2 ); <a name="l00840"></a>00840 <span class="keywordflow">if</span> ( n == 1 || n == 0 ) <a name="l00841"></a>00841 <span class="keywordflow">return</span> put_n_in( forms[0], n); <a name="l00842"></a>00842 <span class="keywordflow">else</span> <a name="l00843"></a>00843 <span class="keywordflow">return</span> put_n_in( forms[1], n); <a name="l00844"></a>00844 <span class="keywordflow">case</span> 3: <span class="comment">// OneTwoRest</span> <a name="l00845"></a>00845 EXPECT_LENGTH( 3 ); <a name="l00846"></a>00846 <span class="keywordflow">if</span> ( n == 1 ) <a name="l00847"></a>00847 <span class="keywordflow">return</span> put_n_in( forms[0], n); <a name="l00848"></a>00848 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( n == 2 ) <a name="l00849"></a>00849 <span class="keywordflow">return</span> put_n_in( forms[1], n); <a name="l00850"></a>00850 <span class="keywordflow">else</span> <a name="l00851"></a>00851 <span class="keywordflow">return</span> put_n_in( forms[2], n); <a name="l00852"></a>00852 <span class="keywordflow">case</span> 4: <span class="comment">// Russian, corrected by mok</span> <a name="l00853"></a>00853 EXPECT_LENGTH( 3 ); <a name="l00854"></a>00854 <span class="keywordflow">if</span> ( n%10 == 1 && n%100 != 11) <a name="l00855"></a>00855 <span class="keywordflow">return</span> put_n_in( forms[0], n); <span class="comment">// odin fail</span> <a name="l00856"></a>00856 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (( n%10 >= 2 && n%10 <=4 ) && (n%100<10 || n%100>20)) <a name="l00857"></a>00857 <span class="keywordflow">return</span> put_n_in( forms[1], n); <span class="comment">// dva faila</span> <a name="l00858"></a>00858 <span class="keywordflow">else</span> <a name="l00859"></a>00859 <span class="keywordflow">return</span> put_n_in( forms[2], n); <span class="comment">// desyat' failov</span> <a name="l00860"></a>00860 <span class="keywordflow">case</span> 5: <span class="comment">// Polish</span> <a name="l00861"></a>00861 EXPECT_LENGTH( 3 ); <a name="l00862"></a>00862 <span class="keywordflow">if</span> ( n == 1 ) <a name="l00863"></a>00863 <span class="keywordflow">return</span> put_n_in( forms[0], n); <a name="l00864"></a>00864 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( n%10 >= 2 && n%10 <=4 && (n%100<10 || n%100>=20) ) <a name="l00865"></a>00865 <span class="keywordflow">return</span> put_n_in( forms[1], n); <a name="l00866"></a>00866 <span class="keywordflow">else</span> <a name="l00867"></a>00867 <span class="keywordflow">return</span> put_n_in( forms[2], n); <a name="l00868"></a>00868 <span class="keywordflow">case</span> 6: <span class="comment">// Slovenian</span> <a name="l00869"></a>00869 EXPECT_LENGTH( 4 ); <a name="l00870"></a>00870 <span class="keywordflow">if</span> ( n%100 == 1 ) <a name="l00871"></a>00871 <span class="keywordflow">return</span> put_n_in( forms[1], n); <span class="comment">// ena datoteka</span> <a name="l00872"></a>00872 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( n%100 == 2 ) <a name="l00873"></a>00873 <span class="keywordflow">return</span> put_n_in( forms[2], n); <span class="comment">// dve datoteki</span> <a name="l00874"></a>00874 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( n%100 == 3 || n%100 == 4 ) <a name="l00875"></a>00875 <span class="keywordflow">return</span> put_n_in( forms[3], n); <span class="comment">// tri datoteke</span> <a name="l00876"></a>00876 <span class="keywordflow">else</span> <a name="l00877"></a>00877 <span class="keywordflow">return</span> put_n_in( forms[0], n); <span class="comment">// sto datotek</span> <a name="l00878"></a>00878 <span class="keywordflow">case</span> 7: <span class="comment">// Lithuanian</span> <a name="l00879"></a>00879 EXPECT_LENGTH( 3 ); <a name="l00880"></a>00880 <span class="keywordflow">if</span> ( n%10 == 0 || (n%100>=11 && n%100<=19) ) <a name="l00881"></a>00881 <span class="keywordflow">return</span> put_n_in( forms[2], n); <a name="l00882"></a>00882 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( n%10 == 1 ) <a name="l00883"></a>00883 <span class="keywordflow">return</span> put_n_in( forms[0], n); <a name="l00884"></a>00884 <span class="keywordflow">else</span> <a name="l00885"></a>00885 <span class="keywordflow">return</span> put_n_in( forms[1], n); <a name="l00886"></a>00886 <span class="keywordflow">case</span> 8: <span class="comment">// Czech - use modern form which is equivalent to Slovak</span> <a name="l00887"></a>00887 <span class="keywordflow">case</span> 9: <span class="comment">// Slovak</span> <a name="l00888"></a>00888 EXPECT_LENGTH( 3 ); <a name="l00889"></a>00889 <span class="keywordflow">if</span> ( n == 1 ) <a name="l00890"></a>00890 <span class="keywordflow">return</span> put_n_in( forms[0], n); <a name="l00891"></a>00891 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (( n >= 2 ) && ( n <= 4 )) <a name="l00892"></a>00892 <span class="keywordflow">return</span> put_n_in( forms[1], n); <a name="l00893"></a>00893 <span class="keywordflow">else</span> <a name="l00894"></a>00894 <span class="keywordflow">return</span> put_n_in( forms[2], n); <a name="l00895"></a>00895 <span class="keywordflow">case</span> 10: <span class="comment">// Maltese</span> <a name="l00896"></a>00896 EXPECT_LENGTH( 4 ); <a name="l00897"></a>00897 <span class="keywordflow">if</span> ( n == 1 ) <a name="l00898"></a>00898 <span class="keywordflow">return</span> put_n_in( forms[0], n ); <a name="l00899"></a>00899 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( ( n == 0 ) || ( n%100 > 0 && n%100 <= 10 ) ) <a name="l00900"></a>00900 <span class="keywordflow">return</span> put_n_in( forms[1], n ); <a name="l00901"></a>00901 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( n%100 > 10 && n%100 < 20 ) <a name="l00902"></a>00902 <span class="keywordflow">return</span> put_n_in( forms[2], n ); <a name="l00903"></a>00903 <span class="keywordflow">else</span> <a name="l00904"></a>00904 <span class="keywordflow">return</span> put_n_in( forms[3], n ); <a name="l00905"></a>00905 <span class="keywordflow">case</span> 11: <span class="comment">// Arabic</span> <a name="l00906"></a>00906 EXPECT_LENGTH( 4 ); <a name="l00907"></a>00907 <span class="keywordflow">if</span> (n == 1) <a name="l00908"></a>00908 <span class="keywordflow">return</span> put_n_in(forms[0], n); <a name="l00909"></a>00909 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (n == 2) <a name="l00910"></a>00910 <span class="keywordflow">return</span> put_n_in(forms[1], n); <a name="l00911"></a>00911 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( n < 11) <a name="l00912"></a>00912 <span class="keywordflow">return</span> put_n_in(forms[2], n); <a name="l00913"></a>00913 <span class="keywordflow">else</span> <a name="l00914"></a>00914 <span class="keywordflow">return</span> put_n_in(forms[3], n); <a name="l00915"></a>00915 <span class="keywordflow">case</span> 12: <span class="comment">// Balcan</span> <a name="l00916"></a>00916 EXPECT_LENGTH( 3 ); <a name="l00917"></a>00917 <span class="keywordflow">if</span> (n != 11 && n % 10 == 1) <a name="l00918"></a>00918 <span class="keywordflow">return</span> put_n_in(forms[0], n); <a name="l00919"></a>00919 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (n / 10 != 1 && n % 10 >= 2 && n % 10 <= 4) <a name="l00920"></a>00920 <span class="keywordflow">return</span> put_n_in(forms[1], n); <a name="l00921"></a>00921 <span class="keywordflow">else</span> <a name="l00922"></a>00922 <span class="keywordflow">return</span> put_n_in(forms[2], n); <a name="l00923"></a>00923 <span class="keywordflow">case</span> 13: <span class="comment">// Macedonian</span> <a name="l00924"></a>00924 EXPECT_LENGTH(3); <a name="l00925"></a>00925 <span class="keywordflow">if</span> (n % 10 == 1) <a name="l00926"></a>00926 <span class="keywordflow">return</span> put_n_in(forms[0], n); <a name="l00927"></a>00927 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (n % 10 == 2) <a name="l00928"></a>00928 <span class="keywordflow">return</span> put_n_in(forms[1], n); <a name="l00929"></a>00929 <span class="keywordflow">else</span> <a name="l00930"></a>00930 <span class="keywordflow">return</span> put_n_in(forms[2], n); <a name="l00931"></a>00931 <span class="keywordflow">case</span> 14: <span class="comment">// Gaeilge</span> <a name="l00932"></a>00932 EXPECT_LENGTH(5); <a name="l00933"></a>00933 <span class="keywordflow">if</span> (n == 1) <span class="comment">// "ceann amhain"</span> <a name="l00934"></a>00934 <span class="keywordflow">return</span> put_n_in(forms[0], n); <a name="l00935"></a>00935 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (n == 2) <span class="comment">// "dha cheann"</span> <a name="l00936"></a>00936 <span class="keywordflow">return</span> put_n_in(forms[1], n); <a name="l00937"></a>00937 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (n < 7) <span class="comment">// "%n cinn"</span> <a name="l00938"></a>00938 <span class="keywordflow">return</span> put_n_in(forms[2], n); <a name="l00939"></a>00939 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (n < 11) <span class="comment">// "%n gcinn"</span> <a name="l00940"></a>00940 <span class="keywordflow">return</span> put_n_in(forms[3], n); <a name="l00941"></a>00941 <span class="keywordflow">else</span> <span class="comment">// "%n ceann"</span> <a name="l00942"></a>00942 <span class="keywordflow">return</span> put_n_in(forms[4], n); <a name="l00943"></a>00943 } <a name="l00944"></a>00944 kdFatal() << <span class="stringliteral">"The function should have been returned in another way\n"</span>; <a name="l00945"></a>00945 <a name="l00946"></a>00946 <span class="keywordflow">return</span> QString::null; <a name="l00947"></a>00947 } <a name="l00948"></a>00948 <a name="l00949"></a><a class="code" href="classKLocale.html#ad18416ed94b082d0fc5d45b83b67068c">00949</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#ad18416ed94b082d0fc5d45b83b67068c" title="Translates a message as a QTranslator is supposed to.">KLocale::translateQt</a>( <span class="keyword">const</span> <span class="keywordtype">char</span> *context, <span class="keyword">const</span> <span class="keywordtype">char</span> *source, <a name="l00950"></a>00950 <span class="keyword">const</span> <span class="keywordtype">char</span> *message)<span class="keyword"> const</span> <a name="l00951"></a>00951 <span class="keyword"></span>{ <a name="l00952"></a>00952 <span class="keywordflow">if</span> (!source || !source[0]) { <a name="l00953"></a>00953 kdWarning() << <span class="stringliteral">"KLocale: trying to look up \"\" in catalog. "</span> <a name="l00954"></a>00954 << <span class="stringliteral">"Fix the program"</span> << <a class="code" href="group__kdebug.html#ga313d520ed8f8f6b46eeef22cfb3b082a" title="Does nothing.">endl</a>; <a name="l00955"></a>00955 <span class="keywordflow">return</span> QString::null; <a name="l00956"></a>00956 } <a name="l00957"></a>00957 <a name="l00958"></a>00958 <span class="keywordflow">if</span> ( useDefaultLanguage() ) { <a name="l00959"></a>00959 <span class="keywordflow">return</span> QString::null; <a name="l00960"></a>00960 } <a name="l00961"></a>00961 <a name="l00962"></a>00962 <span class="keywordtype">char</span> *newstring = 0; <a name="l00963"></a>00963 <span class="keyword">const</span> <span class="keywordtype">char</span> *translation = 0; <a name="l00964"></a>00964 <a class="codeRef" href="qstring.html">QString</a> r; <a name="l00965"></a>00965 <a name="l00966"></a>00966 <span class="keywordflow">if</span> ( message && message[0]) { <a name="l00967"></a>00967 <span class="keywordtype">char</span> *newstring = <span class="keyword">new</span> <span class="keywordtype">char</span>[strlen(source) + strlen(message) + 5]; <a name="l00968"></a>00968 sprintf(newstring, <span class="stringliteral">"_: %s\n%s"</span>, source, message); <a name="l00969"></a>00969 <span class="keyword">const</span> <span class="keywordtype">char</span> *translation = 0; <a name="l00970"></a>00970 <span class="comment">// as copying QString is very fast, it looks slower as it is ;/</span> <a name="l00971"></a>00971 r = translate_priv(newstring, source, &translation); <a name="l00972"></a>00972 <span class="keyword">delete</span> [] newstring; <a name="l00973"></a>00973 <span class="keywordflow">if</span> (translation) <a name="l00974"></a>00974 <span class="keywordflow">return</span> r; <a name="l00975"></a>00975 } <a name="l00976"></a>00976 <a name="l00977"></a>00977 <span class="keywordflow">if</span> ( context && context[0] && message && message[0]) { <a name="l00978"></a>00978 newstring = <span class="keyword">new</span> <span class="keywordtype">char</span>[strlen(context) + strlen(message) + 5]; <a name="l00979"></a>00979 sprintf(newstring, <span class="stringliteral">"_: %s\n%s"</span>, context, message); <a name="l00980"></a>00980 <span class="comment">// as copying QString is very fast, it looks slower as it is ;/</span> <a name="l00981"></a>00981 r = translate_priv(newstring, source, &translation); <a name="l00982"></a>00982 <span class="keyword">delete</span> [] newstring; <a name="l00983"></a>00983 <span class="keywordflow">if</span> (translation) <a name="l00984"></a>00984 <span class="keywordflow">return</span> r; <a name="l00985"></a>00985 } <a name="l00986"></a>00986 <a name="l00987"></a>00987 r = translate_priv(source, source, &translation); <a name="l00988"></a>00988 <span class="keywordflow">if</span> (translation) <a name="l00989"></a>00989 <span class="keywordflow">return</span> r; <a name="l00990"></a>00990 <span class="keywordflow">return</span> QString::null; <a name="l00991"></a>00991 } <a name="l00992"></a>00992 <a name="l00993"></a><a class="code" href="classKLocale.html#ae98da365996c1c9567756adb7b34e186">00993</a> <span class="keywordtype">bool</span> <a class="code" href="classKLocale.html#ae98da365996c1c9567756adb7b34e186" title="Use this to determine whether nouns are declined in locale's language.">KLocale::nounDeclension</a>()<span class="keyword"> const</span> <a name="l00994"></a>00994 <span class="keyword"></span>{ <a name="l00995"></a>00995 doFormatInit(); <a name="l00996"></a>00996 <span class="keywordflow">return</span> d->nounDeclension; <a name="l00997"></a>00997 } <a name="l00998"></a>00998 <a name="l00999"></a><a class="code" href="classKLocale.html#ae7de58995e08a78554157a1423858b6b">00999</a> <span class="keywordtype">bool</span> <a class="code" href="classKLocale.html#ae7de58995e08a78554157a1423858b6b" title="Use this to determine whether in dates a possessive form of month name is preferred ("of January" rat...">KLocale::dateMonthNamePossessive</a>()<span class="keyword"> const</span> <a name="l01000"></a>01000 <span class="keyword"></span>{ <a name="l01001"></a>01001 doFormatInit(); <a name="l01002"></a>01002 <span class="keywordflow">return</span> d->dateMonthNamePossessive; <a name="l01003"></a>01003 } <a name="l01004"></a>01004 <a name="l01005"></a><a class="code" href="classKLocale.html#a7d935d5c682c8349cc16e3830afb2125">01005</a> <span class="keywordtype">int</span> <a class="code" href="classKLocale.html#a7d935d5c682c8349cc16e3830afb2125" title="Use this to determine which day is the first day of the week.">KLocale::weekStartDay</a>()<span class="keyword"> const</span> <a name="l01006"></a>01006 <span class="keyword"></span>{ <a name="l01007"></a>01007 doFormatInit(); <a name="l01008"></a>01008 <span class="keywordflow">return</span> d->weekStartDay; <a name="l01009"></a>01009 } <a name="l01010"></a>01010 <a name="l01011"></a><a class="code" href="classKLocale.html#af04ddae21a5ef3c11d73b714532cf9bd">01011</a> <span class="keywordtype">bool</span> <a class="code" href="classKLocale.html#af04ddae21a5ef3c11d73b714532cf9bd">KLocale::weekStartsMonday</a>() const <span class="comment">//deprecated</span> <a name="l01012"></a>01012 { <a name="l01013"></a>01013 doFormatInit(); <a name="l01014"></a>01014 <span class="keywordflow">return</span> (d->weekStartDay==1); <a name="l01015"></a>01015 } <a name="l01016"></a>01016 <a name="l01017"></a><a class="code" href="classKLocale.html#a1390d3ec1ce5272bed4d3ad5b825608e">01017</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#a1390d3ec1ce5272bed4d3ad5b825608e" title="Returns what a decimal point should look like ("." or "," etc.) according to the current locale or us...">KLocale::decimalSymbol</a>()<span class="keyword"> const</span> <a name="l01018"></a>01018 <span class="keyword"></span>{ <a name="l01019"></a>01019 doFormatInit(); <a name="l01020"></a>01020 <span class="keywordflow">return</span> m_decimalSymbol; <a name="l01021"></a>01021 } <a name="l01022"></a>01022 <a name="l01023"></a><a class="code" href="classKLocale.html#a1eeb5cf549b5aa6b7373f6c3bd2c6dab">01023</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#a1eeb5cf549b5aa6b7373f6c3bd2c6dab" title="Returns what the thousands separator should look like ("," or "." etc.) according to the current loca...">KLocale::thousandsSeparator</a>()<span class="keyword"> const</span> <a name="l01024"></a>01024 <span class="keyword"></span>{ <a name="l01025"></a>01025 doFormatInit(); <a name="l01026"></a>01026 <span class="keywordflow">return</span> m_thousandsSeparator; <a name="l01027"></a>01027 } <a name="l01028"></a>01028 <a name="l01029"></a><a class="code" href="classKLocale.html#ab2f29e23e070c14ea8ea7660c2bc7bf6">01029</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#ab2f29e23e070c14ea8ea7660c2bc7bf6" title="Returns what the symbol denoting currency in the current locale as as defined by user settings should...">KLocale::currencySymbol</a>()<span class="keyword"> const</span> <a name="l01030"></a>01030 <span class="keyword"></span>{ <a name="l01031"></a>01031 doFormatInit(); <a name="l01032"></a>01032 <span class="keywordflow">return</span> m_currencySymbol; <a name="l01033"></a>01033 } <a name="l01034"></a>01034 <a name="l01035"></a><a class="code" href="classKLocale.html#a2818b2208387eaf860a3287792bfc245">01035</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#a2818b2208387eaf860a3287792bfc245" title="Returns what a decimal point should look like ("." or "," etc.) for monetary values, according to the current locale or user settings.">KLocale::monetaryDecimalSymbol</a>()<span class="keyword"> const</span> <a name="l01036"></a>01036 <span class="keyword"></span>{ <a name="l01037"></a>01037 doFormatInit(); <a name="l01038"></a>01038 <span class="keywordflow">return</span> m_monetaryDecimalSymbol; <a name="l01039"></a>01039 } <a name="l01040"></a>01040 <a name="l01041"></a><a class="code" href="classKLocale.html#a54c2fbfde652eb723d83a7c83099b749">01041</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#a54c2fbfde652eb723d83a7c83099b749" title="Returns what a thousands separator for monetary values should look like ("," or " " etc...">KLocale::monetaryThousandsSeparator</a>()<span class="keyword"> const</span> <a name="l01042"></a>01042 <span class="keyword"></span>{ <a name="l01043"></a>01043 doFormatInit(); <a name="l01044"></a>01044 <span class="keywordflow">return</span> m_monetaryThousandsSeparator; <a name="l01045"></a>01045 } <a name="l01046"></a>01046 <a name="l01047"></a><a class="code" href="classKLocale.html#aa510e5039d8a66386b26ba308145f781">01047</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#aa510e5039d8a66386b26ba308145f781" title="Returns what a positive sign should look like ("+", " ", etc.) according to the current locale or use...">KLocale::positiveSign</a>()<span class="keyword"> const</span> <a name="l01048"></a>01048 <span class="keyword"></span>{ <a name="l01049"></a>01049 doFormatInit(); <a name="l01050"></a>01050 <span class="keywordflow">return</span> m_positiveSign; <a name="l01051"></a>01051 } <a name="l01052"></a>01052 <a name="l01053"></a><a class="code" href="classKLocale.html#a94d10bce709860e202d243fae590037c">01053</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#a94d10bce709860e202d243fae590037c" title="Returns what a negative sign should look like ("-", etc.) according to the current locale or user set...">KLocale::negativeSign</a>()<span class="keyword"> const</span> <a name="l01054"></a>01054 <span class="keyword"></span>{ <a name="l01055"></a>01055 doFormatInit(); <a name="l01056"></a>01056 <span class="keywordflow">return</span> m_negativeSign; <a name="l01057"></a>01057 } <a name="l01058"></a>01058 <a name="l01059"></a><a class="code" href="classKLocale.html#a319be8fdcba8d4a09a5041cdb10a380d">01059</a> <span class="keywordtype">int</span> <a class="code" href="classKLocale.html#a319be8fdcba8d4a09a5041cdb10a380d" title="The number of fractional digits to include in numeric/monetary values (usually 2).">KLocale::fracDigits</a>()<span class="keyword"> const</span> <a name="l01060"></a>01060 <span class="keyword"></span>{ <a name="l01061"></a>01061 doFormatInit(); <a name="l01062"></a>01062 <span class="keywordflow">return</span> m_fracDigits; <a name="l01063"></a>01063 } <a name="l01064"></a>01064 <a name="l01065"></a><a class="code" href="classKLocale.html#abdefd92e0bc75b5dce04def1f0eab900">01065</a> <span class="keywordtype">bool</span> <a class="code" href="classKLocale.html#abdefd92e0bc75b5dce04def1f0eab900" title="If and only if the currency symbol precedes a positive value, this will be true.">KLocale::positivePrefixCurrencySymbol</a>()<span class="keyword"> const</span> <a name="l01066"></a>01066 <span class="keyword"></span>{ <a name="l01067"></a>01067 doFormatInit(); <a name="l01068"></a>01068 <span class="keywordflow">return</span> m_positivePrefixCurrencySymbol; <a name="l01069"></a>01069 } <a name="l01070"></a>01070 <a name="l01071"></a><a class="code" href="classKLocale.html#af0103eddeb62443b8c235128cbdffe5a">01071</a> <span class="keywordtype">bool</span> <a class="code" href="classKLocale.html#af0103eddeb62443b8c235128cbdffe5a" title="If and only if the currency symbol precedes a negative value, this will be true.">KLocale::negativePrefixCurrencySymbol</a>()<span class="keyword"> const</span> <a name="l01072"></a>01072 <span class="keyword"></span>{ <a name="l01073"></a>01073 doFormatInit(); <a name="l01074"></a>01074 <span class="keywordflow">return</span> m_negativePrefixCurrencySymbol; <a name="l01075"></a>01075 } <a name="l01076"></a>01076 <a name="l01077"></a><a class="code" href="classKLocale.html#a16b0b267c33b414ea7f25e5cf7c26b49">01077</a> <a class="code" href="classKLocale.html#a2871a581bfe0179b1068a3ebfb6cbc51" title="Various positions for where to place the positive or negative sign when they are related to a monetar...">KLocale::SignPosition</a> <a class="code" href="classKLocale.html#a16b0b267c33b414ea7f25e5cf7c26b49" title="Returns the position of a positive sign in relation to a monetary value.">KLocale::positiveMonetarySignPosition</a>()<span class="keyword"> const</span> <a name="l01078"></a>01078 <span class="keyword"></span>{ <a name="l01079"></a>01079 doFormatInit(); <a name="l01080"></a>01080 <span class="keywordflow">return</span> m_positiveMonetarySignPosition; <a name="l01081"></a>01081 } <a name="l01082"></a>01082 <a name="l01083"></a><a class="code" href="classKLocale.html#ab0784f5d7d965416ee8b4611848a874d">01083</a> <a class="code" href="classKLocale.html#a2871a581bfe0179b1068a3ebfb6cbc51" title="Various positions for where to place the positive or negative sign when they are related to a monetar...">KLocale::SignPosition</a> <a class="code" href="classKLocale.html#ab0784f5d7d965416ee8b4611848a874d" title="Denotes where to place a negative sign in relation to a monetary value.">KLocale::negativeMonetarySignPosition</a>()<span class="keyword"> const</span> <a name="l01084"></a>01084 <span class="keyword"></span>{ <a name="l01085"></a>01085 doFormatInit(); <a name="l01086"></a>01086 <span class="keywordflow">return</span> m_negativeMonetarySignPosition; <a name="l01087"></a>01087 } <a name="l01088"></a>01088 <a name="l01089"></a>01089 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> put_it_in( <a class="codeRef" href="qchar.html">QChar</a> *buffer, uint& index, <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> &s ) <a name="l01090"></a>01090 { <a name="l01091"></a>01091 <span class="keywordflow">for</span> ( uint l = 0; l < s.<a class="codeRef" href="qstring.html#length">length</a>(); l++ ) <a name="l01092"></a>01092 buffer[index++] = s.<a class="codeRef" href="qstring.html#at">at</a>( l ); <a name="l01093"></a>01093 } <a name="l01094"></a>01094 <a name="l01095"></a>01095 <span class="keyword">static</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> put_it_in( <a class="codeRef" href="qchar.html">QChar</a> *buffer, uint& index, <span class="keywordtype">int</span> number ) <a name="l01096"></a>01096 { <a name="l01097"></a>01097 buffer[index++] = number / 10 + <span class="charliteral">'0'</span>; <a name="l01098"></a>01098 buffer[index++] = number % 10 + <span class="charliteral">'0'</span>; <a name="l01099"></a>01099 } <a name="l01100"></a>01100 <a name="l01101"></a>01101 <span class="comment">// insert (thousands)-"separator"s into the non-fractional part of str </span> <a name="l01102"></a>01102 <span class="keyword">static</span> <span class="keywordtype">void</span> _insertSeparator(<a class="codeRef" href="qstring.html">QString</a> &str, <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> &separator, <a name="l01103"></a>01103 <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> &decimalSymbol) <a name="l01104"></a>01104 { <a name="l01105"></a>01105 <span class="comment">// leave fractional part untouched</span> <a name="l01106"></a>01106 <a class="codeRef" href="qstring.html">QString</a> mainPart = str.<a class="codeRef" href="qstring.html#section">section</a>(decimalSymbol, 0, 0); <a name="l01107"></a>01107 <a class="codeRef" href="qstring.html">QString</a> fracPart = str.<a class="codeRef" href="qstring.html#section">section</a>(decimalSymbol, 1, 1, <a name="l01108"></a>01108 QString::SectionIncludeLeadingSep); <a name="l01109"></a>01109 <a name="l01110"></a>01110 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> pos = mainPart.<a class="codeRef" href="qstring.html#length">length</a>() - 3; pos > 0; pos -= 3) <a name="l01111"></a>01111 mainPart.<a class="codeRef" href="qstring.html#insert">insert</a>(pos, separator); <a name="l01112"></a>01112 <a name="l01113"></a>01113 str = mainPart + fracPart; <a name="l01114"></a>01114 } <a name="l01115"></a>01115 <a name="l01116"></a><a class="code" href="classKLocale.html#a80ce343308e0f5a9d36f0da606bcde37">01116</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#a80ce343308e0f5a9d36f0da606bcde37" title="Given a double, converts that to a numeric string containing the localized monetary equivalent...">KLocale::formatMoney</a>(<span class="keywordtype">double</span> num, <a name="l01117"></a>01117 <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> & symbol, <a name="l01118"></a>01118 <span class="keywordtype">int</span> precision)<span class="keyword"> const</span> <a name="l01119"></a>01119 <span class="keyword"></span>{ <a name="l01120"></a>01120 <span class="comment">// some defaults</span> <a name="l01121"></a>01121 <a class="codeRef" href="qstring.html">QString</a> currency = symbol.<a class="codeRef" href="qstring.html#isNull">isNull</a>() <a name="l01122"></a>01122 ? <a class="code" href="classKLocale.html#ab2f29e23e070c14ea8ea7660c2bc7bf6" title="Returns what the symbol denoting currency in the current locale as as defined by user settings should...">currencySymbol</a>() <a name="l01123"></a>01123 : symbol; <a name="l01124"></a>01124 <span class="keywordflow">if</span> (precision < 0) precision = <a class="code" href="classKLocale.html#a319be8fdcba8d4a09a5041cdb10a380d" title="The number of fractional digits to include in numeric/monetary values (usually 2).">fracDigits</a>(); <a name="l01125"></a>01125 <a name="l01126"></a>01126 <span class="comment">// the number itself</span> <a name="l01127"></a>01127 <span class="keywordtype">bool</span> neg = num < 0; <a name="l01128"></a>01128 <a class="codeRef" href="qstring.html">QString</a> res = <a class="codeRef" href="qstring.html#number">QString::number</a>(neg?-num:num, <span class="charliteral">'f'</span>, precision); <a name="l01129"></a>01129 <a name="l01130"></a>01130 <span class="comment">// Replace dot with locale decimal separator</span> <a name="l01131"></a>01131 res.<a class="codeRef" href="qstring.html#replace">replace</a>(<a class="codeRef" href="qchar.html">QChar</a>(<span class="charliteral">'.'</span>), <a class="code" href="classKLocale.html#a2818b2208387eaf860a3287792bfc245" title="Returns what a decimal point should look like ("." or "," etc.) for monetary values, according to the current locale or user settings.">monetaryDecimalSymbol</a>()); <a name="l01132"></a>01132 <a name="l01133"></a>01133 <span class="comment">// Insert the thousand separators</span> <a name="l01134"></a>01134 _insertSeparator(res, <a class="code" href="classKLocale.html#a54c2fbfde652eb723d83a7c83099b749" title="Returns what a thousands separator for monetary values should look like ("," or " " etc...">monetaryThousandsSeparator</a>(), <a class="code" href="classKLocale.html#a2818b2208387eaf860a3287792bfc245" title="Returns what a decimal point should look like ("." or "," etc.) for monetary values, according to the current locale or user settings.">monetaryDecimalSymbol</a>()); <a name="l01135"></a>01135 <a name="l01136"></a>01136 <span class="comment">// set some variables we need later</span> <a name="l01137"></a>01137 <span class="keywordtype">int</span> signpos = neg <a name="l01138"></a>01138 ? <a class="code" href="classKLocale.html#ab0784f5d7d965416ee8b4611848a874d" title="Denotes where to place a negative sign in relation to a monetary value.">negativeMonetarySignPosition</a>() <a name="l01139"></a>01139 : <a class="code" href="classKLocale.html#a16b0b267c33b414ea7f25e5cf7c26b49" title="Returns the position of a positive sign in relation to a monetary value.">positiveMonetarySignPosition</a>(); <a name="l01140"></a>01140 <a class="codeRef" href="qstring.html">QString</a> sign = neg <a name="l01141"></a>01141 ? <a class="code" href="classKLocale.html#a94d10bce709860e202d243fae590037c" title="Returns what a negative sign should look like ("-", etc.) according to the current locale or user set...">negativeSign</a>() <a name="l01142"></a>01142 : <a class="code" href="classKLocale.html#aa510e5039d8a66386b26ba308145f781" title="Returns what a positive sign should look like ("+", " ", etc.) according to the current locale or use...">positiveSign</a>(); <a name="l01143"></a>01143 <a name="l01144"></a>01144 <span class="keywordflow">switch</span> (signpos) <a name="l01145"></a>01145 { <a name="l01146"></a>01146 <span class="keywordflow">case</span> ParensAround: <a name="l01147"></a>01147 res.<a class="codeRef" href="qstring.html#prepend">prepend</a>(<span class="charliteral">'('</span>); <a name="l01148"></a>01148 res.<a class="codeRef" href="qstring.html#append">append</a> (<span class="charliteral">')'</span>); <a name="l01149"></a>01149 <span class="keywordflow">break</span>; <a name="l01150"></a>01150 <span class="keywordflow">case</span> BeforeQuantityMoney: <a name="l01151"></a>01151 res.<a class="codeRef" href="qstring.html#prepend">prepend</a>(sign); <a name="l01152"></a>01152 <span class="keywordflow">break</span>; <a name="l01153"></a>01153 <span class="keywordflow">case</span> AfterQuantityMoney: <a name="l01154"></a>01154 res.<a class="codeRef" href="qstring.html#append">append</a>(sign); <a name="l01155"></a>01155 <span class="keywordflow">break</span>; <a name="l01156"></a>01156 <span class="keywordflow">case</span> BeforeMoney: <a name="l01157"></a>01157 currency.<a class="codeRef" href="qstring.html#prepend">prepend</a>(sign); <a name="l01158"></a>01158 <span class="keywordflow">break</span>; <a name="l01159"></a>01159 <span class="keywordflow">case</span> AfterMoney: <a name="l01160"></a>01160 currency.<a class="codeRef" href="qstring.html#append">append</a>(sign); <a name="l01161"></a>01161 <span class="keywordflow">break</span>; <a name="l01162"></a>01162 } <a name="l01163"></a>01163 <a name="l01164"></a>01164 <span class="keywordflow">if</span> (neg?<a class="code" href="classKLocale.html#af0103eddeb62443b8c235128cbdffe5a" title="If and only if the currency symbol precedes a negative value, this will be true.">negativePrefixCurrencySymbol</a>(): <a name="l01165"></a>01165 <a class="code" href="classKLocale.html#abdefd92e0bc75b5dce04def1f0eab900" title="If and only if the currency symbol precedes a positive value, this will be true.">positivePrefixCurrencySymbol</a>()) <a name="l01166"></a>01166 { <a name="l01167"></a>01167 res.<a class="codeRef" href="qstring.html#prepend">prepend</a>(<span class="charliteral">' '</span>); <a name="l01168"></a>01168 res.<a class="codeRef" href="qstring.html#prepend">prepend</a>(currency); <a name="l01169"></a>01169 } <span class="keywordflow">else</span> { <a name="l01170"></a>01170 res.<a class="codeRef" href="qstring.html#append">append</a> (<span class="charliteral">' '</span>); <a name="l01171"></a>01171 res.<a class="codeRef" href="qstring.html#append">append</a> (currency); <a name="l01172"></a>01172 } <a name="l01173"></a>01173 <a name="l01174"></a>01174 <span class="keywordflow">return</span> res; <a name="l01175"></a>01175 } <a name="l01176"></a>01176 <a name="l01177"></a><a class="code" href="classKLocale.html#ae8fa5493466ebfe0a7bc7b1659dde17d">01177</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#a80ce343308e0f5a9d36f0da606bcde37" title="Given a double, converts that to a numeric string containing the localized monetary equivalent...">KLocale::formatMoney</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> &numStr)<span class="keyword"> const</span> <a name="l01178"></a>01178 <span class="keyword"></span>{ <a name="l01179"></a>01179 <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#a80ce343308e0f5a9d36f0da606bcde37" title="Given a double, converts that to a numeric string containing the localized monetary equivalent...">formatMoney</a>(numStr.<a class="codeRef" href="qstring.html#toDouble">toDouble</a>()); <a name="l01180"></a>01180 } <a name="l01181"></a>01181 <a name="l01182"></a><a class="code" href="classKLocale.html#a52b2ef4c19dafcc310d754cbd795531d">01182</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#a52b2ef4c19dafcc310d754cbd795531d" title="Given a double, converts that to a numeric string containing the localized numeric equivalent...">KLocale::formatNumber</a>(<span class="keywordtype">double</span> num, <span class="keywordtype">int</span> precision)<span class="keyword"> const</span> <a name="l01183"></a>01183 <span class="keyword"></span>{ <a name="l01184"></a>01184 <span class="keywordflow">if</span> (precision == -1) precision = 2; <a name="l01185"></a>01185 <span class="comment">// no need to round since QString::number does this for us</span> <a name="l01186"></a>01186 <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#a52b2ef4c19dafcc310d754cbd795531d" title="Given a double, converts that to a numeric string containing the localized numeric equivalent...">formatNumber</a>(<a class="codeRef" href="qstring.html#number">QString::number</a>(num, <span class="charliteral">'f'</span>, precision), <span class="keyword">false</span>, 0); <a name="l01187"></a>01187 } <a name="l01188"></a>01188 <a name="l01189"></a><a class="code" href="classKLocale.html#a702b600a71a3946bfb85a220c74327bb">01189</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#a702b600a71a3946bfb85a220c74327bb" title="Given an integer, converts that to a numeric string containing the localized numeric equivalent...">KLocale::formatLong</a>(<span class="keywordtype">long</span> num)<span class="keyword"> const</span> <a name="l01190"></a>01190 <span class="keyword"></span>{ <a name="l01191"></a>01191 <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#a52b2ef4c19dafcc310d754cbd795531d" title="Given a double, converts that to a numeric string containing the localized numeric equivalent...">formatNumber</a>((<span class="keywordtype">double</span>)num, 0); <a name="l01192"></a>01192 } <a name="l01193"></a>01193 <a name="l01194"></a><a class="code" href="classKLocale.html#af41ef5b1f58c48881e7afa6158cd348d">01194</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#a52b2ef4c19dafcc310d754cbd795531d" title="Given a double, converts that to a numeric string containing the localized numeric equivalent...">KLocale::formatNumber</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> &numStr)<span class="keyword"> const</span> <a name="l01195"></a>01195 <span class="keyword"></span>{ <a name="l01196"></a>01196 <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#a52b2ef4c19dafcc310d754cbd795531d" title="Given a double, converts that to a numeric string containing the localized numeric equivalent...">formatNumber</a>(numStr, <span class="keyword">true</span>, 2); <a name="l01197"></a>01197 } <a name="l01198"></a>01198 <a name="l01199"></a>01199 <span class="comment">// increase the digit at 'position' by one</span> <a name="l01200"></a>01200 <span class="keyword">static</span> <span class="keywordtype">void</span> _inc_by_one(<a class="codeRef" href="qstring.html">QString</a> &str, <span class="keywordtype">int</span> position) <a name="l01201"></a>01201 { <a name="l01202"></a>01202 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = position; i >= 0; i--) <a name="l01203"></a>01203 { <a name="l01204"></a>01204 <span class="keywordtype">char</span> last_char = str[i].<a class="codeRef" href="qstring.html#latin1">latin1</a>(); <a name="l01205"></a>01205 <span class="keywordflow">switch</span>(last_char) <a name="l01206"></a>01206 { <a name="l01207"></a>01207 <span class="keywordflow">case</span> <span class="charliteral">'0'</span>: <a name="l01208"></a>01208 str[i] = <span class="charliteral">'1'</span>; <a name="l01209"></a>01209 <span class="keywordflow">break</span>; <a name="l01210"></a>01210 <span class="keywordflow">case</span> <span class="charliteral">'1'</span>: <a name="l01211"></a>01211 str[i] = <span class="charliteral">'2'</span>; <a name="l01212"></a>01212 <span class="keywordflow">break</span>; <a name="l01213"></a>01213 <span class="keywordflow">case</span> <span class="charliteral">'2'</span>: <a name="l01214"></a>01214 str[i] = <span class="charliteral">'3'</span>; <a name="l01215"></a>01215 <span class="keywordflow">break</span>; <a name="l01216"></a>01216 <span class="keywordflow">case</span> <span class="charliteral">'3'</span>: <a name="l01217"></a>01217 str[i] = <span class="charliteral">'4'</span>; <a name="l01218"></a>01218 <span class="keywordflow">break</span>; <a name="l01219"></a>01219 <span class="keywordflow">case</span> <span class="charliteral">'4'</span>: <a name="l01220"></a>01220 str[i] = <span class="charliteral">'5'</span>; <a name="l01221"></a>01221 <span class="keywordflow">break</span>; <a name="l01222"></a>01222 <span class="keywordflow">case</span> <span class="charliteral">'5'</span>: <a name="l01223"></a>01223 str[i] = <span class="charliteral">'6'</span>; <a name="l01224"></a>01224 <span class="keywordflow">break</span>; <a name="l01225"></a>01225 <span class="keywordflow">case</span> <span class="charliteral">'6'</span>: <a name="l01226"></a>01226 str[i] = <span class="charliteral">'7'</span>; <a name="l01227"></a>01227 <span class="keywordflow">break</span>; <a name="l01228"></a>01228 <span class="keywordflow">case</span> <span class="charliteral">'7'</span>: <a name="l01229"></a>01229 str[i] = <span class="charliteral">'8'</span>; <a name="l01230"></a>01230 <span class="keywordflow">break</span>; <a name="l01231"></a>01231 <span class="keywordflow">case</span> <span class="charliteral">'8'</span>: <a name="l01232"></a>01232 str[i] = <span class="charliteral">'9'</span>; <a name="l01233"></a>01233 <span class="keywordflow">break</span>; <a name="l01234"></a>01234 <span class="keywordflow">case</span> <span class="charliteral">'9'</span>: <a name="l01235"></a>01235 str[i] = <span class="charliteral">'0'</span>; <a name="l01236"></a>01236 <span class="keywordflow">if</span> (i == 0) str.<a class="codeRef" href="qstring.html#prepend">prepend</a>(<span class="charliteral">'1'</span>); <a name="l01237"></a>01237 <span class="keywordflow">continue</span>; <a name="l01238"></a>01238 <span class="keywordflow">case</span> <span class="charliteral">'.'</span>: <a name="l01239"></a>01239 <span class="keywordflow">continue</span>; <a name="l01240"></a>01240 } <a name="l01241"></a>01241 <span class="keywordflow">break</span>; <a name="l01242"></a>01242 } <a name="l01243"></a>01243 } <a name="l01244"></a>01244 <a name="l01245"></a>01245 <span class="comment">// Cut off if more digits in fractional part than 'precision'</span> <a name="l01246"></a>01246 <span class="keyword">static</span> <span class="keywordtype">void</span> _round(<a class="codeRef" href="qstring.html">QString</a> &str, <span class="keywordtype">int</span> precision) <a name="l01247"></a>01247 { <a name="l01248"></a>01248 <span class="keywordtype">int</span> decimalSymbolPos = str.<a class="codeRef" href="qstring.html#find">find</a>(<span class="charliteral">'.'</span>); <a name="l01249"></a>01249 <a name="l01250"></a>01250 <span class="keywordflow">if</span> (decimalSymbolPos == -1) <a name="l01251"></a>01251 <span class="keywordflow">if</span> (precision == 0) <span class="keywordflow">return</span>; <a name="l01252"></a>01252 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (precision > 0) <span class="comment">// add dot if missing (and needed)</span> <a name="l01253"></a>01253 { <a name="l01254"></a>01254 str.<a class="codeRef" href="qstring.html#append">append</a>(<span class="charliteral">'.'</span>); <a name="l01255"></a>01255 decimalSymbolPos = str.<a class="codeRef" href="qstring.html#length">length</a>() - 1; <a name="l01256"></a>01256 } <a name="l01257"></a>01257 <a name="l01258"></a>01258 <span class="comment">// fill up with more than enough zeroes (in case fractional part too short)</span> <a name="l01259"></a>01259 str.<a class="codeRef" href="qstring.html#append">append</a>(<a class="codeRef" href="qstring.html">QString</a>().fill(<span class="charliteral">'0'</span>, precision)); <a name="l01260"></a>01260 <a name="l01261"></a>01261 <span class="comment">// Now decide whether to round up or down</span> <a name="l01262"></a>01262 <span class="keywordtype">char</span> last_char = str[decimalSymbolPos + precision + 1].<a class="codeRef" href="qstring.html#latin1">latin1</a>(); <a name="l01263"></a>01263 <span class="keywordflow">switch</span> (last_char) <a name="l01264"></a>01264 { <a name="l01265"></a>01265 <span class="keywordflow">case</span> <span class="charliteral">'0'</span>: <a name="l01266"></a>01266 <span class="keywordflow">case</span> <span class="charliteral">'1'</span>: <a name="l01267"></a>01267 <span class="keywordflow">case</span> <span class="charliteral">'2'</span>: <a name="l01268"></a>01268 <span class="keywordflow">case</span> <span class="charliteral">'3'</span>: <a name="l01269"></a>01269 <span class="keywordflow">case</span> <span class="charliteral">'4'</span>: <a name="l01270"></a>01270 <span class="comment">// nothing to do, rounding down</span> <a name="l01271"></a>01271 <span class="keywordflow">break</span>; <a name="l01272"></a>01272 <span class="keywordflow">case</span> <span class="charliteral">'5'</span>: <a name="l01273"></a>01273 <span class="keywordflow">case</span> <span class="charliteral">'6'</span>: <a name="l01274"></a>01274 <span class="keywordflow">case</span> <span class="charliteral">'7'</span>: <a name="l01275"></a>01275 <span class="keywordflow">case</span> <span class="charliteral">'8'</span>: <a name="l01276"></a>01276 <span class="keywordflow">case</span> <span class="charliteral">'9'</span>: <a name="l01277"></a>01277 _inc_by_one(str, decimalSymbolPos + precision); <a name="l01278"></a>01278 <span class="keywordflow">break</span>; <a name="l01279"></a>01279 <span class="keywordflow">default</span>: <a name="l01280"></a>01280 <span class="keywordflow">break</span>; <a name="l01281"></a>01281 } <a name="l01282"></a>01282 <a name="l01283"></a>01283 decimalSymbolPos = str.<a class="codeRef" href="qstring.html#find">find</a>(<span class="charliteral">'.'</span>); <a name="l01284"></a>01284 str.<a class="codeRef" href="qstring.html#truncate">truncate</a>(decimalSymbolPos + precision + 1); <a name="l01285"></a>01285 <a name="l01286"></a>01286 <span class="comment">// if precision == 0 delete also '.'</span> <a name="l01287"></a>01287 <span class="keywordflow">if</span> (precision == 0) str = str.<a class="codeRef" href="qstring.html#section">section</a>(<span class="charliteral">'.'</span>, 0, 0); <a name="l01288"></a>01288 } <a name="l01289"></a>01289 <a name="l01290"></a><a class="code" href="classKLocale.html#ac3f75501750b91d8f8b0e2c03d37d967">01290</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#a52b2ef4c19dafcc310d754cbd795531d" title="Given a double, converts that to a numeric string containing the localized numeric equivalent...">KLocale::formatNumber</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> &numStr, <span class="keywordtype">bool</span> round, <a name="l01291"></a>01291 <span class="keywordtype">int</span> precision)<span class="keyword"> const</span> <a name="l01292"></a>01292 <span class="keyword"></span>{ <a name="l01293"></a>01293 <a class="codeRef" href="qstring.html">QString</a> tmpString = numStr; <a name="l01294"></a>01294 <span class="keywordflow">if</span> ((round && precision < 0) || <a name="l01295"></a>01295 ! <a class="codeRef" href="qregexp.html">QRegExp</a>(<span class="stringliteral">"^[+-]?\\d+(\\.\\d+)*(e[+-]?\\d+)?$"</span>).exactMatch(tmpString)) <a name="l01296"></a>01296 <span class="keywordflow">return</span> numStr; <a name="l01297"></a>01297 <a name="l01298"></a>01298 <a name="l01299"></a>01299 <span class="comment">// Skip the sign (for now)</span> <a name="l01300"></a>01300 <span class="keywordtype">bool</span> neg = (tmpString[0] == <span class="charliteral">'-'</span>); <a name="l01301"></a>01301 <span class="keywordflow">if</span> (neg || tmpString[0] == <span class="charliteral">'+'</span>) tmpString.<a class="codeRef" href="qstring.html#remove">remove</a>(0, 1); <a name="l01302"></a>01302 <a name="l01303"></a>01303 <span class="comment">// Split off exponential part (including 'e'-symbol)</span> <a name="l01304"></a>01304 <a class="codeRef" href="qstring.html">QString</a> mantString = tmpString.<a class="codeRef" href="qstring.html#section">section</a>(<span class="charliteral">'e'</span>, 0, 0, <a name="l01305"></a>01305 QString::SectionCaseInsensitiveSeps); <a name="l01306"></a>01306 <a class="codeRef" href="qstring.html">QString</a> expString = tmpString.<a class="codeRef" href="qstring.html#section">section</a>(<span class="charliteral">'e'</span>, 1, 1, <a name="l01307"></a>01307 QString::SectionCaseInsensitiveSeps | <a name="l01308"></a>01308 QString::SectionIncludeLeadingSep); <a name="l01309"></a>01309 <a name="l01310"></a>01310 <span class="keywordflow">if</span> (round) _round(mantString, precision); <a name="l01311"></a>01311 <a name="l01312"></a>01312 <span class="comment">// Replace dot with locale decimal separator</span> <a name="l01313"></a>01313 mantString.<a class="codeRef" href="qstring.html#replace">replace</a>(<a class="codeRef" href="qchar.html">QChar</a>(<span class="charliteral">'.'</span>), <a class="code" href="classKLocale.html#a1390d3ec1ce5272bed4d3ad5b825608e" title="Returns what a decimal point should look like ("." or "," etc.) according to the current locale or us...">decimalSymbol</a>()); <a name="l01314"></a>01314 <a name="l01315"></a>01315 <span class="comment">// Insert the thousand separators</span> <a name="l01316"></a>01316 _insertSeparator(mantString, <a class="code" href="classKLocale.html#a1eeb5cf549b5aa6b7373f6c3bd2c6dab" title="Returns what the thousands separator should look like ("," or "." etc.) according to the current loca...">thousandsSeparator</a>(), <a class="code" href="classKLocale.html#a1390d3ec1ce5272bed4d3ad5b825608e" title="Returns what a decimal point should look like ("." or "," etc.) according to the current locale or us...">decimalSymbol</a>()); <a name="l01317"></a>01317 <a name="l01318"></a>01318 <span class="comment">// How can we know where we should put the sign?</span> <a name="l01319"></a>01319 mantString.<a class="codeRef" href="qstring.html#prepend">prepend</a>(neg?<a class="code" href="classKLocale.html#a94d10bce709860e202d243fae590037c" title="Returns what a negative sign should look like ("-", etc.) according to the current locale or user set...">negativeSign</a>():<a class="code" href="classKLocale.html#aa510e5039d8a66386b26ba308145f781" title="Returns what a positive sign should look like ("+", " ", etc.) according to the current locale or use...">positiveSign</a>()); <a name="l01320"></a>01320 <a name="l01321"></a>01321 <span class="keywordflow">return</span> mantString + expString; <a name="l01322"></a>01322 } <a name="l01323"></a>01323 <a name="l01324"></a><a class="code" href="classKLocale.html#adb35e2b0a666be6bca297ee4a40c4f89">01324</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#adb35e2b0a666be6bca297ee4a40c4f89" title="Returns a string formatted to the current locale's conventions regarding dates.">KLocale::formatDate</a>(<span class="keyword">const</span> <a class="codeRef" href="qdate.html">QDate</a> &pDate, <span class="keywordtype">bool</span> shortFormat)<span class="keyword"> const</span> <a name="l01325"></a>01325 <span class="keyword"></span>{ <a name="l01326"></a>01326 <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> rst = shortFormat?<a class="code" href="classKLocale.html#a25628f2ed7d48cfadf69c2ae7a1d6e84" title="Returns the currently selected short date format.">dateFormatShort</a>():<a class="code" href="classKLocale.html#a8a80f48689c9cde5efc6e16d507ea153" title="Returns the currently selected date format.">dateFormat</a>(); <a name="l01327"></a>01327 <a name="l01328"></a>01328 <a class="codeRef" href="qstring.html">QString</a> buffer; <a name="l01329"></a>01329 <a name="l01330"></a>01330 <span class="keywordflow">if</span> ( ! pDate.<a class="codeRef" href="qdate.html#isValid">isValid</a>() ) <span class="keywordflow">return</span> buffer; <a name="l01331"></a>01331 <a name="l01332"></a>01332 <span class="keywordtype">bool</span> escape = <span class="keyword">false</span>; <a name="l01333"></a>01333 <a name="l01334"></a>01334 <span class="keywordtype">int</span> year = <a class="code" href="classKLocale.html#a0bfd055c66b769eef7005bd970cab326" title="Returns a pointer to the calendar system object.">calendar</a>()-><a class="code" href="classKCalendarSystem.html#a8411a320d265d0d77e1b7ff29a0066b4" title="Gets specific calendar type year for a given gregorian date.">year</a>(pDate); <a name="l01335"></a>01335 <span class="keywordtype">int</span> month = <a class="code" href="classKLocale.html#a0bfd055c66b769eef7005bd970cab326" title="Returns a pointer to the calendar system object.">calendar</a>()-><a class="code" href="classKCalendarSystem.html#a3a23851e58f6ba5e98d24695fb388137" title="Gets specific calendar type month for a given gregorian date.">month</a>(pDate); <a name="l01336"></a>01336 <a name="l01337"></a>01337 <span class="keywordflow">for</span> ( uint format_index = 0; format_index < rst.<a class="codeRef" href="qstring.html#length">length</a>(); ++format_index ) <a name="l01338"></a>01338 { <a name="l01339"></a>01339 <span class="keywordflow">if</span> ( !escape ) <a name="l01340"></a>01340 { <a name="l01341"></a>01341 <span class="keywordflow">if</span> ( rst.<a class="codeRef" href="qstring.html#at">at</a>( format_index ).unicode() == <span class="charliteral">'%'</span> ) <a name="l01342"></a>01342 escape = <span class="keyword">true</span>; <a name="l01343"></a>01343 <span class="keywordflow">else</span> <a name="l01344"></a>01344 buffer.<a class="codeRef" href="qstring.html#append">append</a>(rst.<a class="codeRef" href="qstring.html#at">at</a>(format_index)); <a name="l01345"></a>01345 } <a name="l01346"></a>01346 <span class="keywordflow">else</span> <a name="l01347"></a>01347 { <a name="l01348"></a>01348 <span class="keywordflow">switch</span> ( rst.<a class="codeRef" href="qstring.html#at">at</a>( format_index ).unicode() ) <a name="l01349"></a>01349 { <a name="l01350"></a>01350 <span class="keywordflow">case</span> <span class="charliteral">'%'</span>: <a name="l01351"></a>01351 buffer.<a class="codeRef" href="qstring.html#append">append</a>(<span class="charliteral">'%'</span>); <a name="l01352"></a>01352 <span class="keywordflow">break</span>; <a name="l01353"></a>01353 <span class="keywordflow">case</span> <span class="charliteral">'Y'</span>: <a name="l01354"></a>01354 buffer.<a class="codeRef" href="qstring.html#append">append</a>(<a class="code" href="classKLocale.html#a0bfd055c66b769eef7005bd970cab326" title="Returns a pointer to the calendar system object.">calendar</a>()->yearString(pDate, <span class="keyword">false</span>)); <a name="l01355"></a>01355 <span class="keywordflow">break</span>; <a name="l01356"></a>01356 <span class="keywordflow">case</span> <span class="charliteral">'y'</span>: <a name="l01357"></a>01357 buffer.<a class="codeRef" href="qstring.html#append">append</a>(<a class="code" href="classKLocale.html#a0bfd055c66b769eef7005bd970cab326" title="Returns a pointer to the calendar system object.">calendar</a>()->yearString(pDate, <span class="keyword">true</span>)); <a name="l01358"></a>01358 <span class="keywordflow">break</span>; <a name="l01359"></a>01359 <span class="keywordflow">case</span> <span class="charliteral">'n'</span>: <a name="l01360"></a>01360 buffer.<a class="codeRef" href="qstring.html#append">append</a>(<a class="code" href="classKLocale.html#a0bfd055c66b769eef7005bd970cab326" title="Returns a pointer to the calendar system object.">calendar</a>()->monthString(pDate, <span class="keyword">true</span>)); <a name="l01361"></a>01361 <span class="keywordflow">break</span>; <a name="l01362"></a>01362 <span class="keywordflow">case</span> <span class="charliteral">'e'</span>: <a name="l01363"></a>01363 buffer.<a class="codeRef" href="qstring.html#append">append</a>(<a class="code" href="classKLocale.html#a0bfd055c66b769eef7005bd970cab326" title="Returns a pointer to the calendar system object.">calendar</a>()->dayString(pDate, <span class="keyword">true</span>)); <a name="l01364"></a>01364 <span class="keywordflow">break</span>; <a name="l01365"></a>01365 <span class="keywordflow">case</span> <span class="charliteral">'m'</span>: <a name="l01366"></a>01366 buffer.<a class="codeRef" href="qstring.html#append">append</a>(<a class="code" href="classKLocale.html#a0bfd055c66b769eef7005bd970cab326" title="Returns a pointer to the calendar system object.">calendar</a>()->monthString(pDate, <span class="keyword">false</span>)); <a name="l01367"></a>01367 <span class="keywordflow">break</span>; <a name="l01368"></a>01368 <span class="keywordflow">case</span> <span class="charliteral">'b'</span>: <a name="l01369"></a>01369 <span class="keywordflow">if</span> (d->nounDeclension && d->dateMonthNamePossessive) <a name="l01370"></a>01370 buffer.<a class="codeRef" href="qstring.html#append">append</a>(<a class="code" href="classKLocale.html#a0bfd055c66b769eef7005bd970cab326" title="Returns a pointer to the calendar system object.">calendar</a>()-><a class="code" href="classKLocale.html#a412755b26ce67d66d2b46983b024cc8c">monthNamePossessive</a>(month, year, <span class="keyword">true</span>)); <a name="l01371"></a>01371 <span class="keywordflow">else</span> <a name="l01372"></a>01372 buffer.<a class="codeRef" href="qstring.html#append">append</a>(<a class="code" href="classKLocale.html#a0bfd055c66b769eef7005bd970cab326" title="Returns a pointer to the calendar system object.">calendar</a>()-><a class="code" href="classKLocale.html#a41ea28a1068006a4eabcd7e049335aa5">monthName</a>(month, year, <span class="keyword">true</span>)); <a name="l01373"></a>01373 <span class="keywordflow">break</span>; <a name="l01374"></a>01374 <span class="keywordflow">case</span> <span class="charliteral">'B'</span>: <a name="l01375"></a>01375 <span class="keywordflow">if</span> (d->nounDeclension && d->dateMonthNamePossessive) <a name="l01376"></a>01376 buffer.<a class="codeRef" href="qstring.html#append">append</a>(<a class="code" href="classKLocale.html#a0bfd055c66b769eef7005bd970cab326" title="Returns a pointer to the calendar system object.">calendar</a>()-><a class="code" href="classKLocale.html#a412755b26ce67d66d2b46983b024cc8c">monthNamePossessive</a>(month, year, <span class="keyword">false</span>)); <a name="l01377"></a>01377 <span class="keywordflow">else</span> <a name="l01378"></a>01378 buffer.<a class="codeRef" href="qstring.html#append">append</a>(<a class="code" href="classKLocale.html#a0bfd055c66b769eef7005bd970cab326" title="Returns a pointer to the calendar system object.">calendar</a>()-><a class="code" href="classKLocale.html#a41ea28a1068006a4eabcd7e049335aa5">monthName</a>(month, year, <span class="keyword">false</span>)); <a name="l01379"></a>01379 <span class="keywordflow">break</span>; <a name="l01380"></a>01380 <span class="keywordflow">case</span> <span class="charliteral">'d'</span>: <a name="l01381"></a>01381 buffer.<a class="codeRef" href="qstring.html#append">append</a>(<a class="code" href="classKLocale.html#a0bfd055c66b769eef7005bd970cab326" title="Returns a pointer to the calendar system object.">calendar</a>()->dayString(pDate, <span class="keyword">false</span>)); <a name="l01382"></a>01382 <span class="keywordflow">break</span>; <a name="l01383"></a>01383 <span class="keywordflow">case</span> <span class="charliteral">'a'</span>: <a name="l01384"></a>01384 buffer.<a class="codeRef" href="qstring.html#append">append</a>(<a class="code" href="classKLocale.html#a0bfd055c66b769eef7005bd970cab326" title="Returns a pointer to the calendar system object.">calendar</a>()-><a class="code" href="classKLocale.html#a11d04f0f19b11c768451f1baba84650c">weekDayName</a>(pDate, <span class="keyword">true</span>)); <a name="l01385"></a>01385 <span class="keywordflow">break</span>; <a name="l01386"></a>01386 <span class="keywordflow">case</span> <span class="charliteral">'A'</span>: <a name="l01387"></a>01387 buffer.<a class="codeRef" href="qstring.html#append">append</a>(<a class="code" href="classKLocale.html#a0bfd055c66b769eef7005bd970cab326" title="Returns a pointer to the calendar system object.">calendar</a>()-><a class="code" href="classKLocale.html#a11d04f0f19b11c768451f1baba84650c">weekDayName</a>(pDate, <span class="keyword">false</span>)); <a name="l01388"></a>01388 <span class="keywordflow">break</span>; <a name="l01389"></a>01389 <span class="keywordflow">default</span>: <a name="l01390"></a>01390 buffer.<a class="codeRef" href="qstring.html#append">append</a>(rst.<a class="codeRef" href="qstring.html#at">at</a>(format_index)); <a name="l01391"></a>01391 <span class="keywordflow">break</span>; <a name="l01392"></a>01392 } <a name="l01393"></a>01393 escape = <span class="keyword">false</span>; <a name="l01394"></a>01394 } <a name="l01395"></a>01395 } <a name="l01396"></a>01396 <span class="keywordflow">return</span> buffer; <a name="l01397"></a>01397 } <a name="l01398"></a>01398 <a name="l01399"></a><a class="code" href="classKLocale.html#a4b3e96beb1179a41b2f4b8b2ea97b4e5">01399</a> <span class="keywordtype">void</span> <a class="code" href="classKLocale.html#a4b3e96beb1179a41b2f4b8b2ea97b4e5" title="Use this as main catalog for *all* KLocales, if not the appname will be used.">KLocale::setMainCatalogue</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *catalog) <a name="l01400"></a>01400 { <a name="l01401"></a>01401 maincatalogue = catalog; <a name="l01402"></a>01402 } <a name="l01403"></a>01403 <a name="l01404"></a><a class="code" href="classKLocale.html#a1a9ba53d06c09b1ad723e2c7514d501f">01404</a> <span class="keywordtype">double</span> <a class="code" href="classKLocale.html#a1a9ba53d06c09b1ad723e2c7514d501f" title="Converts a localized numeric string to a double.">KLocale::readNumber</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> &_str, <span class="keywordtype">bool</span> * ok)<span class="keyword"> const</span> <a name="l01405"></a>01405 <span class="keyword"></span>{ <a name="l01406"></a>01406 <a class="codeRef" href="qstring.html">QString</a> str = _str.<a class="codeRef" href="qstring.html#stripWhiteSpace">stripWhiteSpace</a>(); <a name="l01407"></a>01407 <span class="keywordtype">bool</span> neg = str.<a class="codeRef" href="qstring.html#find">find</a>(<a class="code" href="classKLocale.html#a94d10bce709860e202d243fae590037c" title="Returns what a negative sign should look like ("-", etc.) according to the current locale or user set...">negativeSign</a>()) == 0; <a name="l01408"></a>01408 <span class="keywordflow">if</span> (neg) <a name="l01409"></a>01409 str.<a class="codeRef" href="qstring.html#remove">remove</a>( 0, <a class="code" href="classKLocale.html#a94d10bce709860e202d243fae590037c" title="Returns what a negative sign should look like ("-", etc.) according to the current locale or user set...">negativeSign</a>().length() ); <a name="l01410"></a>01410 <a name="l01411"></a>01411 <span class="comment">/* will hold the scientific notation portion of the number.</span> <a name="l01412"></a>01412 <span class="comment"> Example, with 2.34E+23, exponentialPart == "E+23"</span> <a name="l01413"></a>01413 <span class="comment"> */</span> <a name="l01414"></a>01414 <a class="codeRef" href="qstring.html">QString</a> exponentialPart; <a name="l01415"></a>01415 <span class="keywordtype">int</span> EPos; <a name="l01416"></a>01416 <a name="l01417"></a>01417 EPos = str.<a class="codeRef" href="qstring.html#find">find</a>(<span class="charliteral">'E'</span>, 0, <span class="keyword">false</span>); <a name="l01418"></a>01418 <a name="l01419"></a>01419 <span class="keywordflow">if</span> (EPos != -1) <a name="l01420"></a>01420 { <a name="l01421"></a>01421 exponentialPart = str.<a class="codeRef" href="qstring.html#mid">mid</a>(EPos); <a name="l01422"></a>01422 str = str.<a class="codeRef" href="qstring.html#left">left</a>(EPos); <a name="l01423"></a>01423 } <a name="l01424"></a>01424 <a name="l01425"></a>01425 <span class="keywordtype">int</span> pos = str.<a class="codeRef" href="qstring.html#find">find</a>(<a class="code" href="classKLocale.html#a1390d3ec1ce5272bed4d3ad5b825608e" title="Returns what a decimal point should look like ("." or "," etc.) according to the current locale or us...">decimalSymbol</a>()); <a name="l01426"></a>01426 <a class="codeRef" href="qstring.html">QString</a> major; <a name="l01427"></a>01427 <a class="codeRef" href="qstring.html">QString</a> minor; <a name="l01428"></a>01428 <span class="keywordflow">if</span> ( pos == -1 ) <a name="l01429"></a>01429 major = str; <a name="l01430"></a>01430 <span class="keywordflow">else</span> <a name="l01431"></a>01431 { <a name="l01432"></a>01432 major = str.<a class="codeRef" href="qstring.html#left">left</a>(pos); <a name="l01433"></a>01433 minor = str.<a class="codeRef" href="qstring.html#mid">mid</a>(pos + <a class="code" href="classKLocale.html#a1390d3ec1ce5272bed4d3ad5b825608e" title="Returns what a decimal point should look like ("." or "," etc.) according to the current locale or us...">decimalSymbol</a>().length()); <a name="l01434"></a>01434 } <a name="l01435"></a>01435 <a name="l01436"></a>01436 <span class="comment">// Remove thousand separators</span> <a name="l01437"></a>01437 <span class="keywordtype">int</span> thlen = <a class="code" href="classKLocale.html#a1eeb5cf549b5aa6b7373f6c3bd2c6dab" title="Returns what the thousands separator should look like ("," or "." etc.) according to the current loca...">thousandsSeparator</a>().<a class="codeRef" href="qstring.html#length">length</a>(); <a name="l01438"></a>01438 <span class="keywordtype">int</span> lastpos = 0; <a name="l01439"></a>01439 <span class="keywordflow">while</span> ( ( pos = major.<a class="codeRef" href="qstring.html#find">find</a>( <a class="code" href="classKLocale.html#a1eeb5cf549b5aa6b7373f6c3bd2c6dab" title="Returns what the thousands separator should look like ("," or "." etc.) according to the current loca...">thousandsSeparator</a>() ) ) > 0 ) <a name="l01440"></a>01440 { <a name="l01441"></a>01441 <span class="comment">// e.g. 12,,345,,678,,922 Acceptable positions (from the end) are 5, 10, 15... i.e. (3+thlen)*N</span> <a name="l01442"></a>01442 <span class="keywordtype">int</span> fromEnd = major.<a class="codeRef" href="qstring.html#length">length</a>() - pos; <a name="l01443"></a>01443 <span class="keywordflow">if</span> ( fromEnd % (3+thlen) != 0 <span class="comment">// Needs to be a multiple, otherwise it's an error</span> <a name="l01444"></a>01444 || pos - lastpos > 3 <span class="comment">// More than 3 digits between two separators -> error</span> <a name="l01445"></a>01445 || pos == 0 <span class="comment">// Can't start with a separator</span> <a name="l01446"></a>01446 || (lastpos>0 && pos-lastpos!=3)) <span class="comment">// Must have exactly 3 digits between two separators</span> <a name="l01447"></a>01447 { <a name="l01448"></a>01448 <span class="keywordflow">if</span> (ok) *ok = <span class="keyword">false</span>; <a name="l01449"></a>01449 <span class="keywordflow">return</span> 0.0; <a name="l01450"></a>01450 } <a name="l01451"></a>01451 <a name="l01452"></a>01452 lastpos = pos; <a name="l01453"></a>01453 major.<a class="codeRef" href="qstring.html#remove">remove</a>( pos, thlen ); <a name="l01454"></a>01454 } <a name="l01455"></a>01455 <span class="keywordflow">if</span> (lastpos>0 && major.<a class="codeRef" href="qstring.html#length">length</a>()-lastpos!=3) <span class="comment">// Must have exactly 3 digits after the last separator</span> <a name="l01456"></a>01456 { <a name="l01457"></a>01457 <span class="keywordflow">if</span> (ok) *ok = <span class="keyword">false</span>; <a name="l01458"></a>01458 <span class="keywordflow">return</span> 0.0; <a name="l01459"></a>01459 } <a name="l01460"></a>01460 <a name="l01461"></a>01461 <a class="codeRef" href="qstring.html">QString</a> tot; <a name="l01462"></a>01462 <span class="keywordflow">if</span> (neg) tot = <span class="charliteral">'-'</span>; <a name="l01463"></a>01463 <a name="l01464"></a>01464 tot += major + <span class="charliteral">'.'</span> + minor + exponentialPart; <a name="l01465"></a>01465 <a name="l01466"></a>01466 <span class="keywordflow">return</span> tot.<a class="codeRef" href="qstring.html#toDouble">toDouble</a>(ok); <a name="l01467"></a>01467 } <a name="l01468"></a>01468 <a name="l01469"></a><a class="code" href="classKLocale.html#acedf6be804777aa04a6d92311fffac4a">01469</a> <span class="keywordtype">double</span> <a class="code" href="classKLocale.html#acedf6be804777aa04a6d92311fffac4a" title="Converts a localized monetary string to a double.">KLocale::readMoney</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> &_str, <span class="keywordtype">bool</span> * ok)<span class="keyword"> const</span> <a name="l01470"></a>01470 <span class="keyword"></span>{ <a name="l01471"></a>01471 <a class="codeRef" href="qstring.html">QString</a> str = _str.<a class="codeRef" href="qstring.html#stripWhiteSpace">stripWhiteSpace</a>(); <a name="l01472"></a>01472 <span class="keywordtype">bool</span> neg = <span class="keyword">false</span>; <a name="l01473"></a>01473 <span class="keywordtype">bool</span> currencyFound = <span class="keyword">false</span>; <a name="l01474"></a>01474 <a class="codeRef" href="qstring.html">QString</a> symbol = <a class="code" href="classKLocale.html#ab2f29e23e070c14ea8ea7660c2bc7bf6" title="Returns what the symbol denoting currency in the current locale as as defined by user settings should...">currencySymbol</a>(); <a name="l01475"></a>01475 <span class="comment">// First try removing currency symbol from either end</span> <a name="l01476"></a>01476 <span class="keywordtype">int</span> pos = str.<a class="codeRef" href="qstring.html#find">find</a>(symbol); <a name="l01477"></a>01477 <span class="keywordflow">if</span> ( pos == 0 || pos == (<span class="keywordtype">int</span>) str.<a class="codeRef" href="qstring.html#length">length</a>()-symbol.<a class="codeRef" href="qstring.html#length">length</a>() ) <a name="l01478"></a>01478 { <a name="l01479"></a>01479 str.<a class="codeRef" href="qstring.html#remove">remove</a>(pos,symbol.<a class="codeRef" href="qstring.html#length">length</a>()); <a name="l01480"></a>01480 str = str.<a class="codeRef" href="qstring.html#stripWhiteSpace">stripWhiteSpace</a>(); <a name="l01481"></a>01481 currencyFound = <span class="keyword">true</span>; <a name="l01482"></a>01482 } <a name="l01483"></a>01483 <span class="keywordflow">if</span> (str.<a class="codeRef" href="qstring.html#isEmpty">isEmpty</a>()) <a name="l01484"></a>01484 { <a name="l01485"></a>01485 <span class="keywordflow">if</span> (ok) *ok = <span class="keyword">false</span>; <a name="l01486"></a>01486 <span class="keywordflow">return</span> 0; <a name="l01487"></a>01487 } <a name="l01488"></a>01488 <span class="comment">// Then try removing negative sign from either end</span> <a name="l01489"></a>01489 <span class="comment">// (with a special case for parenthesis)</span> <a name="l01490"></a>01490 <span class="keywordflow">if</span> (<a class="code" href="classKLocale.html#ab0784f5d7d965416ee8b4611848a874d" title="Denotes where to place a negative sign in relation to a monetary value.">negativeMonetarySignPosition</a>() == ParensAround) <a name="l01491"></a>01491 { <a name="l01492"></a>01492 <span class="keywordflow">if</span> (str[0] == <span class="charliteral">'('</span> && str[str.<a class="codeRef" href="qstring.html#length">length</a>()-1] == <span class="charliteral">')'</span>) <a name="l01493"></a>01493 { <a name="l01494"></a>01494 neg = <span class="keyword">true</span>; <a name="l01495"></a>01495 str.<a class="codeRef" href="qstring.html#remove">remove</a>(str.<a class="codeRef" href="qstring.html#length">length</a>()-1,1); <a name="l01496"></a>01496 str.<a class="codeRef" href="qstring.html#remove">remove</a>(0,1); <a name="l01497"></a>01497 } <a name="l01498"></a>01498 } <a name="l01499"></a>01499 <span class="keywordflow">else</span> <a name="l01500"></a>01500 { <a name="l01501"></a>01501 <span class="keywordtype">int</span> i1 = str.<a class="codeRef" href="qstring.html#find">find</a>(<a class="code" href="classKLocale.html#a94d10bce709860e202d243fae590037c" title="Returns what a negative sign should look like ("-", etc.) according to the current locale or user set...">negativeSign</a>()); <a name="l01502"></a>01502 <span class="keywordflow">if</span> ( i1 == 0 || i1 == (<span class="keywordtype">int</span>) str.<a class="codeRef" href="qstring.html#length">length</a>()-1 ) <a name="l01503"></a>01503 { <a name="l01504"></a>01504 neg = <span class="keyword">true</span>; <a name="l01505"></a>01505 str.<a class="codeRef" href="qstring.html#remove">remove</a>(i1,<a class="code" href="classKLocale.html#a94d10bce709860e202d243fae590037c" title="Returns what a negative sign should look like ("-", etc.) according to the current locale or user set...">negativeSign</a>().length()); <a name="l01506"></a>01506 } <a name="l01507"></a>01507 } <a name="l01508"></a>01508 <span class="keywordflow">if</span> (neg) str = str.<a class="codeRef" href="qstring.html#stripWhiteSpace">stripWhiteSpace</a>(); <a name="l01509"></a>01509 <a name="l01510"></a>01510 <span class="comment">// Finally try again for the currency symbol, if we didn't find</span> <a name="l01511"></a>01511 <span class="comment">// it already (because of the negative sign being in the way).</span> <a name="l01512"></a>01512 <span class="keywordflow">if</span> ( !currencyFound ) <a name="l01513"></a>01513 { <a name="l01514"></a>01514 pos = str.<a class="codeRef" href="qstring.html#find">find</a>(symbol); <a name="l01515"></a>01515 <span class="keywordflow">if</span> ( pos == 0 || pos == (<span class="keywordtype">int</span>) str.<a class="codeRef" href="qstring.html#length">length</a>()-symbol.<a class="codeRef" href="qstring.html#length">length</a>() ) <a name="l01516"></a>01516 { <a name="l01517"></a>01517 str.<a class="codeRef" href="qstring.html#remove">remove</a>(pos,symbol.<a class="codeRef" href="qstring.html#length">length</a>()); <a name="l01518"></a>01518 str = str.<a class="codeRef" href="qstring.html#stripWhiteSpace">stripWhiteSpace</a>(); <a name="l01519"></a>01519 } <a name="l01520"></a>01520 } <a name="l01521"></a>01521 <a name="l01522"></a>01522 <span class="comment">// And parse the rest as a number</span> <a name="l01523"></a>01523 pos = str.<a class="codeRef" href="qstring.html#find">find</a>(<a class="code" href="classKLocale.html#a2818b2208387eaf860a3287792bfc245" title="Returns what a decimal point should look like ("." or "," etc.) for monetary values, according to the current locale or user settings.">monetaryDecimalSymbol</a>()); <a name="l01524"></a>01524 <a class="codeRef" href="qstring.html">QString</a> major; <a name="l01525"></a>01525 <a class="codeRef" href="qstring.html">QString</a> minior; <a name="l01526"></a>01526 <span class="keywordflow">if</span> (pos == -1) <a name="l01527"></a>01527 major = str; <a name="l01528"></a>01528 <span class="keywordflow">else</span> <a name="l01529"></a>01529 { <a name="l01530"></a>01530 major = str.<a class="codeRef" href="qstring.html#left">left</a>(pos); <a name="l01531"></a>01531 minior = str.<a class="codeRef" href="qstring.html#mid">mid</a>(pos + <a class="code" href="classKLocale.html#a2818b2208387eaf860a3287792bfc245" title="Returns what a decimal point should look like ("." or "," etc.) for monetary values, according to the current locale or user settings.">monetaryDecimalSymbol</a>().length()); <a name="l01532"></a>01532 } <a name="l01533"></a>01533 <a name="l01534"></a>01534 <span class="comment">// Remove thousand separators</span> <a name="l01535"></a>01535 <span class="keywordtype">int</span> thlen = <a class="code" href="classKLocale.html#a54c2fbfde652eb723d83a7c83099b749" title="Returns what a thousands separator for monetary values should look like ("," or " " etc...">monetaryThousandsSeparator</a>().<a class="codeRef" href="qstring.html#length">length</a>(); <a name="l01536"></a>01536 <span class="keywordtype">int</span> lastpos = 0; <a name="l01537"></a>01537 <span class="keywordflow">while</span> ( ( pos = major.<a class="codeRef" href="qstring.html#find">find</a>( <a class="code" href="classKLocale.html#a54c2fbfde652eb723d83a7c83099b749" title="Returns what a thousands separator for monetary values should look like ("," or " " etc...">monetaryThousandsSeparator</a>() ) ) > 0 ) <a name="l01538"></a>01538 { <a name="l01539"></a>01539 <span class="comment">// e.g. 12,,345,,678,,922 Acceptable positions (from the end) are 5, 10, 15... i.e. (3+thlen)*N</span> <a name="l01540"></a>01540 <span class="keywordtype">int</span> fromEnd = major.<a class="codeRef" href="qstring.html#length">length</a>() - pos; <a name="l01541"></a>01541 <span class="keywordflow">if</span> ( fromEnd % (3+thlen) != 0 <span class="comment">// Needs to be a multiple, otherwise it's an error</span> <a name="l01542"></a>01542 || pos - lastpos > 3 <span class="comment">// More than 3 digits between two separators -> error</span> <a name="l01543"></a>01543 || pos == 0 <span class="comment">// Can't start with a separator</span> <a name="l01544"></a>01544 || (lastpos>0 && pos-lastpos!=3)) <span class="comment">// Must have exactly 3 digits between two separators</span> <a name="l01545"></a>01545 { <a name="l01546"></a>01546 <span class="keywordflow">if</span> (ok) *ok = <span class="keyword">false</span>; <a name="l01547"></a>01547 <span class="keywordflow">return</span> 0.0; <a name="l01548"></a>01548 } <a name="l01549"></a>01549 lastpos = pos; <a name="l01550"></a>01550 major.<a class="codeRef" href="qstring.html#remove">remove</a>( pos, thlen ); <a name="l01551"></a>01551 } <a name="l01552"></a>01552 <span class="keywordflow">if</span> (lastpos>0 && major.<a class="codeRef" href="qstring.html#length">length</a>()-lastpos!=3) <span class="comment">// Must have exactly 3 digits after the last separator</span> <a name="l01553"></a>01553 { <a name="l01554"></a>01554 <span class="keywordflow">if</span> (ok) *ok = <span class="keyword">false</span>; <a name="l01555"></a>01555 <span class="keywordflow">return</span> 0.0; <a name="l01556"></a>01556 } <a name="l01557"></a>01557 <a name="l01558"></a>01558 <a class="codeRef" href="qstring.html">QString</a> tot; <a name="l01559"></a>01559 <span class="keywordflow">if</span> (neg) tot = <span class="charliteral">'-'</span>; <a name="l01560"></a>01560 tot += major + <span class="charliteral">'.'</span> + minior; <a name="l01561"></a>01561 <span class="keywordflow">return</span> tot.<a class="codeRef" href="qstring.html#toDouble">toDouble</a>(ok); <a name="l01562"></a>01562 } <a name="l01563"></a>01563 <a name="l01570"></a>01570 <span class="keyword">static</span> <span class="keywordtype">int</span> readInt(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> &str, uint &pos) <a name="l01571"></a>01571 { <a name="l01572"></a>01572 <span class="keywordflow">if</span> (!str.<a class="codeRef" href="qstring.html#at">at</a>(pos).isDigit()) <span class="keywordflow">return</span> -1; <a name="l01573"></a>01573 <span class="keywordtype">int</span> result = 0; <a name="l01574"></a>01574 <span class="keywordflow">for</span> (; str.<a class="codeRef" href="qstring.html#length">length</a>() > pos && str.<a class="codeRef" href="qstring.html#at">at</a>(pos).isDigit(); pos++) <a name="l01575"></a>01575 { <a name="l01576"></a>01576 result *= 10; <a name="l01577"></a>01577 result += str.<a class="codeRef" href="qstring.html#at">at</a>(pos).digitValue(); <a name="l01578"></a>01578 } <a name="l01579"></a>01579 <a name="l01580"></a>01580 <span class="keywordflow">return</span> result; <a name="l01581"></a>01581 } <a name="l01582"></a>01582 <a name="l01583"></a><a class="code" href="classKLocale.html#ac14f0f86273c10872492cabd603696f8">01583</a> <a class="codeRef" href="qdate.html">QDate</a> <a class="code" href="classKLocale.html#ac14f0f86273c10872492cabd603696f8" title="Converts a localized date string to a QDate.">KLocale::readDate</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> &intstr, <span class="keywordtype">bool</span>* ok)<span class="keyword"> const</span> <a name="l01584"></a>01584 <span class="keyword"></span>{ <a name="l01585"></a>01585 <a class="codeRef" href="qdate.html">QDate</a> date; <a name="l01586"></a>01586 date = <a class="code" href="classKLocale.html#ac14f0f86273c10872492cabd603696f8" title="Converts a localized date string to a QDate.">readDate</a>(intstr, ShortFormat, ok); <a name="l01587"></a>01587 <span class="keywordflow">if</span> (date.<a class="codeRef" href="qdate.html#isValid">isValid</a>()) <span class="keywordflow">return</span> date; <a name="l01588"></a>01588 <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#ac14f0f86273c10872492cabd603696f8" title="Converts a localized date string to a QDate.">readDate</a>(intstr, NormalFormat, ok); <a name="l01589"></a>01589 } <a name="l01590"></a>01590 <a name="l01591"></a><a class="code" href="classKLocale.html#a8609edefd85fddad9e0cff39f7e71deb">01591</a> <a class="codeRef" href="qdate.html">QDate</a> <a class="code" href="classKLocale.html#ac14f0f86273c10872492cabd603696f8" title="Converts a localized date string to a QDate.">KLocale::readDate</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> &intstr, ReadDateFlags flags, <span class="keywordtype">bool</span>* ok)<span class="keyword"> const</span> <a name="l01592"></a>01592 <span class="keyword"></span>{ <a name="l01593"></a>01593 <a class="codeRef" href="qstring.html">QString</a> fmt = ((flags & ShortFormat) ? <a class="code" href="classKLocale.html#a25628f2ed7d48cfadf69c2ae7a1d6e84" title="Returns the currently selected short date format.">dateFormatShort</a>() : <a class="code" href="classKLocale.html#a8a80f48689c9cde5efc6e16d507ea153" title="Returns the currently selected date format.">dateFormat</a>()).simplifyWhiteSpace(); <a name="l01594"></a>01594 <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#ac14f0f86273c10872492cabd603696f8" title="Converts a localized date string to a QDate.">readDate</a>( intstr, fmt, ok ); <a name="l01595"></a>01595 } <a name="l01596"></a>01596 <a name="l01597"></a><a class="code" href="classKLocale.html#a9cb83b80e605297f253d81e6667bdf05">01597</a> <a class="codeRef" href="qdate.html">QDate</a> <a class="code" href="classKLocale.html#ac14f0f86273c10872492cabd603696f8" title="Converts a localized date string to a QDate.">KLocale::readDate</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> &intstr, <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> &fmt, <span class="keywordtype">bool</span>* ok)<span class="keyword"> const</span> <a name="l01598"></a>01598 <span class="keyword"></span>{ <a name="l01599"></a>01599 <span class="comment">//kdDebug() << "KLocale::readDate intstr=" << intstr << " fmt=" << fmt << endl;</span> <a name="l01600"></a>01600 <a class="codeRef" href="qstring.html">QString</a> str = intstr.<a class="codeRef" href="qstring.html#simplifyWhiteSpace">simplifyWhiteSpace</a>().lower(); <a name="l01601"></a>01601 <span class="keywordtype">int</span> day = -1, month = -1; <a name="l01602"></a>01602 <span class="comment">// allow the year to be omitted if not in the format</span> <a name="l01603"></a>01603 <span class="keywordtype">int</span> year = <a class="code" href="classKLocale.html#a0bfd055c66b769eef7005bd970cab326" title="Returns a pointer to the calendar system object.">calendar</a>()-><a class="code" href="classKCalendarSystem.html#a8411a320d265d0d77e1b7ff29a0066b4" title="Gets specific calendar type year for a given gregorian date.">year</a>(<a class="codeRef" href="qdate.html#currentDate-2">QDate::currentDate</a>()); <a name="l01604"></a>01604 uint strpos = 0; <a name="l01605"></a>01605 uint fmtpos = 0; <a name="l01606"></a>01606 <a name="l01607"></a>01607 <span class="keywordtype">int</span> iLength; <span class="comment">// Temporary variable used when reading input</span> <a name="l01608"></a>01608 <a name="l01609"></a>01609 <span class="keywordtype">bool</span> error = <span class="keyword">false</span>; <a name="l01610"></a>01610 <a name="l01611"></a>01611 <span class="keywordflow">while</span> (fmt.<a class="codeRef" href="qstring.html#length">length</a>() > fmtpos && str.<a class="codeRef" href="qstring.html#length">length</a>() > strpos && !error) <a name="l01612"></a>01612 { <a name="l01613"></a>01613 <a name="l01614"></a>01614 <a class="codeRef" href="qchar.html">QChar</a> c = fmt.<a class="codeRef" href="qstring.html#at">at</a>(fmtpos++); <a name="l01615"></a>01615 <a name="l01616"></a>01616 <span class="keywordflow">if</span> (c != <span class="charliteral">'%'</span>) { <a name="l01617"></a>01617 <span class="keywordflow">if</span> (c.<a class="codeRef" href="qchar.html#isSpace">isSpace</a>() && str.<a class="codeRef" href="qstring.html#at">at</a>(strpos).isSpace()) <a name="l01618"></a>01618 strpos++; <a name="l01619"></a>01619 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (c != str.<a class="codeRef" href="qstring.html#at">at</a>(strpos++)) <a name="l01620"></a>01620 error = <span class="keyword">true</span>; <a name="l01621"></a>01621 } <a name="l01622"></a>01622 <span class="keywordflow">else</span> <a name="l01623"></a>01623 { <a name="l01624"></a>01624 <span class="keywordtype">int</span> j; <a name="l01625"></a>01625 <span class="comment">// remove space at the beginning</span> <a name="l01626"></a>01626 <span class="keywordflow">if</span> (str.<a class="codeRef" href="qstring.html#length">length</a>() > strpos && str.<a class="codeRef" href="qstring.html#at">at</a>(strpos).isSpace()) <a name="l01627"></a>01627 strpos++; <a name="l01628"></a>01628 <a name="l01629"></a>01629 c = fmt.<a class="codeRef" href="qstring.html#at">at</a>(fmtpos++); <a name="l01630"></a>01630 <span class="keywordflow">switch</span> (c) <a name="l01631"></a>01631 { <a name="l01632"></a>01632 <span class="keywordflow">case</span> <span class="charliteral">'a'</span>: <a name="l01633"></a>01633 <span class="keywordflow">case</span> <span class="charliteral">'A'</span>: <a name="l01634"></a>01634 <a name="l01635"></a>01635 error = <span class="keyword">true</span>; <a name="l01636"></a>01636 j = 1; <a name="l01637"></a>01637 <span class="keywordflow">while</span> (error && (j < 8)) { <a name="l01638"></a>01638 <a class="codeRef" href="qstring.html">QString</a> s = <a class="code" href="classKLocale.html#a0bfd055c66b769eef7005bd970cab326" title="Returns a pointer to the calendar system object.">calendar</a>()-><a class="code" href="classKCalendarSystem.html#a06dd24136f979dad84aa5be2d8c5b785" title="Gets specific calendar type week day name If an invalid week day is specified, QString::null is retur...">weekDayName</a>(j, c == <span class="charliteral">'a'</span>).<a class="codeRef" href="qstring.html#lower">lower</a>(); <a name="l01639"></a>01639 <span class="keywordtype">int</span> len = s.<a class="codeRef" href="qstring.html#length">length</a>(); <a name="l01640"></a>01640 <span class="keywordflow">if</span> (str.<a class="codeRef" href="qstring.html#mid">mid</a>(strpos, len) == s) <a name="l01641"></a>01641 { <a name="l01642"></a>01642 strpos += len; <a name="l01643"></a>01643 error = <span class="keyword">false</span>; <a name="l01644"></a>01644 } <a name="l01645"></a>01645 j++; <a name="l01646"></a>01646 } <a name="l01647"></a>01647 <span class="keywordflow">break</span>; <a name="l01648"></a>01648 <span class="keywordflow">case</span> <span class="charliteral">'b'</span>: <a name="l01649"></a>01649 <span class="keywordflow">case</span> <span class="charliteral">'B'</span>: <a name="l01650"></a>01650 <a name="l01651"></a>01651 error = <span class="keyword">true</span>; <a name="l01652"></a>01652 <span class="keywordflow">if</span> (d->nounDeclension && d->dateMonthNamePossessive) { <a name="l01653"></a>01653 j = 1; <a name="l01654"></a>01654 <span class="keywordflow">while</span> (error && (j < 13)) { <a name="l01655"></a>01655 <a class="codeRef" href="qstring.html">QString</a> s = <a class="code" href="classKLocale.html#a0bfd055c66b769eef7005bd970cab326" title="Returns a pointer to the calendar system object.">calendar</a>()-><a class="code" href="classKCalendarSystem.html#aef2c9a230068754fc88c0f5cfde25d40" title="Returns a string containing the possessive form of the month name.">monthNamePossessive</a>(j, year, c == <span class="charliteral">'b'</span>).<a class="codeRef" href="qstring.html#lower">lower</a>(); <a name="l01656"></a>01656 <span class="keywordtype">int</span> len = s.<a class="codeRef" href="qstring.html#length">length</a>(); <a name="l01657"></a>01657 <span class="keywordflow">if</span> (str.<a class="codeRef" href="qstring.html#mid">mid</a>(strpos, len) == s) { <a name="l01658"></a>01658 month = j; <a name="l01659"></a>01659 strpos += len; <a name="l01660"></a>01660 error = <span class="keyword">false</span>; <a name="l01661"></a>01661 } <a name="l01662"></a>01662 j++; <a name="l01663"></a>01663 } <a name="l01664"></a>01664 } <a name="l01665"></a>01665 j = 1; <a name="l01666"></a>01666 <span class="keywordflow">while</span> (error && (j < 13)) { <a name="l01667"></a>01667 <a class="codeRef" href="qstring.html">QString</a> s = <a class="code" href="classKLocale.html#a0bfd055c66b769eef7005bd970cab326" title="Returns a pointer to the calendar system object.">calendar</a>()-><a class="code" href="classKCalendarSystem.html#a11cc2e945d43c9bc298aca685496f43b" title="Gets specific calendar type month name for a given month number If an invalid month is specified...">monthName</a>(j, year, c == <span class="charliteral">'b'</span>).<a class="codeRef" href="qstring.html#lower">lower</a>(); <a name="l01668"></a>01668 <span class="keywordtype">int</span> len = s.<a class="codeRef" href="qstring.html#length">length</a>(); <a name="l01669"></a>01669 <span class="keywordflow">if</span> (str.<a class="codeRef" href="qstring.html#mid">mid</a>(strpos, len) == s) { <a name="l01670"></a>01670 month = j; <a name="l01671"></a>01671 strpos += len; <a name="l01672"></a>01672 error = <span class="keyword">false</span>; <a name="l01673"></a>01673 } <a name="l01674"></a>01674 j++; <a name="l01675"></a>01675 } <a name="l01676"></a>01676 <span class="keywordflow">break</span>; <a name="l01677"></a>01677 <span class="keywordflow">case</span> <span class="charliteral">'d'</span>: <a name="l01678"></a>01678 <span class="keywordflow">case</span> <span class="charliteral">'e'</span>: <a name="l01679"></a>01679 day = <a class="code" href="classKLocale.html#a0bfd055c66b769eef7005bd970cab326" title="Returns a pointer to the calendar system object.">calendar</a>()-><a class="code" href="classKCalendarSystem.html#add512b09d12f4a1fe569c6f952694335" title="Converts a day literal of a part of a string into a integer starting at the beginning of the string...">dayStringToInteger</a>(str.<a class="codeRef" href="qstring.html#mid">mid</a>(strpos), iLength); <a name="l01680"></a>01680 strpos += iLength; <a name="l01681"></a>01681 <a name="l01682"></a>01682 error = iLength <= 0; <a name="l01683"></a>01683 <span class="keywordflow">break</span>; <a name="l01684"></a>01684 <a name="l01685"></a>01685 <span class="keywordflow">case</span> <span class="charliteral">'n'</span>: <a name="l01686"></a>01686 <span class="keywordflow">case</span> <span class="charliteral">'m'</span>: <a name="l01687"></a>01687 month = <a class="code" href="classKLocale.html#a0bfd055c66b769eef7005bd970cab326" title="Returns a pointer to the calendar system object.">calendar</a>()-><a class="code" href="classKCalendarSystem.html#a6338e8ae8c2c4e6e033ea7a4747fbf78" title="Converts a month literal of a part of a string into a integer starting at the beginning of the string...">monthStringToInteger</a>(str.<a class="codeRef" href="qstring.html#mid">mid</a>(strpos), iLength); <a name="l01688"></a>01688 strpos += iLength; <a name="l01689"></a>01689 <a name="l01690"></a>01690 error = iLength <= 0; <a name="l01691"></a>01691 <span class="keywordflow">break</span>; <a name="l01692"></a>01692 <a name="l01693"></a>01693 <span class="keywordflow">case</span> <span class="charliteral">'Y'</span>: <a name="l01694"></a>01694 <span class="keywordflow">case</span> <span class="charliteral">'y'</span>: <a name="l01695"></a>01695 year = <a class="code" href="classKLocale.html#a0bfd055c66b769eef7005bd970cab326" title="Returns a pointer to the calendar system object.">calendar</a>()-><a class="code" href="classKCalendarSystem.html#a9670efa4827be8db552fec6e52e121c2" title="Converts a year literal of a part of a string into a integer starting at the beginning of the string...">yearStringToInteger</a>(str.<a class="codeRef" href="qstring.html#mid">mid</a>(strpos), iLength); <a name="l01696"></a>01696 strpos += iLength; <a name="l01697"></a>01697 <a name="l01698"></a>01698 error = iLength <= 0; <a name="l01699"></a>01699 <span class="keywordflow">break</span>; <a name="l01700"></a>01700 } <a name="l01701"></a>01701 } <a name="l01702"></a>01702 } <a name="l01703"></a>01703 <a name="l01704"></a>01704 <span class="comment">/* for a match, we should reach the end of both strings, not just one of</span> <a name="l01705"></a>01705 <span class="comment"> them */</span> <a name="l01706"></a>01706 <span class="keywordflow">if</span> ( fmt.<a class="codeRef" href="qstring.html#length">length</a>() > fmtpos || str.<a class="codeRef" href="qstring.html#length">length</a>() > strpos ) <a name="l01707"></a>01707 { <a name="l01708"></a>01708 error = <span class="keyword">true</span>; <a name="l01709"></a>01709 } <a name="l01710"></a>01710 <a name="l01711"></a>01711 <span class="comment">//kdDebug(173) << "KLocale::readDate day=" << day << " month=" << month << " year=" << year << endl;</span> <a name="l01712"></a>01712 <span class="keywordflow">if</span> ( year != -1 && month != -1 && day != -1 && !error) <a name="l01713"></a>01713 { <a name="l01714"></a>01714 <span class="keywordflow">if</span> (ok) *ok = <span class="keyword">true</span>; <a name="l01715"></a>01715 <a name="l01716"></a>01716 <a class="codeRef" href="qdate.html">QDate</a> result; <a name="l01717"></a>01717 <a class="code" href="classKLocale.html#a0bfd055c66b769eef7005bd970cab326" title="Returns a pointer to the calendar system object.">calendar</a>()-><a class="code" href="classKCalendarSystem.html#a6a854b67ccdcc697046d3a2ef870f4ae" title="Changes the date's year, month and day.">setYMD</a>(result, year, month, day); <a name="l01718"></a>01718 <a name="l01719"></a>01719 <span class="keywordflow">return</span> result; <a name="l01720"></a>01720 } <a name="l01721"></a>01721 <span class="keywordflow">else</span> <a name="l01722"></a>01722 { <a name="l01723"></a>01723 <span class="keywordflow">if</span> (ok) *ok = <span class="keyword">false</span>; <a name="l01724"></a>01724 <span class="keywordflow">return</span> <a class="codeRef" href="qdate.html">QDate</a>(); <span class="comment">// invalid date</span> <a name="l01725"></a>01725 } <a name="l01726"></a>01726 } <a name="l01727"></a>01727 <a name="l01728"></a><a class="code" href="classKLocale.html#ab53cd9306c0f6c56df45567e41859a59">01728</a> <a class="codeRef" href="qtime.html">QTime</a> <a class="code" href="classKLocale.html#ab53cd9306c0f6c56df45567e41859a59" title="Converts a localized time string to a QTime.">KLocale::readTime</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> &intstr, <span class="keywordtype">bool</span> *ok)<span class="keyword"> const</span> <a name="l01729"></a>01729 <span class="keyword"></span>{ <a name="l01730"></a>01730 <a class="codeRef" href="qtime.html">QTime</a> _time; <a name="l01731"></a>01731 _time = <a class="code" href="classKLocale.html#ab53cd9306c0f6c56df45567e41859a59" title="Converts a localized time string to a QTime.">readTime</a>(intstr, WithSeconds, ok); <a name="l01732"></a>01732 <span class="keywordflow">if</span> (_time.<a class="codeRef" href="qtime.html#isValid">isValid</a>()) <span class="keywordflow">return</span> _time; <a name="l01733"></a>01733 <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#ab53cd9306c0f6c56df45567e41859a59" title="Converts a localized time string to a QTime.">readTime</a>(intstr, WithoutSeconds, ok); <a name="l01734"></a>01734 } <a name="l01735"></a>01735 <a name="l01736"></a><a class="code" href="classKLocale.html#a48bd5f986fd51e13726fc5e0c4bd302f">01736</a> <a class="codeRef" href="qtime.html">QTime</a> <a class="code" href="classKLocale.html#ab53cd9306c0f6c56df45567e41859a59" title="Converts a localized time string to a QTime.">KLocale::readTime</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> &intstr, ReadTimeFlags flags, <span class="keywordtype">bool</span> *ok)<span class="keyword"> const</span> <a name="l01737"></a>01737 <span class="keyword"></span>{ <a name="l01738"></a>01738 <a class="codeRef" href="qstring.html">QString</a> str = intstr.<a class="codeRef" href="qstring.html#simplifyWhiteSpace">simplifyWhiteSpace</a>().lower(); <a name="l01739"></a>01739 <a class="codeRef" href="qstring.html">QString</a> Format = <a class="code" href="classKLocale.html#a6c4edc8a58413e1d0625abb96325b294" title="Returns the currently selected time format.">timeFormat</a>().<a class="codeRef" href="qstring.html#simplifyWhiteSpace">simplifyWhiteSpace</a>(); <a name="l01740"></a>01740 <span class="keywordflow">if</span> (flags & WithoutSeconds) <a name="l01741"></a>01741 Format.<a class="codeRef" href="qstring.html#remove">remove</a>(<a class="codeRef" href="qregexp.html">QRegExp</a>(<span class="stringliteral">".%S"</span>)); <a name="l01742"></a>01742 <a name="l01743"></a>01743 <span class="keywordtype">int</span> hour = -1, minute = -1; <a name="l01744"></a>01744 <span class="keywordtype">int</span> second = ( (flags & WithoutSeconds) == 0 ) ? -1 : 0; <span class="comment">// don't require seconds</span> <a name="l01745"></a>01745 <span class="keywordtype">bool</span> g_12h = <span class="keyword">false</span>; <a name="l01746"></a>01746 <span class="keywordtype">bool</span> pm = <span class="keyword">false</span>; <a name="l01747"></a>01747 uint strpos = 0; <a name="l01748"></a>01748 uint Formatpos = 0; <a name="l01749"></a>01749 <a name="l01750"></a>01750 <span class="keywordflow">while</span> (Format.<a class="codeRef" href="qstring.html#length">length</a>() > Formatpos || str.<a class="codeRef" href="qstring.html#length">length</a>() > strpos) <a name="l01751"></a>01751 { <a name="l01752"></a>01752 <span class="keywordflow">if</span> ( !(Format.<a class="codeRef" href="qstring.html#length">length</a>() > Formatpos && str.<a class="codeRef" href="qstring.html#length">length</a>() > strpos) ) <span class="keywordflow">goto</span> error; <a name="l01753"></a>01753 <a name="l01754"></a>01754 <a class="codeRef" href="qchar.html">QChar</a> c = Format.<a class="codeRef" href="qstring.html#at">at</a>(Formatpos++); <a name="l01755"></a>01755 <a name="l01756"></a>01756 <span class="keywordflow">if</span> (c != <span class="charliteral">'%'</span>) <a name="l01757"></a>01757 { <a name="l01758"></a>01758 <span class="keywordflow">if</span> (c.<a class="codeRef" href="qchar.html#isSpace">isSpace</a>()) <a name="l01759"></a>01759 strpos++; <a name="l01760"></a>01760 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (c != str.<a class="codeRef" href="qstring.html#at">at</a>(strpos++)) <a name="l01761"></a>01761 <span class="keywordflow">goto</span> error; <a name="l01762"></a>01762 <span class="keywordflow">continue</span>; <a name="l01763"></a>01763 } <a name="l01764"></a>01764 <a name="l01765"></a>01765 <span class="comment">// remove space at the beginning</span> <a name="l01766"></a>01766 <span class="keywordflow">if</span> (str.<a class="codeRef" href="qstring.html#length">length</a>() > strpos && str.<a class="codeRef" href="qstring.html#at">at</a>(strpos).isSpace()) <a name="l01767"></a>01767 strpos++; <a name="l01768"></a>01768 <a name="l01769"></a>01769 c = Format.<a class="codeRef" href="qstring.html#at">at</a>(Formatpos++); <a name="l01770"></a>01770 <span class="keywordflow">switch</span> (c) <a name="l01771"></a>01771 { <a name="l01772"></a>01772 <span class="keywordflow">case</span> <span class="charliteral">'p'</span>: <a name="l01773"></a>01773 { <a name="l01774"></a>01774 <a class="codeRef" href="qstring.html">QString</a> s; <a name="l01775"></a>01775 s = <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"pm"</span>).<a class="codeRef" href="qstring.html#lower">lower</a>(); <a name="l01776"></a>01776 <span class="keywordtype">int</span> len = s.<a class="codeRef" href="qstring.html#length">length</a>(); <a name="l01777"></a>01777 <span class="keywordflow">if</span> (str.<a class="codeRef" href="qstring.html#mid">mid</a>(strpos, len) == s) <a name="l01778"></a>01778 { <a name="l01779"></a>01779 pm = <span class="keyword">true</span>; <a name="l01780"></a>01780 strpos += len; <a name="l01781"></a>01781 } <a name="l01782"></a>01782 <span class="keywordflow">else</span> <a name="l01783"></a>01783 { <a name="l01784"></a>01784 s = <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"am"</span>).<a class="codeRef" href="qstring.html#lower">lower</a>(); <a name="l01785"></a>01785 len = s.<a class="codeRef" href="qstring.html#length">length</a>(); <a name="l01786"></a>01786 <span class="keywordflow">if</span> (str.<a class="codeRef" href="qstring.html#mid">mid</a>(strpos, len) == s) { <a name="l01787"></a>01787 pm = <span class="keyword">false</span>; <a name="l01788"></a>01788 strpos += len; <a name="l01789"></a>01789 } <a name="l01790"></a>01790 <span class="keywordflow">else</span> <a name="l01791"></a>01791 <span class="keywordflow">goto</span> error; <a name="l01792"></a>01792 } <a name="l01793"></a>01793 } <a name="l01794"></a>01794 <span class="keywordflow">break</span>; <a name="l01795"></a>01795 <a name="l01796"></a>01796 <span class="keywordflow">case</span> <span class="charliteral">'k'</span>: <a name="l01797"></a>01797 <span class="keywordflow">case</span> <span class="charliteral">'H'</span>: <a name="l01798"></a>01798 g_12h = <span class="keyword">false</span>; <a name="l01799"></a>01799 hour = readInt(str, strpos); <a name="l01800"></a>01800 <span class="keywordflow">if</span> (hour < 0 || hour > 23) <a name="l01801"></a>01801 <span class="keywordflow">goto</span> error; <a name="l01802"></a>01802 <a name="l01803"></a>01803 <span class="keywordflow">break</span>; <a name="l01804"></a>01804 <a name="l01805"></a>01805 <span class="keywordflow">case</span> <span class="charliteral">'l'</span>: <a name="l01806"></a>01806 <span class="keywordflow">case</span> <span class="charliteral">'I'</span>: <a name="l01807"></a>01807 g_12h = <span class="keyword">true</span>; <a name="l01808"></a>01808 hour = readInt(str, strpos); <a name="l01809"></a>01809 <span class="keywordflow">if</span> (hour < 1 || hour > 12) <a name="l01810"></a>01810 <span class="keywordflow">goto</span> error; <a name="l01811"></a>01811 <a name="l01812"></a>01812 <span class="keywordflow">break</span>; <a name="l01813"></a>01813 <a name="l01814"></a>01814 <span class="keywordflow">case</span> <span class="charliteral">'M'</span>: <a name="l01815"></a>01815 minute = readInt(str, strpos); <a name="l01816"></a>01816 <span class="keywordflow">if</span> (minute < 0 || minute > 59) <a name="l01817"></a>01817 <span class="keywordflow">goto</span> error; <a name="l01818"></a>01818 <a name="l01819"></a>01819 <span class="keywordflow">break</span>; <a name="l01820"></a>01820 <a name="l01821"></a>01821 <span class="keywordflow">case</span> <span class="charliteral">'S'</span>: <a name="l01822"></a>01822 second = readInt(str, strpos); <a name="l01823"></a>01823 <span class="keywordflow">if</span> (second < 0 || second > 59) <a name="l01824"></a>01824 <span class="keywordflow">goto</span> error; <a name="l01825"></a>01825 <a name="l01826"></a>01826 <span class="keywordflow">break</span>; <a name="l01827"></a>01827 } <a name="l01828"></a>01828 } <a name="l01829"></a>01829 <span class="keywordflow">if</span> (g_12h) { <a name="l01830"></a>01830 hour %= 12; <a name="l01831"></a>01831 <span class="keywordflow">if</span> (pm) hour += 12; <a name="l01832"></a>01832 } <a name="l01833"></a>01833 <a name="l01834"></a>01834 <span class="keywordflow">if</span> (ok) *ok = <span class="keyword">true</span>; <a name="l01835"></a>01835 <span class="keywordflow">return</span> <a class="codeRef" href="qtime.html">QTime</a>(hour, minute, second); <a name="l01836"></a>01836 <a name="l01837"></a>01837 error: <a name="l01838"></a>01838 <span class="keywordflow">if</span> (ok) *ok = <span class="keyword">false</span>; <a name="l01839"></a>01839 <span class="comment">// ######## KDE4: remove this</span> <a name="l01840"></a>01840 <span class="keywordflow">return</span> <a class="codeRef" href="qtime.html">QTime</a>(-1, -1, -1); <span class="comment">// return invalid date if it didn't work</span> <a name="l01841"></a>01841 } <a name="l01842"></a>01842 <a name="l01843"></a>01843 <span class="comment">//BIC: merge with below</span> <a name="l01844"></a><a class="code" href="classKLocale.html#a088cc3f312fb09e0106cd44ae11bbf79">01844</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#ac087ff0bf770af77b718d3c44ec1e820" title="Returns a string formatted to the current locale's conventions regarding times.">KLocale::formatTime</a>(<span class="keyword">const</span> <a class="codeRef" href="qtime.html">QTime</a> &pTime, <span class="keywordtype">bool</span> includeSecs)<span class="keyword"> const</span> <a name="l01845"></a>01845 <span class="keyword"></span>{ <a name="l01846"></a>01846 <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#ac087ff0bf770af77b718d3c44ec1e820" title="Returns a string formatted to the current locale's conventions regarding times.">formatTime</a>( pTime, includeSecs, <span class="keyword">false</span> ); <a name="l01847"></a>01847 } <a name="l01848"></a>01848 <a name="l01849"></a><a class="code" href="classKLocale.html#ac087ff0bf770af77b718d3c44ec1e820">01849</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#ac087ff0bf770af77b718d3c44ec1e820" title="Returns a string formatted to the current locale's conventions regarding times.">KLocale::formatTime</a>(<span class="keyword">const</span> <a class="codeRef" href="qtime.html">QTime</a> &pTime, <span class="keywordtype">bool</span> includeSecs, <span class="keywordtype">bool</span> isDuration)<span class="keyword"> const</span> <a name="l01850"></a>01850 <span class="keyword"></span>{ <a name="l01851"></a>01851 <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> rst = <a class="code" href="classKLocale.html#a6c4edc8a58413e1d0625abb96325b294" title="Returns the currently selected time format.">timeFormat</a>(); <a name="l01852"></a>01852 <a name="l01853"></a>01853 <span class="comment">// only "pm/am" here can grow, the rest shrinks, but</span> <a name="l01854"></a>01854 <span class="comment">// I'm rather safe than sorry</span> <a name="l01855"></a>01855 <a class="codeRef" href="qchar.html">QChar</a> *buffer = <span class="keyword">new</span> <a class="codeRef" href="qchar.html">QChar</a>[rst.<a class="codeRef" href="qstring.html#length">length</a>() * 3 / 2 + 30]; <a name="l01856"></a>01856 <a name="l01857"></a>01857 uint index = 0; <a name="l01858"></a>01858 <span class="keywordtype">bool</span> escape = <span class="keyword">false</span>; <a name="l01859"></a>01859 <span class="keywordtype">int</span> number = 0; <a name="l01860"></a>01860 <a name="l01861"></a>01861 <span class="keywordflow">for</span> ( uint format_index = 0; format_index < rst.<a class="codeRef" href="qstring.html#length">length</a>(); format_index++ ) <a name="l01862"></a>01862 { <a name="l01863"></a>01863 <span class="keywordflow">if</span> ( !escape ) <a name="l01864"></a>01864 { <a name="l01865"></a>01865 <span class="keywordflow">if</span> ( rst.<a class="codeRef" href="qstring.html#at">at</a>( format_index ).unicode() == <span class="charliteral">'%'</span> ) <a name="l01866"></a>01866 escape = <span class="keyword">true</span>; <a name="l01867"></a>01867 <span class="keywordflow">else</span> <a name="l01868"></a>01868 buffer[index++] = rst.<a class="codeRef" href="qstring.html#at">at</a>( format_index ); <a name="l01869"></a>01869 } <a name="l01870"></a>01870 <span class="keywordflow">else</span> <a name="l01871"></a>01871 { <a name="l01872"></a>01872 <span class="keywordflow">switch</span> ( rst.<a class="codeRef" href="qstring.html#at">at</a>( format_index ).unicode() ) <a name="l01873"></a>01873 { <a name="l01874"></a>01874 <span class="keywordflow">case</span> <span class="charliteral">'%'</span>: <a name="l01875"></a>01875 buffer[index++] = <span class="charliteral">'%'</span>; <a name="l01876"></a>01876 <span class="keywordflow">break</span>; <a name="l01877"></a>01877 <span class="keywordflow">case</span> <span class="charliteral">'H'</span>: <a name="l01878"></a>01878 put_it_in( buffer, index, pTime.<a class="codeRef" href="qtime.html#hour">hour</a>() ); <a name="l01879"></a>01879 <span class="keywordflow">break</span>; <a name="l01880"></a>01880 <span class="keywordflow">case</span> <span class="charliteral">'I'</span>: <a name="l01881"></a>01881 <span class="keywordflow">if</span> ( isDuration ) <a name="l01882"></a>01882 put_it_in( buffer, index, pTime.<a class="codeRef" href="qtime.html#hour">hour</a>() ); <a name="l01883"></a>01883 <span class="keywordflow">else</span> <a name="l01884"></a>01884 put_it_in( buffer, index, ( pTime.<a class="codeRef" href="qtime.html#hour">hour</a>() + 11) % 12 + 1 ); <a name="l01885"></a>01885 <span class="keywordflow">break</span>; <a name="l01886"></a>01886 <span class="keywordflow">case</span> <span class="charliteral">'M'</span>: <a name="l01887"></a>01887 put_it_in( buffer, index, pTime.<a class="codeRef" href="qtime.html#minute">minute</a>() ); <a name="l01888"></a>01888 <span class="keywordflow">break</span>; <a name="l01889"></a>01889 <span class="keywordflow">case</span> <span class="charliteral">'S'</span>: <a name="l01890"></a>01890 <span class="keywordflow">if</span> (includeSecs) <a name="l01891"></a>01891 put_it_in( buffer, index, pTime.<a class="codeRef" href="qtime.html#second">second</a>() ); <a name="l01892"></a>01892 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( index > 0 ) <a name="l01893"></a>01893 { <a name="l01894"></a>01894 <span class="comment">// we remove the separator sign before the seconds and</span> <a name="l01895"></a>01895 <span class="comment">// assume that works everywhere</span> <a name="l01896"></a>01896 --index; <a name="l01897"></a>01897 <span class="keywordflow">break</span>; <a name="l01898"></a>01898 } <a name="l01899"></a>01899 <span class="keywordflow">break</span>; <a name="l01900"></a>01900 <span class="keywordflow">case</span> <span class="charliteral">'k'</span>: <a name="l01901"></a>01901 number = pTime.<a class="codeRef" href="qtime.html#hour">hour</a>(); <a name="l01902"></a>01902 <span class="keywordflow">case</span> <span class="charliteral">'l'</span>: <a name="l01903"></a>01903 <span class="comment">// to share the code</span> <a name="l01904"></a>01904 <span class="keywordflow">if</span> ( rst.<a class="codeRef" href="qstring.html#at">at</a>( format_index ).unicode() == <span class="charliteral">'l'</span> ) <a name="l01905"></a>01905 number = isDuration ? pTime.<a class="codeRef" href="qtime.html#hour">hour</a>() : (pTime.<a class="codeRef" href="qtime.html#hour">hour</a>() + 11) % 12 + 1; <a name="l01906"></a>01906 <span class="keywordflow">if</span> ( number / 10 ) <a name="l01907"></a>01907 buffer[index++] = number / 10 + <span class="charliteral">'0'</span>; <a name="l01908"></a>01908 buffer[index++] = number % 10 + <span class="charliteral">'0'</span>; <a name="l01909"></a>01909 <span class="keywordflow">break</span>; <a name="l01910"></a>01910 <span class="keywordflow">case</span> <span class="charliteral">'p'</span>: <a name="l01911"></a>01911 <span class="keywordflow">if</span> ( !isDuration ) <a name="l01912"></a>01912 { <a name="l01913"></a>01913 <a class="codeRef" href="qstring.html">QString</a> s; <a name="l01914"></a>01914 <span class="keywordflow">if</span> ( pTime.<a class="codeRef" href="qtime.html#hour">hour</a>() >= 12 ) <a name="l01915"></a>01915 put_it_in( buffer, index, <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"pm"</span>) ); <a name="l01916"></a>01916 <span class="keywordflow">else</span> <a name="l01917"></a>01917 put_it_in( buffer, index, <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"am"</span>) ); <a name="l01918"></a>01918 } <a name="l01919"></a>01919 <span class="keywordflow">break</span>; <a name="l01920"></a>01920 <span class="keywordflow">default</span>: <a name="l01921"></a>01921 buffer[index++] = rst.<a class="codeRef" href="qstring.html#at">at</a>( format_index ); <a name="l01922"></a>01922 <span class="keywordflow">break</span>; <a name="l01923"></a>01923 } <a name="l01924"></a>01924 escape = <span class="keyword">false</span>; <a name="l01925"></a>01925 } <a name="l01926"></a>01926 } <a name="l01927"></a>01927 <a class="codeRef" href="qstring.html">QString</a> ret( buffer, index ); <a name="l01928"></a>01928 <span class="keyword">delete</span> [] buffer; <a name="l01929"></a>01929 <span class="keywordflow">if</span> ( isDuration ) <span class="comment">// eliminate trailing-space due to " %p"</span> <a name="l01930"></a>01930 <span class="keywordflow">return</span> ret.<a class="codeRef" href="qstring.html#stripWhiteSpace">stripWhiteSpace</a>(); <a name="l01931"></a>01931 <span class="keywordflow">else</span> <a name="l01932"></a>01932 <span class="keywordflow">return</span> ret; <a name="l01933"></a>01933 } <a name="l01934"></a>01934 <a name="l01935"></a><a class="code" href="classKLocale.html#a4620ade3e95ff23fddcb68fef301243d">01935</a> <span class="keywordtype">bool</span> <a class="code" href="classKLocale.html#a4620ade3e95ff23fddcb68fef301243d" title="Use this to determine if the user wants a 12 hour clock.">KLocale::use12Clock</a>()<span class="keyword"> const</span> <a name="l01936"></a>01936 <span class="keyword"></span>{ <a name="l01937"></a>01937 <span class="keywordflow">if</span> ((<a class="code" href="classKLocale.html#a6c4edc8a58413e1d0625abb96325b294" title="Returns the currently selected time format.">timeFormat</a>().contains(<a class="codeRef" href="qstring.html#fromLatin1">QString::fromLatin1</a>(<span class="stringliteral">"%I"</span>)) > 0) || <a name="l01938"></a>01938 (<a class="code" href="classKLocale.html#a6c4edc8a58413e1d0625abb96325b294" title="Returns the currently selected time format.">timeFormat</a>().contains(<a class="codeRef" href="qstring.html#fromLatin1">QString::fromLatin1</a>(<span class="stringliteral">"%l"</span>)) > 0)) <a name="l01939"></a>01939 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l01940"></a>01940 <span class="keywordflow">else</span> <a name="l01941"></a>01941 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l01942"></a>01942 } <a name="l01943"></a>01943 <a name="l01944"></a><a class="code" href="classKLocale.html#ac53fb74d02453784179ddd54c4ff14ea">01944</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#ac53fb74d02453784179ddd54c4ff14ea">KLocale::languages</a>()<span class="keyword"> const</span> <a name="l01945"></a>01945 <span class="keyword"></span>{ <a name="l01946"></a>01946 <span class="keywordflow">return</span> d->languageList.join( <a class="codeRef" href="qstring.html#fromLatin1">QString::fromLatin1</a>(<span class="stringliteral">":"</span>) ); <a name="l01947"></a>01947 } <a name="l01948"></a>01948 <a name="l01949"></a><a class="code" href="classKLocale.html#a53da146b33285ca9cbcdca8306039eb2">01949</a> <a class="codeRef" href="qstringlist.html">QStringList</a> <a class="code" href="classKLocale.html#a53da146b33285ca9cbcdca8306039eb2" title="Returns the languages selected by user.">KLocale::languageList</a>()<span class="keyword"> const</span> <a name="l01950"></a>01950 <span class="keyword"></span>{ <a name="l01951"></a>01951 <span class="keywordflow">return</span> d->languageList; <a name="l01952"></a>01952 } <a name="l01953"></a>01953 <a name="l01954"></a><a class="code" href="classKLocale.html#aa8815c4d9c7ce38c88721aab826aff83">01954</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#aa8815c4d9c7ce38c88721aab826aff83" title="Returns a string formated to the current locale's conventions regarding both date and time...">KLocale::formatDateTime</a>(<span class="keyword">const</span> <a class="codeRef" href="qdatetime.html">QDateTime</a> &pDateTime, <a name="l01955"></a>01955 <span class="keywordtype">bool</span> shortFormat, <a name="l01956"></a>01956 <span class="keywordtype">bool</span> includeSeconds)<span class="keyword"> const</span> <a name="l01957"></a>01957 <span class="keyword"></span>{ <a name="l01958"></a>01958 <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(<span class="stringliteral">"concatenation of dates and time"</span>, <span class="stringliteral">"%1 %2"</span>) <a name="l01959"></a>01959 .<a class="codeRef" href="qstring.html#arg">arg</a>( <a class="code" href="classKLocale.html#adb35e2b0a666be6bca297ee4a40c4f89" title="Returns a string formatted to the current locale's conventions regarding dates.">formatDate</a>( pDateTime.<a class="codeRef" href="qdatetime.html#date">date</a>(), shortFormat ) ) <a name="l01960"></a>01960 .arg( <a class="code" href="classKLocale.html#ac087ff0bf770af77b718d3c44ec1e820" title="Returns a string formatted to the current locale's conventions regarding times.">formatTime</a>( pDateTime.<a class="codeRef" href="qdatetime.html#time">time</a>(), includeSeconds ) ); <a name="l01961"></a>01961 } <a name="l01962"></a>01962 <a name="l01963"></a><a class="code" href="classKLocale.html#a0eca0239d7b23eb40006d82d6210aa69">01963</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#a0eca0239d7b23eb40006d82d6210aa69">i18n</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* text) <a name="l01964"></a>01964 { <a name="l01965"></a>01965 <span class="keyword">register</span> <a class="code" href="classKLocale.html" title="KLocale provides support for country specific stuff like the national language.">KLocale</a> *instance = <a class="code" href="classKGlobal.html#a8c3e5ecff78f674b94eadfe0eae067e1" title="Returns the global locale object.">KGlobal::locale</a>(); <a name="l01966"></a>01966 <span class="keywordflow">if</span> (instance) <a name="l01967"></a>01967 <span class="keywordflow">return</span> instance-><a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(text); <a name="l01968"></a>01968 <span class="keywordflow">return</span> <a class="codeRef" href="qstring.html#fromUtf8">QString::fromUtf8</a>(text); <a name="l01969"></a>01969 } <a name="l01970"></a>01970 <a name="l01971"></a><a class="code" href="classKLocale.html#a3b5c9212c6fd133d3c028fb4ec93643b">01971</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#a0eca0239d7b23eb40006d82d6210aa69">i18n</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* index, <span class="keyword">const</span> <span class="keywordtype">char</span> *text) <a name="l01972"></a>01972 { <a name="l01973"></a>01973 <span class="keyword">register</span> <a class="code" href="classKLocale.html" title="KLocale provides support for country specific stuff like the national language.">KLocale</a> *instance = <a class="code" href="classKGlobal.html#a8c3e5ecff78f674b94eadfe0eae067e1" title="Returns the global locale object.">KGlobal::locale</a>(); <a name="l01974"></a>01974 <span class="keywordflow">if</span> (instance) <a name="l01975"></a>01975 <span class="keywordflow">return</span> instance-><a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(index, text); <a name="l01976"></a>01976 <span class="keywordflow">return</span> <a class="codeRef" href="qstring.html#fromUtf8">QString::fromUtf8</a>(text); <a name="l01977"></a>01977 } <a name="l01978"></a>01978 <a name="l01979"></a><a class="code" href="classKLocale.html#add2c097d93324f8f868b915a9604353f">01979</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#a0eca0239d7b23eb40006d82d6210aa69">i18n</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* singular, <span class="keyword">const</span> <span class="keywordtype">char</span>* plural, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> n) <a name="l01980"></a>01980 { <a name="l01981"></a>01981 <span class="keyword">register</span> <a class="code" href="classKLocale.html" title="KLocale provides support for country specific stuff like the national language.">KLocale</a> *instance = <a class="code" href="classKGlobal.html#a8c3e5ecff78f674b94eadfe0eae067e1" title="Returns the global locale object.">KGlobal::locale</a>(); <a name="l01982"></a>01982 <span class="keywordflow">if</span> (instance) <a name="l01983"></a>01983 <span class="keywordflow">return</span> instance-><a class="code" href="classKLocale.html#aa9704054436adb5b1ec75cd731304927" title="Translates the string into the corresponding string in the national language, if available.">translate</a>(singular, plural, n); <a name="l01984"></a>01984 <span class="keywordflow">if</span> (n == 1) <a name="l01985"></a>01985 <span class="keywordflow">return</span> put_n_in(<a class="codeRef" href="qstring.html#fromUtf8">QString::fromUtf8</a>(singular), n); <a name="l01986"></a>01986 <span class="keywordflow">else</span> <a name="l01987"></a>01987 <span class="keywordflow">return</span> put_n_in(<a class="codeRef" href="qstring.html#fromUtf8">QString::fromUtf8</a>(plural), n); <a name="l01988"></a>01988 } <a name="l01989"></a>01989 <a name="l01990"></a>01990 <span class="keywordtype">void</span> KLocale::initInstance() <a name="l01991"></a>01991 { <a name="l01992"></a>01992 <span class="keywordflow">if</span> (KGlobal::_locale) <a name="l01993"></a>01993 <span class="keywordflow">return</span>; <a name="l01994"></a>01994 <a name="l01995"></a>01995 <a class="code" href="classKInstance.html" title="Access to KDE global objects for use in shared libraries.">KInstance</a> *app = <a class="code" href="classKGlobal.html#a7005487680376266c61372ea7ff3c080" title="Returns the global instance.">KGlobal::instance</a>(); <a name="l01996"></a>01996 <span class="keywordflow">if</span> (app) { <a name="l01997"></a>01997 KGlobal::_locale = <span class="keyword">new</span> <a class="code" href="classKLocale.html#a71368e476693c57f754bbad641ac35f5" title="Constructs a KLocale with the given catalog name.">KLocale</a>(<a class="codeRef" href="qstring.html#fromLatin1">QString::fromLatin1</a>(app-><a class="code" href="classKInstance.html#a6f97644ef0333d52e9a281aaa78d00ca" title="Returns the name of the instance.">instanceName</a>())); <a name="l01998"></a>01998 <a name="l01999"></a>01999 <span class="comment">// only do this for the global instance</span> <a name="l02000"></a>02000 <a class="codeRef" href="qtextcodec.html#setCodecForLocale">QTextCodec::setCodecForLocale</a>(KGlobal::_locale-><a class="code" href="classKLocale.html#a4e1b718c8e31aeed53702d7e52cfa99b" title="Returns the user's preferred encoding.">codecForEncoding</a>()); <a name="l02001"></a>02001 } <a name="l02002"></a>02002 <span class="keywordflow">else</span> <a name="l02003"></a>02003 kdDebug(173) << <span class="stringliteral">"no app name available using KLocale - nothing to do\n"</span>; <a name="l02004"></a>02004 } <a name="l02005"></a>02005 <a name="l02006"></a><a class="code" href="classKLocale.html#ad7b49bdf3043d6f84beb7dda88625977">02006</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#ad7b49bdf3043d6f84beb7dda88625977" title="Finds localized resource in resourceDir( rtype ) + <lang> + fname.">KLocale::langLookup</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> &fname, <span class="keyword">const</span> <span class="keywordtype">char</span> *rtype) <a name="l02007"></a>02007 { <a name="l02008"></a>02008 <a class="codeRef" href="qstringlist.html">QStringList</a> search; <a name="l02009"></a>02009 <a name="l02010"></a>02010 <span class="comment">// assemble the local search paths</span> <a name="l02011"></a>02011 <span class="keyword">const</span> <a class="codeRef" href="qstringlist.html">QStringList</a> localDoc = <a class="code" href="classKGlobal.html#a431d05bf9a252475846c89769fbff8c1" title="Returns the application standard dirs object.">KGlobal::dirs</a>()-><a class="code" href="classKStandardDirs.html#ab9c60e7d155beb6c273435ff409c7721" title="This function is used internally by almost all other function as it serves and fills the directories ...">resourceDirs</a>(rtype); <a name="l02012"></a>02012 <a name="l02013"></a>02013 <span class="comment">// look up the different languages</span> <a name="l02014"></a>02014 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> <span class="keywordtype">id</span>=localDoc.count()-1; <span class="keywordtype">id</span> >= 0; --id) <a name="l02015"></a>02015 { <a name="l02016"></a>02016 <a class="codeRef" href="qstringlist.html">QStringList</a> langs = <a class="code" href="classKGlobal.html#a8c3e5ecff78f674b94eadfe0eae067e1" title="Returns the global locale object.">KGlobal::locale</a>()-><a class="code" href="classKLocale.html#a53da146b33285ca9cbcdca8306039eb2" title="Returns the languages selected by user.">languageList</a>(); <a name="l02017"></a>02017 langs.append( <span class="stringliteral">"en"</span> ); <a name="l02018"></a>02018 langs.remove( <a class="code" href="classKLocale.html#ac44bcb4778c651d35b5cce6048b63da2" title="Returns the name of the internal language.">defaultLanguage</a>() ); <a name="l02019"></a>02019 QStringList::ConstIterator lang; <a name="l02020"></a>02020 <span class="keywordflow">for</span> (lang = langs.begin(); lang != langs.end(); ++lang) <a name="l02021"></a>02021 search.append(<a class="codeRef" href="qstring.html">QString</a>(<span class="stringliteral">"%1%2/%3"</span>).arg(localDoc[<span class="keywordtype">id</span>]).arg(*lang).<a class="codeRef" href="qstring.html#arg">arg</a>(fname)); <a name="l02022"></a>02022 } <a name="l02023"></a>02023 <a name="l02024"></a>02024 <span class="comment">// try to locate the file</span> <a name="l02025"></a>02025 QStringList::Iterator it; <a name="l02026"></a>02026 <span class="keywordflow">for</span> (it = search.begin(); it != search.end(); ++it) <a name="l02027"></a>02027 { <a name="l02028"></a>02028 kdDebug(173) << <span class="stringliteral">"Looking for help in: "</span> << *it << <a class="code" href="group__kdebug.html#ga313d520ed8f8f6b46eeef22cfb3b082a" title="Does nothing.">endl</a>; <a name="l02029"></a>02029 <a name="l02030"></a>02030 <a class="codeRef" href="qfileinfo.html">QFileInfo</a> info(*it); <a name="l02031"></a>02031 <span class="keywordflow">if</span> (info.<a class="codeRef" href="qfileinfo.html#exists">exists</a>() && info.<a class="codeRef" href="qfileinfo.html#isFile">isFile</a>() && info.<a class="codeRef" href="qfileinfo.html#isReadable">isReadable</a>()) <a name="l02032"></a>02032 <span class="keywordflow">return</span> *it; <a name="l02033"></a>02033 } <a name="l02034"></a>02034 <a name="l02035"></a>02035 <span class="keywordflow">return</span> QString::null; <a name="l02036"></a>02036 } <a name="l02037"></a>02037 <a name="l02038"></a>02038 <span class="keywordtype">bool</span> KLocale::useDefaultLanguage()<span class="keyword"> const</span> <a name="l02039"></a>02039 <span class="keyword"></span>{ <a name="l02040"></a>02040 <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#aba800e1c9ded357356e130d6092593a8" title="Returns the language used by this object.">language</a>() == <a class="code" href="classKLocale.html#ac44bcb4778c651d35b5cce6048b63da2" title="Returns the name of the internal language.">defaultLanguage</a>(); <a name="l02041"></a>02041 } <a name="l02042"></a>02042 <a name="l02043"></a>02043 <span class="keywordtype">void</span> KLocale::initEncoding(<a class="code" href="classKConfig.html" title="Access KDE Configuration entries.">KConfig</a> *) <a name="l02044"></a>02044 { <a name="l02045"></a>02045 <span class="keyword">const</span> <span class="keywordtype">int</span> mibDefault = 4; <span class="comment">// ISO 8859-1</span> <a name="l02046"></a>02046 <a name="l02047"></a>02047 <span class="comment">// This all made more sense when we still had the EncodingEnum config key.</span> <a name="l02048"></a>02048 <a class="code" href="classKLocale.html#a276df14c2d1cbd93e1aac41706bdd3be" title="Changes the current encoding.">setEncoding</a>( <a class="codeRef" href="qtextcodec.html#codecForLocale">QTextCodec::codecForLocale</a>()->mibEnum() ); <a name="l02049"></a>02049 <a name="l02050"></a>02050 <span class="keywordflow">if</span> ( !d->codecForEncoding ) <a name="l02051"></a>02051 { <a name="l02052"></a>02052 kdWarning(173) << <span class="stringliteral">" Defaulting to ISO 8859-1 encoding."</span> << <a class="code" href="group__kdebug.html#ga313d520ed8f8f6b46eeef22cfb3b082a" title="Does nothing.">endl</a>; <a name="l02053"></a>02053 <a class="code" href="classKLocale.html#a276df14c2d1cbd93e1aac41706bdd3be" title="Changes the current encoding.">setEncoding</a>(mibDefault); <a name="l02054"></a>02054 } <a name="l02055"></a>02055 <a name="l02056"></a>02056 Q_ASSERT( d->codecForEncoding ); <a name="l02057"></a>02057 } <a name="l02058"></a>02058 <a name="l02059"></a>02059 <span class="keywordtype">void</span> KLocale::initFileNameEncoding(<a class="code" href="classKConfig.html" title="Access KDE Configuration entries.">KConfig</a> *) <a name="l02060"></a>02060 { <a name="l02061"></a>02061 <span class="comment">// If the following environment variable is set, assume all filenames</span> <a name="l02062"></a>02062 <span class="comment">// are in UTF-8 regardless of the current C locale.</span> <a name="l02063"></a>02063 d->utf8FileEncoding = getenv(<span class="stringliteral">"KDE_UTF8_FILENAMES"</span>) != 0; <a name="l02064"></a>02064 <span class="keywordflow">if</span> (d->utf8FileEncoding) <a name="l02065"></a>02065 { <a name="l02066"></a>02066 <a class="codeRef" href="qfile.html#setEncodingFunction">QFile::setEncodingFunction</a>(KLocale::encodeFileNameUTF8); <a name="l02067"></a>02067 <a class="codeRef" href="qfile.html#setDecodingFunction">QFile::setDecodingFunction</a>(KLocale::decodeFileNameUTF8); <a name="l02068"></a>02068 } <a name="l02069"></a>02069 <span class="comment">// Otherwise, stay with QFile's default filename encoding functions</span> <a name="l02070"></a>02070 <span class="comment">// which, on Unix platforms, use the locale's codec.</span> <a name="l02071"></a>02071 } <a name="l02072"></a>02072 <a name="l02073"></a>02073 <a class="codeRef" href="qcstring.html">QCString</a> KLocale::encodeFileNameUTF8( <span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> & fileName ) <a name="l02074"></a>02074 { <a name="l02075"></a>02075 <span class="keywordflow">return</span> fileName.<a class="codeRef" href="qstring.html#utf8">utf8</a>(); <a name="l02076"></a>02076 } <a name="l02077"></a>02077 <a name="l02078"></a>02078 <a class="codeRef" href="qstring.html">QString</a> KLocale::decodeFileNameUTF8( <span class="keyword">const</span> <a class="codeRef" href="qcstring.html">QCString</a> & localFileName ) <a name="l02079"></a>02079 { <a name="l02080"></a>02080 <span class="keywordflow">return</span> <a class="codeRef" href="qstring.html#fromUtf8">QString::fromUtf8</a>(localFileName); <a name="l02081"></a>02081 } <a name="l02082"></a>02082 <a name="l02083"></a><a class="code" href="classKLocale.html#a5e4ee54f137775bc9b6f59d3af85b009">02083</a> <span class="keywordtype">void</span> <a class="code" href="classKLocale.html#a5e4ee54f137775bc9b6f59d3af85b009" title="Changes the current date format.">KLocale::setDateFormat</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> & format) <a name="l02084"></a>02084 { <a name="l02085"></a>02085 doFormatInit(); <a name="l02086"></a>02086 m_dateFormat = format.<a class="codeRef" href="qstring.html#stripWhiteSpace">stripWhiteSpace</a>(); <a name="l02087"></a>02087 } <a name="l02088"></a>02088 <a name="l02089"></a><a class="code" href="classKLocale.html#ae300f90e49e07fcae28eeb53ad76cc96">02089</a> <span class="keywordtype">void</span> <a class="code" href="classKLocale.html#ae300f90e49e07fcae28eeb53ad76cc96" title="Changes the current short date format.">KLocale::setDateFormatShort</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> & format) <a name="l02090"></a>02090 { <a name="l02091"></a>02091 doFormatInit(); <a name="l02092"></a>02092 m_dateFormatShort = format.<a class="codeRef" href="qstring.html#stripWhiteSpace">stripWhiteSpace</a>(); <a name="l02093"></a>02093 } <a name="l02094"></a>02094 <a name="l02095"></a><a class="code" href="classKLocale.html#a9cba77dc4e23725dcb04734a3219769c">02095</a> <span class="keywordtype">void</span> <a class="code" href="classKLocale.html#a9cba77dc4e23725dcb04734a3219769c" title="Changes the form of month name used in dates.">KLocale::setDateMonthNamePossessive</a>(<span class="keywordtype">bool</span> possessive) <a name="l02096"></a>02096 { <a name="l02097"></a>02097 doFormatInit(); <a name="l02098"></a>02098 d->dateMonthNamePossessive = possessive; <a name="l02099"></a>02099 } <a name="l02100"></a>02100 <a name="l02101"></a><a class="code" href="classKLocale.html#a59728c92b2feb8da7972a8e4c46b9246">02101</a> <span class="keywordtype">void</span> <a class="code" href="classKLocale.html#a59728c92b2feb8da7972a8e4c46b9246" title="Changes the current time format.">KLocale::setTimeFormat</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> & format) <a name="l02102"></a>02102 { <a name="l02103"></a>02103 doFormatInit(); <a name="l02104"></a>02104 m_timeFormat = format.<a class="codeRef" href="qstring.html#stripWhiteSpace">stripWhiteSpace</a>(); <a name="l02105"></a>02105 } <a name="l02106"></a>02106 <a name="l02107"></a><a class="code" href="classKLocale.html#a3794c8578ce28b55c46f7f26aaaa34ce">02107</a> <span class="keywordtype">void</span> <a class="code" href="classKLocale.html#a3794c8578ce28b55c46f7f26aaaa34ce">KLocale::setWeekStartsMonday</a>(<span class="keywordtype">bool</span> start) <span class="comment">//deprecated</span> <a name="l02108"></a>02108 { <a name="l02109"></a>02109 doFormatInit(); <a name="l02110"></a>02110 <span class="keywordflow">if</span> (start) <a name="l02111"></a>02111 d->weekStartDay = 1; <a name="l02112"></a>02112 <span class="keywordflow">else</span> <a name="l02113"></a>02113 d->weekStartDay = 7; <a name="l02114"></a>02114 } <a name="l02115"></a>02115 <a name="l02116"></a><a class="code" href="classKLocale.html#a5687af00bc1beab3004b2a5dc8273a54">02116</a> <span class="keywordtype">void</span> <a class="code" href="classKLocale.html#a5687af00bc1beab3004b2a5dc8273a54" title="Changes how KLocale defines the first day in week.">KLocale::setWeekStartDay</a>(<span class="keywordtype">int</span> day) <a name="l02117"></a>02117 { <a name="l02118"></a>02118 doFormatInit(); <a name="l02119"></a>02119 <span class="keywordflow">if</span> (day>7 || day<1) <a name="l02120"></a>02120 d->weekStartDay = 1; <span class="comment">//Monday is default</span> <a name="l02121"></a>02121 <span class="keywordflow">else</span> <a name="l02122"></a>02122 d->weekStartDay = day; <a name="l02123"></a>02123 } <a name="l02124"></a>02124 <a name="l02125"></a><a class="code" href="classKLocale.html#a8a80f48689c9cde5efc6e16d507ea153">02125</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#a8a80f48689c9cde5efc6e16d507ea153" title="Returns the currently selected date format.">KLocale::dateFormat</a>()<span class="keyword"> const</span> <a name="l02126"></a>02126 <span class="keyword"></span>{ <a name="l02127"></a>02127 doFormatInit(); <a name="l02128"></a>02128 <span class="keywordflow">return</span> m_dateFormat; <a name="l02129"></a>02129 } <a name="l02130"></a>02130 <a name="l02131"></a><a class="code" href="classKLocale.html#a25628f2ed7d48cfadf69c2ae7a1d6e84">02131</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#a25628f2ed7d48cfadf69c2ae7a1d6e84" title="Returns the currently selected short date format.">KLocale::dateFormatShort</a>()<span class="keyword"> const</span> <a name="l02132"></a>02132 <span class="keyword"></span>{ <a name="l02133"></a>02133 doFormatInit(); <a name="l02134"></a>02134 <span class="keywordflow">return</span> m_dateFormatShort; <a name="l02135"></a>02135 } <a name="l02136"></a>02136 <a name="l02137"></a><a class="code" href="classKLocale.html#a6c4edc8a58413e1d0625abb96325b294">02137</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#a6c4edc8a58413e1d0625abb96325b294" title="Returns the currently selected time format.">KLocale::timeFormat</a>()<span class="keyword"> const</span> <a name="l02138"></a>02138 <span class="keyword"></span>{ <a name="l02139"></a>02139 doFormatInit(); <a name="l02140"></a>02140 <span class="keywordflow">return</span> m_timeFormat; <a name="l02141"></a>02141 } <a name="l02142"></a>02142 <a name="l02143"></a><a class="code" href="classKLocale.html#a6e6b92e1984901675b617c45b5814bdd">02143</a> <span class="keywordtype">void</span> <a class="code" href="classKLocale.html#a6e6b92e1984901675b617c45b5814bdd" title="Changes the symbol used to identify the decimal pointer.">KLocale::setDecimalSymbol</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> & symbol) <a name="l02144"></a>02144 { <a name="l02145"></a>02145 doFormatInit(); <a name="l02146"></a>02146 m_decimalSymbol = symbol.<a class="codeRef" href="qstring.html#stripWhiteSpace">stripWhiteSpace</a>(); <a name="l02147"></a>02147 } <a name="l02148"></a>02148 <a name="l02149"></a><a class="code" href="classKLocale.html#a989fc8180d1cd77ff2f5438d5e58d704">02149</a> <span class="keywordtype">void</span> <a class="code" href="classKLocale.html#a989fc8180d1cd77ff2f5438d5e58d704" title="Changes the separator used to group digits when formating numbers.">KLocale::setThousandsSeparator</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> & separator) <a name="l02150"></a>02150 { <a name="l02151"></a>02151 doFormatInit(); <a name="l02152"></a>02152 <span class="comment">// allow spaces here</span> <a name="l02153"></a>02153 m_thousandsSeparator = separator; <a name="l02154"></a>02154 } <a name="l02155"></a>02155 <a name="l02156"></a><a class="code" href="classKLocale.html#a2782ecc042ba50b23cee690e0ccf9fba">02156</a> <span class="keywordtype">void</span> <a class="code" href="classKLocale.html#a2782ecc042ba50b23cee690e0ccf9fba" title="Changes the sign used to identify a positive number.">KLocale::setPositiveSign</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> & sign) <a name="l02157"></a>02157 { <a name="l02158"></a>02158 doFormatInit(); <a name="l02159"></a>02159 m_positiveSign = sign.<a class="codeRef" href="qstring.html#stripWhiteSpace">stripWhiteSpace</a>(); <a name="l02160"></a>02160 } <a name="l02161"></a>02161 <a name="l02162"></a><a class="code" href="classKLocale.html#ab3ef22e1d2282403823419c11db84d88">02162</a> <span class="keywordtype">void</span> <a class="code" href="classKLocale.html#ab3ef22e1d2282403823419c11db84d88" title="Changes the sign used to identify a negative number.">KLocale::setNegativeSign</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> & sign) <a name="l02163"></a>02163 { <a name="l02164"></a>02164 doFormatInit(); <a name="l02165"></a>02165 m_negativeSign = sign.<a class="codeRef" href="qstring.html#stripWhiteSpace">stripWhiteSpace</a>(); <a name="l02166"></a>02166 } <a name="l02167"></a>02167 <a name="l02168"></a><a class="code" href="classKLocale.html#a671a887754c562b26c0a1f5b1c0c7159">02168</a> <span class="keywordtype">void</span> <a class="code" href="classKLocale.html#a671a887754c562b26c0a1f5b1c0c7159" title="Changes the sign position used for positive monetary values.">KLocale::setPositiveMonetarySignPosition</a>(<a class="code" href="classKLocale.html#a2871a581bfe0179b1068a3ebfb6cbc51" title="Various positions for where to place the positive or negative sign when they are related to a monetar...">SignPosition</a> signpos) <a name="l02169"></a>02169 { <a name="l02170"></a>02170 doFormatInit(); <a name="l02171"></a>02171 m_positiveMonetarySignPosition = signpos; <a name="l02172"></a>02172 } <a name="l02173"></a>02173 <a name="l02174"></a><a class="code" href="classKLocale.html#ae6e45843ec7dd36c80e7b5375d326794">02174</a> <span class="keywordtype">void</span> <a class="code" href="classKLocale.html#ae6e45843ec7dd36c80e7b5375d326794" title="Changes the sign position used for negative monetary values.">KLocale::setNegativeMonetarySignPosition</a>(<a class="code" href="classKLocale.html#a2871a581bfe0179b1068a3ebfb6cbc51" title="Various positions for where to place the positive or negative sign when they are related to a monetar...">SignPosition</a> signpos) <a name="l02175"></a>02175 { <a name="l02176"></a>02176 doFormatInit(); <a name="l02177"></a>02177 m_negativeMonetarySignPosition = signpos; <a name="l02178"></a>02178 } <a name="l02179"></a>02179 <a name="l02180"></a><a class="code" href="classKLocale.html#a00abe12527449926ea0f59470473afca">02180</a> <span class="keywordtype">void</span> <a class="code" href="classKLocale.html#a00abe12527449926ea0f59470473afca" title="Changes the position where the currency symbol should be printed for positive monetary values...">KLocale::setPositivePrefixCurrencySymbol</a>(<span class="keywordtype">bool</span> prefix) <a name="l02181"></a>02181 { <a name="l02182"></a>02182 doFormatInit(); <a name="l02183"></a>02183 m_positivePrefixCurrencySymbol = prefix; <a name="l02184"></a>02184 } <a name="l02185"></a>02185 <a name="l02186"></a><a class="code" href="classKLocale.html#afcc5ee91d310644f7c8b5c65ad7db6ce">02186</a> <span class="keywordtype">void</span> <a class="code" href="classKLocale.html#afcc5ee91d310644f7c8b5c65ad7db6ce" title="Changes the position where the currency symbol should be printed for negative monetary values...">KLocale::setNegativePrefixCurrencySymbol</a>(<span class="keywordtype">bool</span> prefix) <a name="l02187"></a>02187 { <a name="l02188"></a>02188 doFormatInit(); <a name="l02189"></a>02189 m_negativePrefixCurrencySymbol = prefix; <a name="l02190"></a>02190 } <a name="l02191"></a>02191 <a name="l02192"></a><a class="code" href="classKLocale.html#a8b184fc67beeb9e59578572e4f4c6e83">02192</a> <span class="keywordtype">void</span> <a class="code" href="classKLocale.html#a8b184fc67beeb9e59578572e4f4c6e83" title="Changes the number of digits used when formating numbers.">KLocale::setFracDigits</a>(<span class="keywordtype">int</span> digits) <a name="l02193"></a>02193 { <a name="l02194"></a>02194 doFormatInit(); <a name="l02195"></a>02195 m_fracDigits = digits; <a name="l02196"></a>02196 } <a name="l02197"></a>02197 <a name="l02198"></a><a class="code" href="classKLocale.html#a9babc705c53ff9d7a2b6c1b359550d9d">02198</a> <span class="keywordtype">void</span> <a class="code" href="classKLocale.html#a9babc705c53ff9d7a2b6c1b359550d9d" title="Changes the separator used to group digits when formating monetary values.">KLocale::setMonetaryThousandsSeparator</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> & separator) <a name="l02199"></a>02199 { <a name="l02200"></a>02200 doFormatInit(); <a name="l02201"></a>02201 <span class="comment">// allow spaces here</span> <a name="l02202"></a>02202 m_monetaryThousandsSeparator = separator; <a name="l02203"></a>02203 } <a name="l02204"></a>02204 <a name="l02205"></a><a class="code" href="classKLocale.html#a119bd34e23fcd6ff549c4ec68f66b5f1">02205</a> <span class="keywordtype">void</span> <a class="code" href="classKLocale.html#a119bd34e23fcd6ff549c4ec68f66b5f1" title="Changes the symbol used to identify the decimal pointer for monetary values.">KLocale::setMonetaryDecimalSymbol</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> & symbol) <a name="l02206"></a>02206 { <a name="l02207"></a>02207 doFormatInit(); <a name="l02208"></a>02208 m_monetaryDecimalSymbol = symbol.<a class="codeRef" href="qstring.html#stripWhiteSpace">stripWhiteSpace</a>(); <a name="l02209"></a>02209 } <a name="l02210"></a>02210 <a name="l02211"></a><a class="code" href="classKLocale.html#a9afe6f62e29765d7e03f07cb7ddfc954">02211</a> <span class="keywordtype">void</span> <a class="code" href="classKLocale.html#a9afe6f62e29765d7e03f07cb7ddfc954" title="Changes the current currency symbol.">KLocale::setCurrencySymbol</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> & symbol) <a name="l02212"></a>02212 { <a name="l02213"></a>02213 doFormatInit(); <a name="l02214"></a>02214 m_currencySymbol = symbol.<a class="codeRef" href="qstring.html#stripWhiteSpace">stripWhiteSpace</a>(); <a name="l02215"></a>02215 } <a name="l02216"></a>02216 <a name="l02217"></a><a class="code" href="classKLocale.html#a87c8ee3b285ffaac36b93bee2f6569af">02217</a> <span class="keywordtype">int</span> <a class="code" href="classKLocale.html#a87c8ee3b285ffaac36b93bee2f6569af" title="Returns the preferred page size for printing.">KLocale::pageSize</a>()<span class="keyword"> const</span> <a name="l02218"></a>02218 <span class="keyword"></span>{ <a name="l02219"></a>02219 doFormatInit(); <a name="l02220"></a>02220 <span class="keywordflow">return</span> d->pageSize; <a name="l02221"></a>02221 } <a name="l02222"></a>02222 <a name="l02223"></a><a class="code" href="classKLocale.html#a88851bc6778ce71323d3c1cb37ff7093">02223</a> <span class="keywordtype">void</span> <a class="code" href="classKLocale.html#a88851bc6778ce71323d3c1cb37ff7093" title="Changes the preferred page size when printing.">KLocale::setPageSize</a>(<span class="keywordtype">int</span> pageSize) <a name="l02224"></a>02224 { <a name="l02225"></a>02225 <span class="comment">// #### check if it's in range??</span> <a name="l02226"></a>02226 doFormatInit(); <a name="l02227"></a>02227 d->pageSize = <a class="code" href="classKLocale.html#a87c8ee3b285ffaac36b93bee2f6569af" title="Returns the preferred page size for printing.">pageSize</a>; <a name="l02228"></a>02228 } <a name="l02229"></a>02229 <a name="l02230"></a><a class="code" href="classKLocale.html#ac6d3d37c7d6d914c93bbba765f3a5d35">02230</a> <a class="code" href="classKLocale.html#a9f3b163a356a322afde1820878b97118" title="The Metric system will give you information in mm, while the Imperial system will give you informatio...">KLocale::MeasureSystem</a> <a class="code" href="classKLocale.html#ac6d3d37c7d6d914c93bbba765f3a5d35" title="Returns which measuring system we use.">KLocale::measureSystem</a>()<span class="keyword"> const</span> <a name="l02231"></a>02231 <span class="keyword"></span>{ <a name="l02232"></a>02232 doFormatInit(); <a name="l02233"></a>02233 <span class="keywordflow">return</span> d->measureSystem; <a name="l02234"></a>02234 } <a name="l02235"></a>02235 <a name="l02236"></a><a class="code" href="classKLocale.html#a13180ae6b7b4db199c223f0efd7a7643">02236</a> <span class="keywordtype">void</span> <a class="code" href="classKLocale.html#a13180ae6b7b4db199c223f0efd7a7643" title="Changes the preferred measuring system.">KLocale::setMeasureSystem</a>(<a class="code" href="classKLocale.html#a9f3b163a356a322afde1820878b97118" title="The Metric system will give you information in mm, while the Imperial system will give you informatio...">MeasureSystem</a> value) <a name="l02237"></a>02237 { <a name="l02238"></a>02238 doFormatInit(); <a name="l02239"></a>02239 d->measureSystem = value; <a name="l02240"></a>02240 } <a name="l02241"></a>02241 <a name="l02242"></a><a class="code" href="classKLocale.html#ac44bcb4778c651d35b5cce6048b63da2">02242</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#ac44bcb4778c651d35b5cce6048b63da2" title="Returns the name of the internal language.">KLocale::defaultLanguage</a>() <a name="l02243"></a>02243 { <a name="l02244"></a>02244 <span class="keywordflow">return</span> <a class="codeRef" href="qstring.html#fromLatin1">QString::fromLatin1</a>(<span class="stringliteral">"en_US"</span>); <a name="l02245"></a>02245 } <a name="l02246"></a>02246 <a name="l02247"></a><a class="code" href="classKLocale.html#ab33058526a3fb1e26561d38c1f076896">02247</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#ab33058526a3fb1e26561d38c1f076896" title="Returns the name of the default country.">KLocale::defaultCountry</a>() <a name="l02248"></a>02248 { <a name="l02249"></a>02249 <span class="keywordflow">return</span> <a class="codeRef" href="qstring.html#fromLatin1">QString::fromLatin1</a>(<span class="stringliteral">"C"</span>); <a name="l02250"></a>02250 } <a name="l02251"></a>02251 <a name="l02252"></a><a class="code" href="classKLocale.html#a3c4ec5f5eaada7c8e77faf896a646452">02252</a> <span class="keyword">const</span> <span class="keywordtype">char</span> * <a class="code" href="classKLocale.html#a3c4ec5f5eaada7c8e77faf896a646452" title="Returns the user's preferred encoding.">KLocale::encoding</a>()<span class="keyword"> const</span> <a name="l02253"></a>02253 <span class="keyword"></span>{ <a name="l02254"></a>02254 <span class="preprocessor">#ifdef Q_WS_WIN</span> <a name="l02255"></a>02255 <span class="preprocessor"></span> <span class="keywordflow">if</span> (0==qstrcmp(<span class="stringliteral">"System"</span>, <a class="code" href="classKLocale.html#a4e1b718c8e31aeed53702d7e52cfa99b" title="Returns the user's preferred encoding.">codecForEncoding</a>()->name())) <a name="l02256"></a>02256 { <a name="l02257"></a>02257 <span class="comment">//win32 returns "System" codec name here but KDE apps expect a real name:</span> <a name="l02258"></a>02258 strcpy(d->win32SystemEncoding, <span class="stringliteral">"cp "</span>); <a name="l02259"></a>02259 <span class="keywordflow">if</span> (GetLocaleInfoA( MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), SORT_DEFAULT), <a name="l02260"></a>02260 LOCALE_IDEFAULTANSICODEPAGE, d->win32SystemEncoding+3, <span class="keyword">sizeof</span>(d->win32SystemEncoding)-3-1 )) <a name="l02261"></a>02261 { <a name="l02262"></a>02262 <span class="keywordflow">return</span> d->win32SystemEncoding; <a name="l02263"></a>02263 } <a name="l02264"></a>02264 } <a name="l02265"></a>02265 <span class="preprocessor">#endif</span> <a name="l02266"></a>02266 <span class="preprocessor"></span> <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#a4e1b718c8e31aeed53702d7e52cfa99b" title="Returns the user's preferred encoding.">codecForEncoding</a>()-><a class="codeRef" href="qtextcodec.html#name">name</a>(); <a name="l02267"></a>02267 } <a name="l02268"></a>02268 <a name="l02269"></a><a class="code" href="classKLocale.html#a10c8627f3759e2328eada49e1d847316">02269</a> <span class="keywordtype">int</span> <a class="code" href="classKLocale.html#a10c8627f3759e2328eada49e1d847316" title="Returns the user's preferred encoding.">KLocale::encodingMib</a>()<span class="keyword"> const</span> <a name="l02270"></a>02270 <span class="keyword"></span>{ <a name="l02271"></a>02271 <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#a4e1b718c8e31aeed53702d7e52cfa99b" title="Returns the user's preferred encoding.">codecForEncoding</a>()-><a class="codeRef" href="qtextcodec.html#mibEnum">mibEnum</a>(); <a name="l02272"></a>02272 } <a name="l02273"></a>02273 <a name="l02274"></a><a class="code" href="classKLocale.html#abd6621c35830f5d42a090e28fbf8c849">02274</a> <span class="keywordtype">int</span> <a class="code" href="classKLocale.html#abd6621c35830f5d42a090e28fbf8c849" title="Returns the file encoding.">KLocale::fileEncodingMib</a>()<span class="keyword"> const</span> <a name="l02275"></a>02275 <span class="keyword"></span>{ <a name="l02276"></a>02276 <span class="keywordflow">if</span> (d->utf8FileEncoding) <a name="l02277"></a>02277 <span class="keywordflow">return</span> 106; <a name="l02278"></a>02278 <span class="keywordflow">return</span> <a class="code" href="classKLocale.html#a4e1b718c8e31aeed53702d7e52cfa99b" title="Returns the user's preferred encoding.">codecForEncoding</a>()-><a class="codeRef" href="qtextcodec.html#mibEnum">mibEnum</a>(); <a name="l02279"></a>02279 } <a name="l02280"></a>02280 <a name="l02281"></a><a class="code" href="classKLocale.html#a4e1b718c8e31aeed53702d7e52cfa99b">02281</a> <a class="codeRef" href="qtextcodec.html">QTextCodec</a> * <a class="code" href="classKLocale.html#a4e1b718c8e31aeed53702d7e52cfa99b" title="Returns the user's preferred encoding.">KLocale::codecForEncoding</a>()<span class="keyword"> const</span> <a name="l02282"></a>02282 <span class="keyword"></span>{ <a name="l02283"></a>02283 <span class="keywordflow">return</span> d->codecForEncoding; <a name="l02284"></a>02284 } <a name="l02285"></a>02285 <a name="l02286"></a><a class="code" href="classKLocale.html#a276df14c2d1cbd93e1aac41706bdd3be">02286</a> <span class="keywordtype">bool</span> <a class="code" href="classKLocale.html#a276df14c2d1cbd93e1aac41706bdd3be" title="Changes the current encoding.">KLocale::setEncoding</a>(<span class="keywordtype">int</span> mibEnum) <a name="l02287"></a>02287 { <a name="l02288"></a>02288 <a class="codeRef" href="qtextcodec.html">QTextCodec</a> * codec = <a class="codeRef" href="qtextcodec.html#codecForMib">QTextCodec::codecForMib</a>(mibEnum); <a name="l02289"></a>02289 <span class="keywordflow">if</span> (codec) <a name="l02290"></a>02290 d->codecForEncoding = codec; <a name="l02291"></a>02291 <a name="l02292"></a>02292 <span class="keywordflow">return</span> codec != 0; <a name="l02293"></a>02293 } <a name="l02294"></a>02294 <a name="l02295"></a><a class="code" href="classKLocale.html#a0e314cf66d3b57ed29456038a1dd3452">02295</a> <a class="codeRef" href="qstringlist.html">QStringList</a> <a class="code" href="classKLocale.html#a0e314cf66d3b57ed29456038a1dd3452" title="Returns the preferred languages as ISO 639-1 codes.">KLocale::languagesTwoAlpha</a>()<span class="keyword"> const</span> <a name="l02296"></a>02296 <span class="keyword"></span>{ <a name="l02297"></a>02297 <span class="keywordflow">if</span> (d->langTwoAlpha.count()) <a name="l02298"></a>02298 <span class="keywordflow">return</span> d->langTwoAlpha; <a name="l02299"></a>02299 <a name="l02300"></a>02300 <span class="keyword">const</span> <a class="codeRef" href="qstringlist.html">QStringList</a> &origList = languageList(); <a name="l02301"></a>02301 <a name="l02302"></a>02302 <a class="codeRef" href="qstringlist.html">QStringList</a> result; <a name="l02303"></a>02303 <a name="l02304"></a>02304 <a class="code" href="classKConfig.html" title="Access KDE Configuration entries.">KConfig</a> config(<a class="codeRef" href="qstring.html#fromLatin1">QString::fromLatin1</a>(<span class="stringliteral">"language.codes"</span>), <span class="keyword">true</span>, <span class="keyword">false</span>); <a name="l02305"></a>02305 config.<a class="code" href="classKConfigBase.html#a1754e470553c9f9ac2556a9d63ce61c9" title="Specifies the group in which keys will be read and written.">setGroup</a>(<span class="stringliteral">"TwoLetterCodes"</span>); <a name="l02306"></a>02306 <a name="l02307"></a>02307 <span class="keywordflow">for</span> ( QStringList::ConstIterator it = origList.begin(); <a name="l02308"></a>02308 it != origList.end(); <a name="l02309"></a>02309 ++it ) <a name="l02310"></a>02310 { <a name="l02311"></a>02311 <a class="codeRef" href="qstring.html">QString</a> lang = *it; <a name="l02312"></a>02312 <a class="codeRef" href="qstringlist.html">QStringList</a> langLst; <a name="l02313"></a>02313 <span class="keywordflow">if</span> (config.<a class="code" href="classKConfigBase.html#ac18cd9eea5bfba6ab9b9d9b4834249ec" title="Checks whether the key has an entry in the currently active group.">hasKey</a>( lang )) <a name="l02314"></a>02314 langLst = config.<a class="code" href="classKConfigBase.html#ac44dfc4886fd5247b6740493baa7c197" title="Reads a list of strings.">readListEntry</a>( lang ); <a name="l02315"></a>02315 <span class="keywordflow">else</span> <a name="l02316"></a>02316 { <a name="l02317"></a>02317 <span class="keywordtype">int</span> i = lang.<a class="codeRef" href="qstring.html#find">find</a>(<span class="charliteral">'_'</span>); <a name="l02318"></a>02318 <span class="keywordflow">if</span> (i >= 0) <a name="l02319"></a>02319 lang.<a class="codeRef" href="qstring.html#truncate">truncate</a>(i); <a name="l02320"></a>02320 langLst << lang; <a name="l02321"></a>02321 } <a name="l02322"></a>02322 <a name="l02323"></a>02323 <span class="keywordflow">for</span> ( QStringList::ConstIterator langIt = langLst.begin(); <a name="l02324"></a>02324 langIt != langLst.end(); <a name="l02325"></a>02325 ++langIt ) <a name="l02326"></a>02326 { <a name="l02327"></a>02327 <span class="keywordflow">if</span> ( !(*langIt).isEmpty() && !result.contains( *langIt ) ) <a name="l02328"></a>02328 result += *langIt; <a name="l02329"></a>02329 } <a name="l02330"></a>02330 } <a name="l02331"></a>02331 d->langTwoAlpha = result; <a name="l02332"></a>02332 <span class="keywordflow">return</span> result; <a name="l02333"></a>02333 } <a name="l02334"></a>02334 <a name="l02335"></a><a class="code" href="classKLocale.html#ae6ba11a5e5a44279706e14c75e75d439">02335</a> <a class="codeRef" href="qstringlist.html">QStringList</a> <a class="code" href="classKLocale.html#ae6ba11a5e5a44279706e14c75e75d439" title="Returns list of all known ISO 639-1 codes.">KLocale::allLanguagesTwoAlpha</a>()<span class="keyword"> const</span> <a name="l02336"></a>02336 <span class="keyword"></span>{ <a name="l02337"></a>02337 <span class="keywordflow">if</span> (!d->languages) <a name="l02338"></a>02338 d->languages = <span class="keyword">new</span> <a class="code" href="classKConfig.html" title="Access KDE Configuration entries.">KConfig</a>(<span class="stringliteral">"all_languages"</span>, <span class="keyword">true</span>, <span class="keyword">false</span>, <span class="stringliteral">"locale"</span>); <a name="l02339"></a>02339 <a name="l02340"></a>02340 <span class="keywordflow">return</span> d->languages->groupList(); <a name="l02341"></a>02341 } <a name="l02342"></a>02342 <a name="l02343"></a><a class="code" href="classKLocale.html#aef82a89eecb3584d060173828257f29b">02343</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#aef82a89eecb3584d060173828257f29b" title="Convert a ISO 639-1 code to a human readable form.">KLocale::twoAlphaToLanguageName</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> &code)<span class="keyword"> const</span> <a name="l02344"></a>02344 <span class="keyword"></span>{ <a name="l02345"></a>02345 <span class="keywordflow">if</span> (!d->languages) <a name="l02346"></a>02346 d->languages = <span class="keyword">new</span> <a class="code" href="classKConfig.html" title="Access KDE Configuration entries.">KConfig</a>(<span class="stringliteral">"all_languages"</span>, <span class="keyword">true</span>, <span class="keyword">false</span>, <span class="stringliteral">"locale"</span>); <a name="l02347"></a>02347 <a name="l02348"></a>02348 <a class="codeRef" href="qstring.html">QString</a> groupName = code; <a name="l02349"></a>02349 <span class="keyword">const</span> <span class="keywordtype">int</span> i = groupName.<a class="codeRef" href="qstring.html#find">find</a>(<span class="charliteral">'_'</span>); <a name="l02350"></a>02350 groupName.<a class="codeRef" href="qstring.html#replace">replace</a>(0, i, groupName.<a class="codeRef" href="qstring.html#left">left</a>(i).lower()); <a name="l02351"></a>02351 <a name="l02352"></a>02352 d->languages->setGroup(groupName); <a name="l02353"></a>02353 <span class="keywordflow">return</span> d->languages->readEntry(<span class="stringliteral">"Name"</span>); <a name="l02354"></a>02354 } <a name="l02355"></a>02355 <a name="l02356"></a><a class="code" href="classKLocale.html#a0763a46ab258fb2ec67ceb7e6dfa3bb6">02356</a> <a class="codeRef" href="qstringlist.html">QStringList</a> <a class="code" href="classKLocale.html#a0763a46ab258fb2ec67ceb7e6dfa3bb6" title="Returns list of all known country codes.">KLocale::allCountriesTwoAlpha</a>()<span class="keyword"> const</span> <a name="l02357"></a>02357 <span class="keyword"></span>{ <a name="l02358"></a>02358 <a class="codeRef" href="qstringlist.html">QStringList</a> countries; <a name="l02359"></a>02359 <a class="codeRef" href="qstringlist.html">QStringList</a> paths = <a class="code" href="classKGlobal.html#a431d05bf9a252475846c89769fbff8c1" title="Returns the application standard dirs object.">KGlobal::dirs</a>()-><a class="code" href="classKStandardDirs.html#ae6310facab4e97b2aceb5cf37080c3c0" title="Tries to find all resources with the specified type.">findAllResources</a>(<span class="stringliteral">"locale"</span>, <span class="stringliteral">"l10n/*/entry.desktop"</span>); <a name="l02360"></a>02360 <span class="keywordflow">for</span>(QStringList::ConstIterator it = paths.begin(); <a name="l02361"></a>02361 it != paths.end(); ++it) <a name="l02362"></a>02362 { <a name="l02363"></a>02363 <a class="codeRef" href="qstring.html">QString</a> code = (*it).<a class="codeRef" href="qstring.html#mid">mid</a>((*it).length()-16, 2); <a name="l02364"></a>02364 <span class="keywordflow">if</span> (code != <span class="stringliteral">"/C"</span>) <a name="l02365"></a>02365 countries.append(code); <a name="l02366"></a>02366 } <a name="l02367"></a>02367 <span class="keywordflow">return</span> countries; <a name="l02368"></a>02368 } <a name="l02369"></a>02369 <a name="l02370"></a><a class="code" href="classKLocale.html#a116c55e3df0e3363c9a374b558b7b39a">02370</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#a116c55e3df0e3363c9a374b558b7b39a" title="Convert a country code to a human readable form.">KLocale::twoAlphaToCountryName</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> &code)<span class="keyword"> const</span> <a name="l02371"></a>02371 <span class="keyword"></span>{ <a name="l02372"></a>02372 <a class="code" href="classKConfig.html" title="Access KDE Configuration entries.">KConfig</a> cfg(<span class="stringliteral">"l10n/"</span>+code.<a class="codeRef" href="qstring.html#lower">lower</a>()+<span class="stringliteral">"/entry.desktop"</span>, <span class="keyword">true</span>, <span class="keyword">false</span>, <span class="stringliteral">"locale"</span>); <a name="l02373"></a>02373 cfg.<a class="code" href="classKConfigBase.html#a1754e470553c9f9ac2556a9d63ce61c9" title="Specifies the group in which keys will be read and written.">setGroup</a>(<span class="stringliteral">"KCM Locale"</span>); <a name="l02374"></a>02374 <span class="keywordflow">return</span> cfg.readEntry(<span class="stringliteral">"Name"</span>); <a name="l02375"></a>02375 } <a name="l02376"></a>02376 <a name="l02377"></a><a class="code" href="classKLocale.html#ab340993b2ca1bfba66e986aaf5ef8d7c">02377</a> <span class="keywordtype">void</span> <a class="code" href="classKLocale.html#ab340993b2ca1bfba66e986aaf5ef8d7c" title="Changes the current calendar system to the calendar specified.">KLocale::setCalendar</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> & calType) <a name="l02378"></a>02378 { <a name="l02379"></a>02379 doFormatInit(); <a name="l02380"></a>02380 <a name="l02381"></a>02381 d->calendarType = calType; <a name="l02382"></a>02382 <a name="l02383"></a>02383 <span class="keyword">delete</span> d->calendar; <a name="l02384"></a>02384 d->calendar = 0; <a name="l02385"></a>02385 } <a name="l02386"></a>02386 <a name="l02387"></a><a class="code" href="classKLocale.html#a53f37cec39f4f92af604e9be03107720">02387</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#a53f37cec39f4f92af604e9be03107720" title="Returns the name of the calendar system that is currently being used by the system.">KLocale::calendarType</a>()<span class="keyword"> const</span> <a name="l02388"></a>02388 <span class="keyword"></span>{ <a name="l02389"></a>02389 doFormatInit(); <a name="l02390"></a>02390 <a name="l02391"></a>02391 <span class="keywordflow">return</span> d->calendarType; <a name="l02392"></a>02392 } <a name="l02393"></a>02393 <a name="l02394"></a><a class="code" href="classKLocale.html#a0bfd055c66b769eef7005bd970cab326">02394</a> <span class="keyword">const</span> <a class="code" href="classKCalendarSystem.html" title="CalendarSystem abstract class, default derived kde gregorian class and factory class.">KCalendarSystem</a> * <a class="code" href="classKLocale.html#a0bfd055c66b769eef7005bd970cab326" title="Returns a pointer to the calendar system object.">KLocale::calendar</a>()<span class="keyword"> const</span> <a name="l02395"></a>02395 <span class="keyword"></span>{ <a name="l02396"></a>02396 doFormatInit(); <a name="l02397"></a>02397 <a name="l02398"></a>02398 <span class="comment">// Check if it's the correct calendar?!?</span> <a name="l02399"></a>02399 <span class="keywordflow">if</span> ( !d->calendar ) <a name="l02400"></a>02400 d->calendar = <a class="code" href="classKCalendarSystemFactory.html#afb8c520f1c9603dd66bc277e0dc9e04d" title="Gets specific calendar type number of days in previous month for a given date.">KCalendarSystemFactory::create</a>( d->calendarType, <span class="keyword">this</span> ); <a name="l02401"></a>02401 <a name="l02402"></a>02402 <span class="keywordflow">return</span> d->calendar; <a name="l02403"></a>02403 } <a name="l02404"></a>02404 <a name="l02405"></a><a class="code" href="classKLocale.html#af3c3f4382da142c21cacda4c0075a0b6">02405</a> <a class="code" href="classKLocale.html#a71368e476693c57f754bbad641ac35f5" title="Constructs a KLocale with the given catalog name.">KLocale::KLocale</a>(<span class="keyword">const</span> <a class="code" href="classKLocale.html" title="KLocale provides support for country specific stuff like the national language.">KLocale</a> & rhs) <a name="l02406"></a>02406 { <a name="l02407"></a>02407 d = <span class="keyword">new</span> KLocalePrivate; <a name="l02408"></a>02408 <a name="l02409"></a>02409 *<span class="keyword">this</span> = rhs; <a name="l02410"></a>02410 } <a name="l02411"></a>02411 <a name="l02412"></a><a class="code" href="classKLocale.html#ad2cc97a9f5a23307ca6d093afe935167">02412</a> <a class="code" href="classKLocale.html" title="KLocale provides support for country specific stuff like the national language.">KLocale</a> & <a class="code" href="classKLocale.html#ad2cc97a9f5a23307ca6d093afe935167" title="Assignment operator.">KLocale::operator=</a>(<span class="keyword">const</span> <a class="code" href="classKLocale.html" title="KLocale provides support for country specific stuff like the national language.">KLocale</a> & rhs) <a name="l02413"></a>02413 { <a name="l02414"></a>02414 <span class="comment">// Numbers and money</span> <a name="l02415"></a>02415 m_decimalSymbol = rhs.m_decimalSymbol; <a name="l02416"></a>02416 m_thousandsSeparator = rhs.m_thousandsSeparator; <a name="l02417"></a>02417 m_currencySymbol = rhs.m_currencySymbol; <a name="l02418"></a>02418 m_monetaryDecimalSymbol = rhs.m_monetaryDecimalSymbol; <a name="l02419"></a>02419 m_monetaryThousandsSeparator = rhs.m_monetaryThousandsSeparator; <a name="l02420"></a>02420 m_positiveSign = rhs.m_positiveSign; <a name="l02421"></a>02421 m_negativeSign = rhs.m_negativeSign; <a name="l02422"></a>02422 m_fracDigits = rhs.m_fracDigits; <a name="l02423"></a>02423 m_positivePrefixCurrencySymbol = rhs.m_positivePrefixCurrencySymbol; <a name="l02424"></a>02424 m_negativePrefixCurrencySymbol = rhs.m_negativePrefixCurrencySymbol; <a name="l02425"></a>02425 m_positiveMonetarySignPosition = rhs.m_positiveMonetarySignPosition; <a name="l02426"></a>02426 m_negativeMonetarySignPosition = rhs.m_negativeMonetarySignPosition; <a name="l02427"></a>02427 <a name="l02428"></a>02428 <span class="comment">// Date and time</span> <a name="l02429"></a>02429 m_timeFormat = rhs.m_timeFormat; <a name="l02430"></a>02430 m_dateFormat = rhs.m_dateFormat; <a name="l02431"></a>02431 m_dateFormatShort = rhs.m_dateFormatShort; <a name="l02432"></a>02432 <a name="l02433"></a>02433 m_language = rhs.m_language; <a name="l02434"></a>02434 m_country = rhs.m_country; <a name="l02435"></a>02435 <a name="l02436"></a>02436 <span class="comment">// the assignment operator works here</span> <a name="l02437"></a>02437 *d = *rhs.d; <a name="l02438"></a>02438 d->languages = 0; <span class="comment">// Don't copy languages</span> <a name="l02439"></a>02439 d->calendar = 0; <span class="comment">// Don't copy the calendar</span> <a name="l02440"></a>02440 <a name="l02441"></a>02441 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l02442"></a>02442 } <a name="l02443"></a>02443 <a name="l02444"></a><a class="code" href="classKLocale.html#a27b304ca4948ace8b07aeec381f8a035">02444</a> <span class="keywordtype">bool</span> <a class="code" href="classKLocale.html#a27b304ca4948ace8b07aeec381f8a035">KLocale::setCharset</a>(<span class="keyword">const</span> <a class="codeRef" href="qstring.html">QString</a> & ) { <span class="keywordflow">return</span> <span class="keyword">true</span>; } <a name="l02445"></a><a class="code" href="classKLocale.html#a000babcbcae3d64462f63ea4429809d7">02445</a> <a class="codeRef" href="qstring.html">QString</a> <a class="code" href="classKLocale.html#a000babcbcae3d64462f63ea4429809d7">KLocale::charset</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <a class="codeRef" href="qstring.html#fromLatin1">QString::fromLatin1</a>(<span class="stringliteral">"UTF-8"</span>); } <a name="l02446"></a>02446 <a name="l02447"></a>02447 <span class="comment">// KDE4: remove</span> <a name="l02448"></a>02448 <span class="preprocessor">#if 0</span> <a name="l02449"></a>02449 <span class="preprocessor"></span><span class="keywordtype">void</span> nothing() { <a class="code" href="classKLocale.html#a0eca0239d7b23eb40006d82d6210aa69">i18n</a>(<span class="stringliteral">"&Next"</span>); } <a name="l02450"></a>02450 <span class="preprocessor">#endif</span> </pre></div></div> </div> </div></div> </td> </tr> <tr> <td valign="top" id="leftmenu" width="25%"> <a name="navigation"></a> <div class="menu_box"><h2>kdecore</h2> <div class="nav_list"> <ul><li><a href="index.html">Main Page</a></li><li><a href="modules.html">Modules</a></li><li><a href="namespaces.html">Namespace List</a></li><li><a href="hierarchy.html">Class Hierarchy</a></li><li><a href="classes.html">Alphabetical List</a></li><li><a href="annotated.html">Class List</a></li><li><a href="files.html">File List</a></li><li><a href="namespacemembers.html">Namespace Members</a></li><li><a href="functions.html">Class Members</a></li><li><a href="pages.html">Related Pages</a></li></ul> <!-- <h2>Class Picker</h2> <div style="text-align: center;"> <form name="guideform"> <select name="guidelinks" style="width:100%;" onChange="window.location=document.guideform.guidelinks.options[document.guideform.guidelinks.selectedIndex].value"> <option value="annotated.html">-- Choose --</option> <option value="classKAboutData.html">kaboutdata</option>, <option value="classKAboutPerson.html">kaboutperson</option>, <option value="classKAboutTranslator.html">kabouttranslator</option>, <option value="classKAccel.html">kaccel</option>, <option value="classKAcceleratorManager.html">kacceleratormanager</option>, <option value="classKAccelManagerAlgorithm.html">kaccelmanageralgorithm</option>, <option value="classKAccelShortcutList.html">kaccelshortcutlist</option>, <option value="classKAccelString.html">kaccelstring</option>, <option value="classKAddressInfo.html">kaddressinfo</option>, <option value="classKAppDCOPInterface.html">kappdcopinterface</option>, <option value="classKApplication.html">kapplication</option>, <option value="classKAsyncIO.html">kasyncio</option>, <option value="classKAudioPlayer.html">kaudioplayer</option>, <option value="classKBufferedIO.html">kbufferedio</option>, <option value="classKCalendarSystem.html">kcalendarsystem</option>, <option value="classKCalendarSystemFactory.html">kcalendarsystemfactory</option>, <option value="classKCalendarSystemJalali.html">kcalendarsystemjalali</option>, <option value="classKCatalogue.html">kcatalogue</option>, <option value="classKCharMacroExpander.html">kcharmacroexpander</option>, <option value="classKCharsets.html">kcharsets</option>, <option value="classKClipboardSynchronizer.html">kclipboardsynchronizer</option>, <option value="classKCmdLineArgs.html">kcmdlineargs</option>, <option value="classKCodecs.html">kcodecs</option>, <option value="classKCompletion.html">kcompletion</option>, <option value="classKCompletionBase.html">kcompletionbase</option>, <option value="classKCompletionMatches.html">kcompletionmatches</option>, <option value="classKCompTreeNode.html">kcomptreenode</option>, <option value="classKConfig.html">kconfig</option>, <option value="classKConfigBackEnd.html">kconfigbackend</option>, <option value="classKConfigBase.html">kconfigbase</option>, <option value="classKConfigDialogManager.html">kconfigdialogmanager</option>, <option value="classKConfigGroup.html">kconfiggroup</option>, <option value="classKConfigGroupSaver.html">kconfiggroupsaver</option>, <option value="classKConfigINIBackEnd.html">kconfiginibackend</option>, <option value="classKConfigSkeleton.html">kconfigskeleton</option>, <option value="classKConfigSkeleton_1_1ItemBool.html">kconfigskeleton::itembool</option>, <option value="classKConfigSkeleton_1_1ItemColor.html">kconfigskeleton::itemcolor</option>, <option value="classKConfigSkeleton_1_1ItemDateTime.html">kconfigskeleton::itemdatetime</option>, <option value="classKConfigSkeleton_1_1ItemDouble.html">kconfigskeleton::itemdouble</option>, <option value="classKConfigSkeleton_1_1ItemEnum.html">kconfigskeleton::itemenum</option>, <option value="classKConfigSkeleton_1_1ItemFont.html">kconfigskeleton::itemfont</option>, <option value="classKConfigSkeleton_1_1ItemInt.html">kconfigskeleton::itemint</option>, <option value="classKConfigSkeleton_1_1ItemInt64.html">kconfigskeleton::itemint64</option>, <option value="classKConfigSkeleton_1_1ItemIntList.html">kconfigskeleton::itemintlist</option>, <option value="classKConfigSkeleton_1_1ItemLong.html">kconfigskeleton::itemlong</option>, <option value="classKConfigSkeleton_1_1ItemPassword.html">kconfigskeleton::itempassword</option>, <option value="classKConfigSkeleton_1_1ItemPath.html">kconfigskeleton::itempath</option>, <option value="classKConfigSkeleton_1_1ItemPathList.html">kconfigskeleton::itempathlist</option>, <option value="classKConfigSkeleton_1_1ItemPoint.html">kconfigskeleton::itempoint</option>, <option value="classKConfigSkeleton_1_1ItemProperty.html">kconfigskeleton::itemproperty</option>, <option value="classKConfigSkeleton_1_1ItemRect.html">kconfigskeleton::itemrect</option>, <option value="classKConfigSkeleton_1_1ItemSize.html">kconfigskeleton::itemsize</option>, <option value="classKConfigSkeleton_1_1ItemString.html">kconfigskeleton::itemstring</option>, <option value="classKConfigSkeleton_1_1ItemStringList.html">kconfigskeleton::itemstringlist</option>, <option value="classKConfigSkeleton_1_1ItemUInt.html">kconfigskeleton::itemuint</option>, <option value="classKConfigSkeleton_1_1ItemUInt64.html">kconfigskeleton::itemuint64</option>, <option value="classKConfigSkeleton_1_1ItemULong.html">kconfigskeleton::itemulong</option>, <option value="classKConfigSkeletonItem.html">kconfigskeletonitem</option>, <option value="classKCrash.html">kcrash</option>, <option value="classKDCOPPropertyProxy.html">kdcoppropertyproxy</option>, <option value="classKDebugDCOPIface.html">kdebugdcopiface</option>, <option value="classKDesktopFile.html">kdesktopfile</option>, <option value="classKExtendedSocket.html">kextendedsocket</option>, <option value="classKGenericFactory.html">kgenericfactory</option>, <option value="classKGenericFactory_3_01KTypeList_3_01Product_00_01ProductListTail_01_4_00_01KTypeList_3_01Pare1ed8d1e5a9847c99711cad3b12c7e96c.html">kgenericfactory< ktypelist< product, productlisttail >, ktypelist< pare1ed8d1e5a9847c99711cad3b12c7e96c</option>, <option value="classKGenericFactory_3_01KTypeList_3_01Product_00_01ProductListTail_01_4_00_01KTypeList_3_01Paref6a00f76851e0daa2cb662bb8a41fc7f.html">kgenericfactory< ktypelist< product, productlisttail >, ktypelist< paref6a00f76851e0daa2cb662bb8a41fc7f</option>, <option value="classKGenericFactory_3_01KTypeList_3_01Product_00_01ProductListTail_01_4_00_01QObject_01_4.html">kgenericfactory< ktypelist< product, productlisttail >, qobject ></option>, <option value="classKGlobal.html">kglobal</option>, <option value="classKGlobalAccel.html">kglobalaccel</option>, <option value="classKGlobalSettings.html">kglobalsettings</option>, <option value="classKIcon.html">kicon</option>, <option value="classKIconEffect.html">kiconeffect</option>, <option value="classKIconLoader.html">kiconloader</option>, <option value="classKIconTheme.html">kicontheme</option>, <option value="classKInetSocketAddress.html">kinetsocketaddress</option>, <option value="classKInstance.html">kinstance</option>, <option value="classKIOBufferBase.html">kiobufferbase</option>, <option value="classKIPC.html">kipc</option>, <option value="classKKey.html">kkey</option>, <option value="classKKeyNative.html">kkeynative</option>, <option value="classKKeySequence.html">kkeysequence</option>, <option value="classKLibFactory.html">klibfactory</option>, <option value="classKLibLoader.html">klibloader</option>, <option value="classKLibrary.html">klibrary</option>, <option value="classKLocale.html">klocale</option>, <option value="classKLockFile.html">klockfile</option>, <option value="classKMacroExpanderBase.html">kmacroexpanderbase</option>, <option value="classKMD4.html">kmd4</option>, <option value="classKMD5.html">kmd5</option>, <option value="classKMimeSourceFactory.html">kmimesourcefactory</option>, <option value="classKMountPoint.html">kmountpoint</option>, <option value="classKMultipleDrag.html">kmultipledrag</option>, <option value="classKNetwork_1_1KActiveSocketBase.html">knetwork::kactivesocketbase</option>, <option value="classKNetwork_1_1KBufferedSocket.html">knetwork::kbufferedsocket</option>, <option value="classKNetwork_1_1KClientSocketBase.html">knetwork::kclientsocketbase</option>, <option value="classKNetwork_1_1KDatagramPacket.html">knetwork::kdatagrampacket</option>, <option value="classKNetwork_1_1KDatagramSocket.html">knetwork::kdatagramsocket</option>, <option value="classKNetwork_1_1KHttpProxySocketDevice.html">knetwork::khttpproxysocketdevice</option>, <option value="classKNetwork_1_1KInetSocketAddress.html">knetwork::kinetsocketaddress</option>, <option value="classKNetwork_1_1KIpAddress.html">knetwork::kipaddress</option>, <option value="classKNetwork_1_1KMulticastSocket.html">knetwork::kmulticastsocket</option>, <option value="classKNetwork_1_1KMulticastSocketImpl.html">knetwork::kmulticastsocketimpl</option>, <option value="classKNetwork_1_1KNetworkInterface.html">knetwork::knetworkinterface</option>, <option value="classKNetwork_1_1KPassiveSocketBase.html">knetwork::kpassivesocketbase</option>, <option value="classKNetwork_1_1KResolver.html">knetwork::kresolver</option>, <option value="classKNetwork_1_1KResolverEntry.html">knetwork::kresolverentry</option>, <option value="classKNetwork_1_1KResolverResults.html">knetwork::kresolverresults</option>, <option value="classKNetwork_1_1KResolverWorkerBase_1_1ResolverLocker.html">knetwork::kresolverworkerbase::resolverlocker</option>, <option value="classKNetwork_1_1KReverseResolver.html">knetwork::kreverseresolver</option>, <option value="classKNetwork_1_1KServerSocket.html">knetwork::kserversocket</option>, <option value="classKNetwork_1_1KSocketAddress.html">knetwork::ksocketaddress</option>, <option value="classKNetwork_1_1KSocketBase.html">knetwork::ksocketbase</option>, <option value="classKNetwork_1_1KSocketDevice.html">knetwork::ksocketdevice</option>, <option value="classKNetwork_1_1KSocketDeviceFactory.html">knetwork::ksocketdevicefactory</option>, <option value="classKNetwork_1_1KSocksSocketDevice.html">knetwork::ksockssocketdevice</option>, <option value="classKNetwork_1_1KStreamSocket.html">knetwork::kstreamsocket</option>, <option value="classKNetwork_1_1KUnixSocketAddress.html">knetwork::kunixsocketaddress</option>, <option value="classKNotifyClient_1_1Instance.html">knotifyclient::instance</option>, <option value="classKPalette.html">kpalette</option>, <option value="classKPixmapProvider.html">kpixmapprovider</option>, <option value="classKPopupAccelManager.html">kpopupaccelmanager</option>, <option value="classKProcess.html">kprocess</option>, <option value="classKProcessController.html">kprocesscontroller</option>, <option value="classKProcIO.html">kprocio</option>, <option value="classKProtocolInfoFactory.html">kprotocolinfofactory</option>, <option value="classKPty.html">kpty</option>, <option value="classKRandomSequence.html">krandomsequence</option>, <option value="classKRegExp.html">kregexp</option>, <option value="classKRegExpPrivate.html">kregexpprivate</option>, <option value="classKRFCDate.html">krfcdate</option>, <option value="classKRootProp.html">krootprop</option>, <option value="classKSaveFile.html">ksavefile</option>, <option value="classKServerSocket.html">kserversocket</option>, <option value="classKSessionManaged.html">ksessionmanaged</option>, <option value="classKShared.html">kshared</option>, <option value="classKSharedConfig.html">ksharedconfig</option>, <option value="classKSharedPtr.html">ksharedptr</option>, <option value="classKShellProcess.html">kshellprocess</option>, <option value="classKShortcut.html">kshortcut</option>, <option value="classKShortcutList.html">kshortcutlist</option>, <option value="classKSimpleConfig.html">ksimpleconfig</option>, <option value="classKSocket.html">ksocket</option>, <option value="classKSocketAddress.html">ksocketaddress</option>, <option value="classKSocks.html">ksocks</option>, <option value="classKSortableItem.html">ksortableitem</option>, <option value="classKSortableValueList.html">ksortablevaluelist</option>, <option value="classKStandardDirs.html">kstandarddirs</option>, <option value="classKStaticDeleter.html">kstaticdeleter</option>, <option value="classKStaticDeleterBase.html">kstaticdeleterbase</option>, <option value="classKStdAccel_1_1ShortcutList.html">kstdaccel::shortcutlist</option>, <option value="classKStringHandler.html">kstringhandler</option>, <option value="classKSycocaEntry.html">ksycocaentry</option>, <option value="classKSycocaFactoryList.html">ksycocafactorylist</option>, <option value="classKTempDir.html">ktempdir</option>, <option value="classKTempFile.html">ktempfile</option>, <option value="classKTimezone.html">ktimezone</option>, <option value="classKTimezoneDetails.html">ktimezonedetails</option>, <option value="classKTimezones.html">ktimezones</option>, <option value="classKTimezoneSource.html">ktimezonesource</option>, <option value="classKUniqueApplication.html">kuniqueapplication</option>, <option value="classKUnixSocketAddress.html">kunixsocketaddress</option>, <option value="classKURL.html">kurl</option>, <option value="classKURL_1_1List.html">kurl::list</option>, <option value="classKURLDrag.html">kurldrag</option>, <option value="classKUser.html">kuser</option>, <option value="classKUserGroup.html">kusergroup</option>, <option value="classKVMAllocator.html">kvmallocator</option>, <option value="classKWin.html">kwin</option>, <option value="classKWin_1_1WindowInfo.html">kwin::windowinfo</option>, <option value="classKWinModule.html">kwinmodule</option>, <option value="classKWordMacroExpander.html">kwordmacroexpander</option>, <option value="classKXErrorHandler.html">kxerrorhandler</option>, <option value="classKZoneAllocator.html">kzoneallocator</option>, <option value="classNET.html">net</option>, </select> </form> </div> --> </div></div> <div class="menu_box"><h2>API Dox</h2> <div class="nav_list"> <ul> <li><a href="../../arts/html/index.html">arts</a></li><li><a href="../../dcop/html/index.html">dcop</a></li><li><a href="../../dnssd/html/index.html">dnssd</a></li><li><a href="../../interfaces/html/index.html">interfaces</a></li><li> <a href="../../interfaces/kimproxy/interface/html/index.html">interface</a></li><li> <a href="../../interfaces/kimproxy/library/html/index.html">library</a></li><li> <a href="../../interfaces/kspeech/html/index.html">kspeech</a></li><li> <a href="../../interfaces/ktexteditor/html/index.html">ktexteditor</a></li><li><a href="../../kabc/html/index.html">kabc</a></li><li><a href="../../kate/html/index.html">kate</a></li><li><a href="../../kcmshell/html/index.html">kcmshell</a></li><li><a href="../../kdecore/html/index.html">kdecore</a></li><li><a href="../../kded/html/index.html">kded</a></li><li><a href="../../kdefx/html/index.html">kdefx</a></li><li><a href="../../kdeprint/html/index.html">kdeprint</a></li><li><a href="../../kdesu/html/index.html">kdesu</a></li><li><a href="../../kdeui/html/index.html">kdeui</a></li><li><a href="../../kdoctools/html/index.html">kdoctools</a></li><li><a href="../../khtml/html/index.html">khtml</a></li><li><a href="../../kimgio/html/index.html">kimgio</a></li><li><a href="../../kinit/html/index.html">kinit</a></li><li><a href="../../kio/html/index.html">kio</a></li><li> <a href="../../kio/bookmarks/html/index.html">bookmarks</a></li><li> <a href="../../kio/httpfilter/html/index.html">httpfilter</a></li><li> <a href="../../kio/kfile/html/index.html">kfile</a></li><li> <a href="../../kio/kio/html/index.html">kio</a></li><li> <a href="../../kio/kioexec/html/index.html">kioexec</a></li><li> <a href="../../kio/kpasswdserver/html/index.html">kpasswdserver</a></li><li> <a href="../../kio/kssl/html/index.html">kssl</a></li><li><a href="../../kioslave/html/index.html">kioslave</a></li><li> <a href="../../kioslave/http/html/index.html">http</a></li><li><a href="../../kjs/html/index.html">kjs</a></li><li><a href="../../kmdi/html/index.html">kmdi</a></li><li> <a href="../../kmdi/kmdi/html/index.html">kmdi</a></li><li><a href="../../knewstuff/html/index.html">knewstuff</a></li><li><a href="../../kparts/html/index.html">kparts</a></li><li><a href="../../kresources/html/index.html">kresources</a></li><li><a href="../../kspell2/html/index.html">kspell2</a></li><li><a href="../../kunittest/html/index.html">kunittest</a></li><li><a href="../../kutils/html/index.html">kutils</a></li><li><a href="../../kwallet/html/index.html">kwallet</a></li><li><a href="../../libkmid/html/index.html">libkmid</a></li><li><a href="../../libkscreensaver/html/index.html">libkscreensaver</a></li> </ul></div></div> </td> </tr> </table> <span class="doNotDisplay"> <a href="http://www.kde.org/" accesskey="8">KDE Home</a> | <a href="http://accessibility.kde.org/" accesskey="9">KDE Accessibility Home</a> | <a href="http://www.kde.org/media/accesskeys.php" accesskey="0">Description of Access Keys</a> </span> <div style="height: 8px"></div> <div id="footer"> <div id="footer_left"> Maintained by <a href="mailto:groot@kde.org">Adriaan de Groot</a> and <a href="mailto:winter@kde.org">Allen Winter</a>. <br/> KDE and K Desktop Environment are trademarks of <a href="http://www.kde.org/areas/kde-ev/" title="Homepage of the KDE non-profit Organization">KDE e.V.</a> | <a href="http://www.kde.org/contact/impressum.php">Legal</a> </div> <div id="footer_right"><img src="/media/images/footer_right.png" style="margin: 0px" alt="" /></div> </div> <!-- WARNING: DO NOT SEND MAIL TO THE FOLLOWING EMAIL ADDRESS! YOU WILL BE BLOCKED INSTANTLY AND PERMANENTLY! <a href="mailto:aaaatrap-425acc3b5374943f@kde.org">Block me</a> WARNING END --> </body> </html>