author | drw <drw> | 2002-11-22 01:48:26 (UTC) |
---|---|---|
committer | drw <drw> | 2002-11-22 01:48:26 (UTC) |
commit | 772c1321e4e95a415b9de700c3474f81f98b5482 (patch) (side-by-side diff) | |
tree | e220beb65ea90ae7aee52c0ac83ecbc69bd8191a | |
parent | 87240f18c4e7b12c56d7f61a3431221d94f59f4c (diff) | |
download | opie-772c1321e4e95a415b9de700c3474f81f98b5482.zip opie-772c1321e4e95a415b9de700c3474f81f98b5482.tar.gz opie-772c1321e4e95a415b9de700c3474f81f98b5482.tar.bz2 |
Make sure update frequency is initialized 1st time in (thanks to Simon)
-rw-r--r-- | noncore/todayplugins/weather/weatherpluginwidget.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/todayplugins/weather/weatherpluginwidget.cpp b/noncore/todayplugins/weather/weatherpluginwidget.cpp index 6444ebf..f4ea0f2 100644 --- a/noncore/todayplugins/weather/weatherpluginwidget.cpp +++ b/noncore/todayplugins/weather/weatherpluginwidget.cpp @@ -50,72 +50,72 @@ WeatherPluginWidget::WeatherPluginWidget( QWidget *parent, const char* name ) weatherIcon = new QLabel( this ); weatherIcon->setMaximumWidth( 32 ); QImage logo1 = Resource::loadImage( "todayweatherplugin/wait" ); QPixmap pic; pic.convertFromImage( logo1 ); weatherIcon->setPixmap( pic ); weatherLabel = new QLabel( tr( "Retreiving current weather information." ), this ); weatherLabel->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ) ); startTimer(1000); } WeatherPluginWidget::~WeatherPluginWidget() { QFile file( localFile ); if ( file.exists() ) { file.remove(); } } void WeatherPluginWidget::timerEvent( QTimerEvent *e ) { killTimer( e->timerId() ); retreiveData(); } void WeatherPluginWidget::retreiveData() { - startTimer( frequency * 60000 ); - Config config( "todayweatherplugin"); config.setGroup( "Config" ); location = config.readEntry( "Location", "" ); useMetric = config.readBoolEntry( "Metric", TRUE ); frequency = config.readNumEntry( "Frequency", 5 ); + + startTimer( frequency * 60000 ); localFile = "/tmp/"; localFile.append( location ); localFile.append( ".TXT" ); remoteFile = "http://weather.noaa.gov/pub/data/observations/metar/stations/"; remoteFile.append( location ); remoteFile.append( ".TXT" ); QFile file( localFile ); if ( file.exists() ) { file.remove(); } OProcess *proc = new OProcess; *proc << "wget" << "-q" << remoteFile << "-O" << localFile; connect( proc, SIGNAL( processExited( OProcess * ) ), this, SLOT( dataRetrieved( OProcess * ) ) ); proc->start(); } void WeatherPluginWidget::displayWeather() { weatherData = QString::null; QFile file( localFile ); if ( file.open( IO_ReadOnly ) ) { QTextStream data( &file ); while ( !data.eof() ) { |