diff options
Diffstat (limited to 'kcontrol/locale')
26 files changed, 3618 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 ([email protected]) +Hans Petter Bieker <[email protected]> diff --git a/kcontrol/locale/CMakeLists.txt b/kcontrol/locale/CMakeLists.txt new file mode 100644 index 000000000..c604cf551 --- /dev/null +++ b/kcontrol/locale/CMakeLists.txt @@ -0,0 +1,38 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_subdirectory( default ) +add_subdirectory( pics ) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + +##### other data ################################ + +install( FILES language.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) + + +##### kcm_locale (module) ####################### + +tde_add_kpart( kcm_locale AUTOMOC + SOURCES + main.cpp toplevel.cpp kcmlocale.cpp klocalesample.cpp + localenum.cpp localemon.cpp localetime.cpp localeother.cpp + LINK tdeio-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/kcontrol/locale/Makefile.am b/kcontrol/locale/Makefile.am new file mode 100644 index 000000000..0eaa24ae4 --- /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_TDEIO) + +# 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)/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/CMakeLists.txt b/kcontrol/locale/default/CMakeLists.txt new file mode 100644 index 000000000..14499886c --- /dev/null +++ b/kcontrol/locale/default/CMakeLists.txt @@ -0,0 +1,12 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +install( FILES entry.desktop DESTINATION ${LOCALE_INSTALL_DIR}/en_US ) 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..3d1736676 --- /dev/null +++ b/kcontrol/locale/kcmlocale.cpp @@ -0,0 +1,535 @@ +/* + * locale.cpp + * + * Copyright (c) 1998 Matthias Hoelzer ([email protected]) + * Copyright (c) 1999 Preston Brown <[email protected]> + * Copyright (c) 1999-2003 Hans Petter Bieker <[email protected]> + * + * 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 <tqhbox.h> +#include <tqlabel.h> +#include <tqlayout.h> +#include <tqlistbox.h> +#include <tqpushbutton.h> +#include <tqtooltip.h> +#include <tqwhatsthis.h> + +#include <kdebug.h> +#include <kdialog.h> +#include <kprocess.h> +#include <kiconloader.h> +#include <klanguagebutton.h> +#include <ksimpleconfig.h> +#include <kstandarddirs.h> + +#include "kcmlocale.h" +#include "kcmlocale.moc" +#include "toplevel.h" + +TDELocaleConfig::TDELocaleConfig(TDELocale *locale, + TQWidget *parent, const char *name) + : TQWidget (parent, name), + m_locale(locale) +{ + TQGridLayout *lay = new TQGridLayout(this, 4, 3, + KDialog::marginHint(), + KDialog::spacingHint()); + + m_labCountry = new TQLabel(this, I18N_NOOP("Country or region:")); + m_comboCountry = new KLanguageButton( this ); + m_labCountry->setBuddy(m_comboCountry); + connect( m_comboCountry, TQT_SIGNAL(activated(const TQString &)), + this, TQT_SLOT(changedCountry(const TQString &)) ); + + m_labLang = new TQLabel(this, I18N_NOOP("Languages:")); + m_labLang->setAlignment( AlignTop ); + + m_languages = new TQListBox(this); + connect(m_languages, TQT_SIGNAL(selectionChanged()), + TQT_SLOT(slotCheckButtons())); + + TQWidget * vb = new TQWidget(this); + TQVBoxLayout * boxlay = new TQVBoxLayout(vb, 0, KDialog::spacingHint()); + m_addLanguage = new KLanguageButton(TQString::null, vb, I18N_NOOP("Add Language")); + boxlay->add(m_addLanguage); + connect(m_addLanguage, TQT_SIGNAL(activated(const TQString &)), + TQT_SLOT(slotAddLanguage(const TQString &))); + m_removeLanguage = new TQPushButton(vb, I18N_NOOP("Remove Language")); + m_upButton = new TQPushButton(vb, I18N_NOOP("Move Up")); + m_downButton = new TQPushButton(vb, I18N_NOOP("Move Down")); + boxlay->add(m_removeLanguage); + boxlay->add(m_upButton); + boxlay->add(m_downButton); + connect(m_removeLanguage, TQT_SIGNAL(clicked()), + TQT_SLOT(slotRemoveLanguage())); + connect(m_upButton, TQT_SIGNAL(clicked()), + TQT_SLOT(slotLanguageUp())); + connect(m_downButton, TQT_SIGNAL(clicked()), + TQT_SLOT(slotLanguageDown())); + boxlay->insertStretch(-1); + + // #### HPB: This should be implemented for KDE 3 + // new TQLabel(this, I18N_NOOP("Encoding:")); + //TQComboBox * cb = new TQComboBox( this ); + //cb->insertStringList( TDEGlobal::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); + +#if 0 + // Added jriddell 2007-01-08, for Kubuntu Language Selector spec + TQHBoxLayout* languageSelectorLayout = new TQHBoxLayout(); + installLanguage = new TQPushButton(i18n("Install New Language"), this); + languageSelectorLayout->addWidget(installLanguage); + uninstallLanguage = new TQPushButton(i18n("Uninstall Language"), this); + languageSelectorLayout->addWidget(uninstallLanguage); + selectLanguage = new TQPushButton(i18n("Select System Language"), this); + languageSelectorLayout->addWidget(selectLanguage); + languageSelectorLayout->addStretch(); + lay->addMultiCellLayout(languageSelectorLayout, 3, 3, 0, 2); + + connect( installLanguage, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotInstallLanguage()) ); + connect( uninstallLanguage, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotUninstallLanguage()) ); + connect( selectLanguage, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotSelectLanguage()) ); +#endif + +} + +void TDELocaleConfig::slotInstallLanguage() +{ + TDEProcess *proc = new TDEProcess; + + *proc << "tdesu"; + *proc << "qt-language-selector --mode install"; + TQApplication::connect(proc, TQT_SIGNAL(processExited(TDEProcess *)), + this, TQT_SLOT(slotLanguageSelectorExited(TDEProcess *))); + setEnabled(false); + proc->start(); +} + +void TDELocaleConfig::slotUninstallLanguage() +{ + TDEProcess *proc = new TDEProcess; + + *proc << "tdesu"; + *proc << "qt-language-selector --mode uninstall"; + TQApplication::connect(proc, TQT_SIGNAL(processExited(TDEProcess *)), + this, TQT_SLOT(slotLanguageSelectorExited(TDEProcess *))); + setEnabled(false); + proc->start(); +} + +void TDELocaleConfig::slotSelectLanguage() +{ + TDEProcess *proc = new TDEProcess; + + *proc << "tdesu"; + *proc << "qt-language-selector --mode select"; + TQApplication::connect(proc, TQT_SIGNAL(processExited(TDEProcess *)), + this, TQT_SLOT(slotLanguageSelectorExited(TDEProcess *))); + setEnabled(false); + proc->start(); +} + +void TDELocaleConfig::slotLanguageSelectorExited(TDEProcess *) +{ + //reload here + loadLanguageList(); + setEnabled(true); +} + +void TDELocaleConfig::slotAddLanguage(const TQString & code) +{ + TQStringList 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; + + TQStringList::Iterator it = languageList.at( pos ); + + languageList.insert( it, code ); + + m_locale->setLanguage( languageList ); + + emit localeChanged(); + if ( pos == 0 ) + emit languageChanged(); +} + +void TDELocaleConfig::slotRemoveLanguage() +{ + TQStringList languageList = m_locale->languageList(); + int pos = m_languages->currentItem(); + + TQStringList::Iterator it = languageList.at( pos ); + + if ( it != languageList.end() ) + { + languageList.remove( it ); + + m_locale->setLanguage( languageList ); + + emit localeChanged(); + if ( pos == 0 ) + emit languageChanged(); + } +} + +void TDELocaleConfig::slotLanguageUp() +{ + TQStringList languageList = m_locale->languageList(); + int pos = m_languages->currentItem(); + + TQStringList::Iterator it1 = languageList.at( pos - 1 ); + TQStringList::Iterator it2 = languageList.at( pos ); + + if ( it1 != languageList.end() && it2 != languageList.end() ) + { + TQString str = *it1; + *it1 = *it2; + *it2 = str; + + m_locale->setLanguage( languageList ); + + emit localeChanged(); + if ( pos == 1 ) // at the lang before the top + emit languageChanged(); + } +} + +void TDELocaleConfig::slotLanguageDown() +{ + TQStringList languageList = m_locale->languageList(); + int pos = m_languages->currentItem(); + + TQStringList::Iterator it1 = languageList.at( pos ); + TQStringList::Iterator it2 = languageList.at( pos + 1 ); + + if ( it1 != languageList.end() && it2 != languageList.end() ) + { + TQString str = *it1; + *it1 = *it2; + *it2 = str; + + m_locale->setLanguage( languageList ); + + emit localeChanged(); + if ( pos == 0 ) // at the top + emit languageChanged(); + } +} + +void TDELocaleConfig::loadLanguageList() +{ + // temperary use of our locale as the global locale + TDELocale *lsave = TDEGlobal::_locale; + TDEGlobal::_locale = m_locale; + + // clear the list + m_addLanguage->clear(); + + TQStringList first = languageList(); + + TQStringList prilang; + // add the primary languages for the country to the list + for ( TQStringList::ConstIterator it = first.begin(); + it != first.end(); + ++it ) + { + TQString str = locate("locale", TQString::fromLatin1("%1/entry.desktop") + .arg(*it)); + if (!str.isNull()) + prilang << str; + } + + // add all languages to the list + TQStringList alllang = TDEGlobal::dirs()->findAllResources("locale", + TQString::fromLatin1("*/entry.desktop"), + false, true); + TQStringList langlist = prilang; + if (langlist.count() > 0) + langlist << TQString::null; // separator + langlist += alllang; + + int menu_index = -2; + TQString submenu; // we are working on this menu + for ( TQStringList::ConstIterator it = langlist.begin(); + it != langlist.end(); ++it ) + { + if ((*it).isNull()) + { + m_addLanguage->insertSeparator(); + submenu = TQString::fromLatin1("other"); + m_addLanguage->insertSubmenu(m_locale->translate("Other"), + submenu, TQString::null, -1); + menu_index = -2; // first entries should _not_ be sorted + continue; + } + KSimpleConfig entry(*it); + entry.setGroup("KCM Locale"); + TQString name = entry.readEntry("Name", + m_locale->translate("without name")); + + TQString 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 + TDEGlobal::_locale = lsave; +} + +void TDELocaleConfig::loadCountryList() +{ + // temperary use of our locale as the global locale + TDELocale *lsave = TDEGlobal::_locale; + TDEGlobal::_locale = m_locale; + + TQString sub = TQString::fromLatin1("l10n/"); + + // clear the list + m_comboCountry->clear(); + + TQStringList regionlist = TDEGlobal::dirs()->findAllResources("locale", + sub + TQString::fromLatin1("*.desktop"), + false, true ); + + for ( TQStringList::ConstIterator it = regionlist.begin(); + it != regionlist.end(); + ++it ) + { + TQString 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"); + TQString name = entry.readEntry("Name", + m_locale->translate("without name")); + + TQString map( locate( "locale", + TQString::fromLatin1( "l10n/%1.png" ) + .arg(tag) ) ); + TQIconSet icon; + if ( !map.isNull() ) + icon = TDEGlobal::iconLoader()->loadIconSet(map, TDEIcon::Small); + m_comboCountry->insertSubmenu( icon, name, tag, sub, -2 ); + } + + // add all languages to the list + TQStringList countrylist = TDEGlobal::dirs()->findAllResources + ("locale", sub + TQString::fromLatin1("*/entry.desktop"), false, true); + + for ( TQStringList::ConstIterator it = countrylist.begin(); + it != countrylist.end(); ++it ) + { + KSimpleConfig entry(*it); + entry.setGroup("KCM Locale"); + TQString name = entry.readEntry("Name", + m_locale->translate("without name")); + TQString submenu = entry.readEntry("Region"); + + TQString tag = *it; + int index = tag.findRev('/'); + tag.truncate(index); + index = tag.findRev('/'); + tag = tag.mid(index + 1); + int menu_index = submenu.isEmpty() ? -1 : -2; + + TQString flag( locate( "locale", + TQString::fromLatin1( "l10n/%1/flag.png" ) + .arg(tag) ) ); + TQIconSet icon( TDEGlobal::iconLoader()->loadIconSet(flag, TDEIcon::Small) ); + m_comboCountry->insertItem( icon, name, tag, submenu, menu_index ); + } + + // restore the old global locale + TDEGlobal::_locale = lsave; +} + +void TDELocaleConfig::readLocale(const TQString &path, TQString &name, + const TQString &sub) const +{ + // temperary use of our locale as the global locale + TDELocale *lsave = TDEGlobal::_locale; + TDEGlobal::_locale = m_locale; + + // read the name + TQString filepath = TQString::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 + TDEGlobal::_locale = lsave; +} + +void TDELocaleConfig::save() +{ + TDEConfigBase *config = TDEGlobal::config(); + + config->setGroup("Locale"); + + config->writeEntry("Country", m_locale->country(), true, true); + if ( m_locale->languageList().isEmpty() ) + config->writeEntry("Language", TQString::fromLatin1(""), true, true); + else + config->writeEntry("Language", + m_locale->languageList(), ':', true, true); + + config->sync(); +} + +void TDELocaleConfig::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 TDELocaleConfig::slotLocaleChanged() +{ + loadLanguageList(); + loadCountryList(); + + // update language widget + m_languages->clear(); + TQStringList languageList = m_locale->languageList(); + for ( TQStringList::Iterator it = languageList.begin(); + it != languageList.end(); + ++it ) + { + TQString name; + readLocale(*it, name, TQString::null); + + m_languages->insertItem(name); + } + slotCheckButtons(); + + m_comboCountry->setCurrentItem( m_locale->country() ); +} + +void TDELocaleConfig::slotTranslate() +{ + kdDebug() << "slotTranslate()" << endl; + + TQToolTip::add(m_comboCountry, m_locale->translate + ( "This is where you live. TDE will use the defaults for " + "this country or region.") ); + TQToolTip::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." ) ); + + TQToolTip::add(m_removeLanguage, m_locale->translate + ( "This will remove the highlighted language from the list." ) ); + + TQToolTip::add(m_languages, m_locale->translate + ( "TDE programs will be displayed in the first available language in " + "this list.\nIf none of the languages are available, US English " + "will be used.") ); + + TQString 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." ); + TQWhatsThis::add( m_labCountry, str ); + TQWhatsThis::add( m_comboCountry, str ); + + str = m_locale->translate + ( "Here you can choose the languages that will be used by TDE. 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 TDE from.<p>" + "Note that some applications may not be translated to your languages; " + "in this case, they will automatically fall back to US English." ); + TQWhatsThis::add( m_labLang, str ); + TQWhatsThis::add( m_languages, str ); + TQWhatsThis::add( m_addLanguage, str ); + TQWhatsThis::add( m_removeLanguage, str ); +} + +TQStringList TDELocaleConfig::languageList() const +{ + TQString fileName = locate("locale", + TQString::fromLatin1("l10n/%1/entry.desktop") + .arg(m_locale->country())); + + KSimpleConfig entry(fileName); + entry.setGroup("KCM Locale"); + + return entry.readListEntry("Languages"); +} + +void TDELocaleConfig::changedCountry(const TQString & code) +{ + m_locale->setCountry(code); + + // change to the preferred languages in that country, installed only + TQStringList languages = languageList(); + TQStringList newLanguageList; + for ( TQStringList::Iterator it = languages.begin(); + it != languages.end(); + ++it ) + { + TQString name; + readLocale(*it, name, TQString::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..c8b126919 --- /dev/null +++ b/kcontrol/locale/kcmlocale.h @@ -0,0 +1,105 @@ +/* + * kcmlocale.h + * + * Copyright (c) 1998 Matthias Hoelzer <[email protected]> + * Copyright (c) 1999-2003 Hans Petter Bieker <[email protected]> + * + * 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 <tqapplication.h> +#include <tqwidget.h> +#include <tqstringlist.h> + +class KAddButton; +class KLanguageButton; +class TDELocale; +class TDELocaleSample; + +class TQLabel; +class TQListBox; +class TQPushButton; + +class TDELocaleConfig : public TQWidget +{ + Q_OBJECT + +public: + TDELocaleConfig( TDELocale *_locale, + TQWidget *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 TQString & code); + void readLocale(const TQString &path, TQString &name, + const TQString &sub) const; + + void slotAddLanguage(const TQString & id); + void slotRemoveLanguage(); + void slotLanguageUp(); + void slotLanguageDown(); + void slotCheckButtons(); + + void slotInstallLanguage(); + void slotUninstallLanguage(); + void slotSelectLanguage(); + void slotLanguageSelectorExited(TDEProcess *); + +private: + TQStringList languageList() const; + + TDELocale *m_locale; + + KLanguageButton *m_comboCountry; + + TQLabel *m_labCountry; + TQLabel *m_labLang; + + TQListBox * m_languages; + KLanguageButton * m_addLanguage; + TQPushButton * m_removeLanguage; + TQPushButton * m_upButton; + TQPushButton * m_downButton; + + TQPushButton* installLanguage; + TQPushButton* uninstallLanguage; + TQPushButton* selectLanguage; +}; + +#endif diff --git a/kcontrol/locale/klocalesample.cpp b/kcontrol/locale/klocalesample.cpp new file mode 100644 index 000000000..9903965e8 --- /dev/null +++ b/kcontrol/locale/klocalesample.cpp @@ -0,0 +1,132 @@ +/* + * klocalesample.cpp + * + * Copyright (c) 1998 Matthias Hoelzer ([email protected]) + * Copyright (c) 1999 Preston Brown <[email protected]> + * Copyright (c) 1999-2003 Hans Petter Bieker <[email protected]> + * + * 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 <tqdatetime.h> +#include <tqlabel.h> +#include <tqwhatsthis.h> +#include <tqlayout.h> +#include <tqtimer.h> + +#include <stdio.h> + +#include <tdelocale.h> + +#include "klocalesample.h" +#include "klocalesample.moc" + +TDELocaleSample::TDELocaleSample(TDELocale *locale, + TQWidget *parent, const char*name) + : TQWidget(parent, name), + m_locale(locale) +{ + TQGridLayout *lay = new TQGridLayout(this, 5, 2); + lay->setAutoAdd(TRUE); + + // Whatever the color scheme is, we want black text + TQColorGroup a = palette().active(); + a.setColor(TQColorGroup::Foreground, Qt::black); + TQPalette pal(a, a, a); + + m_labNumber = new TQLabel(this, I18N_NOOP("Numbers:")); + m_labNumber->setPalette(pal); + m_numberSample = new TQLabel(this); + m_numberSample->setPalette(pal); + + m_labMoney = new TQLabel(this, I18N_NOOP("Money:")); + m_labMoney->setPalette(pal); + m_moneySample = new TQLabel(this); + m_moneySample->setPalette(pal); + + m_labDate = new TQLabel(this, I18N_NOOP("Date:")); + m_labDate->setPalette(pal); + m_dateSample = new TQLabel(this); + m_dateSample->setPalette(pal); + + m_labDateShort = new TQLabel(this, I18N_NOOP("Short date:")); + m_labDateShort->setPalette(pal); + m_dateShortSample = new TQLabel(this); + m_dateShortSample->setPalette(pal); + + m_labTime = new TQLabel(this, I18N_NOOP("Time:")); + m_labTime->setPalette(pal); + m_timeSample = new TQLabel(this); + m_timeSample->setPalette(pal); + + lay->setColStretch(0, 1); + lay->setColStretch(1, 3); + + TQTimer *timer = new TQTimer(this, "clock_timer"); + connect(timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(slotUpdateTime())); + timer->start(1000); +} + +TDELocaleSample::~TDELocaleSample() +{ +} + +void TDELocaleSample::slotUpdateTime() +{ + TQDateTime dt = TQDateTime::currentDateTime(); + + m_dateSample->setText(m_locale->formatDate(TQT_TQDATE_OBJECT(dt.date()), false)); + m_dateShortSample->setText(m_locale->formatDate(TQT_TQDATE_OBJECT(dt.date()), true)); + m_timeSample->setText(m_locale->formatTime(TQT_TQTIME_OBJECT(dt.time()), true)); +} + +void TDELocaleSample::slotLocaleChanged() +{ + m_numberSample->setText(m_locale->formatNumber(1234567.89) + + TQString::fromLatin1(" / ") + + m_locale->formatNumber(-1234567.89)); + + m_moneySample->setText(m_locale->formatMoney(123456789.00) + + TQString::fromLatin1(" / ") + + m_locale->formatMoney(-123456789.00)); + + slotUpdateTime(); + + TQString str; + + str = m_locale->translate("This is how numbers will be displayed."); + TQWhatsThis::add( m_labNumber, str ); + TQWhatsThis::add( m_numberSample, str ); + + str = m_locale->translate("This is how monetary values will be displayed."); + TQWhatsThis::add( m_labMoney, str ); + TQWhatsThis::add( m_moneySample, str ); + + str = m_locale->translate("This is how date values will be displayed."); + TQWhatsThis::add( m_labDate, str ); + TQWhatsThis::add( m_dateSample, str ); + + str = m_locale->translate("This is how date values will be displayed using " + "a short notation."); + TQWhatsThis::add( m_labDateShort, str ); + TQWhatsThis::add( m_dateShortSample, str ); + + str = m_locale->translate("This is how the time will be displayed."); + TQWhatsThis::add( m_labTime, str ); + TQWhatsThis::add( m_timeSample, str ); +} diff --git a/kcontrol/locale/klocalesample.h b/kcontrol/locale/klocalesample.h new file mode 100644 index 000000000..f4233c3cf --- /dev/null +++ b/kcontrol/locale/klocalesample.h @@ -0,0 +1,58 @@ +/* + * locale.cpp + * + * Copyright (c) 1998 Matthias Hoelzer ([email protected]) + * Copyright (c) 1999-2003 Hans Petter Bieker <[email protected]> + * + * 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 <tqwidget.h> + +class TQLabel; +class TQResizeEvent; + +class TDELocale; + +class TDELocaleSample : public TQWidget +{ + Q_OBJECT +public: + TDELocaleSample(TDELocale *_locale, + TQWidget *parent = 0, const char*name = 0); + virtual ~TDELocaleSample(); + +public slots: + void slotLocaleChanged(); + +protected slots: + void slotUpdateTime(); + +private: + TDELocale *m_locale; + TQLabel *m_numberSample, *m_labNumber; + TQLabel *m_moneySample, *m_labMoney; + TQLabel *m_timeSample, *m_labTime; + TQLabel *m_dateSample, *m_labDate; + TQLabel *m_dateShortSample, *m_labDateShort; +}; + +#endif diff --git a/kcontrol/locale/language.desktop b/kcontrol/locale/language.desktop new file mode 100644 index 000000000..603d2b4aa --- /dev/null +++ b/kcontrol/locale/language.desktop @@ -0,0 +1,236 @@ +[Desktop Entry] +Exec=tdecmshell language +Icon=locale +Type=Application +X-DocPath=kcontrol/language/index.html + + +X-TDE-Library=locale +X-TDE-FactoryName=locale +X-TDE-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;TDE;X-TDE-settings-accessibility; diff --git a/kcontrol/locale/localemon.cpp b/kcontrol/locale/localemon.cpp new file mode 100644 index 000000000..609e0c9ad --- /dev/null +++ b/kcontrol/locale/localemon.cpp @@ -0,0 +1,330 @@ +/* + * localemon.cpp + * + * Copyright (c) 1999-2003 Hans Petter Bieker <[email protected]> + * + * 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 <tqcheckbox.h> +#include <tqcombobox.h> +#include <tqlabel.h> +#include <tqlineedit.h> +#include <tqobjectlist.h> +#include <tqwhatsthis.h> +#include <tqlayout.h> +#include <tqvgroupbox.h> +#include <tqvbox.h> +#include <tqregexp.h> + +#include <knuminput.h> +#include <kdialog.h> +#include <ksimpleconfig.h> +#include <kstandarddirs.h> + +#include "toplevel.h" +#include "localemon.h" +#include "localemon.moc" + +TDELocaleConfigMoney::TDELocaleConfigMoney(TDELocale *locale, + TQWidget *parent, const char*name) + : TQWidget(parent, name), + m_locale(locale) +{ + // Money + TQGridLayout *lay = new TQGridLayout(this, 6, 2, + KDialog::marginHint(), + KDialog::spacingHint()); + + m_labMonCurSym = new TQLabel(this, I18N_NOOP("Currency symbol:")); + lay->addWidget(m_labMonCurSym, 0, 0); + m_edMonCurSym = new TQLineEdit(this); + lay->addWidget(m_edMonCurSym, 0, 1); + connect( m_edMonCurSym, TQT_SIGNAL( textChanged(const TQString &) ), + TQT_SLOT( slotMonCurSymChanged(const TQString &) ) ); + + m_labMonDecSym = new TQLabel(this, I18N_NOOP("Decimal symbol:")); + lay->addWidget(m_labMonDecSym, 1, 0); + m_edMonDecSym = new TQLineEdit(this); + lay->addWidget(m_edMonDecSym, 1, 1); + connect( m_edMonDecSym, TQT_SIGNAL( textChanged(const TQString &) ), + TQT_SLOT( slotMonDecSymChanged(const TQString &) ) ); + + m_labMonThoSep = new TQLabel(this, I18N_NOOP("Thousands separator:")); + lay->addWidget(m_labMonThoSep, 2, 0); + m_edMonThoSep = new TQLineEdit(this); + lay->addWidget(m_edMonThoSep, 2, 1); + connect( m_edMonThoSep, TQT_SIGNAL( textChanged(const TQString &) ), + TQT_SLOT( slotMonThoSepChanged(const TQString &) ) ); + + m_labMonFraDig = new TQLabel(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, TQT_SIGNAL( valueChanged(int) ), + TQT_SLOT( slotMonFraDigChanged(int) ) ); + + TQWidget *vbox = new TQVBox(this); + lay->addMultiCellWidget(vbox, 4, 4, 0, 1); + TQVGroupBox *vgrp; + vgrp = new TQVGroupBox( vbox, I18N_NOOP("Positive") ); + m_chMonPosPreCurSym = new TQCheckBox(vgrp, I18N_NOOP("Prefix currency symbol")); + connect( m_chMonPosPreCurSym, TQT_SIGNAL( clicked() ), + TQT_SLOT( slotMonPosPreCurSymChanged() ) ); + + TQHBox *hbox; + hbox = new TQHBox( vgrp ); + m_labMonPosMonSignPos = new TQLabel(hbox, I18N_NOOP("Sign position:")); + m_cmbMonPosMonSignPos = new TQComboBox(hbox, "signpos"); + connect( m_cmbMonPosMonSignPos, TQT_SIGNAL( activated(int) ), + TQT_SLOT( slotMonPosMonSignPosChanged(int) ) ); + + vgrp = new TQVGroupBox( vbox, I18N_NOOP("Negative") ); + m_chMonNegPreCurSym = new TQCheckBox(vgrp, I18N_NOOP("Prefix currency symbol")); + connect( m_chMonNegPreCurSym, TQT_SIGNAL( clicked() ), + TQT_SLOT( slotMonNegPreCurSymChanged() ) ); + + hbox = new TQHBox( vgrp ); + m_labMonNegMonSignPos = new TQLabel(hbox, I18N_NOOP("Sign position:")); + m_cmbMonNegMonSignPos = new TQComboBox(hbox, "signpos"); + connect( m_cmbMonNegMonSignPos, TQT_SIGNAL( activated(int) ), + TQT_SLOT( slotMonNegMonSignPosChanged(int) ) ); + + // insert some items + int i = 5; + while (i--) + { + m_cmbMonPosMonSignPos->insertItem(TQString()); + m_cmbMonNegMonSignPos->insertItem(TQString()); + } + + lay->setColStretch(1, 1); + lay->addRowSpacing(5, 0); + + adjustSize(); +} + +TDELocaleConfigMoney::~TDELocaleConfigMoney() +{ +} + +void TDELocaleConfigMoney::save() +{ + TDEConfig *config = TDEGlobal::config(); + TDEConfigGroupSaver saver(config, "Locale"); + + KSimpleConfig ent(locate("locale", + TQString::fromLatin1("l10n/%1/entry.desktop") + .arg(m_locale->country())), true); + ent.setGroup("KCM Locale"); + + TQString str; + int i; + bool b; + + str = ent.readEntry("CurrencySymbol", TQString::fromLatin1("$")); + config->deleteEntry("CurrencySymbol", false, true); + if (str != m_locale->currencySymbol()) + config->writeEntry("CurrencySymbol", + m_locale->currencySymbol(), true, true); + + str = ent.readEntry("MonetaryDecimalSymbol", TQString::fromLatin1(".")); + config->deleteEntry("MonetaryDecimalSymbol", false, true); + if (str != m_locale->monetaryDecimalSymbol()) + config->writeEntry("MonetaryDecimalSymbol", + m_locale->monetaryDecimalSymbol(), true, true); + + str = ent.readEntry("MonetaryThousandsSeparator", TQString::fromLatin1(",")); + str.replace(TQString::fromLatin1("$0"), TQString()); + config->deleteEntry("MonetaryThousandsSeparator", false, true); + if (str != m_locale->monetaryThousandsSeparator()) + config->writeEntry("MonetaryThousandsSeparator", + TQString::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)TDELocale::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)TDELocale::ParensAround); + config->deleteEntry("NegativeMonetarySignPosition", false, true); + if (i != m_locale->negativeMonetarySignPosition()) + config->writeEntry("NegativeMonetarySignPosition", + (int)m_locale->negativeMonetarySignPosition(), + true, true); + + config->sync(); +} + +void TDELocaleConfigMoney::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 TDELocaleConfigMoney::slotMonCurSymChanged(const TQString &t) +{ + m_locale->setCurrencySymbol(t); + emit localeChanged(); +} + +void TDELocaleConfigMoney::slotMonDecSymChanged(const TQString &t) +{ + m_locale->setMonetaryDecimalSymbol(t); + emit localeChanged(); +} + +void TDELocaleConfigMoney::slotMonThoSepChanged(const TQString &t) +{ + m_locale->setMonetaryThousandsSeparator(t); + emit localeChanged(); +} + +void TDELocaleConfigMoney::slotMonFraDigChanged(int value) +{ + m_locale->setFracDigits(value); + emit localeChanged(); +} + +void TDELocaleConfigMoney::slotMonPosPreCurSymChanged() +{ + m_locale->setPositivePrefixCurrencySymbol(m_chMonPosPreCurSym->isChecked()); + emit localeChanged(); +} + +void TDELocaleConfigMoney::slotMonNegPreCurSymChanged() +{ + m_locale->setNegativePrefixCurrencySymbol(m_chMonNegPreCurSym->isChecked()); + emit localeChanged(); +} + +void TDELocaleConfigMoney::slotMonPosMonSignPosChanged(int i) +{ + m_locale->setPositiveMonetarySignPosition((TDELocale::SignPosition)i); + emit localeChanged(); +} + +void TDELocaleConfigMoney::slotMonNegMonSignPosChanged(int i) +{ + m_locale->setNegativeMonetarySignPosition((TDELocale::SignPosition)i); + emit localeChanged(); +} + +void TDELocaleConfigMoney::slotTranslate() +{ + TQObjectList list; + list.append(TQT_TQOBJECT(m_cmbMonPosMonSignPos)); + list.append(TQT_TQOBJECT(m_cmbMonNegMonSignPos)); + + TQComboBox *wc; + for (TQObjectListIt li(list) ; (wc = (TQComboBox *)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); + } + + TQString 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." ); + TQWhatsThis::add( m_labMonCurSym, str ); + TQWhatsThis::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)." ); + TQWhatsThis::add( m_labMonDecSym, str ); + TQWhatsThis::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)." ); + TQWhatsThis::add( m_labMonThoSep, str ); + TQWhatsThis::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." ); + TQWhatsThis::add( m_labMonFraDig, str ); + TQWhatsThis::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)." ); + TQWhatsThis::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)." ); + TQWhatsThis::add( m_chMonNegPreCurSym, str ); + + str = m_locale->translate( "Here you can select how a positive sign will be " + "positioned. This only affects monetary values." ); + TQWhatsThis::add( m_labMonPosMonSignPos, str ); + TQWhatsThis::add( m_cmbMonPosMonSignPos, str ); + + str = m_locale->translate( "Here you can select how a negative sign will " + "be positioned. This only affects monetary " + "values." ); + TQWhatsThis::add( m_labMonNegMonSignPos, str ); + TQWhatsThis::add( m_cmbMonNegMonSignPos, str ); +} diff --git a/kcontrol/locale/localemon.h b/kcontrol/locale/localemon.h new file mode 100644 index 000000000..d84db0e37 --- /dev/null +++ b/kcontrol/locale/localemon.h @@ -0,0 +1,93 @@ +/* + * localemon.h + * + * Copyright (c) 1999-2003 Hans Petter Bieker <[email protected]> + * + * 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 <tqwidget.h> + +class TQCheckBox; +class TQComboBox; +class TQLineEdit; + +class KIntNumInput; +class TDELocale; +class KLanguageCombo; + +class TDELocaleConfigMoney : public TQWidget +{ + Q_OBJECT + +public: + TDELocaleConfigMoney(TDELocale *locale, TQWidget *parent = 0, const char *name = 0); + virtual ~TDELocaleConfigMoney(); + + 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 TQString &t); + void slotMonDecSymChanged(const TQString &t); + void slotMonThoSepChanged(const TQString &t); + void slotMonFraDigChanged(int value); + void slotMonPosPreCurSymChanged(); + void slotMonNegPreCurSymChanged(); + void slotMonPosMonSignPosChanged(int i); + void slotMonNegMonSignPosChanged(int i); + +private: + TDELocale *m_locale; + + // Money + TQLabel *m_labMonCurSym; + TQLineEdit *m_edMonCurSym; + TQLabel *m_labMonDecSym; + TQLineEdit *m_edMonDecSym; + TQLabel *m_labMonThoSep; + TQLineEdit *m_edMonThoSep; + TQLabel *m_labMonFraDig; + KIntNumInput * m_inMonFraDig; + + TQCheckBox *m_chMonPosPreCurSym; + TQCheckBox *m_chMonNegPreCurSym; + TQLabel *m_labMonPosMonSignPos; + TQComboBox *m_cmbMonPosMonSignPos; + TQLabel *m_labMonNegMonSignPos; + TQComboBox *m_cmbMonNegMonSignPos; +}; + +#endif diff --git a/kcontrol/locale/localenum.cpp b/kcontrol/locale/localenum.cpp new file mode 100644 index 000000000..ca523d2e9 --- /dev/null +++ b/kcontrol/locale/localenum.cpp @@ -0,0 +1,194 @@ +/* + * localenum.cpp + * + * Copyright (c) 1999-2003 Hans Petter Bieker <[email protected]> + * + * 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 <tqlabel.h> +#include <tqlineedit.h> +#include <tqlayout.h> +#include <tqwhatsthis.h> +#include <tqregexp.h> + +#include <kdialog.h> +#include <ksimpleconfig.h> +#include <kstandarddirs.h> + +#include "toplevel.h" +#include "localenum.h" +#include "localenum.moc" + +TDELocaleConfigNumber::TDELocaleConfigNumber(TDELocale *locale, + TQWidget *parent, const char*name) + : TQWidget(parent, name), + m_locale(locale) +{ + TQGridLayout *lay = new TQGridLayout(this, 5, 2, + KDialog::marginHint(), + KDialog::spacingHint()); + lay->setAutoAdd(TRUE); + + m_labDecSym = new TQLabel(this, I18N_NOOP("&Decimal symbol:")); + m_edDecSym = new TQLineEdit(this); + connect( m_edDecSym, TQT_SIGNAL( textChanged(const TQString &) ), + this, TQT_SLOT( slotDecSymChanged(const TQString &) ) ); + m_labDecSym->setBuddy(m_edDecSym); + + m_labThoSep = new TQLabel(this, I18N_NOOP("Tho&usands separator:")); + m_edThoSep = new TQLineEdit(this); + connect( m_edThoSep, TQT_SIGNAL( textChanged(const TQString &) ), + this, TQT_SLOT( slotThoSepChanged(const TQString &) ) ); + m_labThoSep->setBuddy(m_edThoSep); + + m_labMonPosSign = new TQLabel(this, I18N_NOOP("Positive si&gn:")); + m_edMonPosSign = new TQLineEdit(this); + connect( m_edMonPosSign, TQT_SIGNAL( textChanged(const TQString &) ), + this, TQT_SLOT( slotMonPosSignChanged(const TQString &) ) ); + m_labMonPosSign->setBuddy(m_edMonPosSign); + + m_labMonNegSign = new TQLabel(this, I18N_NOOP("&Negative sign:")); + m_edMonNegSign = new TQLineEdit(this); + connect( m_edMonNegSign, TQT_SIGNAL( textChanged(const TQString &) ), + this, TQT_SLOT( slotMonNegSignChanged(const TQString &) ) ); + m_labMonNegSign->setBuddy(m_edMonNegSign); + + lay->setColStretch(1, 1); + + connect(this, TQT_SIGNAL(localeChanged()), + TQT_SLOT(slotLocaleChanged())); +} + +TDELocaleConfigNumber::~TDELocaleConfigNumber() +{ +} + +void TDELocaleConfigNumber::save() +{ + // temperary use of our locale as the global locale + TDELocale *lsave = TDEGlobal::_locale; + TDEGlobal::_locale = m_locale; + + TDEConfig *config = TDEGlobal::config(); + TDEConfigGroupSaver saver(config, "Locale"); + + KSimpleConfig ent(locate("locale", + TQString::fromLatin1("l10n/%1/entry.desktop") + .arg(m_locale->country())), true); + ent.setGroup("KCM Locale"); + + TQString str; + + str = ent.readEntry("DecimalSymbol", + TQString::fromLatin1(".")); + config->deleteEntry("DecimalSymbol", false, true); + if (str != m_locale->decimalSymbol()) + config->writeEntry("DecimalSymbol", + m_locale->decimalSymbol(), true, true); + + str = ent.readEntry("ThousandsSeparator", + TQString::fromLatin1(",")); + config->deleteEntry("ThousandsSeparator", false, true); + str.replace(TQString::fromLatin1("$0"), TQString()); + if (str != m_locale->thousandsSeparator()) + config->writeEntry("ThousandsSeparator", + TQString::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", TQString::fromLatin1("-")); + config->deleteEntry("NegativeSign", false, true); + if (str != m_locale->negativeSign()) + config->writeEntry("NegativeSign", m_locale->negativeSign(), true, true); + + // restore the old global locale + TDEGlobal::_locale = lsave; +} + +void TDELocaleConfigNumber::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 TDELocaleConfigNumber::slotDecSymChanged(const TQString &t) +{ + m_locale->setDecimalSymbol(t); + emit localeChanged(); +} + +void TDELocaleConfigNumber::slotThoSepChanged(const TQString &t) +{ + m_locale->setThousandsSeparator(t); + emit localeChanged(); +} + +void TDELocaleConfigNumber::slotMonPosSignChanged(const TQString &t) +{ + m_locale->setPositiveSign(t); + emit localeChanged(); +} + +void TDELocaleConfigNumber::slotMonNegSignChanged(const TQString &t) +{ + m_locale->setNegativeSign(t); + emit localeChanged(); +} + +void TDELocaleConfigNumber::slotTranslate() +{ + TQString 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)." ); + TQWhatsThis::add( m_labDecSym, str ); + TQWhatsThis::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)." ); + TQWhatsThis::add( m_labThoSep, str ); + TQWhatsThis::add( m_edThoSep, str ); + + str = m_locale->translate( "Here you can specify text used to prefix " + "positive numbers. Most people leave this " + "blank." ); + TQWhatsThis::add( m_labMonPosSign, str ); + TQWhatsThis::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 (-)." ); + TQWhatsThis::add( m_labMonNegSign, str ); + TQWhatsThis::add( m_edMonNegSign, str ); +} diff --git a/kcontrol/locale/localenum.h b/kcontrol/locale/localenum.h new file mode 100644 index 000000000..1e19b687f --- /dev/null +++ b/kcontrol/locale/localenum.h @@ -0,0 +1,82 @@ +/* + * localenum.h + * + * Copyright (c) 1999-2003 Hans Petter Bieker <[email protected]> + * + * 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 <tqwidget.h> + +class TQCheckBox; +class TQComboBox; +class TQLineEdit; + +class TDELocale; +class KLanguageCombo; + +class TDELocaleConfigNumber : public TQWidget +{ + Q_OBJECT + +public: + TDELocaleConfigNumber( TDELocale *_locale, + TQWidget *parent=0, const char *name=0); + virtual ~TDELocaleConfigNumber( ); + + 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 TQString &t); + void slotMonNegSignChanged(const TQString &t); + void slotDecSymChanged(const TQString &t); + void slotThoSepChanged(const TQString &t); + +private: + TDELocale *m_locale; + + // Numbers + TQLabel *m_labDecSym; + TQLineEdit *m_edDecSym; + TQLabel *m_labThoSep; + TQLineEdit *m_edThoSep; + TQLabel *m_labMonPosSign; + TQLineEdit *m_edMonPosSign; + TQLabel *m_labMonNegSign; + TQLineEdit *m_edMonNegSign; +}; + +#endif diff --git a/kcontrol/locale/localeother.cpp b/kcontrol/locale/localeother.cpp new file mode 100644 index 000000000..6cb8e9a8d --- /dev/null +++ b/kcontrol/locale/localeother.cpp @@ -0,0 +1,142 @@ +/* + * localeother.cpp + * + * Copyright (c) 2001-2003 Hans Petter Bieker <[email protected]> + * + * 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 <tqcombobox.h> +#include <tqlayout.h> +#include <tqlabel.h> +#include <tqprinter.h> + +#include <kdialog.h> +#include <tdelocale.h> +#include <ksimpleconfig.h> +#include <kstandarddirs.h> + +#include "localeother.h" +#include "localeother.moc" + + +TDELocaleConfigOther::TDELocaleConfigOther(TDELocale *locale, + TQWidget *parent, const char*name) + : TQWidget(parent, name), + m_locale(locale) +{ + // Other + TQGridLayout *lay = new TQGridLayout(this, 3, 2, + KDialog::marginHint(), + KDialog::spacingHint()); + + m_labPageSize = new TQLabel(this, I18N_NOOP("Paper format:")); + lay->addWidget(m_labPageSize, 0, 0); + m_combPageSize = new TQComboBox(this); + lay->addWidget(m_combPageSize, 0, 1); + connect( m_combPageSize, TQT_SIGNAL( activated(int) ), + TQT_SLOT( slotPageSizeChanged(int) ) ); + + m_labMeasureSystem = new TQLabel(this, I18N_NOOP("Measure system:")); + lay->addWidget(m_labMeasureSystem, 1, 0); + m_combMeasureSystem = new TQComboBox(this); + lay->addWidget(m_combMeasureSystem, 1, 1); + connect( m_combMeasureSystem, TQT_SIGNAL( activated(int) ), + TQT_SLOT( slotMeasureSystemChanged(int) ) ); + + m_combPageSize->insertItem(TQString::null); + m_combPageSize->insertItem(TQString::null); + m_combMeasureSystem->insertItem(TQString::null); + m_combMeasureSystem->insertItem(TQString::null); + + lay->setColStretch(1, 1); + lay->addRowSpacing(2, 0); + + adjustSize(); +} + +TDELocaleConfigOther::~TDELocaleConfigOther() +{ +} + +void TDELocaleConfigOther::save() +{ + TDEConfig *config = TDEGlobal::config(); + TDEConfigGroupSaver saver(config, "Locale"); + + KSimpleConfig ent(locate("locale", + TQString::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)TQPrinter::A4); + config->deleteEntry("PageSize", false, true); + if (i != m_locale->pageSize()) + config->writeEntry("PageSize", + m_locale->pageSize(), true, true); + + i = ent.readNumEntry("MeasureSystem", (int)TDELocale::Metric); + config->deleteEntry("MeasureSystem", false, true); + if (i != m_locale->measureSystem()) + config->writeEntry("MeasureSystem", + m_locale->measureSystem(), true, true); + + config->sync(); +} + +void TDELocaleConfigOther::slotLocaleChanged() +{ + m_combMeasureSystem->setCurrentItem(m_locale->measureSystem()); + + int pageSize = m_locale->pageSize(); + + int i = 0; // default to A4 + if ( pageSize == (int)TQPrinter::Letter ) + i = 1; + m_combPageSize->setCurrentItem(i); +} + +void TDELocaleConfigOther::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 TDELocaleConfigOther::slotPageSizeChanged(int i) +{ + TQPrinter::PageSize pageSize = TQPrinter::A4; + + if ( i == 1 ) + pageSize = TQPrinter::Letter; + + m_locale->setPageSize((int)pageSize); + emit localeChanged(); +} + +void TDELocaleConfigOther::slotMeasureSystemChanged(int i) +{ + m_locale->setMeasureSystem((TDELocale::MeasureSystem)i); + emit localeChanged(); +} diff --git a/kcontrol/locale/localeother.h b/kcontrol/locale/localeother.h new file mode 100644 index 000000000..1ccad292d --- /dev/null +++ b/kcontrol/locale/localeother.h @@ -0,0 +1,70 @@ +/* + * localeother.h + * + * Copyright (c) 2001-2003 Hans Petter Bieker <[email protected]> + * + * 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 <tqwidget.h> + +class TQLabel; +class TQComboBox; + +class TDELocale; + +class TDELocaleConfigOther : public TQWidget +{ + Q_OBJECT + +public: + TDELocaleConfigOther(TDELocale *locale, TQWidget *parent = 0, const char *name = 0); + virtual ~TDELocaleConfigOther(); + + 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: + TDELocale *m_locale; + + TQLabel *m_labMeasureSystem; + TQComboBox *m_combMeasureSystem; + TQLabel *m_labPageSize; + TQComboBox *m_combPageSize; +}; + +#endif diff --git a/kcontrol/locale/localetime.cpp b/kcontrol/locale/localetime.cpp new file mode 100644 index 000000000..1e31f14f7 --- /dev/null +++ b/kcontrol/locale/localetime.cpp @@ -0,0 +1,556 @@ +/* + * localetime.cpp + * + * Copyright (c) 1999-2003 Hans Petter Bieker <[email protected]> + * + * 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 <tqcheckbox.h> +#include <tqlabel.h> +#include <tqlayout.h> +#include <tqwhatsthis.h> +#include <tqcombobox.h> +#include <tqvaluevector.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: + TQChar storeName; + TQString userName; + + static StringPair find( const TQValueList <StringPair> &list, const TQChar &c) + { + for ( TQValueList<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 TDELocaleConfigTime::buildStringPair(const TQChar &c, const TQString &s) const +{ + StringPair pair; + pair.storeName=c; + pair.userName=s; + return pair; +} + +TQValueList<StringPair> TDELocaleConfigTime::timeMap() const +{ + TQValueList < 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; +} + +TQValueList <StringPair> TDELocaleConfigTime::dateMap() const +{ + TQValueList < 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; +} + +TQString TDELocaleConfigTime::userToStore(const TQValueList<StringPair> & list, + const TQString & userFormat) const +{ + TQString result; + + for ( uint pos = 0; pos < userFormat.length(); ++pos ) + { + bool bFound = false; + for ( TQValueList<StringPair>::ConstIterator it = list.begin(); + it != list.end() && !bFound; + ++it ) + { + TQString s = (*it).userName; + + if ( userFormat.mid( pos, s.length() ) == s ) + { + result += '%'; + result += (*it).storeName; + + pos += s.length() - 1; + + bFound = true; + } + } + + if ( !bFound ) + { + TQChar c = userFormat.at( pos ); + if ( c == '%' ) + result += c; + + result += c; + } + } + + return result; +} + +TQString TDELocaleConfigTime::storeToUser(const TQValueList<StringPair> & list, + const TQString & storeFormat) const +{ + TQString result; + + bool escaped = false; + for ( uint pos = 0; pos < storeFormat.length(); ++pos ) + { + TQChar 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; +} + +TDELocaleConfigTime::TDELocaleConfigTime(TDELocale *_locale, + TQWidget *parent, const char*name) + : TQWidget(parent, name), + m_locale(_locale) +{ + // Time + TQGridLayout *lay = new TQGridLayout(this, 7, 2, + KDialog::marginHint(), + KDialog::spacingHint()); + lay->setAutoAdd(TRUE); + + m_labCalendarSystem = new TQLabel(this, I18N_NOOP("Calendar system:")); + m_comboCalendarSystem = new TQComboBox(false, this); + connect(m_comboCalendarSystem, TQT_SIGNAL(activated(int)), + this, TQT_SLOT(slotCalendarSystemChanged(int))); + TQStringList tmpCalendars; + tmpCalendars << TQString::null << TQString::null; + m_comboCalendarSystem->insertStringList(tmpCalendars); + + m_labTimeFmt = new TQLabel(this, I18N_NOOP("Time format:")); + m_comboTimeFmt = new TQComboBox(true, this); + //m_edTimeFmt = m_comboTimeFmt->lineEdit(); + //m_edTimeFmt = new TQLineEdit(this); + connect( m_comboTimeFmt, TQT_SIGNAL( textChanged(const TQString &) ), + this, TQT_SLOT( slotTimeFmtChanged(const TQString &) ) ); + + m_labDateFmt = new TQLabel(this, I18N_NOOP("Date format:")); + m_comboDateFmt = new TQComboBox(true, this); + connect( m_comboDateFmt, TQT_SIGNAL( textChanged(const TQString &) ), + this, TQT_SLOT( slotDateFmtChanged(const TQString &) ) ); + + m_labDateFmtShort = new TQLabel(this, I18N_NOOP("Short date format:")); + m_comboDateFmtShort = new TQComboBox(true, this); + connect( m_comboDateFmtShort, TQT_SIGNAL( textChanged(const TQString &) ), + this, TQT_SLOT( slotDateFmtShortChanged(const TQString &) ) ); + + m_labWeekStartDay = new TQLabel(this, I18N_NOOP("First day of the week:")); + m_comboWeekStartDay = new TQComboBox(false, this); + connect (m_comboWeekStartDay, TQT_SIGNAL(activated(int)), + this, TQT_SLOT(slotWeekStartDayChanged(int))); + + updateWeekDayNames(); + + m_chDateMonthNamePossessive = new TQCheckBox(this, I18N_NOOP("Use declined form of month name")); + connect( m_chDateMonthNamePossessive, TQT_SIGNAL( clicked() ), + TQT_SLOT( slotDateMonthNamePossChanged() ) ); + + lay->setColStretch(1, 1); +} + +TDELocaleConfigTime::~TDELocaleConfigTime() +{ +} + +void TDELocaleConfigTime::save() +{ + // temperary use of our locale as the global locale + TDELocale *lsave = TDEGlobal::_locale; + TDEGlobal::_locale = m_locale; + + TDEConfig *config = TDEGlobal::config(); + TDEConfigGroupSaver saver(config, "Locale"); + + KSimpleConfig ent(locate("locale", + TQString::fromLatin1("l10n/%1/entry.desktop") + .arg(m_locale->country())), true); + ent.setGroup("KCM Locale"); + + TQString str; + + str = ent.readEntry("CalendarSystem", TQString::fromLatin1("gregorian")); + config->deleteEntry("CalendarSystem", false, true); + if (str != m_locale->calendarType()) + config->writeEntry("CalendarSystem", m_locale->calendarType(), true, true); + + str = ent.readEntry("TimeFormat", TQString::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", TQString::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", TQString::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 + TDEGlobal::_locale = lsave; +} + +void TDELocaleConfigTime::showEvent( TQShowEvent *e ) +{ + // This option makes sense only for languages where nouns are declined + if ( !m_locale->nounDeclension() ) + m_chDateMonthNamePossessive->hide(); + TQWidget::showEvent( e ); +} + +void TDELocaleConfigTime::slotCalendarSystemChanged(int calendarSystem) +{ + kdDebug() << "CalendarSystem: " << calendarSystem << endl; + + typedef TQValueVector<TQString> CalendarVector; + CalendarVector calendars(4); + calendars[0] = "gregorian"; + calendars[1] = "hijri"; + calendars[2] = "hebrew"; + calendars[3] = "jalali"; + + TQString calendarType; + bool ok; + calendarType = calendars.at(calendarSystem, &ok); + if ( !ok ) + calendarType = calendars.first(); + + m_locale->setCalendar(calendarType); + + updateWeekDayNames(); + emit localeChanged(); +} + +void TDELocaleConfigTime::slotLocaleChanged() +{ + typedef TQValueVector<TQString> CalendarVector; + CalendarVector calendars(4); + calendars[0] = "gregorian"; + calendars[1] = "hijri"; + calendars[2] = "hebrew"; + calendars[3] = "jalali"; + + TQString calendarType = m_locale->calendarType(); + int calendarSystem = 0; + + CalendarVector::iterator it = tqFind(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(), + TQString::fromLatin1("HH:MM:SS AMPM test")) << endl; + +} + +void TDELocaleConfigTime::slotTimeFmtChanged(const TQString &t) +{ + // m_locale->setTimeFormat(t); + m_locale->setTimeFormat( userToStore( timeMap(), t ) ); + + emit localeChanged(); +} + +void TDELocaleConfigTime::slotDateFmtChanged(const TQString &t) +{ + // m_locale->setDateFormat(t); + m_locale->setDateFormat( userToStore( dateMap(), t ) ); + emit localeChanged(); +} + +void TDELocaleConfigTime::slotDateFmtShortChanged(const TQString &t) +{ + //m_locale->setDateFormatShort(t); + m_locale->setDateFormatShort( userToStore( dateMap(), t ) ); + emit localeChanged(); +} + +void TDELocaleConfigTime::slotWeekStartDayChanged(int firstDay) { + kdDebug(173) << k_funcinfo << "first day is now: " << firstDay << endl; + m_locale->setWeekStartDay(m_comboWeekStartDay->currentItem() + 1); + emit localeChanged(); +} + +void TDELocaleConfigTime::slotDateMonthNamePossChanged() +{ + if (m_locale->nounDeclension()) + { + m_locale->setDateMonthNamePossessive(m_chDateMonthNamePossessive->isChecked()); + emit localeChanged(); + } +} + +void TDELocaleConfigTime::slotTranslate() +{ + TQString str; + + TQString sep = TQString::fromLatin1("\n"); + + TQString 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(TQStringList::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(TQStringList::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(TQStringList::split(sep, str)); + m_comboDateFmtShort->setEditText(old); + + updateWeekDayNames(); + + while ( m_comboCalendarSystem->count() < 4 ) + m_comboCalendarSystem->insertItem(TQString::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>"); + TQWhatsThis::add( m_labTimeFmt, str ); + TQWhatsThis::add( m_comboTimeFmt, str ); + + TQString 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; + TQWhatsThis::add( m_labDateFmt, str ); + TQWhatsThis::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; + TQWhatsThis::add( m_labDateFmtShort, str ); + TQWhatsThis::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>"); + TQWhatsThis::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>"); + TQWhatsThis::add( m_chDateMonthNamePossessive, str ); + } +} + +void TDELocaleConfigTime::updateWeekDayNames() +{ + const KCalendarSystem * calendar = m_locale->calendar(); + + for ( int i = 1; ; ++i ) + { + TQString 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..0c34380f7 --- /dev/null +++ b/kcontrol/locale/localetime.h @@ -0,0 +1,102 @@ +/* + * localetime.h + * + * Copyright (c) 1999-2003 Hans Petter Bieker <[email protected]> + * + * 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 <tqwidget.h> + +#include <tqmap.h> + +class TQCheckBox; +class TQComboBox; + +class TDELocale; +class KLanguageCombo; + +class StringPair; + +class TDELocaleConfigTime : public TQWidget +{ + Q_OBJECT + +public: + TDELocaleConfigTime( TDELocale *_locale, TQWidget *parent=0, const char *name=0); + virtual ~TDELocaleConfigTime( ); + + void save(); + +protected: + void showEvent( TQShowEvent *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 TQString &t); + void slotDateFmtChanged(const TQString &t); + void slotDateFmtShortChanged(const TQString &t); + void slotWeekStartDayChanged(int firstDay); + void slotDateMonthNamePossChanged(); + void slotCalendarSystemChanged(int calendarSystem); + +private: + void updateWeekDayNames(); + + TQValueList<StringPair> timeMap() const; + TQValueList<StringPair> dateMap() const; + + TQString storeToUser(const TQValueList<StringPair> & map, + const TQString & storeFormat) const; + TQString userToStore(const TQValueList<StringPair> & map, + const TQString & userFormat) const; + StringPair buildStringPair(const TQChar &storeName, const TQString &userName) const; + + TDELocale *m_locale; + + // Time & dates + TQLabel *m_labTimeFmt; + TQComboBox *m_comboTimeFmt; + TQLabel *m_labDateFmt; + TQComboBox * m_comboDateFmt; + TQLabel *m_labDateFmtShort; + TQComboBox * m_comboDateFmtShort; + TQLabel * m_labWeekStartDay; + TQComboBox * m_comboWeekStartDay; + TQCheckBox *m_chDateMonthNamePossessive; + TQLabel * m_labCalendarSystem; + TQComboBox * m_comboCalendarSystem; +}; + +#endif diff --git a/kcontrol/locale/main.cpp b/kcontrol/locale/main.cpp new file mode 100644 index 000000000..634c3bd45 --- /dev/null +++ b/kcontrol/locale/main.cpp @@ -0,0 +1,38 @@ +/* + main.cpp - A KControl Application + + Copyright 1999-2003 Hans Petter Bieker <[email protected]> + + 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() { + TDELocale::setMainCatalogue("kcmlocale"); + return new TDELocaleFactory("kcmlocale"); + } +} + +/* +extern "C" { + TDECModule *create_locale(TQWidget *parent, const char* name) { + TDELocale::setMainCatalogue("kcmlocale"); + return new TDELocaleApplication(parent, "kcmlocale"); + } +} +*/ diff --git a/kcontrol/locale/pics/CMakeLists.txt b/kcontrol/locale/pics/CMakeLists.txt new file mode 100644 index 000000000..73e5e8f5c --- /dev/null +++ b/kcontrol/locale/pics/CMakeLists.txt @@ -0,0 +1,12 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +install( FILES background.png DESTINATION ${DATA_INSTALL_DIR}/kcmlocale/pics ) 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 Binary files differnew file mode 100644 index 000000000..d9d64462b --- /dev/null +++ b/kcontrol/locale/pics/background.png diff --git a/kcontrol/locale/toplevel.cpp b/kcontrol/locale/toplevel.cpp new file mode 100644 index 000000000..d2a17ca74 --- /dev/null +++ b/kcontrol/locale/toplevel.cpp @@ -0,0 +1,293 @@ +/* + toplevel.cpp - A KControl Application + + Copyright 1998 Matthias Hoelzer + Copyright 1999-2003 Hans Petter Bieker <[email protected]> + + 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 <tqcheckbox.h> +#include <tqlabel.h> +#include <tqlayout.h> +#include <tqobjectlist.h> +#include <tqpushbutton.h> +#include <tqtabwidget.h> +#include <tqvgroupbox.h> + +#include <tdeaboutdata.h> +#include <tdeconfig.h> +#include <kdebug.h> +#include <kdialog.h> +#include <tdemessagebox.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" + +TDELocaleApplication::TDELocaleApplication(TQWidget *parent, const char* /*name*/, + const TQStringList &args) + : TDECModule( TDELocaleFactory::instance(), parent, args) +{ + TDEAboutData* aboutData = new TDEAboutData("kcmlocale", + I18N_NOOP("KCMLocale"), + "3.0", + I18N_NOOP("Regional settings"), + TDEAboutData::License_GPL, + "(C) 1998 Matthias Hoelzer, " + "(C) 1999-2003 Hans Petter Bieker", + 0, 0, "[email protected]"); + setAboutData( aboutData ); + + m_nullConfig = new TDEConfig(TQString::null, false, false); + m_globalConfig = new TDEConfig(TQString::null, false, true); + + m_locale = new TDELocale(TQString::fromLatin1("kcmlocale"), m_nullConfig); + TQVBoxLayout *l = new TQVBoxLayout(this, 0, KDialog::spacingHint()); + l->setAutoAdd(TRUE); + + m_tab = new TQTabWidget(this); + + m_localemain = new TDELocaleConfig(m_locale, this); + m_tab->addTab( m_localemain, TQString::null); + m_localenum = new TDELocaleConfigNumber(m_locale, this); + m_tab->addTab( m_localenum, TQString::null ); + m_localemon = new TDELocaleConfigMoney(m_locale, this); + m_tab->addTab( m_localemon, TQString::null ); + m_localetime = new TDELocaleConfigTime(m_locale, this); + m_tab->addTab( m_localetime, TQString::null ); + m_localeother = new TDELocaleConfigOther(m_locale, this); + m_tab->addTab( m_localeother, TQString::null ); + + // Examples + m_gbox = new TQVGroupBox(this); + m_sample = new TDELocaleSample(m_locale, m_gbox); + + // getting signals from childs + connect(m_localemain, TQT_SIGNAL(localeChanged()), + this, TQT_SIGNAL(localeChanged())); + connect(m_localemain, TQT_SIGNAL(languageChanged()), + this, TQT_SIGNAL(languageChanged())); + + // run the slots on the childs + connect(this, TQT_SIGNAL(localeChanged()), + m_localemain, TQT_SLOT(slotLocaleChanged())); + connect(this, TQT_SIGNAL(localeChanged()), + m_localenum, TQT_SLOT(slotLocaleChanged())); + connect(this, TQT_SIGNAL(localeChanged()), + m_localemon, TQT_SLOT(slotLocaleChanged())); + connect(this, TQT_SIGNAL(localeChanged()), + m_localetime, TQT_SLOT(slotLocaleChanged())); + connect(this, TQT_SIGNAL(localeChanged()), + m_localeother, TQT_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, TQT_SIGNAL(localeChanged()), + m_sample, TQT_SLOT(slotLocaleChanged())); + connect(m_localemon, TQT_SIGNAL(localeChanged()), + m_sample, TQT_SLOT(slotLocaleChanged())); + connect(m_localetime, TQT_SIGNAL(localeChanged()), + m_sample, TQT_SLOT(slotLocaleChanged())); + // No examples for this yet + //connect(m_localeother, TQT_SIGNAL(slotLocaleChanged()), + //m_sample, TQT_SLOT(slotLocaleChanged())); + connect(this, TQT_SIGNAL(localeChanged()), + m_sample, TQT_SLOT(slotLocaleChanged())); + + // make sure we always have translated interface + connect(this, TQT_SIGNAL(languageChanged()), + this, TQT_SLOT(slotTranslate())); + connect(this, TQT_SIGNAL(languageChanged()), + m_localemain, TQT_SLOT(slotTranslate())); + connect(this, TQT_SIGNAL(languageChanged()), + m_localenum, TQT_SLOT(slotTranslate())); + connect(this, TQT_SIGNAL(languageChanged()), + m_localemon, TQT_SLOT(slotTranslate())); + connect(this, TQT_SIGNAL(languageChanged()), + m_localetime, TQT_SLOT(slotTranslate())); + connect(this, TQT_SIGNAL(languageChanged()), + m_localeother, TQT_SLOT(slotTranslate())); + + // mark it as changed when we change it. + connect(m_localemain, TQT_SIGNAL(localeChanged()), + TQT_SLOT(slotChanged())); + connect(m_localenum, TQT_SIGNAL(localeChanged()), + TQT_SLOT(slotChanged())); + connect(m_localemon, TQT_SIGNAL(localeChanged()), + TQT_SLOT(slotChanged())); + connect(m_localetime, TQT_SIGNAL(localeChanged()), + TQT_SLOT(slotChanged())); + connect(m_localeother, TQT_SIGNAL(localeChanged()), + TQT_SLOT(slotChanged())); + + load(); +} + +TDELocaleApplication::~TDELocaleApplication() +{ + delete m_locale; + delete m_globalConfig; + delete m_nullConfig; +} + +void TDELocaleApplication::load() +{ + load( false ); +} + +void TDELocaleApplication::load( bool useDefaults ) +{ + m_globalConfig->setReadDefaults( useDefaults ); + m_globalConfig->reparseConfiguration(); + *m_locale = TDELocale(TQString::fromLatin1("kcmlocale"), m_globalConfig); + + emit localeChanged(); + emit languageChanged(); + emit changed(useDefaults); +} + +void TDELocaleApplication::save() +{ + // temperary use of our locale as the global locale + TDELocale *lsave = TDEGlobal::_locale; + TDEGlobal::_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"), + TQString::fromLatin1("LanguageChangesApplyOnlyToNewlyStartedPrograms")); + // restore the old global locale + TDEGlobal::_locale = lsave; + + TDEConfig *config = TDEGlobal::config(); + TDEConfigGroupSaver 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); +} + +TQString TDELocaleApplication::handbookSection() const +{ + int index = m_tab->currentPageIndex(); + if (index == 0) + return "locale-locale"; + else if (index == 1) + return "locale-numbers"; + else if (index == 2) + return "locale-money"; + else if (index == 3) + return "locale-datetime"; + else if (index == 4) + return "locale-other"; + else + return TQString::null; +} + +void TDELocaleApplication::defaults() +{ + load( true ); +} + +TQString TDELocaleApplication::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 TDE \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 TDELocaleApplication::slotTranslate() +{ + // The untranslated string for TQLabel are stored in + // the name() so we use that when retranslating + TQObject *wc; + TQObjectList *list = queryList(TQWIDGET_OBJECT_NAME_STRING); + TQObjectListIt 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(), TQLABEL_OBJECT_NAME_STRING) == 0) + ((TQLabel *)wc)->setText( m_locale->translate( wc->name() ) ); + else if (::qstrcmp(wc->className(), TQGROUPBOX_OBJECT_NAME_STRING) == 0 || + ::qstrcmp(wc->className(), TQVGROUPBOX_OBJECT_NAME_STRING) == 0) + ((TQGroupBox *)wc)->setTitle( m_locale->translate( wc->name() ) ); + else if (::qstrcmp(wc->className(), TQPUSHBUTTON_OBJECT_NAME_STRING) == 0 || + ::qstrcmp(wc->className(), "KMenuButton") == 0) + ((TQPushButton *)wc)->setText( m_locale->translate( wc->name() ) ); + else if (::qstrcmp(wc->className(), TQCHECKBOX_OBJECT_NAME_STRING) == 0) + ((TQCheckBox *)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 TDELocaleApplication::slotChanged() +{ + emit changed(true); +} + diff --git a/kcontrol/locale/toplevel.h b/kcontrol/locale/toplevel.h new file mode 100644 index 000000000..abc1a47f9 --- /dev/null +++ b/kcontrol/locale/toplevel.h @@ -0,0 +1,88 @@ +/* + toplevel.h - A KControl Application + + written 1998 by Matthias Hoelzer + + Copyright 1998 Matthias Hoelzer. + Copyright 1999-2003 Hans Petter Bieker <[email protected]>. + + 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 <tdecmodule.h> +#include <kgenericfactory.h> + +class TQTabWidget; +class TQGroupBox; + +class TDEConfig; +class TDELocale; +class TDELocaleConfig; +class TDELocaleConfigMoney; +class TDELocaleConfigNumber; +class TDELocaleConfigTime; +class TDELocaleConfigOther; +class TDELocaleSample; + +class TDELocaleApplication : public TDECModule +{ + Q_OBJECT + +public: + TDELocaleApplication(TQWidget *parent, const char *name, const TQStringList &); + virtual ~TDELocaleApplication(); + + virtual void load(); + virtual void load(bool useDefault); + virtual void save(); + virtual void defaults(); + virtual TQString quickHelp() const; + virtual TQString handbookSection() const; + +signals: + void languageChanged(); + void localeChanged(); + +public slots: + /** + * Retranslates the current widget. + */ + void slotTranslate(); + void slotChanged(); + +private: + TDELocale *m_locale; + + TQTabWidget *m_tab; + TDELocaleConfig *m_localemain; + TDELocaleConfigNumber *m_localenum; + TDELocaleConfigMoney *m_localemon; + TDELocaleConfigTime *m_localetime; + TDELocaleConfigOther *m_localeother; + + TQGroupBox *m_gbox; + TDELocaleSample *m_sample; + + TDEConfig * m_globalConfig; + TDEConfig * m_nullConfig; +}; + +typedef KGenericFactory<TDELocaleApplication, TQWidget > TDELocaleFactory; + +#endif |