Version: 1.1 (using KDE 3.4.0 Level "a" , SUSE 9.2.1) Compiler: gcc version 3.3.5 20050117 (prerelease) (SUSE Linux) OS: Linux (x86_64) release 2.6.11-rc4-bk9-27-smp I am using German locale. If I select "Nürnberg, Deutschland" as my location in the configuration wizard, my location is set to the next entry in the list ("Nyborg Fyn, Dänemark"). Entries before the Nürnberg entry work correctly, entries after that one have all the same offset of one, until "Nykoebing Falster", which sets the location to "Nürnberg". Examples: choose: get: Novi, Michigan Novi, Michigan Nürnberg Nyborg Fyn Nyborg Fyn Nykoebing Falster Nykoebing Falster Nürnberg I didn't test all, but similar errors happen with locations that start with other letters (like "Oakfield, Maine" becomes "Oak Park, Illinois". This error seems to be limited to the wizard. I can choose the location directly from the settings menu, and that works as expected.
Please apply the attached patch. The real problem was that the displayed city list and the internal list were out of synch. This problem once existed in the regular Location window, but I applied a similar fix there a while ago (and forgot to apply the fix here in the wizard!). If this works for you too, I'll close the bug and try to get this in for 3.4.0. Thanks for noticing this! Jason Created an attachment (id=9867) kstars.patch
CVS commit by harris: Fixing bug #100371. This was caused by the list of cities displayed in the wizard's list box and the internal list of cities becoming out of sync when the displayed list was sorted. The very same issue was addressed a while ago in the regular Location dialog, but I forgot to do the same thing in the wizard. Thanks for finding the bug, I'm still hoping to get this in for 3.4.0. BUGS: 100371 M +22 -24 kswizard.cpp 1.8 M +3 -0 kswizard.h 1.5 --- kdeedu/kstars/kstars/kswizard.h #1.4:1.5 @@ -22,4 +22,6 @@ #include "kswizardui.h" +class GeoLocation; + /**@class Setup Wizard for KStars *The Setup Wizard will be automatically opened when KStars runs @@ -54,4 +56,5 @@ private: QMemArray<int> GeoID; GeoLocation *Geo; + QPtrList<GeoLocation> filteredCityList; }; --- kdeedu/kstars/kstars/kswizard.cpp #1.7:1.8 @@ -98,4 +98,5 @@ KSWizard::KSWizard( QWidget *parent, con //Initialize Geographic Location page + filteredCityList.setAutoDelete( false ); initGeoPage(); } @@ -112,15 +113,8 @@ void KSWizard::initGeoPage() { int index(0); for (GeoLocation *loc = ksw->data()->geoList.first(); loc; loc = ksw->data()->geoList.next()) { - QString s; - if ( loc->province().isEmpty() ) { - s = loc->translatedName() + ", " + loc->translatedCountry(); - } else { - s = loc->translatedName() + ", " + loc->translatedProvince() + - ", " + loc->translatedCountry(); - } - CityListBox->insertItem( s ); - GeoID[CityListBox->count() - 1] = ksw->data()->geoList.at(); + CityListBox->insertItem( loc->fullName() ); + filteredCityList.append( loc ); - if ( loc->name() == ksw->data()->geo()->name() && loc->country() == ksw->data()->geo()->country() ) + if ( loc->fullName() == ksw->data()->geo()->fullName() ) index = ksw->data()->geoList.at(); } @@ -131,9 +125,18 @@ void KSWizard::initGeoPage() { //preset to current city CityListBox->setCurrentItem( index ); - Geo = ksw->data()->geoList.at( GeoID[ index ] ); } void KSWizard::slotChangeCity() { - Geo = ksw->data()->geoList.at(GeoID[CityListBox->currentItem()]); + Geo = 0L; + + if ( CityListBox->currentItem() >= 0 ) { + for (GeoLocation *loc = filteredCityList.first(); loc; loc = filteredCityList.next()) { + if ( loc->fullName() == CityListBox->currentText() ) { + Geo = loc; + break; + } + } + } + LongBox->showInDegrees( Geo->lng() ); LatBox->showInDegrees( Geo->lat() ); @@ -142,4 +145,6 @@ void KSWizard::slotChangeCity() { void KSWizard::slotFilterCities() { CityListBox->clear(); + filteredCityList.clear(); + for (GeoLocation *loc = ksw->data()->geoList.first(); loc; loc = ksw->data()->geoList.next()) { QString sc( loc->translatedName() ); @@ -152,20 +157,13 @@ void KSWizard::slotFilterCities() { sp.lower().startsWith( ProvinceFilter->text().lower() ) && ss.lower().startsWith( CountryFilter->text().lower() ) ) { - sc.append( ", " ); - if ( !sp.isEmpty() ) { - sc.append( sp ); - sc.append( ", " ); - } - sc.append( ss ); - - CityListBox->insertItem( sc ); - GeoID[CityListBox->count() - 1] = ksw->data()->geoList.at(); + CityListBox->insertItem( loc->fullName() ); + filteredCityList.append( loc ); } } - if ( CityListBox->firstItem() ) { // set first item in list as selected + CityListBox->sort(); + + if ( CityListBox->firstItem() ) // set first item in list as selected CityListBox->setCurrentItem( CityListBox->firstItem() ); - Geo = ksw->data()->geoList.at( GeoID[ CityListBox->currentItem() ] ); - } }