Summary: | weather information should be sorted by real name instead of station code | ||
---|---|---|---|
Product: | [Applications] kontact | Reporter: | Christian Banik <mynews> |
Component: | summary | Assignee: | kdepim bugs <kdepim-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | ||
Priority: | NOR | ||
Version: | 0.1 | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: |
Description
Christian Banik
2003-12-12 22:23:33 UTC
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; |