diff options
Diffstat (limited to 'kweather/kweather.cpp')
| -rw-r--r-- | kweather/kweather.cpp | 64 |
1 files changed, 36 insertions, 28 deletions
diff --git a/kweather/kweather.cpp b/kweather/kweather.cpp index 71fe647..9843914 100644 --- a/kweather/kweather.cpp +++ b/kweather/kweather.cpp @@ -41,7 +41,7 @@ extern "C" { - KDE_EXPORT KPanelApplet* init(TQWidget *parent, const TQString& configFile) + TDE_EXPORT KPanelApplet* init(TQWidget *parent, const TQString& configFile) { TDEGlobal::locale()->insertCatalogue("kweather"); kweather *theApplet = new kweather(configFile, KPanelApplet::Normal, @@ -58,21 +58,21 @@ kweather::kweather(const TQString& configFile, Type t, int actions, { kdDebug(12004) << "Constructor " << endl; setObjId("weatherIface"); - + setBackgroundOrigin( TQWidget::AncestorOrigin ); loadPrefs(); initContextMenu(); initDCOP(); - + dockWidget = new dockwidget(reportLocation, this, "dockwidget"); - connect(dockWidget, TQT_SIGNAL(buttonClicked()), TQT_SLOT(doReport())); + connect(dockWidget, TQ_SIGNAL(buttonClicked()), TQ_SLOT(doReport())); dockWidget->setViewMode(mViewMode); setLabelColor(); - + timeOut = new TQTimer(this, "timeOut" ); - connect(timeOut, TQT_SIGNAL(timeout()), TQT_SLOT(timeout())); + connect(timeOut, TQ_SIGNAL(timeout()), TQ_SLOT(timeout())); timeOut->start(10*60*1000); - + if(mFirstRun) preferences(); else @@ -89,13 +89,13 @@ void kweather::initContextMenu() mContextMenu = new TDEPopupMenu(this); mContextMenu->insertTitle(i18n("KWeather - %1").arg( reportLocation ), -1, 0); mContextMenu->insertItem(SmallIcon("viewmag"), i18n("Show &Report"), - this, TQT_SLOT(doReport()), 0, -1, 1); + this, TQ_SLOT(doReport()), 0, -1, 1); mContextMenu->insertItem(SmallIcon("reload"), i18n("&Update Now"), - this, TQT_SLOT(slotUpdateNow()), 0, -1, 2); + this, TQ_SLOT(slotUpdateNow()), 0, -1, 2); mContextMenu->insertSeparator(); - mContextMenu->insertItem(SmallIcon("kweather"), i18n("&About KWeather"), this, TQT_SLOT(about())); + mContextMenu->insertItem(SmallIcon("kweather"), i18n("&About KWeather"), this, TQ_SLOT(about())); mContextMenu->insertItem(SmallIcon("configure"), - i18n("&Configure KWeather..."), this, TQT_SLOT(preferences())); + i18n("&Configure KWeather..."), this, TQ_SLOT(preferences())); setCustomMenu(mContextMenu); } @@ -103,20 +103,20 @@ void kweather::initDCOP() { if ( !mClient ) mClient = TDEApplication::dcopClient(); - + if(!mClient->isAttached()) mClient->attach(); - + if(!attach()) return; - + kdDebug(12004) << "attached to the server..." << endl; - + if ( mWeatherService ) delete mWeatherService; - + mWeatherService = new WeatherService_stub( "KWeatherService", "WeatherService" ); - + if (!connectDCOPSignal(0, 0, "fileUpdate(TQString)", "refresh(TQString)",false)) kdDebug(12004) << "Could not attach dcop signal..." << endl; @@ -159,10 +159,11 @@ void kweather::preferences() if ( settingsDialog == 0 ) { settingsDialog = new KCMultiDialog( this ); - connect( settingsDialog, TQT_SIGNAL( configCommitted() ), TQT_SLOT( slotPrefsAccepted() ) ); + connect( settingsDialog, TQ_SIGNAL( configCommitted() ), TQ_SLOT( slotPrefsAccepted() ) ); - settingsDialog->addModule( "kcmweather.desktop" ); + settingsDialog->addModule( "kcmweatherapplet.desktop" ); settingsDialog->addModule( "kcmweatherservice.desktop" ); + settingsDialog->addModule( "kcmweatherstations.desktop" ); } settingsDialog->show(); @@ -172,7 +173,7 @@ void kweather::preferences() /** The help handler */ void kweather::help() { - kapp->invokeHelp(TQString(), TQString::fromLatin1("kweather")); + tdeApp->invokeHelp(TQString(), TQString::fromLatin1("kweather")); } /** Display the current weather report. */ @@ -189,10 +190,10 @@ void kweather::doReport() if ( mReport == 0 ) { mReport = new reportView(reportLocation); - - connect( mReport, TQT_SIGNAL( finished() ), TQT_SLOT( slotReportFinished() ) ); + + connect( mReport, TQ_SIGNAL( finished() ), TQ_SLOT( slotReportFinished() ) ); } - + mReport->show(); mReport->raise(); } @@ -225,7 +226,7 @@ void kweather::loadPrefs(){ void kweather::savePrefs(){ kdDebug(12004) << "Saving Prefs..." << endl; TDEConfig *kcConfig = config(); - + kcConfig->setGroup("General Options"); kcConfig->writeEntry("logging", logOn); kcConfig->writeEntry("report_location", reportLocation); @@ -286,7 +287,7 @@ void kweather::timeout() { if ( !mWeatherService ) initDCOP(); - + if ( mWeatherService ) { // isEmtpy is true for null and 0 length strings @@ -301,7 +302,7 @@ void kweather::timeout() int kweather::widthForHeight(int h) const { //kdDebug(12004) << "widthForHeight " << h << endl; - dockWidget->setOrientation(Qt::Horizontal); + dockWidget->setOrientation(TQt::Horizontal); int w = dockWidget->widthForHeight(h); return w; } @@ -309,7 +310,7 @@ int kweather::widthForHeight(int h) const int kweather::heightForWidth(int w) const { kdDebug(12004) << "heightForWidth " << w<< endl; - dockWidget->setOrientation(Qt::Vertical); + dockWidget->setOrientation(TQt::Vertical); int h = dockWidget->heightForWidth( w ); return h; } @@ -332,6 +333,13 @@ void kweather::slotPrefsAccepted() dockWidget->setLocationCode(reportLocation); dockWidget->setViewMode(mViewMode); + + if ( !mWeatherService ) + { + initDCOP(); + } + mWeatherService->forceUpdateAll(); + setLabelColor(); emit updateLayout(); @@ -365,7 +373,7 @@ void kweather::slotPrefsAccepted() void kweather::mousePressEvent(TQMouseEvent *e) { - if ( e->button() != Qt::RightButton ) + if ( e->button() != TQt::RightButton ) { KPanelApplet::mousePressEvent( e ); return; |
