summaryrefslogtreecommitdiffstats
path: root/kcontrol/locale
diff options
context:
space:
mode:
Diffstat (limited to 'kcontrol/locale')
-rw-r--r--kcontrol/locale/AUTHORS2
-rw-r--r--kcontrol/locale/Makefile.am32
-rw-r--r--kcontrol/locale/TIMEZONES392
-rw-r--r--kcontrol/locale/default/Makefile.am2
-rw-r--r--kcontrol/locale/default/entry.desktop72
-rw-r--r--kcontrol/locale/kcmlocale.cpp473
-rw-r--r--kcontrol/locale/kcmlocale.h95
-rw-r--r--kcontrol/locale/klocalesample.cpp132
-rw-r--r--kcontrol/locale/klocalesample.h58
-rw-r--r--kcontrol/locale/language.desktop236
-rw-r--r--kcontrol/locale/localemon.cpp330
-rw-r--r--kcontrol/locale/localemon.h93
-rw-r--r--kcontrol/locale/localenum.cpp194
-rw-r--r--kcontrol/locale/localenum.h82
-rw-r--r--kcontrol/locale/localeother.cpp142
-rw-r--r--kcontrol/locale/localeother.h70
-rw-r--r--kcontrol/locale/localetime.cpp556
-rw-r--r--kcontrol/locale/localetime.h102
-rw-r--r--kcontrol/locale/main.cpp38
-rw-r--r--kcontrol/locale/pics/Makefile.am2
-rw-r--r--kcontrol/locale/pics/background.pngbin0 -> 28823 bytes
-rw-r--r--kcontrol/locale/toplevel.cpp276
-rw-r--r--kcontrol/locale/toplevel.h87
23 files changed, 3466 insertions, 0 deletions
diff --git a/kcontrol/locale/AUTHORS b/kcontrol/locale/AUTHORS
new file mode 100644
index 000000000..74a381b48
--- /dev/null
+++ b/kcontrol/locale/AUTHORS
@@ -0,0 +1,2 @@
+Matthias Hoelzer (hoelzer@physik.uni-wuerzburg.de)
+Hans Petter Bieker <bieker@kde.org>
diff --git a/kcontrol/locale/Makefile.am b/kcontrol/locale/Makefile.am
new file mode 100644
index 000000000..8ca082408
--- /dev/null
+++ b/kcontrol/locale/Makefile.am
@@ -0,0 +1,32 @@
+#AM_CPPFLAGS = -DQT_NO_CAST_ASCII -DQT_NO_COMPAT
+
+AM_CPPFLAGS = $(all_includes)
+
+SUBDIRS = default pics
+
+kde_module_LTLIBRARIES = kcm_locale.la
+kcm_locale_la_SOURCES = main.cpp toplevel.cpp kcmlocale.cpp klocalesample.cpp localenum.cpp localemon.cpp localetime.cpp localeother.cpp
+METASOURCES = AUTO
+noinst_HEADERS = toplevel.h kcmlocale.h klocalesample.h localenum.h localemon.h localetime.h localeother.h
+
+kcm_locale_la_LDFLAGS = -module -avoid-version $(all_libraries) -no-undefined
+kcm_locale_la_LIBADD = $(LIB_KIO)
+
+# Note: newer glibc (e.g. zonetab version 1.31 (cvs revision 1.22) have more/other data than older ones (e.g. zonetab version 1.28)
+
+# timezones-manual is for adding entried from a zone.tab downloaded from glibc's CVS
+timezones-manual:
+ grep -v '^#' zone.tab | tr ' ' ' ' | sed -e "s# *# #" | cut -d' ' -f3 | sed -e 's,^,i18n(",; s,$$,");,' >> $(srcdir)/TIMEZONES
+ sort -u $(srcdir)/TIMEZONES > t && mv t $(srcdir)/TIMEZONES
+
+timezones:
+ grep -v '^#' /usr/share/zoneinfo/zone.tab | tr ' ' ' ' | sed -e "s# *# #" | cut -d' ' -f3 | sed -e 's,^,i18n(",; s,$$,");,' >> $(srcdir)/TIMEZONES
+ sort -u $(srcdir)/TIMEZONES > t && mv t $(srcdir)/TIMEZONES
+
+
+messages:
+ $(XGETTEXT) -ktranslate $(kcm_locale_la_SOURCES) -o $(podir)/kcmlocale.pot
+ $(XGETTEXT) TIMEZONES -o $(podir)/../kdelibs/timezones.pot
+
+xdg_apps_DATA = language.desktop
+
diff --git a/kcontrol/locale/TIMEZONES b/kcontrol/locale/TIMEZONES
new file mode 100644
index 000000000..49839aea4
--- /dev/null
+++ b/kcontrol/locale/TIMEZONES
@@ -0,0 +1,392 @@
+i18n("Africa/Abidjan");
+i18n("Africa/Accra");
+i18n("Africa/Addis_Ababa");
+i18n("Africa/Algiers");
+i18n("Africa/Asmera");
+i18n("Africa/Bamako");
+i18n("Africa/Bangui");
+i18n("Africa/Banjul");
+i18n("Africa/Bissau");
+i18n("Africa/Blantyre");
+i18n("Africa/Brazzaville");
+i18n("Africa/Bujumbura");
+i18n("Africa/Cairo");
+i18n("Africa/Casablanca");
+i18n("Africa/Ceuta");
+i18n("Africa/Conakry");
+i18n("Africa/Dakar");
+i18n("Africa/Dar_es_Salaam");
+i18n("Africa/Djibouti");
+i18n("Africa/Douala");
+i18n("Africa/El_Aaiun");
+i18n("Africa/Freetown");
+i18n("Africa/Gaborone");
+i18n("Africa/Harare");
+i18n("Africa/Johannesburg");
+i18n("Africa/Kampala");
+i18n("Africa/Khartoum");
+i18n("Africa/Kigali");
+i18n("Africa/Kinshasa");
+i18n("Africa/Lagos");
+i18n("Africa/Libreville");
+i18n("Africa/Lome");
+i18n("Africa/Luanda");
+i18n("Africa/Lubumbashi");
+i18n("Africa/Lusaka");
+i18n("Africa/Malabo");
+i18n("Africa/Maputo");
+i18n("Africa/Maseru");
+i18n("Africa/Mbabane");
+i18n("Africa/Mogadishu");
+i18n("Africa/Monrovia");
+i18n("Africa/Nairobi");
+i18n("Africa/Ndjamena");
+i18n("Africa/Niamey");
+i18n("Africa/Nouakchott");
+i18n("Africa/Ouagadougou");
+i18n("Africa/Porto-Novo");
+i18n("Africa/Sao_Tome");
+i18n("Africa/Timbuktu");
+i18n("Africa/Tripoli");
+i18n("Africa/Tunis");
+i18n("Africa/Windhoek");
+i18n("America/Adak");
+i18n("America/Anchorage");
+i18n("America/Anguilla");
+i18n("America/Antigua");
+i18n("America/Araguaina");
+i18n("America/Argentina/Buenos_Aires");
+i18n("America/Argentina/Catamarca");
+i18n("America/Argentina/ComodRivadavia");
+i18n("America/Argentina/Cordoba");
+i18n("America/Argentina/Jujuy");
+i18n("America/Argentina/La_Rioja");
+i18n("America/Argentina/Mendoza");
+i18n("America/Argentina/Rio_Gallegos");
+i18n("America/Argentina/San_Juan");
+i18n("America/Argentina/Tucuman");
+i18n("America/Argentina/Ushuaia");
+i18n("America/Aruba");
+i18n("America/Asuncion");
+i18n("America/Bahia");
+i18n("America/Barbados");
+i18n("America/Belem");
+i18n("America/Belize");
+i18n("America/Boa_Vista");
+i18n("America/Bogota");
+i18n("America/Boise");
+i18n("America/Buenos_Aires");
+i18n("America/Cambridge_Bay");
+i18n("America/Campo_Grande");
+i18n("America/Cancun");
+i18n("America/Caracas");
+i18n("America/Catamarca");
+i18n("America/Cayenne");
+i18n("America/Cayman");
+i18n("America/Chicago");
+i18n("America/Chihuahua");
+i18n("America/Cordoba");
+i18n("America/Costa_Rica");
+i18n("America/Cuiaba");
+i18n("America/Curacao");
+i18n("America/Danmarkshavn");
+i18n("America/Dawson");
+i18n("America/Dawson_Creek");
+i18n("America/Denver");
+i18n("America/Detroit");
+i18n("America/Dominica");
+i18n("America/Edmonton");
+i18n("America/Eirunepe");
+i18n("America/El_Salvador");
+i18n("America/Fortaleza");
+i18n("America/Glace_Bay");
+i18n("America/Godthab");
+i18n("America/Goose_Bay");
+i18n("America/Grand_Turk");
+i18n("America/Grenada");
+i18n("America/Guadeloupe");
+i18n("America/Guatemala");
+i18n("America/Guayaquil");
+i18n("America/Guyana");
+i18n("America/Halifax");
+i18n("America/Havana");
+i18n("America/Hermosillo");
+i18n("America/Indiana/Knox");
+i18n("America/Indiana/Marengo");
+i18n("America/Indiana/Vevay");
+i18n("America/Indianapolis");
+i18n("America/Inuvik");
+i18n("America/Iqaluit");
+i18n("America/Jamaica");
+i18n("America/Jujuy");
+i18n("America/Juneau");
+i18n("America/Kentucky/Monticello");
+i18n("America/La_Paz");
+i18n("America/Lima");
+i18n("America/Los_Angeles");
+i18n("America/Louisville");
+i18n("America/Maceio");
+i18n("America/Managua");
+i18n("America/Manaus");
+i18n("America/Martinique");
+i18n("America/Mazatlan");
+i18n("America/Mendoza");
+i18n("America/Menominee");
+i18n("America/Merida");
+i18n("America/Mexico_City");
+i18n("America/Miquelon");
+i18n("America/Monterrey");
+i18n("America/Montevideo");
+i18n("America/Montreal");
+i18n("America/Montserrat");
+i18n("America/Nassau");
+i18n("America/New_York");
+i18n("America/Nipigon");
+i18n("America/Nome");
+i18n("America/Noronha");
+i18n("America/North_Dakota/Center");
+i18n("America/Panama");
+i18n("America/Pangnirtung");
+i18n("America/Paramaribo");
+i18n("America/Phoenix");
+i18n("America/Port-au-Prince");
+i18n("America/Port_of_Spain");
+i18n("America/Porto_Velho");
+i18n("America/Puerto_Rico");
+i18n("America/Rainy_River");
+i18n("America/Rankin_Inlet");
+i18n("America/Recife");
+i18n("America/Regina");
+i18n("America/Rio_Branco");
+i18n("America/Rosario");
+i18n("America/Santiago");
+i18n("America/Santo_Domingo");
+i18n("America/Sao_Paulo");
+i18n("America/Scoresbysund");
+i18n("America/Shiprock");
+i18n("America/St_Johns");
+i18n("America/St_Kitts");
+i18n("America/St_Lucia");
+i18n("America/St_Thomas");
+i18n("America/St_Vincent");
+i18n("America/Swift_Current");
+i18n("America/Tegucigalpa");
+i18n("America/Thule");
+i18n("America/Thunder_Bay");
+i18n("America/Tijuana");
+i18n("America/Toronto");
+i18n("America/Tortola");
+i18n("America/Vancouver");
+i18n("America/Whitehorse");
+i18n("America/Winnipeg");
+i18n("America/Yakutat");
+i18n("America/Yellowknife");
+i18n("Antarctica/Casey");
+i18n("Antarctica/Davis");
+i18n("Antarctica/DumontDUrville");
+i18n("Antarctica/Mawson");
+i18n("Antarctica/McMurdo");
+i18n("Antarctica/Palmer");
+i18n("Antarctica/Rothera");
+i18n("Antarctica/South_Pole");
+i18n("Antarctica/Syowa");
+i18n("Antarctica/Vostok");
+i18n("Arctic/Longyearbyen");
+i18n("Asia/Aden");
+i18n("Asia/Almaty");
+i18n("Asia/Amman");
+i18n("Asia/Anadyr");
+i18n("Asia/Aqtau");
+i18n("Asia/Aqtobe");
+i18n("Asia/Ashgabat");
+i18n("Asia/Baghdad");
+i18n("Asia/Bahrain");
+i18n("Asia/Baku");
+i18n("Asia/Bangkok");
+i18n("Asia/Beirut");
+i18n("Asia/Bishkek");
+i18n("Asia/Brunei");
+i18n("Asia/Calcutta");
+i18n("Asia/Choibalsan");
+i18n("Asia/Chongqing");
+i18n("Asia/Colombo");
+i18n("Asia/Damascus");
+i18n("Asia/Dhaka");
+i18n("Asia/Dili");
+i18n("Asia/Dubai");
+i18n("Asia/Dushanbe");
+i18n("Asia/Gaza");
+i18n("Asia/Harbin");
+i18n("Asia/Hong_Kong");
+i18n("Asia/Hovd");
+i18n("Asia/Irkutsk");
+i18n("Asia/Jakarta");
+i18n("Asia/Jayapura");
+i18n("Asia/Jerusalem");
+i18n("Asia/Kabul");
+i18n("Asia/Kamchatka");
+i18n("Asia/Karachi");
+i18n("Asia/Kashgar");
+i18n("Asia/Katmandu");
+i18n("Asia/Krasnoyarsk");
+i18n("Asia/Kuala_Lumpur");
+i18n("Asia/Kuching");
+i18n("Asia/Kuwait");
+i18n("Asia/Macau");
+i18n("Asia/Magadan");
+i18n("Asia/Makassar");
+i18n("Asia/Manila");
+i18n("Asia/Muscat");
+i18n("Asia/Nicosia");
+i18n("Asia/Novosibirsk");
+i18n("Asia/Omsk");
+i18n("Asia/Oral");
+i18n("Asia/Phnom_Penh");
+i18n("Asia/Pontianak");
+i18n("Asia/Pyongyang");
+i18n("Asia/Qatar");
+i18n("Asia/Qyzylorda");
+i18n("Asia/Rangoon");
+i18n("Asia/Riyadh");
+i18n("Asia/Saigon");
+i18n("Asia/Sakhalin");
+i18n("Asia/Samarkand");
+i18n("Asia/Seoul");
+i18n("Asia/Shanghai");
+i18n("Asia/Singapore");
+i18n("Asia/Taipei");
+i18n("Asia/Tashkent");
+i18n("Asia/Tbilisi");
+i18n("Asia/Tehran");
+i18n("Asia/Thimphu");
+i18n("Asia/Tokyo");
+i18n("Asia/Ujung_Pandang");
+i18n("Asia/Ulaanbaatar");
+i18n("Asia/Urumqi");
+i18n("Asia/Vientiane");
+i18n("Asia/Vladivostok");
+i18n("Asia/Yakutsk");
+i18n("Asia/Yekaterinburg");
+i18n("Asia/Yerevan");
+i18n("Atlantic/Azores");
+i18n("Atlantic/Bermuda");
+i18n("Atlantic/Canary");
+i18n("Atlantic/Cape_Verde");
+i18n("Atlantic/Faeroe");
+i18n("Atlantic/Jan_Mayen");
+i18n("Atlantic/Madeira");
+i18n("Atlantic/Reykjavik");
+i18n("Atlantic/South_Georgia");
+i18n("Atlantic/St_Helena");
+i18n("Atlantic/Stanley");
+i18n("Australia/Adelaide");
+i18n("Australia/Brisbane");
+i18n("Australia/Broken_Hill");
+i18n("Australia/Darwin");
+i18n("Australia/Hobart");
+i18n("Australia/Lindeman");
+i18n("Australia/Lord_Howe");
+i18n("Australia/Melbourne");
+i18n("Australia/Perth");
+i18n("Australia/Sydney");
+i18n("Europe/Amsterdam");
+i18n("Europe/Andorra");
+i18n("Europe/Athens");
+i18n("Europe/Belfast");
+i18n("Europe/Belgrade");
+i18n("Europe/Berlin");
+i18n("Europe/Bratislava");
+i18n("Europe/Brussels");
+i18n("Europe/Bucharest");
+i18n("Europe/Budapest");
+i18n("Europe/Chisinau");
+i18n("Europe/Copenhagen");
+i18n("Europe/Dublin");
+i18n("Europe/Gibraltar");
+i18n("Europe/Helsinki");
+i18n("Europe/Istanbul");
+i18n("Europe/Kaliningrad");
+i18n("Europe/Kiev");
+i18n("Europe/Lisbon");
+i18n("Europe/Ljubljana");
+i18n("Europe/London");
+i18n("Europe/Luxembourg");
+i18n("Europe/Madrid");
+i18n("Europe/Malta");
+i18n("Europe/Mariehamn");
+i18n("Europe/Minsk");
+i18n("Europe/Monaco");
+i18n("Europe/Moscow");
+i18n("Europe/Oslo");
+i18n("Europe/Paris");
+i18n("Europe/Prague");
+i18n("Europe/Riga");
+i18n("Europe/Rome");
+i18n("Europe/Samara");
+i18n("Europe/San_Marino");
+i18n("Europe/Sarajevo");
+i18n("Europe/Simferopol");
+i18n("Europe/Skopje");
+i18n("Europe/Sofia");
+i18n("Europe/Stockholm");
+i18n("Europe/Tallinn");
+i18n("Europe/Tirane");
+i18n("Europe/Uzhgorod");
+i18n("Europe/Vaduz");
+i18n("Europe/Vatican");
+i18n("Europe/Vienna");
+i18n("Europe/Vilnius");
+i18n("Europe/Warsaw");
+i18n("Europe/Zagreb");
+i18n("Europe/Zaporozhye");
+i18n("Europe/Zurich");
+i18n("Indian/Antananarivo");
+i18n("Indian/Chagos");
+i18n("Indian/Christmas");
+i18n("Indian/Cocos");
+i18n("Indian/Comoro");
+i18n("Indian/Kerguelen");
+i18n("Indian/Mahe");
+i18n("Indian/Maldives");
+i18n("Indian/Mauritius");
+i18n("Indian/Mayotte");
+i18n("Indian/Reunion");
+i18n("Pacific/Apia");
+i18n("Pacific/Auckland");
+i18n("Pacific/Chatham");
+i18n("Pacific/Easter");
+i18n("Pacific/Efate");
+i18n("Pacific/Enderbury");
+i18n("Pacific/Fakaofo");
+i18n("Pacific/Fiji");
+i18n("Pacific/Funafuti");
+i18n("Pacific/Galapagos");
+i18n("Pacific/Gambier");
+i18n("Pacific/Guadalcanal");
+i18n("Pacific/Guam");
+i18n("Pacific/Honolulu");
+i18n("Pacific/Johnston");
+i18n("Pacific/Kiritimati");
+i18n("Pacific/Kosrae");
+i18n("Pacific/Kwajalein");
+i18n("Pacific/Majuro");
+i18n("Pacific/Marquesas");
+i18n("Pacific/Midway");
+i18n("Pacific/Nauru");
+i18n("Pacific/Niue");
+i18n("Pacific/Norfolk");
+i18n("Pacific/Noumea");
+i18n("Pacific/Pago_Pago");
+i18n("Pacific/Palau");
+i18n("Pacific/Pitcairn");
+i18n("Pacific/Ponape");
+i18n("Pacific/Port_Moresby");
+i18n("Pacific/Rarotonga");
+i18n("Pacific/Saipan");
+i18n("Pacific/Tahiti");
+i18n("Pacific/Tarawa");
+i18n("Pacific/Tongatapu");
+i18n("Pacific/Truk");
+i18n("Pacific/Wake");
+i18n("Pacific/Wallis");
+i18n("Pacific/Yap");
diff --git a/kcontrol/locale/default/Makefile.am b/kcontrol/locale/default/Makefile.am
new file mode 100644
index 000000000..dce42537e
--- /dev/null
+++ b/kcontrol/locale/default/Makefile.am
@@ -0,0 +1,2 @@
+kcm_locale_data_DATA = entry.desktop
+kcm_locale_datadir = $(kde_locale)/en_US
diff --git a/kcontrol/locale/default/entry.desktop b/kcontrol/locale/default/entry.desktop
new file mode 100644
index 000000000..4b105a8b2
--- /dev/null
+++ b/kcontrol/locale/default/entry.desktop
@@ -0,0 +1,72 @@
+[KCM Locale]
+Name=US English
+Name[af]=Amerikaanse Engels
+Name[ar]=إنكليزية الولايات المتحدة الأمريكية
+Name[az]=ABŞ İngiliscəsi
+Name[be]=Ангельская (ЗША)
+Name[bg]=Американски английски
+Name[br]=Saozneg SUA
+Name[bs]=Engleski US
+Name[ca]=Anglès US
+Name[cs]=Americká angličtina
+Name[csb]=Amerikańsczi anielsczi
+Name[cy]=Saesneg UD
+Name[da]=Engelsk US
+Name[de]=US-Englisch
+Name[el]=Αγγλική ΗΠΑ
+Name[eo]=Usona anglo
+Name[es]=Inglés de EEUU
+Name[et]=Inglise (US)
+Name[eu]=EEBBetako ingelesa
+Name[fa]=انگلیسی امریکایی
+Name[fi]=Yhdysvaltain englanti
+Name[fr]=Anglais US
+Name[fy]=VS Ingelsk
+Name[gl]=Inglés de EEUU
+Name[he]=אנגלית ארה"ב
+Name[hi]=यूएस अंग्रेजी
+Name[hr]=Američki engleski
+Name[hu]=Amerikai angol
+Name[is]=Enska (BNA)
+Name[it]=Inglese US
+Name[ja]=英語 (アメリカ)
+Name[ka]=ინგლისური (აშშ)
+Name[kk]=Ағылшын (АҚШ)
+Name[km]=អង់គ្លេស អាមេរិក
+Name[ko]=미국 영어
+Name[lt]=JAV anglų
+Name[lv]=ASV Angļu
+Name[mk]=Англиски (САД)
+Name[ms]=Bahasa Inggeris AS
+Name[mt]=Ingliż Amerikan
+Name[nb]=Engelsk (USA)
+Name[nds]=Engelsch (US)
+Name[ne]=US अङ्ग्रेजी
+Name[nl]=VS Engels
+Name[nn]=Engelsk (USA)
+Name[pa]=ਅਮਰੀਕੀ ਅੰਗਰੇਜ਼ੀ
+Name[pl]=Amerykański angielski
+Name[pt]=Inglês dos Estados Unidos
+Name[pt_BR]=Inglês dos EUA
+Name[ro]=Engleză US
+Name[ru]=Английский (США)
+Name[rw]=Icyongereza US
+Name[se]=Eŋgelasgiella (USA)
+Name[sk]=Anglický US
+Name[sl]=Angleško ZDA
+Name[sr]=Амерички енглески
+Name[sr@Latn]=Američki engleski
+Name[sv]=Amerikansk engelska
+Name[ta]=US ஆங்கிலம்
+Name[te]=యూఎస్ ఆంగ్లం
+Name[tg]=Англисии (ШМА)
+Name[th]=อังกฤษ อเมริกัน
+Name[tr]=Amerikan İngilizcesi
+Name[tt]=AQŞ İnglizçäse
+Name[uk]=Англійська (США)
+Name[uz]=Inglizcha AQSH
+Name[uz@cyrillic]=Инглизча AҚШ
+Name[vi]=Tiếng Anh-Mĩ
+Name[wa]=Inglès (USA)
+Name[zh_CN]=美国英语
+Name[zh_TW]=英語 - US
diff --git a/kcontrol/locale/kcmlocale.cpp b/kcontrol/locale/kcmlocale.cpp
new file mode 100644
index 000000000..5d746212e
--- /dev/null
+++ b/kcontrol/locale/kcmlocale.cpp
@@ -0,0 +1,473 @@
+/*
+ * locale.cpp
+ *
+ * Copyright (c) 1998 Matthias Hoelzer (hoelzer@physik.uni-wuerzburg.de)
+ * Copyright (c) 1999 Preston Brown <pbrown@kde.org>
+ * Copyright (c) 1999-2003 Hans Petter Bieker <bieker@kde.org>
+ *
+ * Requires the Qt widget libraries, available at no cost at
+ * http://www.troll.no/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <qhbox.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qlistbox.h>
+#include <qpushbutton.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+
+#include <kdebug.h>
+#include <kdialog.h>
+#include <kiconloader.h>
+#include <klanguagebutton.h>
+#include <ksimpleconfig.h>
+#include <kstandarddirs.h>
+
+#include "kcmlocale.h"
+#include "kcmlocale.moc"
+#include "toplevel.h"
+
+KLocaleConfig::KLocaleConfig(KLocale *locale,
+ QWidget *parent, const char *name)
+ : QWidget (parent, name),
+ m_locale(locale)
+{
+ QGridLayout *lay = new QGridLayout(this, 3, 3,
+ KDialog::marginHint(),
+ KDialog::spacingHint());
+
+ m_labCountry = new QLabel(this, I18N_NOOP("Country or region:"));
+ m_comboCountry = new KLanguageButton( this );
+ m_labCountry->setBuddy(m_comboCountry);
+ connect( m_comboCountry, SIGNAL(activated(const QString &)),
+ this, SLOT(changedCountry(const QString &)) );
+
+ m_labLang = new QLabel(this, I18N_NOOP("Languages:"));
+ m_labLang->setAlignment( AlignTop );
+
+ m_languages = new QListBox(this);
+ connect(m_languages, SIGNAL(selectionChanged()),
+ SLOT(slotCheckButtons()));
+
+ QWidget * vb = new QWidget(this);
+ QVBoxLayout * boxlay = new QVBoxLayout(vb, 0, KDialog::spacingHint());
+ m_addLanguage = new KLanguageButton(QString::null, vb, I18N_NOOP("Add Language"));
+ boxlay->add(m_addLanguage);
+ connect(m_addLanguage, SIGNAL(activated(const QString &)),
+ SLOT(slotAddLanguage(const QString &)));
+ m_removeLanguage = new QPushButton(vb, I18N_NOOP("Remove Language"));
+ m_upButton = new QPushButton(vb, I18N_NOOP("Move Up"));
+ m_downButton = new QPushButton(vb, I18N_NOOP("Move Down"));
+ boxlay->add(m_removeLanguage);
+ boxlay->add(m_upButton);
+ boxlay->add(m_downButton);
+ connect(m_removeLanguage, SIGNAL(clicked()),
+ SLOT(slotRemoveLanguage()));
+ connect(m_upButton, SIGNAL(clicked()),
+ SLOT(slotLanguageUp()));
+ connect(m_downButton, SIGNAL(clicked()),
+ SLOT(slotLanguageDown()));
+ boxlay->insertStretch(-1);
+
+ // #### HPB: This should be implemented for KDE 3
+ // new QLabel(this, I18N_NOOP("Encoding:"));
+ //QComboBox * cb = new QComboBox( this );
+ //cb->insertStringList( KGlobal::charsets()->descriptiveEncodingNames() );
+
+ lay->addMultiCellWidget(m_labCountry, 0, 0, 0, 1);
+ lay->addWidget(m_comboCountry, 0, 2);
+ lay->addWidget(m_labLang, 1, 0);
+ lay->addWidget(m_languages, 1, 1);
+ lay->addWidget(vb, 1, 2);
+
+ lay->setRowStretch(2, 5);
+
+ lay->setColStretch(1, 1);
+ lay->setColStretch(2, 1);
+}
+
+void KLocaleConfig::slotAddLanguage(const QString & code)
+{
+ QStringList languageList = m_locale->languageList();
+
+ int pos = m_languages->currentItem();
+ if ( pos < 0 )
+ pos = 0;
+
+ // If it's already in list, just move it (delete the old, then insert a new)
+ int oldPos = languageList.findIndex( code );
+ if ( oldPos != -1 )
+ languageList.remove( languageList.at(oldPos) );
+
+ if ( oldPos != -1 && oldPos < pos )
+ --pos;
+
+ QStringList::Iterator it = languageList.at( pos );
+
+ languageList.insert( it, code );
+
+ m_locale->setLanguage( languageList );
+
+ emit localeChanged();
+ if ( pos == 0 )
+ emit languageChanged();
+}
+
+void KLocaleConfig::slotRemoveLanguage()
+{
+ QStringList languageList = m_locale->languageList();
+ int pos = m_languages->currentItem();
+
+ QStringList::Iterator it = languageList.at( pos );
+
+ if ( it != languageList.end() )
+ {
+ languageList.remove( it );
+
+ m_locale->setLanguage( languageList );
+
+ emit localeChanged();
+ if ( pos == 0 )
+ emit languageChanged();
+ }
+}
+
+void KLocaleConfig::slotLanguageUp()
+{
+ QStringList languageList = m_locale->languageList();
+ int pos = m_languages->currentItem();
+
+ QStringList::Iterator it1 = languageList.at( pos - 1 );
+ QStringList::Iterator it2 = languageList.at( pos );
+
+ if ( it1 != languageList.end() && it2 != languageList.end() )
+ {
+ QString str = *it1;
+ *it1 = *it2;
+ *it2 = str;
+
+ m_locale->setLanguage( languageList );
+
+ emit localeChanged();
+ if ( pos == 1 ) // at the lang before the top
+ emit languageChanged();
+ }
+}
+
+void KLocaleConfig::slotLanguageDown()
+{
+ QStringList languageList = m_locale->languageList();
+ int pos = m_languages->currentItem();
+
+ QStringList::Iterator it1 = languageList.at( pos );
+ QStringList::Iterator it2 = languageList.at( pos + 1 );
+
+ if ( it1 != languageList.end() && it2 != languageList.end() )
+ {
+ QString str = *it1;
+ *it1 = *it2;
+ *it2 = str;
+
+ m_locale->setLanguage( languageList );
+
+ emit localeChanged();
+ if ( pos == 0 ) // at the top
+ emit languageChanged();
+ }
+}
+
+void KLocaleConfig::loadLanguageList()
+{
+ // temperary use of our locale as the global locale
+ KLocale *lsave = KGlobal::_locale;
+ KGlobal::_locale = m_locale;
+
+ // clear the list
+ m_addLanguage->clear();
+
+ QStringList first = languageList();
+
+ QStringList prilang;
+ // add the primary languages for the country to the list
+ for ( QStringList::ConstIterator it = first.begin();
+ it != first.end();
+ ++it )
+ {
+ QString str = locate("locale", QString::fromLatin1("%1/entry.desktop")
+ .arg(*it));
+ if (!str.isNull())
+ prilang << str;
+ }
+
+ // add all languages to the list
+ QStringList alllang = KGlobal::dirs()->findAllResources("locale",
+ QString::fromLatin1("*/entry.desktop"),
+ false, true);
+ QStringList langlist = prilang;
+ if (langlist.count() > 0)
+ langlist << QString::null; // separator
+ langlist += alllang;
+
+ int menu_index = -2;
+ QString submenu; // we are working on this menu
+ for ( QStringList::ConstIterator it = langlist.begin();
+ it != langlist.end(); ++it )
+ {
+ if ((*it).isNull())
+ {
+ m_addLanguage->insertSeparator();
+ submenu = QString::fromLatin1("other");
+ m_addLanguage->insertSubmenu(m_locale->translate("Other"),
+ submenu, QString::null, -1);
+ menu_index = -2; // first entries should _not_ be sorted
+ continue;
+ }
+ KSimpleConfig entry(*it);
+ entry.setGroup("KCM Locale");
+ QString name = entry.readEntry("Name",
+ m_locale->translate("without name"));
+
+ QString tag = *it;
+ int index = tag.findRev('/');
+ tag = tag.left(index);
+ index = tag.findRev('/');
+ tag = tag.mid(index + 1);
+ m_addLanguage->insertItem(name, tag, submenu, menu_index);
+ }
+
+ // restore the old global locale
+ KGlobal::_locale = lsave;
+}
+
+void KLocaleConfig::loadCountryList()
+{
+ // temperary use of our locale as the global locale
+ KLocale *lsave = KGlobal::_locale;
+ KGlobal::_locale = m_locale;
+
+ QString sub = QString::fromLatin1("l10n/");
+
+ // clear the list
+ m_comboCountry->clear();
+
+ QStringList regionlist = KGlobal::dirs()->findAllResources("locale",
+ sub + QString::fromLatin1("*.desktop"),
+ false, true );
+
+ for ( QStringList::ConstIterator it = regionlist.begin();
+ it != regionlist.end();
+ ++it )
+ {
+ QString tag = *it;
+ int index;
+
+ index = tag.findRev('/');
+ if (index != -1)
+ tag = tag.mid(index + 1);
+
+ index = tag.findRev('.');
+ if (index != -1)
+ tag.truncate(index);
+
+ KSimpleConfig entry(*it);
+ entry.setGroup("KCM Locale");
+ QString name = entry.readEntry("Name",
+ m_locale->translate("without name"));
+
+ QString map( locate( "locale",
+ QString::fromLatin1( "l10n/%1.png" )
+ .arg(tag) ) );
+ QIconSet icon;
+ if ( !map.isNull() )
+ icon = KGlobal::iconLoader()->loadIconSet(map, KIcon::Small);
+ m_comboCountry->insertSubmenu( icon, name, tag, sub, -2 );
+ }
+
+ // add all languages to the list
+ QStringList countrylist = KGlobal::dirs()->findAllResources
+ ("locale", sub + QString::fromLatin1("*/entry.desktop"), false, true);
+
+ for ( QStringList::ConstIterator it = countrylist.begin();
+ it != countrylist.end(); ++it )
+ {
+ KSimpleConfig entry(*it);
+ entry.setGroup("KCM Locale");
+ QString name = entry.readEntry("Name",
+ m_locale->translate("without name"));
+ QString submenu = entry.readEntry("Region");
+
+ QString tag = *it;
+ int index = tag.findRev('/');
+ tag.truncate(index);
+ index = tag.findRev('/');
+ tag = tag.mid(index + 1);
+ int menu_index = submenu.isEmpty() ? -1 : -2;
+
+ QString flag( locate( "locale",
+ QString::fromLatin1( "l10n/%1/flag.png" )
+ .arg(tag) ) );
+ QIconSet icon( KGlobal::iconLoader()->loadIconSet(flag, KIcon::Small) );
+ m_comboCountry->insertItem( icon, name, tag, submenu, menu_index );
+ }
+
+ // restore the old global locale
+ KGlobal::_locale = lsave;
+}
+
+void KLocaleConfig::readLocale(const QString &path, QString &name,
+ const QString &sub) const
+{
+ // temperary use of our locale as the global locale
+ KLocale *lsave = KGlobal::_locale;
+ KGlobal::_locale = m_locale;
+
+ // read the name
+ QString filepath = QString::fromLatin1("%1%2/entry.desktop")
+ .arg(sub)
+ .arg(path);
+
+ KSimpleConfig entry(locate("locale", filepath));
+ entry.setGroup("KCM Locale");
+ name = entry.readEntry("Name");
+
+ // restore the old global locale
+ KGlobal::_locale = lsave;
+}
+
+void KLocaleConfig::save()
+{
+ KConfigBase *config = KGlobal::config();
+
+ config->setGroup("Locale");
+
+ config->writeEntry("Country", m_locale->country(), true, true);
+ if ( m_locale->languageList().isEmpty() )
+ config->writeEntry("Language", QString::fromLatin1(""), true, true);
+ else
+ config->writeEntry("Language",
+ m_locale->languageList(), ':', true, true);
+
+ config->sync();
+}
+
+void KLocaleConfig::slotCheckButtons()
+{
+ m_removeLanguage->setEnabled( m_languages->currentItem() != -1 );
+ m_upButton->setEnabled( m_languages->currentItem() > 0 );
+ m_downButton->setEnabled( m_languages->currentItem() != -1 &&
+ m_languages->currentItem() < (signed)(m_languages->count() - 1) );
+}
+
+void KLocaleConfig::slotLocaleChanged()
+{
+ loadLanguageList();
+ loadCountryList();
+
+ // update language widget
+ m_languages->clear();
+ QStringList languageList = m_locale->languageList();
+ for ( QStringList::Iterator it = languageList.begin();
+ it != languageList.end();
+ ++it )
+ {
+ QString name;
+ readLocale(*it, name, QString::null);
+
+ m_languages->insertItem(name);
+ }
+ slotCheckButtons();
+
+ m_comboCountry->setCurrentItem( m_locale->country() );
+}
+
+void KLocaleConfig::slotTranslate()
+{
+ kdDebug() << "slotTranslate()" << endl;
+
+ QToolTip::add(m_comboCountry, m_locale->translate
+ ( "This is where you live. KDE will use the defaults for "
+ "this country or region.") );
+ QToolTip::add(m_addLanguage, m_locale->translate
+ ( "This will add a language to the list. If the language is already "
+ "in the list, the old one will be moved instead." ) );
+
+ QToolTip::add(m_removeLanguage, m_locale->translate
+ ( "This will remove the highlighted language from the list." ) );
+
+ QToolTip::add(m_languages, m_locale->translate
+ ( "KDE programs will be displayed in the first available language in "
+ "this list.\nIf none of the languages are available, US English "
+ "will be used.") );
+
+ QString str;
+
+ str = m_locale->translate
+ ( "Here you can choose your country or region. The settings "
+ "for languages, numbers etc. will automatically switch to the "
+ "corresponding values." );
+ QWhatsThis::add( m_labCountry, str );
+ QWhatsThis::add( m_comboCountry, str );
+
+ str = m_locale->translate
+ ( "Here you can choose the languages that will be used by KDE. If the "
+ "first language in the list is not available, the second will be used, "
+ "etc. If only US English is available, no translations "
+ "have been installed. You can get translation packages for many "
+ "languages from the place you got KDE from.<p>"
+ "Note that some applications may not be translated to your languages; "
+ "in this case, they will automatically fall back to US English." );
+ QWhatsThis::add( m_labLang, str );
+ QWhatsThis::add( m_languages, str );
+ QWhatsThis::add( m_addLanguage, str );
+ QWhatsThis::add( m_removeLanguage, str );
+}
+
+QStringList KLocaleConfig::languageList() const
+{
+ QString fileName = locate("locale",
+ QString::fromLatin1("l10n/%1/entry.desktop")
+ .arg(m_locale->country()));
+
+ KSimpleConfig entry(fileName);
+ entry.setGroup("KCM Locale");
+
+ return entry.readListEntry("Languages");
+}
+
+void KLocaleConfig::changedCountry(const QString & code)
+{
+ m_locale->setCountry(code);
+
+ // change to the preferred languages in that country, installed only
+ QStringList languages = languageList();
+ QStringList newLanguageList;
+ for ( QStringList::Iterator it = languages.begin();
+ it != languages.end();
+ ++it )
+ {
+ QString name;
+ readLocale(*it, name, QString::null);
+
+ if (!name.isEmpty())
+ newLanguageList += *it;
+ }
+ m_locale->setLanguage( newLanguageList );
+
+ emit localeChanged();
+ emit languageChanged();
+}
diff --git a/kcontrol/locale/kcmlocale.h b/kcontrol/locale/kcmlocale.h
new file mode 100644
index 000000000..f71193418
--- /dev/null
+++ b/kcontrol/locale/kcmlocale.h
@@ -0,0 +1,95 @@
+/*
+ * kcmlocale.h
+ *
+ * Copyright (c) 1998 Matthias Hoelzer <hoelzer@physik.uni-wuerzburg.de>
+ * Copyright (c) 1999-2003 Hans Petter Bieker <bieker@kde.org>
+ *
+ * Requires the Qt widget libraries, available at no cost at
+ * http://www.troll.no/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KCMLOCALE_H
+#define KCMLOCALE_H
+
+#include <qwidget.h>
+#include <qstringlist.h>
+
+class KAddButton;
+class KLanguageButton;
+class KLocale;
+class KLocaleSample;
+
+class QLabel;
+class QListBox;
+class QPushButton;
+
+class KLocaleConfig : public QWidget
+{
+ Q_OBJECT
+
+public:
+ KLocaleConfig( KLocale *_locale,
+ QWidget *parent = 0, const char *name = 0);
+
+ void save();
+
+public slots:
+ /**
+ * Loads all settings from the current locale into the current widget.
+ */
+ void slotLocaleChanged();
+ /**
+ * Retranslate all objects owned by this object using the current locale.
+ */
+ void slotTranslate();
+
+signals:
+ void localeChanged();
+ void languageChanged();
+
+private slots:
+ void loadLanguageList();
+ void loadCountryList();
+
+ void changedCountry(const QString & code);
+ void readLocale(const QString &path, QString &name,
+ const QString &sub) const;
+
+ void slotAddLanguage(const QString & id);
+ void slotRemoveLanguage();
+ void slotLanguageUp();
+ void slotLanguageDown();
+ void slotCheckButtons();
+
+private:
+ QStringList languageList() const;
+
+ KLocale *m_locale;
+
+ KLanguageButton *m_comboCountry;
+
+ QLabel *m_labCountry;
+ QLabel *m_labLang;
+
+ QListBox * m_languages;
+ KLanguageButton * m_addLanguage;
+ QPushButton * m_removeLanguage;
+ QPushButton * m_upButton;
+ QPushButton * m_downButton;
+};
+
+#endif
diff --git a/kcontrol/locale/klocalesample.cpp b/kcontrol/locale/klocalesample.cpp
new file mode 100644
index 000000000..e78ae966c
--- /dev/null
+++ b/kcontrol/locale/klocalesample.cpp
@@ -0,0 +1,132 @@
+/*
+ * klocalesample.cpp
+ *
+ * Copyright (c) 1998 Matthias Hoelzer (hoelzer@physik.uni-wuerzburg.de)
+ * Copyright (c) 1999 Preston Brown <pbrown@kde.org>
+ * Copyright (c) 1999-2003 Hans Petter Bieker <bieker@kde.org>
+ *
+ * Requires the Qt widget libraries, available at no cost at
+ * http://www.troll.no/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <qdatetime.h>
+#include <qlabel.h>
+#include <qwhatsthis.h>
+#include <qlayout.h>
+#include <qtimer.h>
+
+#include <stdio.h>
+
+#include <klocale.h>
+
+#include "klocalesample.h"
+#include "klocalesample.moc"
+
+KLocaleSample::KLocaleSample(KLocale *locale,
+ QWidget *parent, const char*name)
+ : QWidget(parent, name),
+ m_locale(locale)
+{
+ QGridLayout *lay = new QGridLayout(this, 5, 2);
+ lay->setAutoAdd(TRUE);
+
+ // Whatever the color scheme is, we want black text
+ QColorGroup a = palette().active();
+ a.setColor(QColorGroup::Foreground, Qt::black);
+ QPalette pal(a, a, a);
+
+ m_labNumber = new QLabel(this, I18N_NOOP("Numbers:"));
+ m_labNumber->setPalette(pal);
+ m_numberSample = new QLabel(this);
+ m_numberSample->setPalette(pal);
+
+ m_labMoney = new QLabel(this, I18N_NOOP("Money:"));
+ m_labMoney->setPalette(pal);
+ m_moneySample = new QLabel(this);
+ m_moneySample->setPalette(pal);
+
+ m_labDate = new QLabel(this, I18N_NOOP("Date:"));
+ m_labDate->setPalette(pal);
+ m_dateSample = new QLabel(this);
+ m_dateSample->setPalette(pal);
+
+ m_labDateShort = new QLabel(this, I18N_NOOP("Short date:"));
+ m_labDateShort->setPalette(pal);
+ m_dateShortSample = new QLabel(this);
+ m_dateShortSample->setPalette(pal);
+
+ m_labTime = new QLabel(this, I18N_NOOP("Time:"));
+ m_labTime->setPalette(pal);
+ m_timeSample = new QLabel(this);
+ m_timeSample->setPalette(pal);
+
+ lay->setColStretch(0, 1);
+ lay->setColStretch(1, 3);
+
+ QTimer *timer = new QTimer(this, "clock_timer");
+ connect(timer, SIGNAL(timeout()), this, SLOT(slotUpdateTime()));
+ timer->start(1000);
+}
+
+KLocaleSample::~KLocaleSample()
+{
+}
+
+void KLocaleSample::slotUpdateTime()
+{
+ QDateTime dt = QDateTime::currentDateTime();
+
+ m_dateSample->setText(m_locale->formatDate(dt.date(), false));
+ m_dateShortSample->setText(m_locale->formatDate(dt.date(), true));
+ m_timeSample->setText(m_locale->formatTime(dt.time(), true));
+}
+
+void KLocaleSample::slotLocaleChanged()
+{
+ m_numberSample->setText(m_locale->formatNumber(1234567.89) +
+ QString::fromLatin1(" / ") +
+ m_locale->formatNumber(-1234567.89));
+
+ m_moneySample->setText(m_locale->formatMoney(123456789.00) +
+ QString::fromLatin1(" / ") +
+ m_locale->formatMoney(-123456789.00));
+
+ slotUpdateTime();
+
+ QString str;
+
+ str = m_locale->translate("This is how numbers will be displayed.");
+ QWhatsThis::add( m_labNumber, str );
+ QWhatsThis::add( m_numberSample, str );
+
+ str = m_locale->translate("This is how monetary values will be displayed.");
+ QWhatsThis::add( m_labMoney, str );
+ QWhatsThis::add( m_moneySample, str );
+
+ str = m_locale->translate("This is how date values will be displayed.");
+ QWhatsThis::add( m_labDate, str );
+ QWhatsThis::add( m_dateSample, str );
+
+ str = m_locale->translate("This is how date values will be displayed using "
+ "a short notation.");
+ QWhatsThis::add( m_labDateShort, str );
+ QWhatsThis::add( m_dateShortSample, str );
+
+ str = m_locale->translate("This is how the time will be displayed.");
+ QWhatsThis::add( m_labTime, str );
+ QWhatsThis::add( m_timeSample, str );
+}
diff --git a/kcontrol/locale/klocalesample.h b/kcontrol/locale/klocalesample.h
new file mode 100644
index 000000000..bf1cd7462
--- /dev/null
+++ b/kcontrol/locale/klocalesample.h
@@ -0,0 +1,58 @@
+/*
+ * locale.cpp
+ *
+ * Copyright (c) 1998 Matthias Hoelzer (hoelzer@physik.uni-wuerzburg.de)
+ * Copyright (c) 1999-2003 Hans Petter Bieker <bieker@kde.org>
+ *
+ * Requires the Qt widget libraries, available at no cost at
+ * http://www.troll.no/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __KLOCALESAMPLE_H__
+#define __KLOCALESAMPLE_H__
+
+#include <qwidget.h>
+
+class QLabel;
+class QResizeEvent;
+
+class KLocale;
+
+class KLocaleSample : public QWidget
+{
+ Q_OBJECT
+public:
+ KLocaleSample(KLocale *_locale,
+ QWidget *parent = 0, const char*name = 0);
+ virtual ~KLocaleSample();
+
+public slots:
+ void slotLocaleChanged();
+
+protected slots:
+ void slotUpdateTime();
+
+private:
+ KLocale *m_locale;
+ QLabel *m_numberSample, *m_labNumber;
+ QLabel *m_moneySample, *m_labMoney;
+ QLabel *m_timeSample, *m_labTime;
+ QLabel *m_dateSample, *m_labDate;
+ QLabel *m_dateShortSample, *m_labDateShort;
+};
+
+#endif
diff --git a/kcontrol/locale/language.desktop b/kcontrol/locale/language.desktop
new file mode 100644
index 000000000..9bab97b21
--- /dev/null
+++ b/kcontrol/locale/language.desktop
@@ -0,0 +1,236 @@
+[Desktop Entry]
+Exec=kcmshell language
+Icon=locale
+Type=Application
+DocPath=kcontrol/language/index.html
+
+
+X-KDE-Library=locale
+X-KDE-FactoryName=locale
+X-KDE-ParentApp=kcontrol
+
+Name=Country/Region & Language
+Name[af]=Land/Streek & Taal
+Name[ar]=البلد/المنطقة و اللغة
+Name[az]=Ölkə/Bölgə və Dil
+Name[be]=Краіна/Рэгіён і Мова
+Name[bg]=Държава и език
+Name[bn]=দেশ/এলাকা ও ভাষা
+Name[br]=Bro/Rann-vro & yezh
+Name[bs]=Zemlja/region i jezik
+Name[ca]=País/Regió i idioma
+Name[cs]=Země/region a jazyk
+Name[csb]=Kraj/dzél kraju ë jãzëk
+Name[cy]=Gwlad/Rhanbarth ac Iaith
+Name[da]=Land/Område & sprog
+Name[de]=Land/Region & Sprache
+Name[el]=Χώρα/Περιοχή & Γλώσσα
+Name[eo]=Lando/Regiono & Lingvo
+Name[es]=País/Región e idioma
+Name[et]=Riik/regioon ja keel
+Name[eu]=Herrialdea eta hizkuntza
+Name[fa]=کشور/منطقه و زبان
+Name[fi]=Maa tai alue ja kieli
+Name[fr]=Pays & langue
+Name[fy]=Lân/regio en taal
+Name[ga]=Tír/Réigiún agus Teanga
+Name[gl]=País/Rexión e Lingua
+Name[he]=מדינה\אזור ושפה
+Name[hi]=देश/क्षेत्र व भाषा
+Name[hr]=Zemlja i jezik
+Name[hu]=Ország/régió és nyelv
+Name[is]=Land & tungumál
+Name[it]=Lingua e paese
+Name[ja]=国と言語
+Name[ka]=ქვეყანა/რეგიონი და ენა
+Name[kk]=Ел/өлке және тіл
+Name[km]=ប្រទេស/តំបន់ & ភាសា
+Name[ko]=국가, 지역 및 언어
+Name[lo]=ປະເທດແລະພາສາ
+Name[lt]=Šalis-regionas ir kalba
+Name[lv]=Valsts/Reģions un Valoda
+Name[mk]=Земја/регион и јазик
+Name[mn]=Орон/Бүс & Хэл
+Name[ms]=Negara/Rantau & Bahasa
+Name[mt]=Pajjiż/Reġjun u Lingwa
+Name[nb]=Land/region og språk
+Name[nds]=Land/Regioon & Spraak
+Name[ne]=देश/क्षेत्र र भाषा
+Name[nl]=Land/regio en taal
+Name[nn]=Land/region og språk
+Name[nso]=Naga/Lefelo & Leleme
+Name[pa]=ਦੇਸ਼/ਖੇਤਰ ਅਤੇ ਭਾਸ਼ਾ
+Name[pl]=Kraj/region i język
+Name[pt]=País/Região e Língua
+Name[pt_BR]=País/Região & Idioma
+Name[ro]=Țara/regiunea și limba
+Name[ru]=Язык и стандарты
+Name[rw]=Ururimi & Igihugu/Agace
+Name[se]=Riika/guovla ja giella
+Name[sk]=Krajina/Region a Jazyk
+Name[sl]=Država/regija in jezik
+Name[sr]=Држава/регион и језик
+Name[sr@Latn]=Država/region i jezik
+Name[sv]=Land/region och språk
+Name[ta]=நாடு/இடம் மற்றும் மொழி
+Name[te]=దేశం/రాజ్యం & భాష
+Name[tg]=Кишвар/Забон ва Минтақа
+Name[th]=ประเทศและภาษา
+Name[tr]=Ülke/Bölge ve Dil
+Name[tt]=İl/Töbäk belän Tel
+Name[uk]=Країна/регіон та мова
+Name[uz]=Davlat/region va til
+Name[uz@cyrillic]=Давлат/регион ва тил
+Name[ven]=Shango/Fhethu & Luambo
+Name[vi]=Quốc gia và Ngôn ngữ
+Name[wa]=Payis & lingaedje
+Name[xh]=Ilizwe/Ummandla & Ulwimi
+Name[zh_CN]=国家/地区和语言
+Name[zh_TW]=國家/地區與語言
+Name[zu]=Izwe/Isifunda & Ulimi
+
+Comment=Language, numeric, and time settings for your particular region
+Comment[af]=Taal, numeries, en tyd instellings vir jou spesifieke streek
+Comment[ar]=ضبط اللغة, و التقويم, و الأرقام الخاصة بمنطقتك
+Comment[az]=Bölgənizə xas dil, sayı və vaxt qurğuları
+Comment[be]=Моўныя, лічбавыя і часавыя настаўленні для вашага канкрэтнага рэгіёну
+Comment[bg]=Настройване на държавата, езика, формата на датата и часа и др.
+Comment[bn]=আপনার স্থানীয় ভাষা, সময় এবং সংখ্যা বর্ণনা সম্বন্ধীয় নিয়মাবলী
+Comment[br]=Kefluniadur yezh, sifroù hag eur evit ho rannved-c'hwi
+Comment[bs]=Jezik, format brojeva i podešavanje vremena za određenu regiju
+Comment[ca]=Arranjaments d'idioma, numèric i d'hora per a la vostra regió
+Comment[cs]=Nastavení jazyka, formátu čísel a času pro váš region
+Comment[csb]=Jãzëk, fòrmat wielënów é czasu dlô Twòji òbeńdë
+Comment[cy]=Gosodiadu iaith,rhifau,ac amser i'ch rhanbarth
+Comment[da]=Sprog-, tal-, og tidsindstillinger for din region
+Comment[de]=Sprache, Zahlen- und Zeitformate für Ihr Land
+Comment[el]=Αριθμητικές, γλωσσικές και ωρολογιακές ρυθμίσεις για την περιοχή σας
+Comment[eo]=Agordo de lingvoj, nombroj, tempindikoj
+Comment[es]=Preferencias del idioma, formato numérico y fecha/hora para su región particular.
+Comment[et]=Sinu regiooni keele, numbrite ja kellaaja seadistused
+Comment[eu]=Zure herrialdeari dagozkion hizkuntza, zenbaki, eta denbora ezarpenak
+Comment[fa]=زبان، عدد، و تنظیمات زمان برای منطقۀ خاص شما
+Comment[fi]=Alueen kielen, ajan ja lukujen asetukset
+Comment[fr]=Configuration de la langue, des nombres, et du format d'heure
+Comment[fy]=Taal-, numeryk, en tiidsynstelling foar jo eigen regio
+Comment[gl]=Lingua e parámetros numéricos/horarios para a sua rexión particular
+Comment[he]=שינוי הגדרות השפה, המספרים והשעה עבור האזור הייחודי שלך
+Comment[hi]=भाषा,अंकीय, तथा आपके विशेष क्षेत्र के लिए समय विन्यास
+Comment[hr]=Jezik, oblik brojeva i vremenska postavke za određenu regiju
+Comment[hu]=Nyelv-, szám- és időbeállítások
+Comment[id]=Bahasa, penomoran dan seting waktu untuk wilayah anda
+Comment[is]=Tungumál og framsetning talna og dagssetninga
+Comment[it]=Impostazioni nazionali per la lingua, i numeri, la data e l'ora
+Comment[ja]=地域特有の言語と数値や日付書式を設定
+Comment[ka]=თქვენი რეგიონისთვის ენის, თარიღის და ციფრული ფორმატის კონფიგურაცია
+Comment[kk]=Өлкеңіздің тіл, сан және уақыт пішімін орнату
+Comment[km]=ការ​កំណត់​ភាសា, លេខ និង​ពេលវេលា សម្រាប់​តំបន់​ជាក់លាក់​របស់​អ្នក
+Comment[ko]=살고 있는 지역의 언어, 수, 시간 설정
+Comment[lo]=ຮູບແບບພາສາ, ຕົວເລກແລະພື້ນທີ່ເວລາສຳລັບตัวเลข ພື້ນທີ່ທ່ານຢູ່
+Comment[lt]=Kalba, skaitiniai ir laiko nustatymai Jūsų individualiam regionui
+Comment[lv]=Valodas, numuru, un laika uzstādījumi jūsu konkrētajam reģionam
+Comment[mk]=Поставувања на јазикот, броевите и времето за вашиот регион
+Comment[mn]=Хэл, Тоо- ба танай орны цагийн хэлбэр
+Comment[mt]=Lingwa, u setings tan-numri u ħin għar-reġjun tiegħek
+Comment[nb]=Språk-, tall- og tidsinnstillinger for ditt område
+Comment[nds]=Spraak, Tallen un Tietformaat för Dien Land instellen
+Comment[ne]=तपाईँको बिशेष क्षेत्रका लागि भाषा, सङ्ख्यात्मक, र समय सेटिङ
+Comment[nl]=Taal-, numerieke, en tijdsinstelling voor uw eigen regio
+Comment[nn]=Innstillingar for språk, tal og tid i regionen din
+Comment[nso]=Leleme, dinomoro, le dipeakanyo tsa nako go lefelo la gago le itsego
+Comment[oc]=Arranjaments d'idioma, numèric e d'ora pel vostre pais
+Comment[pa]=ਆਪਣੇ ਖਾਸ ਖੇਤਰ ਲਈ ਭਾਸ਼ਾ, ਅੰਕੀ ਤੇ ਸਮਾਂ ਸੈਟ ਕਰੋ
+Comment[pl]=Ustawienia języka, formatu liczb i czasu dla Twojego regionu
+Comment[pt]=Configuração da língua e dos parâmetros numéricos/horários para a sua região
+Comment[pt_BR]=Preferências de idioma, formatos de data e hora de sua região
+Comment[ro]=Setează limbajul, afișarea numerelor și timpului în modul specific regiunii unde locuiți
+Comment[ru]=Настройки языка, даты и времени для вашего региона
+Comment[rw]=Ururimi,bikurikije umubare,n'amagenamiterere y'igihe y'agace kihariye
+Comment[se]=Báikkalaš giella-,lohko- ja áigeheivehusat
+Comment[sk]=Jazyk, čísla, a nastavenia časového regiónu
+Comment[sl]=Jezikovne, številske in časovne nastavitve za vaše območje
+Comment[sr]=Језик, нумеричка и временска подешавања према вашем региону
+Comment[sr@Latn]=Jezik, numerička i vremenska podešavanja prema vašem regionu
+Comment[sv]=Ställ in språk, numeriskt format och tid för din speciella region
+Comment[ta]= குறிப்பிட்ட பகுதிக்கான மொழி, எண் மற்றும் நேர அமைப்புகள்
+Comment[tg]=Танзимоти забон, рақам ва вақт барои минтақаи шумо
+Comment[th]=รูปแบบภาษา, ตัวเลข และพื้นที่เวลาสำหรับพื้นที่ที่คุณอยู่
+Comment[tr]=Bölgenize özgü dil, sayı ve zaman ayarları
+Comment[tt]=Töbägeñ öçen tel, san, waqıt caylawları
+Comment[uk]=Налаштування мови, відображення чисел та часу для вашого регіону
+Comment[uz]=Davlatingiz uchun til, son va vaqt moslamalari
+Comment[uz@cyrillic]=Давлатингиз учун тил, сон ва вақт мосламалари
+Comment[ven]=Luambo, Mbalo, na mavhekanyele a tshifhinga a vhupo hahanu
+Comment[vi]=Ngôn ngữ, số và các thiết lập về thời gian cho vùng cụ thể
+Comment[wa]=Apontiaedje do lingaedje et des preferinces (prezintaedje des limeros, des dates, evnd.) po vosse payis
+Comment[xh]=Ulwimi, amanani, kunye nezicwangciso zexesha zommandla wakho
+Comment[zh_CN]=您所在地区的语言、数字和时间设置
+Comment[zh_TW]=您所在地區的語言、數字和時間設定
+Comment[zu]=Ulimi, okuyizinombolo, kanye nezilungiselelo zesikhathi zesifunda sakho esithile
+
+Keywords=language,translation,number format,currency,time,date,formats,locale,Country,charsets,character sets,Decimal symbol,Thousands separator,symbol,separator,sign,positive,negative,fractional digits,week,week start
+Keywords[af]=language,translation,number format,currency,time,date,formats,locale,Country,charsets,character sets,Decimal symbol,Thousands separator,symbol,separator,sign,positive,negative,fractional digits,week,week begin
+Keywords[az]=dil,tərcümə,sayı şəkli,pul,saat,tarix,şəkillər,yerli,ölkə,hərf kömələri,hərf kömələri,onluq simvolu,minlər ayırıcısı,simvol,ayırıcı,işarət,müsbət,mənfi,onluq pillələr,həftə,həftə başı
+Keywords[be]=Мова,Пераклад,Фармат лікаў,Валюта,Час,Дата,Фарматы,Мясцовасць,Лакаль,Краіна,Знаказбор,Знаказборы,Сімвал дзесятковай коскі,Падзяляльнік тысяч,Сімвал,Знак,Падзяляльнік,Дадатны,Адмоўны,Тыдзень,Пачатак тыдня,language,translation,number format,currency,time,date,formats,locale,Country,charsets,character sets,Decimal symbol,Thousands separator,symbol,separator,sign,positive,negative,fractional digits,week,week start
+Keywords[bg]=език, страна, регион, превод, числа, формат, дата, час, пари, валута, единица, локал, локализация, language, translation, number format, currency, time, date, formats, locale, Country, charsets, character sets, Decimal symbol, Thousands separator, symbol, separator, sign, positive, negative, fractional digits, week, week start
+Keywords[ca]=llengua,traducció,format numèric,moneda,hora,data,formats,locale,País,caràcters,jocs de caràcters,Símbol decimal,Separador de mils,símbol,separador,signe,positiu,negatiu,dígits fraccionaris,setmana,inici de la setmana
+Keywords[cs]=Jazyk,Překlad,Formát čísel,Měna,Čas,Datum,Formát,Locale,Země,Znaková sada,Oddělovač tisíců,Oddělovač desetinných míst,Kladný,Záporný,Desetinná místa,Začátek týdne
+Keywords[csb]=jãzëk,dolmaczënk,fòrmat wielënów,waluta,pieniądze,czas,datum,fòrmatë,òbeńdowé nastôwë,kraj,zestôwë merków,dzesãtny symbòl,merk rozdzelający tësãce,symbòla,separatora,merk,dodatny,ujimny,kawelkòwé lëczbë,tidzéń,zôczątk tidzénia
+Keywords[cy]=iaith,cyfieithiad,fformat rhif,arian cyfred,amser,dyddiad,fformatiau,lleoliad,Gwlad,set nodau,setiau nodau,Symbol degol,Gwahanydd miloedd,symbol,gwahanydd,arwydd,positif,negatif,digidau ffracsiynol,wythnos,cychwyn wythnos
+Keywords[da]=sprog,oversættelse,talformat,mønt,tid,dato,formater,sted,Land,tegnsæt,Decimalsymbol,Tusindeadskiller,symbol, adskiller,fortegn,positiv,negativ,brøkcifre ,uge,ugebegyndelse
+Keywords[de]=Sprachen,Übersetzung,Zahlenformat,Währung,Zeit,Datum,Formate,Regionales,Land,Zeichensätze,Dezimalzeichen,Symbole,Zeichen,Positiv,Negativ,Bruchzahlen,Wochenanfang
+Keywords[el]=γλώσσα,μετάφραση,μορφή αριθμού,συνάλλαγμα,ώρα,ημερομηνία,μορφές,εντοπιότητα,Χώρα,σύνολα χαρακτήρων,σύνολα χαρακτήρων,Σύμβολο υποδιαστολής,Διαχωριστικό χιλιάδων,σύμβολο,διαχωριστικό,πρόσημο,θετικός,αρνητικός,δεκαδικά ψηφία,εβδομάδα,αρχή εβδομάδας
+Keywords[eo]=lingvo,traduko,nombro,mono,tempo,formato,lokaĵo,lando,komo,punkto,onpunkto,decimalsigno,milosigno,signo,pozitiva,negativa,frakcio,semajno,semajnkomenco
+Keywords[es]=idioma,traducción,formato numérico,moneda,hora,fecha,formatos,ambiente,País,mapas de caracteres,Símbolo decimal,Separador de miles,símbolo,separador,signo,positivo,negativo,dígitos fraccionarios,semana,inicio de la semana
+Keywords[et]=keel,tõlge,numbrite vorming,valuuta,kellaaeg,kuupäev,vormingud,lokaale,riik,kooditabelid, kümnendkoha eraldaja,tuhandete eraldaja,sümbol,eraldaja,märk,positiivne,negatiivne,murdarvud, nädal,nädala algus
+Keywords[eu]=hizkuntza,itzulpena,zenbakien formatua,txanpona,denbora,data,formatuak,localea,herrialdea,karaktere-multzoak, karaktere ezarpenak,sinbolo hamartarra,Milakaden banatzailea, sinboloa,banatzailea,zeinua,positiboa,negatiboa,zatikizko zenbakiak,astea,astearen hasiera
+Keywords[fa]=زبان، ترجمه، قالب عدد، پول، زمان، تاریخ، قالبها، محلی، کشور، نویسه‌گان، نویسه‌گان، نماد ده‌دهی، جداساز هزارگان، نماد، جداساز، علامت، مثبت، منفی، اعداد کسری، هفته، آغاز هفته
+Keywords[fi]=kieli,käännös,lukujen muoto,valuutta,aika,päivämäärä,formaatit,muodot,locale,maa,merkistöt,desimaalierotin,tuhansien erotin,symbooli,erotin,etumerkki,positiivinen,negatiivinen,viikko,viikon alku
+Keywords[fr]=langage,langue,traduction,nombres,formats de nombre,format de nombre,monnaie,symbole monétaire,date,heure,formats,localisation,régionalisation,pays,jeu de caractères,table de caractères,jeux de caractères,symbole décimal,virgule,séparateur des milliers,milliers,symbole,séparateur,signe,positif,négatif,nombre de décimales,semaine,début de la semaine,jours de la semaine
+Keywords[fy]=language,oersetting,taal,getalopmaak,valuta,valutasymbool,tijd,datum, opmaak,lokaal,locale,land,tekensets,charsets,karakterverzamelingen,Decimaalsymbool, scheidingsteken,duizendtallen,symbool,symbolen,gulden,teken,positief,negatief,wieke,wieken,jild,bedragen
+Keywords[gl]=lingua,tradución,formato numérico,hora,data,formatos,locale,País,conxuntos de carácteres,charset,símbolo decimal,separador de milleiros,símbolo,separador,signo,positivo,negativo,díxitos fraccionarios,semana,início da semana
+Keywords[he]=עברית,שפה,תרגום,תבנית מספרים,מטבע,שעה,תאריך,תבניות,אזור,מיקום,מדינה,מערכי תווים,סימן עשרוני,מפריד,אלפים,סימן,מפריד,חיובי,שלילי,נקודות עשרוניות,שבוע,תחילת שבוע, language,translation,number format, currency,time,date,formats,locale, Country,charsets,character sets,Decimal symbol,Thousands separator, symbol, separator,sign,positive,negative,fractional digits,week,week start
+Keywords[hi]=भाषा,अनुवाद,संख्या फार्मेट,करेंसी,समय,तारीख़,फार्मेट्स,लोकेल,देश,अक्षरमाला,अक्षर माला,दशमलव प्रतीक,हजार पृथक करने वाला,चिह्न,पृथक करने वाला,निशान,धनात्मक,ऋणात्मक,फ्रेक्शनल अंक,सप्ताह,सप्ताह प्रारंभ
+Keywords[hr]=language,translation,number format,currency,time,date,formats,locale,Country,charsets,character sets,Decimal symbol,Thousands separator,symbol,separator,sign,positive,negative,fractional digits,week,week start,jezik,prijevod,oblik brojeva,valuta,vrijeme,datum,oblik,lokalizacija,Država,Zemlja,znakovi,kodna stranica,decimalni znakovi,razdjelnik tisućica,znak,razdjelnik,pozitivno,negativno,decimale,tjedan,početak tjedna
+Keywords[hu]=nyelv,fordítás,számformátum,pénznem,idő,dátum,formátumok,nyelvi beállítások,ország,karakterkészletek,tizedesjel,ezres elválasztó,jel,elválasztó,szimbólum,pozitív,negatív,tizedesjegyek,hét,a hét első napja
+Keywords[is]=tungumál,þýðing,númer,gjaldeyrir,klukka,tími,dagsetning,staðværar stillingar,locale,land,stafatöflur,stafróf,jákvætt,neikvætt, jákvæð,neiðkvæð,brot,tugabrot,vika,helgi,vikudagur,vikudagar
+Keywords[it]=lingua,traduzione,formato numeri,moneta,valuta,ora,data,formati,impostazioni nazionali,paese,charset,insieme di caratteri,virgola,separatore migliaia,simbolo,separatore,segno,più,meno,cifre decimali,settimana,inizio settimana
+Keywords[ja]=言語,翻訳,数値の書式,通貨,時刻,日付,フォーマット,地域,国,文字コード,文字セット,小数点,1000での区切り,記号,区切り文字,符号,正数,負数,小数桁数,週,週初
+Keywords[km]=ភាសា,បកប្រែ,ទ្រង់ទ្រាយ​លេខ,រូបិយប័ណ្ណ,ពេលវេលា,កាលបរិច្ឆេទ,ទ្រង់ទ្រាយ,មូលដ្ឋាន,ប្រទេស,សំណុំ​តួអក្សរ,សញ្ញា​ទសភាគ,អ្នក​បំបែក​ខ្ទង់​ពាន់,និមិត្ត​សញ្ញា,អ្នក​បំបែក,សញ្ញា,វិជ្ជមាន,អវិជ្ជមាន,ខ្ទង់​ទសភាគ,សប្ដាហ៍,ដើម​សប្ដាហ៍
+Keywords[lt]=language,translation,number format,currency,time,date,formats,locale,Country,charsets,character sets,Decimal symbol,Thousands separator,symbol,separator,sign,positive,negative,fractional digits,week,week start,kalba,vertimas,skaičių formatas,valiuta,laikas,data,formatai,lokalė,Šalis,koduotės,kodavimai,Dešimtainis simbolis,Tūkstančių skirtukas,simbolis,skirtukas,požymis,teigiamas,neigiamas,trupmenų skaitmenys,savaitė,savaitės pradžia
+Keywords[lv]=valoda,tulkojums,numuru formāts,valūta,laiks,datums,formāts,lokāle,Valsts,čārsets,simbolu komplekts,Decimāl simbols,Tūkstošu atdalītājs,simbols,atdalītājs,zīme,pozitīvs,negatīvs,frakciju cipari,nedēļa,nedēļa sākas
+Keywords[mk]=language,translation,number format,currency,time,date,formats,locale,Country,charsets,character sets,Decimal symbol,Thousands separator,symbol,separator,sign,positive,negative,fractional digits,week,week start,јазик,превод,формат на бројки,валута,време,дата,формати,локал,земја,знаковни множества,Децимален симбол,Граничник за илјади,симбол,граничник,знак,позитивен,негативен,дропки,недела,почеток на недела
+Keywords[mn]=Хэл,Орчуулга,Тооны хэлбэр,Мөнгөн нэгж,Цаг,Огноо,Хэлбэр, Бүс,Орон, Тэмдэгт олонлог,Аравтын тэмдэглэгээ,Тэмдэг,Тэмдэгт, Таслал, Нэмэх, Хасах,Бутархай тоо, Долоо хоног,Долоо хоногийн эхлэл
+Keywords[nb]=språk,oversettelse,tallformat,valuta,tid,dato,formater,lokal,land,symbol,separator,tegn,positiv,negativ,uke,ukestart,desimaltegn,skilletegn,brøk
+Keywords[nds]=Spraak,Översetten,Tallenformaat,Tahlmiddel,Tiet,Datum,Formaten,locale,Land,Tekensetten,Tekensett,Dezimaalsymbool,Trennteken,Symbool,Dusend,Vörteken,Positiv,Negativ,Brooktallen,Week,Wekenanfang
+Keywords[ne]=भाषा, अनुवाद, सङ्ख्या ढाँचा, मुद्रा, समय, ढाँचा, स्थान, देश, चारसेटहरू, क्यारेक्टर सेट, दशमलव सङ्केत, हजार विभाजक, सङ्केत, विभाजक, चिन्ह, घनात्मक, ऋणात्मक, भिन्न अङ्कहरू, हप्ता, हप्ताकको सुरु
+Keywords[nl]=language,vertaling,taal,getallenopmaak,valuta,valutasymbool,tijd,datum, opmaak,lokaal,locale,land,tekensets,charsets,tekenverzamelingen,Decimaalsymbool, scheidingsteken,duizendtallen,symbool,symbolen,gulden,teken,positief,negatief,week,weken,geld,bedragen
+Keywords[nn]=språk,omsetjing,talformat,valuta,pengar,tid,dato,format,lokale,land,teiknsett,desimalteikn,skiljeteikn,symbol,teikn,positiv,negativ,desimaltal,veke,vekestart
+Keywords[nso]=leleme,tiragatso,thlolego ya dinomoro,currency,nako,tsatsikgwedi,dithlolego,tulo,Naga,charsets,dipeakanyo tsa dihlaka,Leswao la decimal,Searoganyi sa Dikete, leswao,searoganyi,leswao,dumela,ganetsa,dinomoro tsa fraction,beke,thomiso ya beke
+Keywords[pa]=ਭਾਸ਼ਾ,ਅਨੁਵਾਦ,ਗਿਣਤੀ,ਕਰੰਸੀ,ਸਮਾਂ,ਮਿਤੀ,ਲੋਕੇਲ,ਦੇਸ਼,ਅੱਖਰ-ਸੈਟ, ਦਸ਼ਮਲਵ, ਹਜ਼ਾਰ ਵੱਖਰੇਵਾਂ,ਨਿਸ਼ਾਨ,ਰਿਣਾਤਮਕ,ਧਨਾਤਮਕ,ਭਿੰਨ ਅੰਕ,ਹਫ਼ਤਾ, ਹਫ਼ਤਾ ਸ਼ੁਰੂ
+Keywords[pl]=język,tłumaczenie,format liczb,jednostka walutowa,czas,data,formaty,ustawienia regionalne,kraj,zestawy znaków,symbol dziesiętny,znak rozdzielający tysiące,symbol,separator,znak,dodatni,ujemny,liczby ułamkowe,tydzień,początek tygodnia
+Keywords[pt]=língua,tradução,formato de número,monetário,hora,data,formatos,localização,País,charset,mapa de caracter,símbolo decimal,separador de milhares,símbolo,separador,sinal,positivo,negativo,dígitos fraccionários,semana,início de semana
+Keywords[pt_BR]=idioma,tradução,formato numérico,moeda,data,hora,formatos,localização,país,conjuntos de caracteres,conjunto de caracteres,símbolo decimal,separador de milhares,separador,sinal,positivo,negativo,dígitos de fração,semana,início da semana
+Keywords[ro]=limbaj,traducere,format numere,moneda,timp,dată,formate,localizare,țară,set de caractere,simbol zecimal,separator de mii,semn,pozitiv,negativ,cifre fracționale,săptămînă,început săptămînă
+Keywords[rw]=Ururimi,ivunura,imiterere y'umubare,ifaranga,igihe,itariki,imiterere,ikiranga hantu,igihugu,itsinda-inyuguti,amatsinda y'inyuguti,ikimenyetso binyacumi,igitandukanya ibinyagihumbi,ikimenyetso,igitandukanya,ikimenyetso,cyirenze zeru,hasi zeru,imibare y'umugabane,icyumweru,itangiriro y'icyumweru
+Keywords[se]=giella,jorgaleapmi,jorgalusat,lohkoformáta,valuhtta,ruđat,áigi,formáhtta,locale, eatnan,riika,desimálamearka,gaskamearka,symbola,mearka,positiiva,negatiiva,desimálalohku, vahkku,vahkkoálgu
+Keywords[sk]=jazyk,preklad,formát čísel,mena,čas,dátum,formáty,locale,krajina,znakové sady,kódovanie,desatinná čiarka,oddeľovač tisícov,symbol,oddeľovač,znamienko,kladný,záporný,desatinný,týždeň,začiatok týždňa
+Keywords[sl]=jezik,prevod,oblika števil,valuta,čas,datum,oblika,locale, država,nabor znakov,decimalni simbol,ločilo tisočic,simbol,separator, predznak,pozitivno,negativno,ulomki,teden,začetek tedna
+Keywords[sr]=language,translation,number формат,currency,time,date, formats,locale,Country,charsets,character sets,Decimal symbol,Thousands separator,symbol,separator,sign,positive,negative,fractional digits,week,week старт, језик,превод,формат бројева,новац,време,датум,формати,земља,скуп знакова, децимални знак,одвајач хиљада,знак,недеља,седмица,почетак недеље,почетак седмице
+Keywords[sr@Latn]=language,translation,number format,currency,time,date, formats,locale,Country,charsets,character sets,Decimal symbol,Thousands separator,symbol,separator,sign,positive,negative,fractional digits,week,week start, jezik,prevod,format brojeva,novac,vreme,datum,formati,zemlja,skup znakova, decimalni znak,odvajač hiljada,znak,nedelja,sedmica,početak nedelje,početak sedmice
+Keywords[sv]=språk,översättning,talformat,valuta,tid,datum,format,land,teckenuppsättningar,decimaltecken,tusentalsavskiljare,symbol,avskiljare,tecken,positivt,negativt,decimaler,vecka,första veckodag
+Keywords[ta]=மொழி,மொழிபெயர்ப்பு, எண்வடிவமைப்பு,நாணயம்,நேரம்,தேதி,வடிவமைப்புகள்,வட்டாரம்,நாடு,தகுதரம், தகுதரம், தசம குறியீடு,ஆயிரம் பிரிப்பான்,குறியீடு,பிரிப்பான், குறி, மிகை,குறை,பின்ன எண்ணியம்,வாரம், வார துவக்கம்
+Keywords[th]=ภาษา,การแปลภาษา,รูปแบบตัวเลข,รูปแบบเงินตรา,เวลา,วันทีึ่,รูปแบบ,ภาษาท้องถิ่น,ประเทศ,ชุดอักษร,ชุดอักขระ,สัญลักษณ์ทศนิยม,ตัวแบ่งหลักพัน,สัญลักษณ์,ตัวแบ่ง,เครื่องหมาย,ค่าบวก,ค่าลบ,เศษส่วน,เริ่มสัปดาห์,สัปดาห์
+Keywords[tr]=dil,çeviri,sayı biçimi,para,saat,tarih,biçimler,yerel,ülke,karakter kümeleri, ondalık sembolü,binler ayıracı,sembol,ayırıcı,işaret,pozitif,negatif,ondalık basamaklar,hafta,hafta başı
+Keywords[uk]=мова,переклад,формат чисел,валюта,час,гроші,формати,charset,локаль,країна,набори символів,роздільник тисяч,роздільник десятих,символ,роздільник,знак,додатне,від'ємне,дробові числа,тиждень,початок тижня
+Keywords[uz]=til,tarjima,sonlar formati,pul,vaqt,sana,losal,Davlat,belgilar toʻplami,Oʻnlik belgisi,Mingni ajratuvchi belgi,belgi,ajratuvchi belgi,musbat,manfiy,hafta,haftaning boshlanishi
+Keywords[uz@cyrillic]=тил,таржима,сонлар формати,пул,вақт,сана,лосал,Давлат,белгилар тўплами,Ўнлик белгиси,Мингни ажратувчи белги,белги,ажратувчи белги,мусбат,манфий,ҳафта,ҳафтанинг бошланиши
+Keywords[ven]=luambo,dologa,vhuvha ha nomboro,zwamasheleni,tshifhinga,datumu,vhuvha,henefhano,shango,tshasete,mavhekenyele a tshasete,zwiga zwa desimala,zwikhaukani zwa zwigidi,swiga,zwikhaukani,tshiga,zwavhudi,zwisizwavhudi,vhege,u thoma vhege
+Keywords[vi]=ngôn ngữ,dịch,dạng hiển thị số,tiền tệ,thời gian,ngày,định dạng,địa phương,Nước,bảng mã,bảng mã,ký hiệu thập phân,dấu cách hàng nghìn,ký hiệu,dấu phân cách,dấu,dương,âm,phân số,tuần,bắt đầu của tuần
+Keywords[wa]=lingaedje,ratournaedje,coigne di nombe,manoye,eure,date,locåle,payi,payis,charset,sets di caracteres,simbôle di decimåle,meteu a pårt des meyes,simbôle,meteu a pårt,sine,pozitif,negatif,samwinne,cominçmint del samwinne
+Keywords[xh]=ulwimi,uguqulelo kolunye ulwimi,ifomati yenani,okwangoku,ixesha,umhla,iifomati,locale,Ilizwe,charsets,amaqela abasebenzi,uphawu lwenani leshumi,Umahluli wamawaka,uphawu, umahluli,tyikitya,echaza uvumo,echaza ukhanyelo,amasuntswana angamaqhezu,iveki,isiqalo seveki
+Keywords[zh_CN]=language,translation,number format,currency,time,date,formats,locale,Country,charsets,character sets,Decimal symbol,Thousands separator,symbol,separator,sign,positive,negative,fractional digits,week,week start,语言,翻译,数字格式,货币,时间,日期,格式,区域设置,国家,字符集,千位分隔符,符号,分隔符,正,负,小数,星期
+Keywords[zh_TW]=language,translation,number format,currency,time,date,formats,locale,Country,charsets,character sets,Decimal symbol,Thousands separator,symbol,separator,sign,positive,negative,fractional digits,week,week start,語言,翻譯,數字格式,貨幣格式,時間格式,日期格式,格式,地區,國家,字元,字元集,小數點符號,千分位分隔,符號,分隔,符號,正數,負數,小數點位數,一週,由週日開始
+Keywords[zu]=ulimi,uguqulelo,isakhiwo senombolo, uphawu lwemali, isikhathi,usuku,izakhiwo,indawo,Izwe,charsets,amaqoqo ezimpawu,uphawu lwedesimali,umehlukanisi wezinkulungwane,uphawu,umehlukanisi,uphawu, okungaphezulu kuka-0,okungaphansi kuka-0,izinombolo azahlukanisiwe,isonto, ukuqala kwesonto
+
+Categories=Qt;KDE;X-KDE-settings-accessibility;
diff --git a/kcontrol/locale/localemon.cpp b/kcontrol/locale/localemon.cpp
new file mode 100644
index 000000000..504ce393c
--- /dev/null
+++ b/kcontrol/locale/localemon.cpp
@@ -0,0 +1,330 @@
+/*
+ * localemon.cpp
+ *
+ * Copyright (c) 1999-2003 Hans Petter Bieker <bieker@kde.org>
+ *
+ * Requires the Qt widget libraries, available at no cost at
+ * http://www.troll.no/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <qcheckbox.h>
+#include <qcombobox.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qobjectlist.h>
+#include <qwhatsthis.h>
+#include <qlayout.h>
+#include <qvgroupbox.h>
+#include <qvbox.h>
+#include <qregexp.h>
+
+#include <knuminput.h>
+#include <kdialog.h>
+#include <ksimpleconfig.h>
+#include <kstandarddirs.h>
+
+#include "toplevel.h"
+#include "localemon.h"
+#include "localemon.moc"
+
+KLocaleConfigMoney::KLocaleConfigMoney(KLocale *locale,
+ QWidget *parent, const char*name)
+ : QWidget(parent, name),
+ m_locale(locale)
+{
+ // Money
+ QGridLayout *lay = new QGridLayout(this, 6, 2,
+ KDialog::marginHint(),
+ KDialog::spacingHint());
+
+ m_labMonCurSym = new QLabel(this, I18N_NOOP("Currency symbol:"));
+ lay->addWidget(m_labMonCurSym, 0, 0);
+ m_edMonCurSym = new QLineEdit(this);
+ lay->addWidget(m_edMonCurSym, 0, 1);
+ connect( m_edMonCurSym, SIGNAL( textChanged(const QString &) ),
+ SLOT( slotMonCurSymChanged(const QString &) ) );
+
+ m_labMonDecSym = new QLabel(this, I18N_NOOP("Decimal symbol:"));
+ lay->addWidget(m_labMonDecSym, 1, 0);
+ m_edMonDecSym = new QLineEdit(this);
+ lay->addWidget(m_edMonDecSym, 1, 1);
+ connect( m_edMonDecSym, SIGNAL( textChanged(const QString &) ),
+ SLOT( slotMonDecSymChanged(const QString &) ) );
+
+ m_labMonThoSep = new QLabel(this, I18N_NOOP("Thousands separator:"));
+ lay->addWidget(m_labMonThoSep, 2, 0);
+ m_edMonThoSep = new QLineEdit(this);
+ lay->addWidget(m_edMonThoSep, 2, 1);
+ connect( m_edMonThoSep, SIGNAL( textChanged(const QString &) ),
+ SLOT( slotMonThoSepChanged(const QString &) ) );
+
+ m_labMonFraDig = new QLabel(this, I18N_NOOP("Fract digits:"));
+ lay->addWidget(m_labMonFraDig, 3, 0);
+ m_inMonFraDig = new KIntNumInput(this);
+ m_inMonFraDig->setRange(0, 10, 1, false);
+ lay->addWidget(m_inMonFraDig, 3, 1);
+
+ connect( m_inMonFraDig, SIGNAL( valueChanged(int) ),
+ SLOT( slotMonFraDigChanged(int) ) );
+
+ QWidget *vbox = new QVBox(this);
+ lay->addMultiCellWidget(vbox, 4, 4, 0, 1);
+ QVGroupBox *vgrp;
+ vgrp = new QVGroupBox( vbox, I18N_NOOP("Positive") );
+ m_chMonPosPreCurSym = new QCheckBox(vgrp, I18N_NOOP("Prefix currency symbol"));
+ connect( m_chMonPosPreCurSym, SIGNAL( clicked() ),
+ SLOT( slotMonPosPreCurSymChanged() ) );
+
+ QHBox *hbox;
+ hbox = new QHBox( vgrp );
+ m_labMonPosMonSignPos = new QLabel(hbox, I18N_NOOP("Sign position:"));
+ m_cmbMonPosMonSignPos = new QComboBox(hbox, "signpos");
+ connect( m_cmbMonPosMonSignPos, SIGNAL( activated(int) ),
+ SLOT( slotMonPosMonSignPosChanged(int) ) );
+
+ vgrp = new QVGroupBox( vbox, I18N_NOOP("Negative") );
+ m_chMonNegPreCurSym = new QCheckBox(vgrp, I18N_NOOP("Prefix currency symbol"));
+ connect( m_chMonNegPreCurSym, SIGNAL( clicked() ),
+ SLOT( slotMonNegPreCurSymChanged() ) );
+
+ hbox = new QHBox( vgrp );
+ m_labMonNegMonSignPos = new QLabel(hbox, I18N_NOOP("Sign position:"));
+ m_cmbMonNegMonSignPos = new QComboBox(hbox, "signpos");
+ connect( m_cmbMonNegMonSignPos, SIGNAL( activated(int) ),
+ SLOT( slotMonNegMonSignPosChanged(int) ) );
+
+ // insert some items
+ int i = 5;
+ while (i--)
+ {
+ m_cmbMonPosMonSignPos->insertItem(QString::null);
+ m_cmbMonNegMonSignPos->insertItem(QString::null);
+ }
+
+ lay->setColStretch(1, 1);
+ lay->addRowSpacing(5, 0);
+
+ adjustSize();
+}
+
+KLocaleConfigMoney::~KLocaleConfigMoney()
+{
+}
+
+void KLocaleConfigMoney::save()
+{
+ KConfig *config = KGlobal::config();
+ KConfigGroupSaver saver(config, "Locale");
+
+ KSimpleConfig ent(locate("locale",
+ QString::fromLatin1("l10n/%1/entry.desktop")
+ .arg(m_locale->country())), true);
+ ent.setGroup("KCM Locale");
+
+ QString str;
+ int i;
+ bool b;
+
+ str = ent.readEntry("CurrencySymbol", QString::fromLatin1("$"));
+ config->deleteEntry("CurrencySymbol", false, true);
+ if (str != m_locale->currencySymbol())
+ config->writeEntry("CurrencySymbol",
+ m_locale->currencySymbol(), true, true);
+
+ str = ent.readEntry("MonetaryDecimalSymbol", QString::fromLatin1("."));
+ config->deleteEntry("MonetaryDecimalSymbol", false, true);
+ if (str != m_locale->monetaryDecimalSymbol())
+ config->writeEntry("MonetaryDecimalSymbol",
+ m_locale->monetaryDecimalSymbol(), true, true);
+
+ str = ent.readEntry("MonetaryThousandsSeparator", QString::fromLatin1(","));
+ str.replace(QString::fromLatin1("$0"), QString::null);
+ config->deleteEntry("MonetaryThousandsSeparator", false, true);
+ if (str != m_locale->monetaryThousandsSeparator())
+ config->writeEntry("MonetaryThousandsSeparator",
+ QString::fromLatin1("$0%1$0")
+ .arg(m_locale->monetaryThousandsSeparator()),
+ true, true);
+
+ i = ent.readNumEntry("FracDigits", 2);
+ config->deleteEntry("FracDigits", false, true);
+ if (i != m_locale->fracDigits())
+ config->writeEntry("FracDigits", m_locale->fracDigits(), true, true);
+
+ b = ent.readBoolEntry("PositivePrefixCurrencySymbol", true);
+ config->deleteEntry("PositivePrefixCurrencySymbol", false, true);
+ if (b != m_locale->positivePrefixCurrencySymbol())
+ config->writeEntry("PositivePrefixCurrencySymbol",
+ m_locale->positivePrefixCurrencySymbol(), true, true);
+
+ b = ent.readBoolEntry("NegativePrefixCurrencySymbol", true);
+ config->deleteEntry("NegativePrefixCurrencySymbol", false, true);
+ if (b != m_locale->negativePrefixCurrencySymbol())
+ config->writeEntry("NegativePrefixCurrencySymbol",
+ m_locale->negativePrefixCurrencySymbol(), true, true);
+
+ i = ent.readNumEntry("PositiveMonetarySignPosition",
+ (int)KLocale::BeforeQuantityMoney);
+ config->deleteEntry("PositiveMonetarySignPosition", false, true);
+ if (i != m_locale->positiveMonetarySignPosition())
+ config->writeEntry("PositiveMonetarySignPosition",
+ (int)m_locale->positiveMonetarySignPosition(),
+ true, true);
+
+ i = ent.readNumEntry("NegativeMonetarySignPosition",
+ (int)KLocale::ParensAround);
+ config->deleteEntry("NegativeMonetarySignPosition", false, true);
+ if (i != m_locale->negativeMonetarySignPosition())
+ config->writeEntry("NegativeMonetarySignPosition",
+ (int)m_locale->negativeMonetarySignPosition(),
+ true, true);
+
+ config->sync();
+}
+
+void KLocaleConfigMoney::slotLocaleChanged()
+{
+ m_edMonCurSym->setText( m_locale->currencySymbol() );
+ m_edMonDecSym->setText( m_locale->monetaryDecimalSymbol() );
+ m_edMonThoSep->setText( m_locale->monetaryThousandsSeparator() );
+ m_inMonFraDig->setValue( m_locale->fracDigits() );
+
+ m_chMonPosPreCurSym->setChecked( m_locale->positivePrefixCurrencySymbol() );
+ m_chMonNegPreCurSym->setChecked( m_locale->negativePrefixCurrencySymbol() );
+ m_cmbMonPosMonSignPos->setCurrentItem( m_locale->positiveMonetarySignPosition() );
+ m_cmbMonNegMonSignPos->setCurrentItem( m_locale->negativeMonetarySignPosition() );
+}
+
+void KLocaleConfigMoney::slotMonCurSymChanged(const QString &t)
+{
+ m_locale->setCurrencySymbol(t);
+ emit localeChanged();
+}
+
+void KLocaleConfigMoney::slotMonDecSymChanged(const QString &t)
+{
+ m_locale->setMonetaryDecimalSymbol(t);
+ emit localeChanged();
+}
+
+void KLocaleConfigMoney::slotMonThoSepChanged(const QString &t)
+{
+ m_locale->setMonetaryThousandsSeparator(t);
+ emit localeChanged();
+}
+
+void KLocaleConfigMoney::slotMonFraDigChanged(int value)
+{
+ m_locale->setFracDigits(value);
+ emit localeChanged();
+}
+
+void KLocaleConfigMoney::slotMonPosPreCurSymChanged()
+{
+ m_locale->setPositivePrefixCurrencySymbol(m_chMonPosPreCurSym->isChecked());
+ emit localeChanged();
+}
+
+void KLocaleConfigMoney::slotMonNegPreCurSymChanged()
+{
+ m_locale->setNegativePrefixCurrencySymbol(m_chMonNegPreCurSym->isChecked());
+ emit localeChanged();
+}
+
+void KLocaleConfigMoney::slotMonPosMonSignPosChanged(int i)
+{
+ m_locale->setPositiveMonetarySignPosition((KLocale::SignPosition)i);
+ emit localeChanged();
+}
+
+void KLocaleConfigMoney::slotMonNegMonSignPosChanged(int i)
+{
+ m_locale->setNegativeMonetarySignPosition((KLocale::SignPosition)i);
+ emit localeChanged();
+}
+
+void KLocaleConfigMoney::slotTranslate()
+{
+ QObjectList list;
+ list.append(m_cmbMonPosMonSignPos);
+ list.append(m_cmbMonNegMonSignPos);
+
+ QComboBox *wc;
+ for (QObjectListIt li(list) ; (wc = (QComboBox *)li.current()) != 0; ++li)
+ {
+ wc->changeItem(m_locale->translate("Parentheses Around"), 0);
+ wc->changeItem(m_locale->translate("Before Quantity Money"), 1);
+ wc->changeItem(m_locale->translate("After Quantity Money"), 2);
+ wc->changeItem(m_locale->translate("Before Money"), 3);
+ wc->changeItem(m_locale->translate("After Money"), 4);
+ }
+
+ QString str;
+
+ str = m_locale->translate( "Here you can enter your usual currency "
+ "symbol, e.g. $ or DM."
+ "<p>Please note that the Euro symbol may not be "
+ "available on your system, depending on the "
+ "distribution you use." );
+ QWhatsThis::add( m_labMonCurSym, str );
+ QWhatsThis::add( m_edMonCurSym, str );
+ str = m_locale->translate( "Here you can define the decimal separator used "
+ "to display monetary values."
+ "<p>Note that the decimal separator used to "
+ "display other numbers has to be defined "
+ "separately (see the 'Numbers' tab)." );
+ QWhatsThis::add( m_labMonDecSym, str );
+ QWhatsThis::add( m_edMonDecSym, str );
+
+ str = m_locale->translate( "Here you can define the thousands separator "
+ "used to display monetary values."
+ "<p>Note that the thousands separator used to "
+ "display other numbers has to be defined "
+ "separately (see the 'Numbers' tab)." );
+ QWhatsThis::add( m_labMonThoSep, str );
+ QWhatsThis::add( m_edMonThoSep, str );
+
+ str = m_locale->translate( "This determines the number of fract digits for "
+ "monetary values, i.e. the number of digits you "
+ "find <em>behind</em> the decimal separator. "
+ "Correct value is 2 for almost all people." );
+ QWhatsThis::add( m_labMonFraDig, str );
+ QWhatsThis::add( m_inMonFraDig, str );
+
+ str = m_locale->translate( "If this option is checked, the currency sign "
+ "will be prefixed (i.e. to the left of the "
+ "value) for all positive monetary values. If "
+ "not, it will be postfixed (i.e. to the right)." );
+ QWhatsThis::add( m_chMonPosPreCurSym, str );
+
+ str = m_locale->translate( "If this option is checked, the currency sign "
+ "will be prefixed (i.e. to the left of the "
+ "value) for all negative monetary values. If "
+ "not, it will be postfixed (i.e. to the right)." );
+ QWhatsThis::add( m_chMonNegPreCurSym, str );
+
+ str = m_locale->translate( "Here you can select how a positive sign will be "
+ "positioned. This only affects monetary values." );
+ QWhatsThis::add( m_labMonPosMonSignPos, str );
+ QWhatsThis::add( m_cmbMonPosMonSignPos, str );
+
+ str = m_locale->translate( "Here you can select how a negative sign will "
+ "be positioned. This only affects monetary "
+ "values." );
+ QWhatsThis::add( m_labMonNegMonSignPos, str );
+ QWhatsThis::add( m_cmbMonNegMonSignPos, str );
+}
diff --git a/kcontrol/locale/localemon.h b/kcontrol/locale/localemon.h
new file mode 100644
index 000000000..e772af4d3
--- /dev/null
+++ b/kcontrol/locale/localemon.h
@@ -0,0 +1,93 @@
+/*
+ * localemon.h
+ *
+ * Copyright (c) 1999-2003 Hans Petter Bieker <bieker@kde.org>
+ *
+ * Requires the Qt widget libraries, available at no cost at
+ * http://www.troll.no/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __KLOCALECONFIGMON_H__
+#define __KLOCALECONFIGMON_H__
+
+#include <qwidget.h>
+
+class QCheckBox;
+class QComboBox;
+class QLineEdit;
+
+class KIntNumInput;
+class KLocale;
+class KLanguageCombo;
+
+class KLocaleConfigMoney : public QWidget
+{
+ Q_OBJECT
+
+public:
+ KLocaleConfigMoney(KLocale *locale, QWidget *parent = 0, const char *name = 0);
+ virtual ~KLocaleConfigMoney();
+
+ void save();
+
+public slots:
+ /**
+ * Loads all settings from the current locale into the current widget.
+ */
+ void slotLocaleChanged();
+ /**
+ * Retranslate all objects owned by this object using the current locale.
+ */
+ void slotTranslate();
+
+signals:
+ void localeChanged();
+
+private slots:
+ // Money
+ void slotMonCurSymChanged(const QString &t);
+ void slotMonDecSymChanged(const QString &t);
+ void slotMonThoSepChanged(const QString &t);
+ void slotMonFraDigChanged(int value);
+ void slotMonPosPreCurSymChanged();
+ void slotMonNegPreCurSymChanged();
+ void slotMonPosMonSignPosChanged(int i);
+ void slotMonNegMonSignPosChanged(int i);
+
+private:
+ KLocale *m_locale;
+
+ // Money
+ QLabel *m_labMonCurSym;
+ QLineEdit *m_edMonCurSym;
+ QLabel *m_labMonDecSym;
+ QLineEdit *m_edMonDecSym;
+ QLabel *m_labMonThoSep;
+ QLineEdit *m_edMonThoSep;
+ QLabel *m_labMonFraDig;
+ KIntNumInput * m_inMonFraDig;
+
+ QCheckBox *m_chMonPosPreCurSym;
+ QCheckBox *m_chMonNegPreCurSym;
+ QLabel *m_labMonPosMonSignPos;
+ QComboBox *m_cmbMonPosMonSignPos;
+ QLabel *m_labMonNegMonSignPos;
+ QComboBox *m_cmbMonNegMonSignPos;
+};
+
+#endif
diff --git a/kcontrol/locale/localenum.cpp b/kcontrol/locale/localenum.cpp
new file mode 100644
index 000000000..9e5445ded
--- /dev/null
+++ b/kcontrol/locale/localenum.cpp
@@ -0,0 +1,194 @@
+/*
+ * localenum.cpp
+ *
+ * Copyright (c) 1999-2003 Hans Petter Bieker <bieker@kde.org>
+ *
+ * Requires the Qt widget libraries, available at no cost at
+ * http://www.troll.no/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qlayout.h>
+#include <qwhatsthis.h>
+#include <qregexp.h>
+
+#include <kdialog.h>
+#include <ksimpleconfig.h>
+#include <kstandarddirs.h>
+
+#include "toplevel.h"
+#include "localenum.h"
+#include "localenum.moc"
+
+KLocaleConfigNumber::KLocaleConfigNumber(KLocale *locale,
+ QWidget *parent, const char*name)
+ : QWidget(parent, name),
+ m_locale(locale)
+{
+ QGridLayout *lay = new QGridLayout(this, 5, 2,
+ KDialog::marginHint(),
+ KDialog::spacingHint());
+ lay->setAutoAdd(TRUE);
+
+ m_labDecSym = new QLabel(this, I18N_NOOP("&Decimal symbol:"));
+ m_edDecSym = new QLineEdit(this);
+ connect( m_edDecSym, SIGNAL( textChanged(const QString &) ),
+ this, SLOT( slotDecSymChanged(const QString &) ) );
+ m_labDecSym->setBuddy(m_edDecSym);
+
+ m_labThoSep = new QLabel(this, I18N_NOOP("Tho&usands separator:"));
+ m_edThoSep = new QLineEdit(this);
+ connect( m_edThoSep, SIGNAL( textChanged(const QString &) ),
+ this, SLOT( slotThoSepChanged(const QString &) ) );
+ m_labThoSep->setBuddy(m_edThoSep);
+
+ m_labMonPosSign = new QLabel(this, I18N_NOOP("Positive si&gn:"));
+ m_edMonPosSign = new QLineEdit(this);
+ connect( m_edMonPosSign, SIGNAL( textChanged(const QString &) ),
+ this, SLOT( slotMonPosSignChanged(const QString &) ) );
+ m_labMonPosSign->setBuddy(m_edMonPosSign);
+
+ m_labMonNegSign = new QLabel(this, I18N_NOOP("&Negative sign:"));
+ m_edMonNegSign = new QLineEdit(this);
+ connect( m_edMonNegSign, SIGNAL( textChanged(const QString &) ),
+ this, SLOT( slotMonNegSignChanged(const QString &) ) );
+ m_labMonNegSign->setBuddy(m_edMonNegSign);
+
+ lay->setColStretch(1, 1);
+
+ connect(this, SIGNAL(localeChanged()),
+ SLOT(slotLocaleChanged()));
+}
+
+KLocaleConfigNumber::~KLocaleConfigNumber()
+{
+}
+
+void KLocaleConfigNumber::save()
+{
+ // temperary use of our locale as the global locale
+ KLocale *lsave = KGlobal::_locale;
+ KGlobal::_locale = m_locale;
+
+ KConfig *config = KGlobal::config();
+ KConfigGroupSaver saver(config, "Locale");
+
+ KSimpleConfig ent(locate("locale",
+ QString::fromLatin1("l10n/%1/entry.desktop")
+ .arg(m_locale->country())), true);
+ ent.setGroup("KCM Locale");
+
+ QString str;
+
+ str = ent.readEntry("DecimalSymbol",
+ QString::fromLatin1("."));
+ config->deleteEntry("DecimalSymbol", false, true);
+ if (str != m_locale->decimalSymbol())
+ config->writeEntry("DecimalSymbol",
+ m_locale->decimalSymbol(), true, true);
+
+ str = ent.readEntry("ThousandsSeparator",
+ QString::fromLatin1(","));
+ config->deleteEntry("ThousandsSeparator", false, true);
+ str.replace(QString::fromLatin1("$0"), QString::null);
+ if (str != m_locale->thousandsSeparator())
+ config->writeEntry("ThousandsSeparator",
+ QString::fromLatin1("$0%1$0")
+ .arg(m_locale->thousandsSeparator()), true, true);
+
+ str = ent.readEntry("PositiveSign");
+ config->deleteEntry("PositiveSign", false, true);
+ if (str != m_locale->positiveSign())
+ config->writeEntry("PositiveSign", m_locale->positiveSign(), true, true);
+
+ str = ent.readEntry("NegativeSign", QString::fromLatin1("-"));
+ config->deleteEntry("NegativeSign", false, true);
+ if (str != m_locale->negativeSign())
+ config->writeEntry("NegativeSign", m_locale->negativeSign(), true, true);
+
+ // restore the old global locale
+ KGlobal::_locale = lsave;
+}
+
+void KLocaleConfigNumber::slotLocaleChanged()
+{
+ // #### load all settings here
+ m_edDecSym->setText( m_locale->decimalSymbol() );
+ m_edThoSep->setText( m_locale->thousandsSeparator() );
+ m_edMonPosSign->setText( m_locale->positiveSign() );
+ m_edMonNegSign->setText( m_locale->negativeSign() );
+}
+
+void KLocaleConfigNumber::slotDecSymChanged(const QString &t)
+{
+ m_locale->setDecimalSymbol(t);
+ emit localeChanged();
+}
+
+void KLocaleConfigNumber::slotThoSepChanged(const QString &t)
+{
+ m_locale->setThousandsSeparator(t);
+ emit localeChanged();
+}
+
+void KLocaleConfigNumber::slotMonPosSignChanged(const QString &t)
+{
+ m_locale->setPositiveSign(t);
+ emit localeChanged();
+}
+
+void KLocaleConfigNumber::slotMonNegSignChanged(const QString &t)
+{
+ m_locale->setNegativeSign(t);
+ emit localeChanged();
+}
+
+void KLocaleConfigNumber::slotTranslate()
+{
+ QString str;
+
+ str = m_locale->translate( "Here you can define the decimal separator used "
+ "to display numbers (i.e. a dot or a comma in "
+ "most countries).<p>"
+ "Note that the decimal separator used to "
+ "display monetary values has to be set "
+ "separately (see the 'Money' tab)." );
+ QWhatsThis::add( m_labDecSym, str );
+ QWhatsThis::add( m_edDecSym, str );
+
+ str = m_locale->translate( "Here you can define the thousands separator "
+ "used to display numbers.<p>"
+ "Note that the thousands separator used to "
+ "display monetary values has to be set "
+ "separately (see the 'Money' tab)." );
+ QWhatsThis::add( m_labThoSep, str );
+ QWhatsThis::add( m_edThoSep, str );
+
+ str = m_locale->translate( "Here you can specify text used to prefix "
+ "positive numbers. Most people leave this "
+ "blank." );
+ QWhatsThis::add( m_labMonPosSign, str );
+ QWhatsThis::add( m_edMonPosSign, str );
+
+ str = m_locale->translate( "Here you can specify text used to prefix "
+ "negative numbers. This should not be empty, so "
+ "you can distinguish positive and negative "
+ "numbers. It is normally set to minus (-)." );
+ QWhatsThis::add( m_labMonNegSign, str );
+ QWhatsThis::add( m_edMonNegSign, str );
+}
diff --git a/kcontrol/locale/localenum.h b/kcontrol/locale/localenum.h
new file mode 100644
index 000000000..da75dc708
--- /dev/null
+++ b/kcontrol/locale/localenum.h
@@ -0,0 +1,82 @@
+/*
+ * localenum.h
+ *
+ * Copyright (c) 1999-2003 Hans Petter Bieker <bieker@kde.org>
+ *
+ * Requires the Qt widget libraries, available at no cost at
+ * http://www.troll.no/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef __KLOCALECONFIGNUM_H__
+#define __KLOCALECONFIGNUM_H__
+
+#include <qwidget.h>
+
+class QCheckBox;
+class QComboBox;
+class QLineEdit;
+
+class KLocale;
+class KLanguageCombo;
+
+class KLocaleConfigNumber : public QWidget
+{
+ Q_OBJECT
+
+public:
+ KLocaleConfigNumber( KLocale *_locale,
+ QWidget *parent=0, const char *name=0);
+ virtual ~KLocaleConfigNumber( );
+
+ void save();
+
+public slots:
+ /**
+ * Loads all settings from the current locale into the current widget.
+ */
+ void slotLocaleChanged();
+ /**
+ * Retranslate all objects owned by this object using the current locale.
+ */
+ void slotTranslate();
+
+signals:
+ void localeChanged();
+
+private slots:
+ // Numbers
+ void slotMonPosSignChanged(const QString &t);
+ void slotMonNegSignChanged(const QString &t);
+ void slotDecSymChanged(const QString &t);
+ void slotThoSepChanged(const QString &t);
+
+private:
+ KLocale *m_locale;
+
+ // Numbers
+ QLabel *m_labDecSym;
+ QLineEdit *m_edDecSym;
+ QLabel *m_labThoSep;
+ QLineEdit *m_edThoSep;
+ QLabel *m_labMonPosSign;
+ QLineEdit *m_edMonPosSign;
+ QLabel *m_labMonNegSign;
+ QLineEdit *m_edMonNegSign;
+};
+
+#endif
diff --git a/kcontrol/locale/localeother.cpp b/kcontrol/locale/localeother.cpp
new file mode 100644
index 000000000..97f97ba2f
--- /dev/null
+++ b/kcontrol/locale/localeother.cpp
@@ -0,0 +1,142 @@
+/*
+ * localeother.cpp
+ *
+ * Copyright (c) 2001-2003 Hans Petter Bieker <bieker@kde.org>
+ *
+ * Requires the Qt widget libraries, available at no cost at
+ * http://www.troll.no/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <qcombobox.h>
+#include <qlayout.h>
+#include <qlabel.h>
+#include <qprinter.h>
+
+#include <kdialog.h>
+#include <klocale.h>
+#include <ksimpleconfig.h>
+#include <kstandarddirs.h>
+
+#include "localeother.h"
+#include "localeother.moc"
+
+
+KLocaleConfigOther::KLocaleConfigOther(KLocale *locale,
+ QWidget *parent, const char*name)
+ : QWidget(parent, name),
+ m_locale(locale)
+{
+ // Other
+ QGridLayout *lay = new QGridLayout(this, 3, 2,
+ KDialog::marginHint(),
+ KDialog::spacingHint());
+
+ m_labPageSize = new QLabel(this, I18N_NOOP("Paper format:"));
+ lay->addWidget(m_labPageSize, 0, 0);
+ m_combPageSize = new QComboBox(this);
+ lay->addWidget(m_combPageSize, 0, 1);
+ connect( m_combPageSize, SIGNAL( activated(int) ),
+ SLOT( slotPageSizeChanged(int) ) );
+
+ m_labMeasureSystem = new QLabel(this, I18N_NOOP("Measure system:"));
+ lay->addWidget(m_labMeasureSystem, 1, 0);
+ m_combMeasureSystem = new QComboBox(this);
+ lay->addWidget(m_combMeasureSystem, 1, 1);
+ connect( m_combMeasureSystem, SIGNAL( activated(int) ),
+ SLOT( slotMeasureSystemChanged(int) ) );
+
+ m_combPageSize->insertItem(QString::null);
+ m_combPageSize->insertItem(QString::null);
+ m_combMeasureSystem->insertItem(QString::null);
+ m_combMeasureSystem->insertItem(QString::null);
+
+ lay->setColStretch(1, 1);
+ lay->addRowSpacing(2, 0);
+
+ adjustSize();
+}
+
+KLocaleConfigOther::~KLocaleConfigOther()
+{
+}
+
+void KLocaleConfigOther::save()
+{
+ KConfig *config = KGlobal::config();
+ KConfigGroupSaver saver(config, "Locale");
+
+ KSimpleConfig ent(locate("locale",
+ QString::fromLatin1("l10n/%1/entry.desktop")
+ .arg(m_locale->country())), true);
+ ent.setGroup("KCM Locale");
+
+ // ### HPB: Add code here
+ int i;
+ i = ent.readNumEntry("PageSize", (int)QPrinter::A4);
+ config->deleteEntry("PageSize", false, true);
+ if (i != m_locale->pageSize())
+ config->writeEntry("PageSize",
+ m_locale->pageSize(), true, true);
+
+ i = ent.readNumEntry("MeasureSystem", (int)KLocale::Metric);
+ config->deleteEntry("MeasureSystem", false, true);
+ if (i != m_locale->measureSystem())
+ config->writeEntry("MeasureSystem",
+ m_locale->measureSystem(), true, true);
+
+ config->sync();
+}
+
+void KLocaleConfigOther::slotLocaleChanged()
+{
+ m_combMeasureSystem->setCurrentItem(m_locale->measureSystem());
+
+ int pageSize = m_locale->pageSize();
+
+ int i = 0; // default to A4
+ if ( pageSize == (int)QPrinter::Letter )
+ i = 1;
+ m_combPageSize->setCurrentItem(i);
+}
+
+void KLocaleConfigOther::slotTranslate()
+{
+ m_combMeasureSystem->changeItem( m_locale->translate("The Metric System",
+ "Metric"), 0 );
+ m_combMeasureSystem->changeItem( m_locale->translate("The Imperial System",
+ "Imperial"), 1 );
+
+ m_combPageSize->changeItem( m_locale->translate("A4"), 0 );
+ m_combPageSize->changeItem( m_locale->translate("US Letter"), 1 );
+}
+
+void KLocaleConfigOther::slotPageSizeChanged(int i)
+{
+ QPrinter::PageSize pageSize = QPrinter::A4;
+
+ if ( i == 1 )
+ pageSize = QPrinter::Letter;
+
+ m_locale->setPageSize((int)pageSize);
+ emit localeChanged();
+}
+
+void KLocaleConfigOther::slotMeasureSystemChanged(int i)
+{
+ m_locale->setMeasureSystem((KLocale::MeasureSystem)i);
+ emit localeChanged();
+}
diff --git a/kcontrol/locale/localeother.h b/kcontrol/locale/localeother.h
new file mode 100644
index 000000000..1c6ec0b48
--- /dev/null
+++ b/kcontrol/locale/localeother.h
@@ -0,0 +1,70 @@
+/*
+ * localeother.h
+ *
+ * Copyright (c) 2001-2003 Hans Petter Bieker <bieker@kde.org>
+ *
+ * Requires the Qt widget libraries, available at no cost at
+ * http://www.troll.no/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __KLOCALECONFIGOTHER_H__
+#define __KLOCALECONFIGOTHER_H__
+
+#include <qwidget.h>
+
+class QLabel;
+class QComboBox;
+
+class KLocale;
+
+class KLocaleConfigOther : public QWidget
+{
+ Q_OBJECT
+
+public:
+ KLocaleConfigOther(KLocale *locale, QWidget *parent = 0, const char *name = 0);
+ virtual ~KLocaleConfigOther();
+
+ void save();
+
+public slots:
+ /**
+ * Loads all settings from the current locale into the current widget.
+ */
+ void slotLocaleChanged();
+ /**
+ * Retranslate all objects owned by this object using the current locale.
+ */
+ void slotTranslate();
+
+signals:
+ void localeChanged();
+
+private slots:
+ void slotPageSizeChanged(int i);
+ void slotMeasureSystemChanged(int i);
+
+private:
+ KLocale *m_locale;
+
+ QLabel *m_labMeasureSystem;
+ QComboBox *m_combMeasureSystem;
+ QLabel *m_labPageSize;
+ QComboBox *m_combPageSize;
+};
+
+#endif
diff --git a/kcontrol/locale/localetime.cpp b/kcontrol/locale/localetime.cpp
new file mode 100644
index 000000000..ea077ac89
--- /dev/null
+++ b/kcontrol/locale/localetime.cpp
@@ -0,0 +1,556 @@
+/*
+ * localetime.cpp
+ *
+ * Copyright (c) 1999-2003 Hans Petter Bieker <bieker@kde.org>
+ *
+ * Requires the Qt widget libraries, available at no cost at
+ * http://www.troll.no/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <qcheckbox.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qwhatsthis.h>
+#include <qcombobox.h>
+#include <qvaluevector.h>
+
+#include <kdialog.h>
+#include <ksimpleconfig.h>
+#include <kstandarddirs.h>
+#include <kdebug.h>
+#include <kcalendarsystem.h>
+
+#include "toplevel.h"
+#include "localetime.h"
+#include "localetime.moc"
+
+class StringPair
+{
+public:
+ QChar storeName;
+ QString userName;
+
+ static StringPair find( const QValueList <StringPair> &list, const QChar &c)
+ {
+ for ( QValueList<StringPair>::ConstIterator it = list.begin();
+ it != list.end();
+ ++it )
+ if ((*it).storeName==c) return (*it);
+
+ StringPair r;
+ return r;
+ }
+
+};
+
+/* Sort the string pairs with qHeapSort in the order we want
+ ( relative to the userName value and with "MESCORTO" before "MES" )
+ */
+bool operator< (const StringPair &p1, const StringPair &p2)
+{
+ return ! (p1.userName<p2.userName);
+}
+
+bool operator<= (const StringPair &p1, const StringPair &p2)
+{
+ return ! (p1.userName<=p2.userName);
+}
+
+bool operator> (const StringPair &p1, const StringPair &p2)
+{
+ return ! (p1.userName>p2.userName);
+}
+
+bool operator>= (const StringPair &p1, const StringPair &p2)
+{
+ return ! (p1.userName>=p2.userName);
+}
+
+StringPair KLocaleConfigTime::buildStringPair(const QChar &c, const QString &s) const
+{
+ StringPair pair;
+ pair.storeName=c;
+ pair.userName=s;
+ return pair;
+}
+
+QValueList<StringPair> KLocaleConfigTime::timeMap() const
+{
+ QValueList < StringPair > list;
+ list+=buildStringPair('H',m_locale->translate("HH"));
+ list+=buildStringPair('k',m_locale->translate("hH"));
+ list+=buildStringPair('I',m_locale->translate("PH"));
+ list+=buildStringPair('l',m_locale->translate("pH"));
+ list+=buildStringPair('M',m_locale->translate("Minute", "MM"));
+ list+=buildStringPair('S',m_locale->translate("SS"));
+ list+=buildStringPair('p',m_locale->translate("AMPM"));
+
+ qHeapSort( list );
+
+ return list;
+}
+
+QValueList <StringPair> KLocaleConfigTime::dateMap() const
+{
+ QValueList < StringPair > list;
+ list+=buildStringPair('Y',m_locale->translate("YYYY"));
+ list+=buildStringPair('y',m_locale->translate("YY"));
+ list+=buildStringPair('n',m_locale->translate("mM"));
+ list+=buildStringPair('m',m_locale->translate("Month", "MM"));
+ list+=buildStringPair('b',m_locale->translate("SHORTMONTH"));
+ list+=buildStringPair('B',m_locale->translate("MONTH"));
+ list+=buildStringPair('e',m_locale->translate("dD"));
+ list+=buildStringPair('d',m_locale->translate("DD"));
+ list+=buildStringPair('a',m_locale->translate("SHORTWEEKDAY"));
+ list+=buildStringPair('A',m_locale->translate("WEEKDAY"));
+
+ qHeapSort( list );
+
+ return list;
+}
+
+QString KLocaleConfigTime::userToStore(const QValueList<StringPair> & list,
+ const QString & userFormat) const
+{
+ QString result;
+
+ for ( uint pos = 0; pos < userFormat.length(); ++pos )
+ {
+ bool bFound = false;
+ for ( QValueList<StringPair>::ConstIterator it = list.begin();
+ it != list.end() && !bFound;
+ ++it )
+ {
+ QString s = (*it).userName;
+
+ if ( userFormat.mid( pos, s.length() ) == s )
+ {
+ result += '%';
+ result += (*it).storeName;
+
+ pos += s.length() - 1;
+
+ bFound = true;
+ }
+ }
+
+ if ( !bFound )
+ {
+ QChar c = userFormat.at( pos );
+ if ( c == '%' )
+ result += c;
+
+ result += c;
+ }
+ }
+
+ return result;
+}
+
+QString KLocaleConfigTime::storeToUser(const QValueList<StringPair> & list,
+ const QString & storeFormat) const
+{
+ QString result;
+
+ bool escaped = false;
+ for ( uint pos = 0; pos < storeFormat.length(); ++pos )
+ {
+ QChar c = storeFormat.at(pos);
+ if ( escaped )
+ {
+ StringPair it = StringPair::find( list, c );
+ if ( !it.userName.isEmpty() )
+ result += it.userName;
+ else
+ result += c;
+
+ escaped = false;
+ }
+ else if ( c == '%' )
+ escaped = true;
+ else
+ result += c;
+ }
+
+ return result;
+}
+
+KLocaleConfigTime::KLocaleConfigTime(KLocale *_locale,
+ QWidget *parent, const char*name)
+ : QWidget(parent, name),
+ m_locale(_locale)
+{
+ // Time
+ QGridLayout *lay = new QGridLayout(this, 7, 2,
+ KDialog::marginHint(),
+ KDialog::spacingHint());
+ lay->setAutoAdd(TRUE);
+
+ m_labCalendarSystem = new QLabel(this, I18N_NOOP("Calendar system:"));
+ m_comboCalendarSystem = new QComboBox(false, this);
+ connect(m_comboCalendarSystem, SIGNAL(activated(int)),
+ this, SLOT(slotCalendarSystemChanged(int)));
+ QStringList tmpCalendars;
+ tmpCalendars << QString::null << QString::null;
+ m_comboCalendarSystem->insertStringList(tmpCalendars);
+
+ m_labTimeFmt = new QLabel(this, I18N_NOOP("Time format:"));
+ m_comboTimeFmt = new QComboBox(true, this);
+ //m_edTimeFmt = m_comboTimeFmt->lineEdit();
+ //m_edTimeFmt = new QLineEdit(this);
+ connect( m_comboTimeFmt, SIGNAL( textChanged(const QString &) ),
+ this, SLOT( slotTimeFmtChanged(const QString &) ) );
+
+ m_labDateFmt = new QLabel(this, I18N_NOOP("Date format:"));
+ m_comboDateFmt = new QComboBox(true, this);
+ connect( m_comboDateFmt, SIGNAL( textChanged(const QString &) ),
+ this, SLOT( slotDateFmtChanged(const QString &) ) );
+
+ m_labDateFmtShort = new QLabel(this, I18N_NOOP("Short date format:"));
+ m_comboDateFmtShort = new QComboBox(true, this);
+ connect( m_comboDateFmtShort, SIGNAL( textChanged(const QString &) ),
+ this, SLOT( slotDateFmtShortChanged(const QString &) ) );
+
+ m_labWeekStartDay = new QLabel(this, I18N_NOOP("First day of the week:"));
+ m_comboWeekStartDay = new QComboBox(false, this);
+ connect (m_comboWeekStartDay, SIGNAL(activated(int)),
+ this, SLOT(slotWeekStartDayChanged(int)));
+
+ updateWeekDayNames();
+
+ m_chDateMonthNamePossessive = new QCheckBox(this, I18N_NOOP("Use declined form of month name"));
+ connect( m_chDateMonthNamePossessive, SIGNAL( clicked() ),
+ SLOT( slotDateMonthNamePossChanged() ) );
+
+ lay->setColStretch(1, 1);
+}
+
+KLocaleConfigTime::~KLocaleConfigTime()
+{
+}
+
+void KLocaleConfigTime::save()
+{
+ // temperary use of our locale as the global locale
+ KLocale *lsave = KGlobal::_locale;
+ KGlobal::_locale = m_locale;
+
+ KConfig *config = KGlobal::config();
+ KConfigGroupSaver saver(config, "Locale");
+
+ KSimpleConfig ent(locate("locale",
+ QString::fromLatin1("l10n/%1/entry.desktop")
+ .arg(m_locale->country())), true);
+ ent.setGroup("KCM Locale");
+
+ QString str;
+
+ str = ent.readEntry("CalendarSystem", QString::fromLatin1("gregorian"));
+ config->deleteEntry("CalendarSystem", false, true);
+ if (str != m_locale->calendarType())
+ config->writeEntry("CalendarSystem", m_locale->calendarType(), true, true);
+
+ str = ent.readEntry("TimeFormat", QString::fromLatin1("%H:%M:%S"));
+ config->deleteEntry("TimeFormat", false, true);
+ if (str != m_locale->timeFormat())
+ config->writeEntry("TimeFormat", m_locale->timeFormat(), true, true);
+
+ str = ent.readEntry("DateFormat", QString::fromLatin1("%A %d %B %Y"));
+ config->deleteEntry("DateFormat", false, true);
+ if (str != m_locale->dateFormat())
+ config->writeEntry("DateFormat", m_locale->dateFormat(), true, true);
+
+ str = ent.readEntry("DateFormatShort", QString::fromLatin1("%Y-%m-%d"));
+ config->deleteEntry("DateFormatShort", false, true);
+ if (str != m_locale->dateFormatShort())
+ config->writeEntry("DateFormatShort",
+ m_locale->dateFormatShort(), true, true);
+
+ int firstDay;
+ firstDay = ent.readNumEntry("WeekStartDay", 1);
+ config->deleteEntry("WeekStartDay", false, true);
+ if (firstDay != m_locale->weekStartDay())
+ config->writeEntry("WeekStartDay", m_locale->weekStartDay(), true, true);
+
+ if ( m_locale->nounDeclension() )
+ {
+ bool b;
+ b = ent.readBoolEntry("DateMonthNamePossessive", false);
+ config->deleteEntry("DateMonthNamePossessive", false, true);
+ if (b != m_locale->dateMonthNamePossessive())
+ config->writeEntry("DateMonthNamePossessive",
+ m_locale->dateMonthNamePossessive(), true, true);
+ }
+
+ config->sync();
+
+ // restore the old global locale
+ KGlobal::_locale = lsave;
+}
+
+void KLocaleConfigTime::showEvent( QShowEvent *e )
+{
+ // This option makes sense only for languages where nouns are declined
+ if ( !m_locale->nounDeclension() )
+ m_chDateMonthNamePossessive->hide();
+ QWidget::showEvent( e );
+}
+
+void KLocaleConfigTime::slotCalendarSystemChanged(int calendarSystem)
+{
+ kdDebug() << "CalendarSystem: " << calendarSystem << endl;
+
+ typedef QValueVector<QString> CalendarVector;
+ CalendarVector calendars(4);
+ calendars[0] = "gregorian";
+ calendars[1] = "hijri";
+ calendars[2] = "hebrew";
+ calendars[3] = "jalali";
+
+ QString calendarType;
+ bool ok;
+ calendarType = calendars.at(calendarSystem, &ok);
+ if ( !ok )
+ calendarType = calendars.first();
+
+ m_locale->setCalendar(calendarType);
+
+ updateWeekDayNames();
+ emit localeChanged();
+}
+
+void KLocaleConfigTime::slotLocaleChanged()
+{
+ typedef QValueVector<QString> CalendarVector;
+ CalendarVector calendars(4);
+ calendars[0] = "gregorian";
+ calendars[1] = "hijri";
+ calendars[2] = "hebrew";
+ calendars[3] = "jalali";
+
+ QString calendarType = m_locale->calendarType();
+ int calendarSystem = 0;
+
+ CalendarVector::iterator it = qFind(calendars.begin(), calendars.end(),
+calendarType);
+ if ( it != calendars.end() )
+ calendarSystem = it - calendars.begin();
+
+ kdDebug() << "calSys: " << calendarSystem << ": " << calendarType << endl;
+ m_comboCalendarSystem->setCurrentItem( calendarSystem );
+
+ // m_edTimeFmt->setText( m_locale->timeFormat() );
+ m_comboTimeFmt->setEditText( storeToUser( timeMap(),
+ m_locale->timeFormat() ) );
+ // m_edDateFmt->setText( m_locale->dateFormat() );
+ m_comboDateFmt->setEditText( storeToUser( dateMap(),
+ m_locale->dateFormat() ) );
+ //m_edDateFmtShort->setText( m_locale->dateFormatShort() );
+ m_comboDateFmtShort->setEditText( storeToUser( dateMap(),
+ m_locale->dateFormatShort() ) );
+ m_comboWeekStartDay->setCurrentItem( m_locale->weekStartDay() - 1 );
+
+ if ( m_locale->nounDeclension() )
+ m_chDateMonthNamePossessive->setChecked( m_locale->dateMonthNamePossessive() );
+
+ kdDebug(173) << "converting: " << m_locale->timeFormat() << endl;
+ kdDebug(173) << storeToUser(timeMap(),
+ m_locale->timeFormat()) << endl;
+ kdDebug(173) << userToStore(timeMap(),
+ QString::fromLatin1("HH:MM:SS AMPM test")) << endl;
+
+}
+
+void KLocaleConfigTime::slotTimeFmtChanged(const QString &t)
+{
+ // m_locale->setTimeFormat(t);
+ m_locale->setTimeFormat( userToStore( timeMap(), t ) );
+
+ emit localeChanged();
+}
+
+void KLocaleConfigTime::slotDateFmtChanged(const QString &t)
+{
+ // m_locale->setDateFormat(t);
+ m_locale->setDateFormat( userToStore( dateMap(), t ) );
+ emit localeChanged();
+}
+
+void KLocaleConfigTime::slotDateFmtShortChanged(const QString &t)
+{
+ //m_locale->setDateFormatShort(t);
+ m_locale->setDateFormatShort( userToStore( dateMap(), t ) );
+ emit localeChanged();
+}
+
+void KLocaleConfigTime::slotWeekStartDayChanged(int firstDay) {
+ kdDebug(173) << k_funcinfo << "first day is now: " << firstDay << endl;
+ m_locale->setWeekStartDay(m_comboWeekStartDay->currentItem() + 1);
+ emit localeChanged();
+}
+
+void KLocaleConfigTime::slotDateMonthNamePossChanged()
+{
+ if (m_locale->nounDeclension())
+ {
+ m_locale->setDateMonthNamePossessive(m_chDateMonthNamePossessive->isChecked());
+ emit localeChanged();
+ }
+}
+
+void KLocaleConfigTime::slotTranslate()
+{
+ QString str;
+
+ QString sep = QString::fromLatin1("\n");
+
+ QString old;
+
+ // clear() and insertStringList also changes the current item, so
+ // we better use save and restore here..
+ old = m_comboTimeFmt->currentText();
+ m_comboTimeFmt->clear();
+ str = i18n("some reasonable time formats for the language",
+ "HH:MM:SS\n"
+ "pH:MM:SS AMPM");
+ m_comboTimeFmt->insertStringList(QStringList::split(sep, str));
+ m_comboTimeFmt->setEditText(old);
+
+ old = m_comboDateFmt->currentText();
+ m_comboDateFmt->clear();
+ str = i18n("some reasonable date formats for the language",
+ "WEEKDAY MONTH dD YYYY\n"
+ "SHORTWEEKDAY MONTH dD YYYY");
+ m_comboDateFmt->insertStringList(QStringList::split(sep, str));
+ m_comboDateFmt->setEditText(old);
+
+ old = m_comboDateFmtShort->currentText();
+ m_comboDateFmtShort->clear();
+ str = i18n("some reasonable short date formats for the language",
+ "YYYY-MM-DD\n"
+ "dD.mM.YYYY\n"
+ "DD.MM.YYYY");
+ m_comboDateFmtShort->insertStringList(QStringList::split(sep, str));
+ m_comboDateFmtShort->setEditText(old);
+
+ updateWeekDayNames();
+
+ while ( m_comboCalendarSystem->count() < 4 )
+ m_comboCalendarSystem->insertItem(QString::null);
+ m_comboCalendarSystem->changeItem
+ (m_locale->translate("Calendar System Gregorian", "Gregorian"), 0);
+ m_comboCalendarSystem->changeItem
+ (m_locale->translate("Calendar System Hijri", "Hijri"), 1);
+ m_comboCalendarSystem->changeItem
+ (m_locale->translate("Calendar System Hebrew", "Hebrew"), 2);
+ m_comboCalendarSystem->changeItem
+ (m_locale->translate("Calendar System Jalali", "Jalali"), 3);
+
+ str = m_locale->translate
+ ("<p>The text in this textbox will be used to format "
+ "time strings. The sequences below will be replaced:</p>"
+ "<table>"
+ "<tr><td><b>HH</b></td><td>The hour as a decimal number using a 24-hour "
+ "clock (00-23).</td></tr>"
+ "<tr><td><b>hH</b></td><td>The hour (24-hour clock) as a decimal number "
+ "(0-23).</td></tr>"
+ "<tr><td><b>PH</b></td><td>The hour as a decimal number using a 12-hour "
+ "clock (01-12).</td></tr>"
+ "<tr><td><b>pH</b></td><td>The hour (12-hour clock) as a decimal number "
+ "(1-12).</td></tr>"
+ "<tr><td><b>MM</b></td><td>The minutes as a decimal number (00-59)."
+ "</td><tr>"
+ "<tr><td><b>SS</b></td><td>The seconds as a decimal number (00-59)."
+ "</td></tr>"
+ "<tr><td><b>AMPM</b></td><td>Either \"am\" or \"pm\" according to the "
+ "given time value. Noon is treated as \"pm\" and midnight as \"am\"."
+ "</td></tr>"
+ "</table>");
+ QWhatsThis::add( m_labTimeFmt, str );
+ QWhatsThis::add( m_comboTimeFmt, str );
+
+ QString datecodes = m_locale->translate(
+ "<table>"
+ "<tr><td><b>YYYY</b></td><td>The year with century as a decimal number."
+ "</td></tr>"
+ "<tr><td><b>YY</b></td><td>The year without century as a decimal number "
+ "(00-99).</td></tr>"
+ "<tr><td><b>MM</b></td><td>The month as a decimal number (01-12)."
+ "</td></tr>"
+ "<tr><td><b>mM</b></td><td>The month as a decimal number (1-12).</td></tr>"
+ "<tr><td><b>SHORTMONTH</b></td><td>The first three characters of the month name. "
+ "</td></tr>"
+ "<tr><td><b>MONTH</b></td><td>The full month name.</td></tr>"
+ "<tr><td><b>DD</b></td><td>The day of month as a decimal number (01-31)."
+ "</td></tr>"
+ "<tr><td><b>dD</b></td><td>The day of month as a decimal number (1-31)."
+ "</td></tr>"
+ "<tr><td><b>SHORTWEEKDAY</b></td><td>The first three characters of the weekday name."
+ "</td></tr>"
+ "<tr><td><b>WEEKDAY</b></td><td>The full weekday name.</td></tr>"
+ "</table>");
+
+ str = m_locale->translate
+ ( "<p>The text in this textbox will be used to format long "
+ "dates. The sequences below will be replaced:</p>") + datecodes;
+ QWhatsThis::add( m_labDateFmt, str );
+ QWhatsThis::add( m_comboDateFmt, str );
+
+ str = m_locale->translate
+ ( "<p>The text in this textbox will be used to format short "
+ "dates. For instance, this is used when listing files. "
+ "The sequences below will be replaced:</p>") + datecodes;
+ QWhatsThis::add( m_labDateFmtShort, str );
+ QWhatsThis::add( m_comboDateFmtShort, str );
+
+ str = m_locale->translate
+ ("<p>This option determines which day will be considered as "
+ "the first one of the week.</p>");
+ QWhatsThis::add( m_comboWeekStartDay, str );
+
+ if ( m_locale->nounDeclension() )
+ {
+ str = m_locale->translate
+ ("<p>This option determines whether possessive form of month "
+ "names should be used in dates.</p>");
+ QWhatsThis::add( m_chDateMonthNamePossessive, str );
+ }
+}
+
+void KLocaleConfigTime::updateWeekDayNames()
+{
+ const KCalendarSystem * calendar = m_locale->calendar();
+
+ for ( int i = 1; ; ++i )
+ {
+ QString str = calendar->weekDayName(i);
+ bool outsideComboList = m_comboWeekStartDay->count() < i;
+
+ if ( str.isNull() )
+ {
+ if ( outsideComboList )
+ break;
+ else
+ m_comboWeekStartDay->removeItem(i - 1);
+ }
+
+ if ( outsideComboList )
+ m_comboWeekStartDay->insertItem(str, i - 1);
+ else
+ m_comboWeekStartDay->changeItem(str, i - 1);
+ }
+}
diff --git a/kcontrol/locale/localetime.h b/kcontrol/locale/localetime.h
new file mode 100644
index 000000000..c77f00cd3
--- /dev/null
+++ b/kcontrol/locale/localetime.h
@@ -0,0 +1,102 @@
+/*
+ * localetime.h
+ *
+ * Copyright (c) 1999-2003 Hans Petter Bieker <bieker@kde.org>
+ *
+ * Requires the Qt widget libraries, available at no cost at
+ * http://www.troll.no/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __KLOCALECONFIGTIME_H__
+#define __KLOCALECONFIGTIME_H__
+
+#include <qwidget.h>
+
+#include <qmap.h>
+
+class QCheckBox;
+class QComboBox;
+
+class KLocale;
+class KLanguageCombo;
+
+class StringPair;
+
+class KLocaleConfigTime : public QWidget
+{
+ Q_OBJECT
+
+public:
+ KLocaleConfigTime( KLocale *_locale, QWidget *parent=0, const char *name=0);
+ virtual ~KLocaleConfigTime( );
+
+ void save();
+
+protected:
+ void showEvent( QShowEvent *e );
+
+public slots:
+ /**
+ * Loads all settings from the current locale into the current widget.
+ */
+ void slotLocaleChanged();
+ /**
+ * Retranslate all objects owned by this object using the current locale.
+ */
+ void slotTranslate();
+
+signals:
+ void localeChanged();
+
+private slots:
+ // Time & dates
+ void slotTimeFmtChanged(const QString &t);
+ void slotDateFmtChanged(const QString &t);
+ void slotDateFmtShortChanged(const QString &t);
+ void slotWeekStartDayChanged(int firstDay);
+ void slotDateMonthNamePossChanged();
+ void slotCalendarSystemChanged(int calendarSystem);
+
+private:
+ void updateWeekDayNames();
+
+ QValueList<StringPair> timeMap() const;
+ QValueList<StringPair> dateMap() const;
+
+ QString storeToUser(const QValueList<StringPair> & map,
+ const QString & storeFormat) const;
+ QString userToStore(const QValueList<StringPair> & map,
+ const QString & userFormat) const;
+ StringPair buildStringPair(const QChar &storeName, const QString &userName) const;
+
+ KLocale *m_locale;
+
+ // Time & dates
+ QLabel *m_labTimeFmt;
+ QComboBox *m_comboTimeFmt;
+ QLabel *m_labDateFmt;
+ QComboBox * m_comboDateFmt;
+ QLabel *m_labDateFmtShort;
+ QComboBox * m_comboDateFmtShort;
+ QLabel * m_labWeekStartDay;
+ QComboBox * m_comboWeekStartDay;
+ QCheckBox *m_chDateMonthNamePossessive;
+ QLabel * m_labCalendarSystem;
+ QComboBox * m_comboCalendarSystem;
+};
+
+#endif
diff --git a/kcontrol/locale/main.cpp b/kcontrol/locale/main.cpp
new file mode 100644
index 000000000..7a861495b
--- /dev/null
+++ b/kcontrol/locale/main.cpp
@@ -0,0 +1,38 @@
+/*
+ main.cpp - A KControl Application
+
+ Copyright 1999-2003 Hans Petter Bieker <bieker@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ */
+
+#include "toplevel.h"
+
+extern "C" {
+ KDE_EXPORT void *init_kcm_locale() {
+ KLocale::setMainCatalogue("kcmlocale");
+ return new KLocaleFactory("kcmlocale");
+ }
+}
+
+/*
+extern "C" {
+ KCModule *create_locale(QWidget *parent, const char* name) {
+ KLocale::setMainCatalogue("kcmlocale");
+ return new KLocaleApplication(parent, "kcmlocale");
+ }
+}
+*/
diff --git a/kcontrol/locale/pics/Makefile.am b/kcontrol/locale/pics/Makefile.am
new file mode 100644
index 000000000..4929480b0
--- /dev/null
+++ b/kcontrol/locale/pics/Makefile.am
@@ -0,0 +1,2 @@
+pics_DATA = background.png
+picsdir = $(kde_datadir)/kcmlocale/pics
diff --git a/kcontrol/locale/pics/background.png b/kcontrol/locale/pics/background.png
new file mode 100644
index 000000000..d9d64462b
--- /dev/null
+++ b/kcontrol/locale/pics/background.png
Binary files differ
diff --git a/kcontrol/locale/toplevel.cpp b/kcontrol/locale/toplevel.cpp
new file mode 100644
index 000000000..4ba70e1ed
--- /dev/null
+++ b/kcontrol/locale/toplevel.cpp
@@ -0,0 +1,276 @@
+/*
+ toplevel.cpp - A KControl Application
+
+ Copyright 1998 Matthias Hoelzer
+ Copyright 1999-2003 Hans Petter Bieker <bieker@kde.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ */
+
+#include <qcheckbox.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qobjectlist.h>
+#include <qpushbutton.h>
+#include <qtabwidget.h>
+#include <qvgroupbox.h>
+
+#include <kaboutdata.h>
+#include <kconfig.h>
+#include <kdebug.h>
+#include <kdialog.h>
+#include <kmessagebox.h>
+#include <kprocess.h>
+#include <kservice.h>
+
+#include "localenum.h"
+#include "localemon.h"
+#include "localetime.h"
+#include "localeother.h"
+#include "klocalesample.h"
+#include "toplevel.h"
+#include "kcmlocale.h"
+#include "toplevel.moc"
+
+KLocaleApplication::KLocaleApplication(QWidget *parent, const char* /*name*/,
+ const QStringList &args)
+ : KCModule( KLocaleFactory::instance(), parent, args)
+{
+ KAboutData* aboutData = new KAboutData("kcmlocale",
+ I18N_NOOP("KCMLocale"),
+ "3.0",
+ I18N_NOOP("Regional settings"),
+ KAboutData::License_GPL,
+ "(C) 1998 Matthias Hoelzer, "
+ "(C) 1999-2003 Hans Petter Bieker",
+ 0, 0, "bieker@kde.org");
+ setAboutData( aboutData );
+
+ m_nullConfig = new KConfig(QString::null, false, false);
+ m_globalConfig = new KConfig(QString::null, false, true);
+
+ m_locale = new KLocale(QString::fromLatin1("kcmlocale"), m_nullConfig);
+ QVBoxLayout *l = new QVBoxLayout(this, 0, KDialog::spacingHint());
+ l->setAutoAdd(TRUE);
+
+ m_tab = new QTabWidget(this);
+
+ m_localemain = new KLocaleConfig(m_locale, this);
+ m_tab->addTab( m_localemain, QString::null);
+ m_localenum = new KLocaleConfigNumber(m_locale, this);
+ m_tab->addTab( m_localenum, QString::null );
+ m_localemon = new KLocaleConfigMoney(m_locale, this);
+ m_tab->addTab( m_localemon, QString::null );
+ m_localetime = new KLocaleConfigTime(m_locale, this);
+ m_tab->addTab( m_localetime, QString::null );
+ m_localeother = new KLocaleConfigOther(m_locale, this);
+ m_tab->addTab( m_localeother, QString::null );
+
+ // Examples
+ m_gbox = new QVGroupBox(this);
+ m_sample = new KLocaleSample(m_locale, m_gbox);
+
+ // getting signals from childs
+ connect(m_localemain, SIGNAL(localeChanged()),
+ this, SIGNAL(localeChanged()));
+ connect(m_localemain, SIGNAL(languageChanged()),
+ this, SIGNAL(languageChanged()));
+
+ // run the slots on the childs
+ connect(this, SIGNAL(localeChanged()),
+ m_localemain, SLOT(slotLocaleChanged()));
+ connect(this, SIGNAL(localeChanged()),
+ m_localenum, SLOT(slotLocaleChanged()));
+ connect(this, SIGNAL(localeChanged()),
+ m_localemon, SLOT(slotLocaleChanged()));
+ connect(this, SIGNAL(localeChanged()),
+ m_localetime, SLOT(slotLocaleChanged()));
+ connect(this, SIGNAL(localeChanged()),
+ m_localeother, SLOT(slotLocaleChanged()));
+
+ // keep the example up to date
+ // NOTE: this will make the sample be updated 6 times the first time
+ // because combo boxes++ emits the change signal not only when the user changes
+ // it, but also when it's changed by the program.
+ connect(m_localenum, SIGNAL(localeChanged()),
+ m_sample, SLOT(slotLocaleChanged()));
+ connect(m_localemon, SIGNAL(localeChanged()),
+ m_sample, SLOT(slotLocaleChanged()));
+ connect(m_localetime, SIGNAL(localeChanged()),
+ m_sample, SLOT(slotLocaleChanged()));
+ // No examples for this yet
+ //connect(m_localeother, SIGNAL(slotLocaleChanged()),
+ //m_sample, SLOT(slotLocaleChanged()));
+ connect(this, SIGNAL(localeChanged()),
+ m_sample, SLOT(slotLocaleChanged()));
+
+ // make sure we always have translated interface
+ connect(this, SIGNAL(languageChanged()),
+ this, SLOT(slotTranslate()));
+ connect(this, SIGNAL(languageChanged()),
+ m_localemain, SLOT(slotTranslate()));
+ connect(this, SIGNAL(languageChanged()),
+ m_localenum, SLOT(slotTranslate()));
+ connect(this, SIGNAL(languageChanged()),
+ m_localemon, SLOT(slotTranslate()));
+ connect(this, SIGNAL(languageChanged()),
+ m_localetime, SLOT(slotTranslate()));
+ connect(this, SIGNAL(languageChanged()),
+ m_localeother, SLOT(slotTranslate()));
+
+ // mark it as changed when we change it.
+ connect(m_localemain, SIGNAL(localeChanged()),
+ SLOT(slotChanged()));
+ connect(m_localenum, SIGNAL(localeChanged()),
+ SLOT(slotChanged()));
+ connect(m_localemon, SIGNAL(localeChanged()),
+ SLOT(slotChanged()));
+ connect(m_localetime, SIGNAL(localeChanged()),
+ SLOT(slotChanged()));
+ connect(m_localeother, SIGNAL(localeChanged()),
+ SLOT(slotChanged()));
+
+ load();
+}
+
+KLocaleApplication::~KLocaleApplication()
+{
+ delete m_locale;
+ delete m_globalConfig;
+ delete m_nullConfig;
+}
+
+void KLocaleApplication::load()
+{
+ load( false );
+}
+
+void KLocaleApplication::load( bool useDefaults )
+{
+ m_globalConfig->setReadDefaults( useDefaults );
+ m_globalConfig->reparseConfiguration();
+ *m_locale = KLocale(QString::fromLatin1("kcmlocale"), m_globalConfig);
+
+ emit localeChanged();
+ emit languageChanged();
+ emit changed(useDefaults);
+}
+
+void KLocaleApplication::save()
+{
+ // temperary use of our locale as the global locale
+ KLocale *lsave = KGlobal::_locale;
+ KGlobal::_locale = m_locale;
+ KMessageBox::information(this, m_locale->translate
+ ("Changed language settings apply only to "
+ "newly started applications.\nTo change the "
+ "language of all programs, you will have to "
+ "logout first."),
+ m_locale->translate("Applying Language Settings"),
+ QString::fromLatin1("LanguageChangesApplyOnlyToNewlyStartedPrograms"));
+ // restore the old global locale
+ KGlobal::_locale = lsave;
+
+ KConfig *config = KGlobal::config();
+ KConfigGroupSaver saver(config, "Locale");
+
+ // ##### this doesn't make sense
+ bool langChanged = config->readEntry("Language")
+ != m_locale->language();
+
+ m_localemain->save();
+ m_localenum->save();
+ m_localemon->save();
+ m_localetime->save();
+ m_localeother->save();
+
+ // rebuild the date base if language was changed
+ if (langChanged)
+ {
+ KService::rebuildKSycoca(this);
+ }
+
+ emit changed(false);
+}
+
+void KLocaleApplication::defaults()
+{
+ load( true );
+}
+
+QString KLocaleApplication::quickHelp() const
+{
+ return m_locale->translate("<h1>Country/Region & Language</h1>\n"
+ "<p>From here you can configure language, numeric, and time \n"
+ "settings for your particular region. In most cases it will be \n"
+ "sufficient to choose the country you live in. For instance KDE \n"
+ "will automatically choose \"German\" as language if you choose \n"
+ "\"Germany\" from the list. It will also change the time format \n"
+ "to use 24 hours and and use comma as decimal separator.</p>\n");
+}
+
+void KLocaleApplication::slotTranslate()
+{
+ // The untranslated string for QLabel are stored in
+ // the name() so we use that when retranslating
+ QObject *wc;
+ QObjectList *list = queryList("QWidget");
+ QObjectListIt it(*list);
+ while ( (wc = it.current()) != 0 )
+ {
+ ++it;
+
+ // unnamed labels will cause errors and should not be
+ // retranslated. E.g. the example box should not be
+ // retranslated from here.
+ if (wc->name() == 0)
+ continue;
+ if (::qstrcmp(wc->name(), "") == 0)
+ continue;
+ if (::qstrcmp(wc->name(), "unnamed") == 0)
+ continue;
+
+ if (::qstrcmp(wc->className(), "QLabel") == 0)
+ ((QLabel *)wc)->setText( m_locale->translate( wc->name() ) );
+ else if (::qstrcmp(wc->className(), "QGroupBox") == 0 ||
+ ::qstrcmp(wc->className(), "QVGroupBox") == 0)
+ ((QGroupBox *)wc)->setTitle( m_locale->translate( wc->name() ) );
+ else if (::qstrcmp(wc->className(), "QPushButton") == 0 ||
+ ::qstrcmp(wc->className(), "KMenuButton") == 0)
+ ((QPushButton *)wc)->setText( m_locale->translate( wc->name() ) );
+ else if (::qstrcmp(wc->className(), "QCheckBox") == 0)
+ ((QCheckBox *)wc)->setText( m_locale->translate( wc->name() ) );
+ }
+ delete list;
+
+ // Here we have the pointer
+ m_gbox->setCaption(m_locale->translate("Examples"));
+ m_tab->changeTab(m_localemain, m_locale->translate("&Locale"));
+ m_tab->changeTab(m_localenum, m_locale->translate("&Numbers"));
+ m_tab->changeTab(m_localemon, m_locale->translate("&Money"));
+ m_tab->changeTab(m_localetime, m_locale->translate("&Time && Dates"));
+ m_tab->changeTab(m_localeother, m_locale->translate("&Other"));
+
+ // FIXME: All widgets are done now. However, there are
+ // still some problems. Popup menus from the QLabels are
+ // not retranslated.
+}
+
+void KLocaleApplication::slotChanged()
+{
+ emit changed(true);
+}
+
diff --git a/kcontrol/locale/toplevel.h b/kcontrol/locale/toplevel.h
new file mode 100644
index 000000000..746f22a69
--- /dev/null
+++ b/kcontrol/locale/toplevel.h
@@ -0,0 +1,87 @@
+/*
+ toplevel.h - A KControl Application
+
+ written 1998 by Matthias Hoelzer
+
+ Copyright 1998 Matthias Hoelzer.
+ Copyright 1999-2003 Hans Petter Bieker <bieker@kde.org>.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ */
+
+#ifndef __TOPLEVEL_H__
+#define __TOPLEVEL_H__
+
+#include <kcmodule.h>
+#include <kgenericfactory.h>
+
+class QTabWidget;
+class QGroupBox;
+
+class KConfig;
+class KLocale;
+class KLocaleConfig;
+class KLocaleConfigMoney;
+class KLocaleConfigNumber;
+class KLocaleConfigTime;
+class KLocaleConfigOther;
+class KLocaleSample;
+
+class KLocaleApplication : public KCModule
+{
+ Q_OBJECT
+
+public:
+ KLocaleApplication(QWidget *parent, const char *name, const QStringList &);
+ virtual ~KLocaleApplication();
+
+ virtual void load();
+ virtual void load(bool useDefault);
+ virtual void save();
+ virtual void defaults();
+ virtual QString quickHelp() const;
+
+signals:
+ void languageChanged();
+ void localeChanged();
+
+public slots:
+ /**
+ * Retranslates the current widget.
+ */
+ void slotTranslate();
+ void slotChanged();
+
+private:
+ KLocale *m_locale;
+
+ QTabWidget *m_tab;
+ KLocaleConfig *m_localemain;
+ KLocaleConfigNumber *m_localenum;
+ KLocaleConfigMoney *m_localemon;
+ KLocaleConfigTime *m_localetime;
+ KLocaleConfigOther *m_localeother;
+
+ QGroupBox *m_gbox;
+ KLocaleSample *m_sample;
+
+ KConfig * m_globalConfig;
+ KConfig * m_nullConfig;
+};
+
+typedef KGenericFactory<KLocaleApplication, QWidget > KLocaleFactory;
+
+#endif