[yast-commit] r43224 - in /trunk/country: VERSION package/yast2-country.changes timezone/data/timezone_raw.ycp timezone/src/Timezone.ycp timezone/src/dialogs.ycp timezone/testsuite/tests/UpdateTimezone.out
Author: jsuchome Date: Fri Dec 21 16:04:24 2007 New Revision: 43224 URL: http://svn.opensuse.org/viewcvs/yast?rev=43224&view=rev Log: - added support for TimezoneSelector widget - updated list of timezones (added new ones, many old ones converted to the format used by zone.tab) - 2.16.5 Modified: trunk/country/VERSION trunk/country/package/yast2-country.changes trunk/country/timezone/data/timezone_raw.ycp trunk/country/timezone/src/Timezone.ycp trunk/country/timezone/src/dialogs.ycp trunk/country/timezone/testsuite/tests/UpdateTimezone.out Modified: trunk/country/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/country/VERSION?rev=43224&r1=43223&r2=43224&view=diff ============================================================================== --- trunk/country/VERSION (original) +++ trunk/country/VERSION Fri Dec 21 16:04:24 2007 @@ -1 +1 @@ -2.16.4 +2.16.5 Modified: trunk/country/package/yast2-country.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/country/package/yast2-country.changes?rev=43224&r1=43223&r2=43224&view=diff ============================================================================== --- trunk/country/package/yast2-country.changes (original) +++ trunk/country/package/yast2-country.changes Fri Dec 21 16:04:24 2007 @@ -1,4 +1,12 @@ ------------------------------------------------------------------- +Fri Dec 21 15:51:25 CET 2007 - jsuchome@suse.cz + +- added support for TimezoneSelector widget +- updated list of timezones (added new ones, many old ones converted + to the format used by zone.tab) +- 2.16.5 + +------------------------------------------------------------------- Fri Dec 7 15:53:26 CET 2007 - jsuchome@suse.cz - Storage is required only during installation -> usage moved to Modified: trunk/country/timezone/data/timezone_raw.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/country/timezone/data/timezone_raw.ycp?rev=43224&r1=43223&r2=43224&view=diff ============================================================================== --- trunk/country/timezone/data/timezone_raw.ycp (original) +++ trunk/country/timezone/data/timezone_raw.ycp Fri Dec 21 16:04:24 2007 @@ -12,7 +12,6 @@ * ***************************************************************** * */ - { textdomain "timezone_db"; @@ -22,9 +21,11 @@ $[ "name" : _("Europe"), "entries" : $[ "Europe/Amsterdam" : _("Netherlands"), + // time zone + "Europe/Andorra" : _("Andorra"), "Europe/Athens" : _("Greece"), - "Europe/Belfast" : _("Northern Ireland"), - "Europe/Belgrade" : _("Yugoslavia"), + // time zone + "Europe/Belgrade" : _("Serbia"), "Europe/Berlin" : _("Germany"), "Europe/Bratislava" : _("Slovakia"), "Europe/Brussels" : _("Belgium"), @@ -52,6 +53,8 @@ "Europe/Moscow" : _("Russia (Moscow)"), "Europe/Oslo" : _("Norway"), "Europe/Paris" : _("France"), + // time zone + "Europe/Podgorica" : _("Montenegro"), "Europe/Prague" : _("Czech Republic"), "Europe/Riga" : _("Latvia"), "Europe/Rome" : _("Italy"), @@ -71,75 +74,150 @@ "Europe/Vilnius" : _("Lithuania"), "Europe/Warsaw" : _("Poland"), "Europe/Zagreb" : _("Croatia"), - "Iceland" : _("Iceland"), + // time zone + "Atlantic/Reykjavik" : _("Iceland"), "Atlantic/Azores" : _("Azores"), // time zone "Atlantic/Canary" : _("Canary Islands"), - "Europe/Zurich" : _("Switzerland") ] ], + "Europe/Zurich" : _("Switzerland"), + // time zone + "America/Godthab" : _("Greenland--Nuuk"), + ] +], $[ "name" : _("USA"), "entries" : $[ - "US/Alaska" : _("Alaska"), - "US/Aleutian" : _("Aleutian"), - "US/Arizona" : _("Arizona"), - "US/Central" : _("Central"), - "US/East-Indiana" : _("East Indiana"), - "US/Hawaii" : _("Hawaii"), - "US/Indiana-Starke" : _("Indiana Starke"), - "US/Michigan" : _("Michigan"), - "US/Mountain" : _("Mountain"), - "US/Pacific" : _("Pacific"), - "US/Samoa" : _("Samoa"), - "US/Eastern" : _("Eastern") ] ], + // time zone + "America/Anchorage" : _("Alaska"), + // time zone + "America/Adak" : _("Aleutian"), + // time zone + "America/Phoenix" : _("Arizona"), + // time zone + "America/Chicago" : _("Central"), + // time zone + "America/Indiana/Indianapolis" : _("East Indiana"), + // time zone + "Pacific/Honolulu" : _("Hawaii"), + // time zone + "America/Indiana/Knox" : _("Indiana Starke"), + // time zone + "America/Detroit" : _("Michigan"), + // time zone + "America/Denver" : _("Mountain"), + // time zone + "America/Los_Angeles" : _("Pacific"), + // time zone + "Pacific/Pago_Pago" : _("Samoa"), + // time zone + "America/New_York" : _("Eastern"), + // time zone + "America/St_Thomas" : _("Virgin Islands"), + // time zone + "America/Puerto_Rico" : _("Puerto Rico"), + ] +], -$[ "name" : _("Canada"), - "entries" : $[ - "Canada/Atlantic" : _("Atlantic"), - "Canada/Central" : _("Central"), - "Canada/Eastern" : _("Eastern"), - "Canada/Mountain" : _("Mountain"), - "Canada/Newfoundland" : _("Newfoundland"), - "Canada/Pacific" : _("Pacific"), - "Canada/Saskatchewan" : _("Saskatchewan"), - "Canada/East-Saskatchewan" : _("East Saskatchewan"), - "Canada/Yukon" : _("Yukon") ] ], +$[ + // time zone region + "name" : _("Canada"), + "entries" : $[ + // time zone + "America/Halifax" : _("Atlantic"), + // time zone + "America/Winnipeg" : _("Central"), + // time zone + "America/Toronto" : _("Eastern"), + // time zone + "America/Edmonton" : _("Mountain"), + // time zone + "America/St_Johns" : _("Newfoundland"), + // time zone + "America/Vancouver" : _("Pacific"), + // time zone + "America/Regina" : _("Saskatchewan"), + // time zone + "America/Whitehorse" : _("Yukon") + ] +], -$[ "name" : _("Central and South America"), - "entries" : $[ + +$[ + // time zone region + "name" : _("Central and South America"), + "entries" : $[ + // time zone + "America/Havana" : _("Havana"), + // time zone + "Pacific/Galapagos" : _("Galapagos"), + // time zone + "America/Guayaquil" : _("Guayaquil"), + // time zone + "America/Rio_Branco" : _("Brazil Acre"), + // time zone + "America/Sao_Paulo" : _("Brazil East"), + // time zone + "America/Manaus" : _("Brazil West"), + // time zone + "America/Noronha" : _("Brazil de Noronha"), + // time zone + "America/Santiago" : _("Chile Continental"), + // time zone + "Pacific/Easter" : _("Chile Easter Island"), + // time zone + "America/Jamaica" : _("Jamaica"), + // time zone + "Atlantic/Bermuda" : _("Bermuda"), + // time zone + "America/Tijuana" : _("Mexico Baja Norte"), + // time zone + "America/Mazatlan" : _("Mexico Baja Sur"), + // time zone + "America/Mexico_City" : _("Mexico General--Mexico City"), // time zone - "Brazil/Acre" : _("Brazil Acre"), - "Brazil/East" : _("Brazil East"), - "Brazil/West" : _("Brazil West"), - "Chile/Continental" : _("Chile Continental"), - "Chile/EasterIsland" : _("Chile EasterIsland"), - "Jamaica" : _("Jamaica"), - "Atlantic/Bermuda" : _("Bermuda"), - "Mexico/BajaNorte" : _("Mexico BajaNorte"), - "Mexico/BajaSur" : _("Mexico BajaSur"), "America/Asuncion" : _("Asuncion"), + // time zone "America/Barbados" : _("Barbados"), + // time zone "America/Bogota" : _("Bogota"), - "America/Buenos_Aires" : _("Buenos Aires"), + // time zone + "America/Argentina/Buenos_Aires" : _("Buenos Aires"), // time zone "America/Cayenne" : _("Cayenne"), + // time zone "America/Caracas" : _("Caracas"), + // time zone "America/Costa_Rica" : _("Costa Rica"), + // time zone "America/Dominica" : _("Dominica"), + // time zone "America/El_Salvador" : _("El Salvador"), + // time zone "America/Grenada" : _("Grenada"), + // time zone "America/Guadeloupe" : _("Guadeloupe"), + // time zone "America/Guatemala" : _("Guatemala"), // time zone "America/Guyana" : _("Guyana"), + // time zone "America/Lima" : _("Lima"), + // time zone "America/Managua" : _("Managua"), + // time zone "America/Martinique" : _("Martinique"), + // time zone "America/Panama" : _("Panama"), + // time zone "America/Puerto_Rico" : _("Puerto Rico"), + // time zone "America/Montevideo" : _("Uruguay"), // time zone - "America/Virgin" : _("Virgin Islands"), - "Mexico/General" : _("Mexico General") ] ], + "America/St_Thomas" : _("Virgin Islands"), + // time zone + "Atlantic/Stanley" : _("Stanley"), + ] +], $[ // name of region @@ -176,18 +254,14 @@ ] ], -$[ "name" : _("Asia"), - "entries" : $[ - // time zone - "Japan" : _("Japan"), - // time zone - "PRC" : _("China"), +$[ + // name of region + "name" : _("Asia"), + "entries" : $[ // time zone - "ROK" : _("Korea"), + "Asia/Almaty" : _("Almaty"), // time zone - "Hongkong" : _("Hongkong"), - // time zone - "Asia/Kabul" : _("Afghanistan"), + "Asia/Ashgabat" : _("Ashgabat"), // time zone "Asia/Anadyr" : _("Anadyr"), // time zone @@ -195,6 +269,8 @@ // time zone "Asia/Bahrain" : _("Bahrain"), // time zone + "Asia/Baku" : _("Baku"), + // time zone "Asia/Bangkok" : _("Bangkok"), // time zone "Asia/Beirut" : _("Beirut"), @@ -215,10 +291,18 @@ // time zone "Asia/Gaza" : _("Gaza"), // time zone + "Asia/Hong_Kong" : _("Hongkong"), + // time zone "Asia/Irkutsk" : _("Irkutsk"), // time zone "Asia/Jakarta" : _("Jakarta"), // time zone + "Asia/Jerusalem" : _("Israel"), + // time zone + "Asia/Kabul" : _("Afghanistan"), + // time zone + "Asia/Karachi" : _("Karachi"), + // time zone "Asia/Kamchatka" : _("Kamchatka"), // time zone "Asia/Katmandu" : _("Katmandu"), @@ -229,18 +313,22 @@ // time zone "Asia/Kuwait" : _("Kuwait"), // time zone - "Asia/Macao" : _("Macao"), + "Asia/Macau" : _("Macao"), // time zone "Asia/Magadan" : _("Magadan"), // time zone "Asia/Manila" : _("Manila"), // time zone + "Asia/Nicosia" : _("Nicosia"), + // time zone "Asia/Novosibirsk" : _("Novosibirsk"), // time zone "Asia/Omsk" : _("Omsk"), // time zone "Asia/Phnom_Penh" : _("Phnom Penh"), // time zone + "Asia/Pyongyang" : _("Pyongyang"), + // time zone "Asia/Qatar" : _("Qatar"), // time zone "Asia/Rangoon" : _("Myanmar"), @@ -255,8 +343,6 @@ // time zone "Asia/Tehran" : _("Tehran"), // time zone - "Asia/Tel_Aviv" : _("Tel Aviv"), - // time zone "Asia/Thimphu" : _("Thimphu"), // time zone "Asia/Vladivostok" : _("Vladivostok"), @@ -267,11 +353,13 @@ // time zone "Asia/Shanghai" : _("Shanghai"), // time zone + "Asia/Beijing" : _("Beijing"), + // time zone "Asia/Taipei" : _("Taipei"), // time zone "Asia/Seoul" : _("Seoul"), // time zone - "Israel" : _("Israel"), + "Asia/Riyadh" : _("Riyadh"), // time zone "Mideast/Riyadh87" : _("Mideast Riyadh87"), // time zone @@ -281,25 +369,53 @@ // time zone "Asia/Singapore" : _("Singapore"), // time zone + "Asia/Tbilisi" : _("Tbilisi"), + // time zone + "Asia/Tokyo" : _("Japan"), + // time zone + "Asia/Ulaanbaatar" : _("Ulan Bator"), + // time zone + "Asia/Vientiane" : _("Vientiane"), + // time zone "Asia/Yakutsk" : _("Yakutsk"), + // time zone + "Asia/Yerevan" : _("Yerevan"), ] ], $[ "name" : _("Australia"), "entries" : $[ - "Australia/North" : _("Northern Territory--Darwin"), - "Australia/Queensland" : _("Queensland--Brisbane"), - "Australia/South" : _("South Australia--Adelaide"), - "Australia/NSW" : _("New South Wales--Sydney"), - "Australia/ACT" : _("Australian Capital Territory--Canberra"), - "Australia/Tasmania" : _("Tasmania--Hobart"), - "Australia/Victoria" : _("Victoria--Melbourne"), - "Australia/West" : _("Western Australia--Perth"), + // time zone + "Australia/Lord_Howe" : _("Lord Howe Island"), + // time zone + "Australia/Darwin" : _("Northern Territory--Darwin"), + // time zone + "Australia/Brisbane" : _("Queensland--Brisbane"), + // time zone + "Australia/Adelaide" : _("South Australia--Adelaide"), + // time zone + "Australia/Sydney" : _("New South Wales--Sydney"), + // time zone + "Australia/Broken_Hill" : _("New South Wales--Broken Hill"), + // time zone +// "Australia/Canberra" : _("Australian Capital Territory--Canberra"), + // time zone + "Australia/Hobart" : _("Tasmania--Hobart"), + // time zone + "Australia/Currie" : _("Tasmania--Currie"), + // time zone + "Australia/Melbourne" : _("Victoria--Melbourne"), + // time zone + "Australia/Perth" : _("Western Australia--Perth"), ] ], $[ "name" : _("Africa"), "entries" : $[ + // time zone + "Indian/Antananarivo" : _("Antananarivo"), + // time zone + "Africa/Addis_Ababa" : _("Addis Ababa"), "Africa/Algiers" : _("Algiers"), "Africa/Brazzaville" : _("Brazzaville"), "Africa/Casablanca" : _("Casablanca"), @@ -309,21 +425,35 @@ "Africa/Djibouti" : _("Djibouti"), "Africa/Freetown" : _("Freetown"), "Africa/Johannesburg" : _("Johannesburg"), + // time zone + "Africa/Kampala" : _("Kampala"), + // time zone + "Africa/Khartoum" : _("Khartoum"), + // time zone + "Africa/Kinshasa" : _("Kinshasa"), + // time zone + "Africa/Kigali" : _("Kigali"), + // time zone + "Africa/Lusaka" : _("Lusaka"), "Africa/Libreville" : _("Libreville"), + // time zone + "Africa/Maputo" : _("Maputo"), + // time zone + "Africa/Mogadishu" : _("Mogadishu"), "Africa/Monrovia" : _("Monrovia"), "Africa/Nairobi" : _("Nairobi"), - "Africa/Timbuktu" : _("Timbuktu"), + // time zone + "Africa/Bamako" : _("Bamako"), "Africa/Tunis" : _("Tunis"), "Africa/Windhoek" : _("Windhoek"), "Africa/Cairo" : _("Cairo"), - "Egypt" : _("Egypt"), - "Africa/Tripoli" : _("Tripoli") ] ], + "Africa/Tripoli" : _("Tripoli") ] +], $[ "name" : _("Pacific"), "entries" : $[ "Pacific/Auckland" : _("New Zealand"), "Pacific/Fiji" : _("Fiji"), - "Pacific/Galapagos" : _("Galapagos"), "Pacific/Guadalcanal" : _("Guadalcanal"), "Pacific/Guam" : _("Guam"), "Pacific/Midway" : _("Midway"), @@ -331,12 +461,22 @@ "Pacific/Palau" : _("Palau"), "Pacific/Pitcairn" : _("Pitcairn"), "Pacific/Tahiti" : _("Tahiti"), - "Pacific/Samoa" : _("Samoa") ] ], + "Pacific/Pago_Pago" : _("Samoa"), + // time zone + "Pacific/Port_Moresby" : _("Port_Moresby"), + // time zone + "Pacific/Dili" : _("Dili"), + ] +], $[ "name" : _("Global"), "entries" : $[ + // time zone "Antarctica/South_Pole" : _("South Pole"), - "Arctic/Longyearbyen" : _("Arctic Longyearbyen"), + // time zone + "Arctic/Longyearbyen" : _("Arctic Longyearbyen"), + // time zone + "America/Godthab" : _("Greenland--Nuuk"), "CET" : _("CET"), "CST6CDT" : _("CST6CDT"), "EET" : _("EET"), Modified: trunk/country/timezone/src/Timezone.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/country/timezone/src/Timezone.ycp?rev=43224&r1=43223&r2=43224&view=diff ============================================================================== --- trunk/country/timezone/src/Timezone.ycp (original) +++ trunk/country/timezone/src/Timezone.ycp Fri Dec 21 16:04:24 2007 @@ -56,9 +56,73 @@ */ global boolean windows_partition = false; -// internal map used to store initial data -map push = $[]; +// translation of correct timezone to the one that could be shown in map widget +global map <string,string> yast2zonetab = $[ + "Mideast/Riyadh87" : "Asia/Riyadh", + "Mideast/Riyadh88" : "Asia/Riyadh", + "Mideast/Riyadh89" : "Asia/Riyadh", +]; + +// on init, translate these to correct ones +global map<string,string> obsoleted_zones = $[ + "Iceland" : "Atlantic/Reykjavik", + "Europe/Belfast" : "Europe/London", + + "Australia/South" : "Australia/Adelaide", + "Australia/North" : "Australia/Darwin", + "Australia/NSW" : "Australia/Sydney", + "Australia/ACT" : "Australia/Canberra", + "Australia/Queensland" : "Australia/Brisbane", + "Australia/Tasmania" : "Australia/Hobart", + "Australia/Victoria" : "Australia/Melbourne", + "Australia/West" : "Australia/Perth", + + "US/Alaska" : "America/Anchorage", + "US/Aleutian" : "America/Adak", + "US/Arizona" : "America/Phoenix", + "US/Central" : "America/Chicago", + "US/East-Indiana" : "America/Indiana/Indianapolis", + "US/Hawaii" : "Pacific/Honolulu", + "US/Indiana-Starke" : "America/Indiana/Knox", + "US/Michigan" : "America/Detroit", + "US/Mountain" : "America/Denver", + "US/Pacific" : "America/Los_Angeles", + "US/Samoa" : "Pacific/Pago_Pago", + "US/Eastern" : "America/New_York", + + "Canada/Atlantic" : "America/Halifax", + "Canada/Central" : "America/Winnipeg", + "Canada/Eastern" : "America/Toronto", + "Canada/Saskatchewan" : "America/Regina", + "Canada/East-Saskatchewan" : "America/Regina", + "Canada/Mountain" : "America/Edmonton", + "Canada/Newfoundland" : "America/St_Johns", + "Canada/Pacific" : "America/Vancouver", + "Canada/Yukon" : "America/Whitehorse", + + "America/Buenos_Aires" : "America/Argentina/Buenos_Aires", + "America/Virgin" : "America/St_Thomas", + "Brazil/Acre" : "America/Rio_Branco", + "Brazil/East" : "America/Sao_Paulo", + "Brazil/West" : "America/Manaus", + "Chile/Continental" : "America/Santiago", + "Chile/EasterIsland" : "Pacific/Easter", + "Mexico/BajaNorte" : "America/Tijuana", + "Mexico/BajaSur" : "America/Mazatlan", + "Mexico/General" : "America/Mexico_City", + "Jamaica" : "America/Jamaica", + + "Asia/Macao" : "Asia/Macau", + "Israel" : "Asia/Jerusalem", + "Asia/Tel_Aviv" : "Asia/Jerusalem", + "Hongkong" : "Asia/Hong_Kong", + "Japan" : "Asia/Tokyo", + "ROK" : "Asia/Seoul", + + "Africa/Timbuktu" : "Africa/Bamako", + "Egypt" : "Africa/Cairo", +]; // ------------------------------------------------------------------ // END: Globally defined data to be accessed via Timezone::<variable> // ------------------------------------------------------------------ @@ -69,6 +133,10 @@ // START: Locally defined data // ------------------------------------------------------------------ +// internal map used to store initial data +map push = $[]; + + string name = ""; list < map < string, any> > zonemap = []; @@ -163,8 +231,9 @@ // if (!Mode::config () && really ) { + boolean inst = Stage::initial () || Stage::cont() || Stage::firstboot(); boolean textmode = Language::GetTextMode (); - if ((Stage::initial () || Stage::cont ()) && !textmode) + if (inst && !textmode) SCR::Execute ( .target.bash, "/usr/bin/xset -dpms"); string cmd = "/usr/sbin/zic -l " + timezone; y2milestone( "Set cmd %1", cmd ); @@ -175,7 +244,7 @@ y2milestone( "Set cmd %1", cmd ); y2milestone( "Set ret %1", SCR::Execute(.target.bash_output, cmd )); } - if ((Stage::initial () || Stage::cont ()) && !textmode) + if (inst && !textmode) SCR::Execute ( .target.bash, "/usr/bin/xset +dpms"); } @@ -200,21 +269,9 @@ string updated_tmz = tmz; - map tmz_duplicates = $[ - "Australia/Adelaide" : "Australia/South", - "Australia/Darwin" : "Australia/North", - "Australia/Sydney" : "Australia/NSW", - "Australia/Canberra" : "Australia/ACT", - "Australia/Brisbane" : "Australia/Queensland", - "Australia/Hobart" : "Australia/Tasmania", - "Australia/Perth" : "Australia/West", - // etc. - "America/Los_Angeles" : "US/Pacific", - ]; - - if (haskey (tmz_duplicates, tmz)) + if (haskey (obsoleted_zones, tmz)) { - updated_tmz = tmz_duplicates[tmz]:tmz; + updated_tmz = obsoleted_zones[tmz]:tmz; y2milestone ("updating timezone from %1 to %2", tmz, updated_tmz); // TODO if still not present, search file in /usr/share/zoneinfo } Modified: trunk/country/timezone/src/dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/country/timezone/src/dialogs.ycp?rev=43224&r1=43223&r2=43224&view=diff ============================================================================== --- trunk/country/timezone/src/dialogs.ycp (original) +++ trunk/country/timezone/src/dialogs.ycp Fri Dec 21 16:04:24 2007 @@ -9,7 +9,7 @@ * Jiri Suchomel <jsuchome@suse.cz> * * Summary: - * Dialogs for timezone and time configuration. + * Dialogs for timeone and time configuration. * * $Id$ */ @@ -17,6 +17,7 @@ textdomain "country"; import "Arch"; + import "Directory"; import "Label"; import "Language"; import "Mode"; @@ -391,40 +392,80 @@ boolean textmode = Language::GetTextMode (); - boolean ntp = false; - term ntp_term = `Frame (_("NTP Synchronization"), `VBox (`HBox ( - `HSpacing (0.5), - `Label (`id(`ntp), _("NTP is not configured")), - // button label - `Right (`PushButton (`id (`ntp_configure), _("Change..."))), - `HSpacing (1) - ), `VSpacing (0.2))); - term contents = `MarginBox ( - `leftMargin (2), `rightMargin (2), `topMargin (0), `bottomMargin (0.2), - `VBox ( + term timezoneterm = `HBox ( + region, + `HSpacing (), + timezonesel + ); + boolean timezone_selector = false; + + list<map> zonemap = Timezone::get_zonemap (); + + // map of zones conversions + map<string,string> yast2zonetab = Timezone::yast2zonetab; + + // map of timezone -> translated label to be passed to TimezoneSelector + map zones = $[]; + + // cache the zonemap with the order sorted according to current locale + list sorted_zonemap = maplist (map region, zonemap, { + list trl = maplist ( + string key, string name, (map<string,string>)region["entries"]:$[], + { + zones[yast2zonetab[key]:key] = name; + return [ name, key ]; + }); + trl = sort (list a, list b, (list<list>) trl, { + list lsorted = lsort ([a[0]:"", b[0]:""]); + return (lsorted[0]:"" == a[0]:"" && a[0]:"" != b[0]:""); + }); + return $[ + "name" : region["name"]:"", + "entries" : trl, + ]; + }); + + if (UI::HasSpecialWidget(`TimezoneSelector)) + { + timezone_selector = true; + string worldmap = Directory::themedir + "/current/worldmap/GLOBALeb10colshade.jpg"; + timezoneterm = `VBox ( + `TimezoneSelector (`id(`timezonemap), `opt(`notify), worldmap, + zones), `HBox ( - region, + `HWeight (1, + `ComboBox (`id(`region), `opt(`notify), + // label text + _("&Region"),Timezone::Region()) + ), `HSpacing (), - timezonesel - ), + `HWeight (1, `ReplacePoint (`id(`tzsel), + // title for combo box 'timezone' + `ComboBox (`id (`timezone), `opt(`notify), _("Time &Zone")) + )) + ) + ); + } + term hwclock_term = `VBox ( + `ComboBox (`id (`hwclock), `opt(`hstretch, `notify), + // combo box label + _("&Hardware Clock Set To"), [ + // ComboBox entry: clock set to local time + `item (`id (`hwclock_localtime), _("Local Time"), + (hwclock == "--localtime")), + // ComboBox entry: clock set UTC + `item (`id(`hwclock_utc ), _("UTC"), (hwclock == "-u")), + ]), + textmode ? `Label ("") : `Empty () + ); + term contents = `MarginBox ( + `leftMargin (2), `rightMargin (2), `topMargin (0), `bottomMargin (0.2), + `VBox ( + timezoneterm, `VSpacing (0.2), `VSquash (`HBox ( `HWeight (1, - utc_only ? `Empty () : `VBox ( - `ComboBox ( - `id (`hwclock), `opt(`hstretch, `notify), - // combo box label - _("&Hardware Clock Set To"), - [ - // ComboBox entry: clock set to local time - `item (`id (`hwclock_localtime), _("Local Time"), - (hwclock == "--localtime")), - - // ComboBox entry: clock set UTC - `item (`id(`hwclock_utc ), _("UTC"), - (hwclock == "-u")) - ] - ), textmode ? `Label ("") : `Empty ()) + utc_only ? `Empty () : hwclock_term ), `HSpacing (1), // frame label @@ -445,6 +486,59 @@ )) ) ); + // cache for lists with timezone items + map timezones_for_region = $[]; + list get_timezones_for_region (integer region, string zone) { + + return maplist (list entry, sorted_zonemap[region,"entries"]:[], + { + return `item (`id(entry[1]:""), entry[0]:"", entry[1]:"" == zone); + }); + } + // region was seleced: show the correct list of timezones + void show_selected_region (integer sel, string zone) { + + if (timezone_selector) + UI::ChangeWidget (`id(`region), `Value, sel); + else + UI::ChangeWidget (`id(`region), `CurrentItem, sel); + + UI::ReplaceWidget (`id(`tzsel), timezone_selector ? + `ComboBox (`id(`timezone), `opt(`notify), + // label text + _("Time &Zone"), get_timezones_for_region (sel, zone) + ) : + `SelectionBox ( `id(`timezone), `opt(`notify), + // label text + _("Time &Zone"), get_timezones_for_region (sel, zone) + ) + ); + } + // which region is selected? + integer selected_region () { + return timezone_selector ? + (integer)UI::QueryWidget (`id(`region), `Value) : + (integer)UI::QueryWidget (`id(`region), `CurrentItem); + } + // which timezone is selected? + string selected_timezone () { + return timezone_selector ? + (string) UI::QueryWidget(`id(`timezone), `Value) : + (string) UI::QueryWidget(`id(`timezone), `CurrentItem); + } + + // for given timezone (selected in map), find out to which region it belongs + integer get_region_for_timezone (string zone) { + integer reg = 0; + foreach (map region, zonemap, { + if (haskey (region["entries"]:$[], zone)) + { + break; + } + reg = reg + 1; + }); + return reg; + } // help for timezone screen string help_text = _(" @@ -494,13 +588,12 @@ symbol hwclock_s_old = hwclock_s; hwclock_s_initial = hwclock_s; - UI::ChangeWidget (`id(`region), `CurrentItem, sel); - UI::ReplaceWidget (`id(`tzsel), - `SelectionBox ( `id(`timezone), `opt(`notify), - // label text - _("Time &Zone"), Timezone::Selection (sel)) - ); - UI::ChangeWidget (`id(`timezone), `CurrentItem, Timezone::timezone); + show_selected_region (sel, timezone); + if (timezone_selector) + { + UI::ChangeWidget (`id(`timezonemap), `CurrentItem, + yast2zonetab[timezone]:timezone); + } UI::SetFocus (`id(`region)); @@ -518,17 +611,9 @@ } if (ret == `region) { - integer num = (integer)UI::QueryWidget( `id(`region), `CurrentItem); - y2milestone ("selected region %1", num); - UI::ReplaceWidget (`id(`tzsel), - `SelectionBox ( `id(`timezone), `opt(`notify), - // label text - _("Time &Zone"), Timezone::Selection (num)) - ); - if (num == sel) - { - UI::ChangeWidget (`id(`timezone), `CurrentItem, timezone); - } + integer num = selected_region (); + show_selected_region (num, timezone); +// FIXME zoom the map (select something in the center of region) } else if (ret == `settime) { @@ -540,7 +625,8 @@ changed_time = true; } } - else if (ret == `next || ret == `timezone || ret == `hwclock) + else if (ret == `next || ret == `timezone || ret == `timezonemap || + ret == `hwclock) { // Get current settings. // UTC vs. localtime, only if needed @@ -550,13 +636,29 @@ { hwclock_s = (symbol)UI::QueryWidget( `id(`hwclock), `Value ); } + if (ret == `timezonemap) + { + timezone = (string) UI::QueryWidget(`id(`timezonemap),`Value); + + integer reg = get_region_for_timezone (timezone); + if (reg == sel) + UI::ChangeWidget (`id(`timezone), `Value, timezone); + else + { + sel = reg; + show_selected_region (sel, timezone); + } + } + else + timezone = selected_timezone (); if (ret == `timezone) { - sel = (integer)UI::QueryWidget( `id(`region), `CurrentItem ); + sel = selected_region (); + if (timezone_selector) + UI::ChangeWidget (`id(`timezonemap), `Value, + yast2zonetab[timezone]:timezone); } - timezone = (string)UI::QueryWidget( `id(`timezone ), `CurrentItem ); - if (timezone == nil || size(timezone) == 0) { // popup text Modified: trunk/country/timezone/testsuite/tests/UpdateTimezone.out URL: http://svn.opensuse.org/viewcvs/yast/trunk/country/timezone/testsuite/tests/UpdateTimezone.out?rev=43224&r1=43223&r2=43224&view=diff ============================================================================== --- trunk/country/timezone/testsuite/tests/UpdateTimezone.out (original) +++ trunk/country/timezone/testsuite/tests/UpdateTimezone.out Fri Dec 21 16:04:24 2007 @@ -1,3 +1,3 @@ -Return US/Pacific -Return Australia/South -Return Australia/South +Return America/Los_Angeles +Return Australia/Adelaide +Return Australia/Adelaide -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
jsuchome@svn.opensuse.org