[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdetoys/kweather
From: Ian Reinhart Geiser <geiseri () kde ! org>
Date: 2004-12-20 0:08:55
Message-ID: 20041220000855.2FBA61BAD4 () office ! kde ! org
[Download RAW message or body]
CVS commit by geiseri:
Finished nadeem and i's effor to confuse users less.
ccmail: 73093-done@bugs.kde.org
M +8 -4 kcmweather.cpp 1.10
M +13 -0 stationdatabase.cpp 1.8
M +2 -0 stationdatabase.h 1.5
M +10 -0 weatherservice.cpp 1.40
M +2 -0 weatherservice.h 1.30
--- kdetoys/kweather/kcmweather.cpp #1.9:1.10
@@ -62,5 +62,5 @@ KCMWeather::KCMWeather( QWidget *parent,
fillStationList();
-
+ load();
connect( mWidget->m_enableLog, SIGNAL( toggled( bool ) ),
SLOT( enableLogWidgets( bool ) ) );
@@ -118,4 +118,6 @@ void KCMWeather::enableLogWidgets( bool
void KCMWeather::reportLocationChanged()
{
+ kdDebug() << "New station: " << mWidget->m_reportLocation->currentText()
+ << " Code: " << mWeatherService->stationCode( \
mWidget->m_reportLocation->currentText() ) << endl; emit changed( true );
}
@@ -123,4 +125,5 @@ void KCMWeather::reportLocationChanged()
void KCMWeather::load()
{
+ kdDebug() << "Load" << endl;
KConfig config( "weather_panelappletrc" );
@@ -131,8 +134,7 @@ void KCMWeather::load()
QString loc = config.readEntry( "report_location" );
- loc = mWeatherService->stationName( loc );
mWidget->m_logFile->setURL( config.readPathEntry( "log_file_name" ) );
- mWidget->m_reportLocation->setCurrentText( loc );
+ mWidget->m_reportLocation->setCurrentText( mWeatherService->stationName( loc ) );
mWidget->m_viewMode->setButton( config.readNumEntry( "smallview_mode", \
dockwidget::ShowAll ) ); changeViewMode( config.readNumEntry( "smallview_mode", \
dockwidget::ShowAll ) ); @@ -142,4 +144,5 @@ void KCMWeather::load()
void KCMWeather::save()
{
+ kdDebug() << "Save" << endl;
KConfig config( "weather_panelappletrc" );
@@ -147,5 +150,6 @@ void KCMWeather::save()
config.writeEntry( "logging", mWidget->m_enableLog->isChecked() );
config.writeEntry( "log_file_name", mWidget->m_logFile->url() );
- config.writeEntry( "report_location", mWidget->m_reportLocation->currentText() );
+ // Station idx to local idx
+ config.writeEntry( "report_location", mWeatherService->stationCode( \
mWidget->m_reportLocation->currentText() ) ); config.writeEntry( "smallview_mode", \
mViewMode ); config.sync();
--- kdetoys/kweather/stationdatabase.cpp #1.7:1.8
@@ -15,4 +15,5 @@
#include <qstringlist.h>
#include <qfile.h>
+#include <kdebug.h>
class StationInfo
@@ -155,2 +156,14 @@ QString StationDatabase::stationCountryF
return result;
}
+
+QString StationDatabase::stationIDfromName( const QString &name )
+{
+ QMap<QString,StationInfo>::Iterator itr = theDB.begin();
+ for( ; itr != theDB.end(); ++itr)
+ {
+ kdDebug() << "Checking " << itr.data().cityName << endl;
+ if( itr.data().cityName == name )
+ return itr.key();
+ }
+ return "0000";
+}
\ No newline at end of file
--- kdetoys/kweather/stationdatabase.h #1.4:1.5
@@ -42,4 +42,6 @@ public:
QString stationCountryFromID( const QString &stationID);
+ QString stationIDfromName( const QString &name );
+
private:
QMap<QString, StationInfo> theDB;
--- kdetoys/kweather/weatherservice.cpp #1.39:1.40
@@ -229,4 +229,14 @@ QString WeatherService::stationName(cons
return stationID;
}
+QString WeatherService::stationCode( const QString &stationName )
+{
+ if ( stationDB )
+ {
+ return stationDB->stationIDfromName(stationName);
+ }
+ else
+ return stationName;
+}
+
QString WeatherService::stationCountry(const QString &stationID)
{
--- kdetoys/kweather/weatherservice.h #1.29:1.30
@@ -88,4 +88,6 @@ class WeatherService : public QObject, p
void addStation(const QString &stationID);
QStringList listStations();
+ QString stationCode( const QString &stationName );
+
void exit();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic