Version: 0.1 (using KDE 3.1.94 (3.2 Beta 2), Gentoo) Compiler: gcc version 3.2.3 20030422 (Gentoo Linux 1.4 3.2.3-r3, propolice) OS: Linux (i686) release 2.4.20-gentoo-r8 In the summary page of Kontact, the three weather stations I have entered are: Augsburg (ESMA) Berlin-Tegel (EDDT) Stockholm/Bromma (ESSB) Currently they are sorted alphabetically by the station code, so the weather information is shown like that: Berlin-Tegel (EDDT) Augsburg (ESMA) Stockholm/Bromma (ESSB) It would be nice to set the sorting to the "real" names instead of the station codes.
Subject: osnabrueck_branch: kdepim/kontact/plugins/weather CVS commit by tokoe: Show weather stations sorted by name. That fixes #70255. CCMAIL:70255-done@bugs.kde.org M +11 -9 summarywidget.cpp 1.14.2.2 M +5 -0 summarywidget.h 1.8.2.1 --- kdepim/kontact/plugins/weather/summarywidget.cpp #1.14.2.1:1.14.2.2 @@ -100,14 +100,16 @@ void SummaryWidget::updateView() } - QMap<QString, WeatherData>::Iterator it; - for ( it = mWeatherMap.begin(); it != mWeatherMap.end(); ++it ) { - WeatherData data = it.data(); + QValueList<WeatherData> dataList = mWeatherMap.values(); + qHeapSort( dataList ); + + QValueList<WeatherData>::Iterator it; + for ( it = dataList.begin(); it != dataList.end(); ++it ) { QString cover; - for ( uint i = 0; i < data.cover().count(); ++i ) - cover += QString( "- %1\n" ).arg( data.cover()[ i ] ); + for ( uint i = 0; i < (*it).cover().count(); ++i ) + cover += QString( "- %1\n" ).arg( (*it).cover()[ i ] ); QImage img; - img = data.icon(); + img = (*it).icon(); QGridLayout *layout = new QGridLayout( mLayout, 3, 3, 3 ); @@ -123,5 +125,5 @@ void SummaryWidget::updateView() label = new QLabel( this ); - label->setText( QString( "%1 (%2)" ).arg( data.name() ).arg( data.temperature() ) ); + label->setText( QString( "%1 (%2)" ).arg( (*it).name() ).arg( (*it).temperature() ) ); QFont font = label->font(); font.setBold( true ); @@ -135,7 +137,7 @@ void SummaryWidget::updateView() "<b>%3:</b> %4" ) .arg( i18n( "Wind Speed" ) ) - .arg( data.windSpeed() ) + .arg( (*it).windSpeed() ) .arg( i18n( "Rel. Humidity" ) ) - .arg( data.relativeHumidity() ); + .arg( (*it).relativeHumidity() ); QToolTip::add( label, labelText.replace( " ", " " ) ); --- kdepim/kontact/plugins/weather/summarywidget.h #1.8:1.8.2.1 @@ -61,4 +61,9 @@ class WeatherData QString relativeHumidity() const { return mRelativeHumidity; } + bool operator< ( const WeatherData &data ) + { + return ( QString::localeAwareCompare( mName, data.mName ) < 0 ); + } + private: QPixmap mIcon;