KWeather Sidebar: timer fixes

Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
pull/16/head
Mavridis Philippe 3 years ago
parent 07171bc7a7
commit 47ea2b84cd
No known key found for this signature in database
GPG Key ID: F8D2D7E2F989A494

@ -63,7 +63,9 @@ KonqSidebarWeather::KonqSidebarWeather(TDEInstance* inst, TQObject* parent,
kdDebug() << "attached dcop signals..." << endl; kdDebug() << "attached dcop signals..." << endl;
timeOut = new TQTimer(this, "timeOut" ); timeOut = new TQTimer(this, "timeOut" );
updateWidgets(true); connect(timeOut, TQT_SIGNAL(timeout()), this, TQT_SLOT(updateWidgets()));
updateWidgets();
} }
@ -114,10 +116,12 @@ void KonqSidebarWeather::handlePreviewOnMouseOver(const KFileItem& item)
{ {
} }
void KonqSidebarWeather::updateWidgets( bool firstTime ) void KonqSidebarWeather::updateWidgets()
{ {
kdDebug() << "updating station widgets" << endl; kdDebug() << "updating station widgets" << endl;
timeOut->stop(); timeOut->stop();
DCOPRef dcopCall( "KWeatherService", "WeatherService" ); DCOPRef dcopCall( "KWeatherService", "WeatherService" );
DCOPReply reply = dcopCall.call("listStations()", true ); DCOPReply reply = dcopCall.call("listStations()", true );
@ -173,13 +177,7 @@ void KonqSidebarWeather::updateWidgets( bool firstTime )
KMessageBox::sorry(0, i18n("The weather service is unreachable!")); KMessageBox::sorry(0, i18n("The weather service is unreachable!"));
} }
if( firstTime ) timeOut->start(15*60000);
timeOut->start(15*60000);
else
{
timeOut->changeInterval(15*60000);
connect(timeOut, TQT_SIGNAL(timeout()), this, TQT_SLOT(updateWidgets()));
}
} }
bool KonqSidebarWeather::startWeatherService() bool KonqSidebarWeather::startWeatherService()

@ -53,7 +53,7 @@ public:
virtual void refresh(TQString); virtual void refresh(TQString);
public slots: public slots:
virtual void updateWidgets( bool firstTime = false ); virtual void updateWidgets();
protected: protected:
virtual void handleURL(const KURL &url); virtual void handleURL(const KURL &url);

Loading…
Cancel
Save