Move useIconTheme DCOP call into kcmweatherservice.

This is where it belongs, and thus it can be used by both
the applet and sidebar.

Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
pull/18/head
Mavridis Philippe 3 years ago
parent b1d0b204e1
commit 56e84d9ab2
No known key found for this signature in database
GPG Key ID: F8D2D7E2F989A494

@ -34,6 +34,8 @@
#include <kurlrequester.h> #include <kurlrequester.h>
#include <kcombobox.h> #include <kcombobox.h>
#include <kcolorbutton.h> #include <kcolorbutton.h>
#include <dcopclient.h>
#include <dcopref.h>
#include "dockwidget.h" #include "dockwidget.h"
#include "serviceconfig.h" #include "serviceconfig.h"
@ -101,7 +103,8 @@ void KCMWeatherService::load()
mWidget->m_logFile->setURL( config.readPathEntry( "log_file_name" ) ); mWidget->m_logFile->setURL( config.readPathEntry( "log_file_name" ) );
mWidget->m_iconTheme->setButton( config.readBoolEntry("use_icon_theme", true) ? 0 : 1 ); mUseIconTheme = config.readBoolEntry("use_icon_theme", true);
mWidget->m_iconTheme->setButton( mUseIconTheme ? 0 : 1 );
emit changed( false ); emit changed( false );
} }
@ -115,7 +118,9 @@ void KCMWeatherService::save()
config.writeEntry( "logging", mWidget->m_enableLog->isChecked() ); config.writeEntry( "logging", mWidget->m_enableLog->isChecked() );
config.writeEntry( "log_file_name", mWidget->m_logFile->url() ); config.writeEntry( "log_file_name", mWidget->m_logFile->url() );
config.writeEntry( "use_icon_theme", mWidget->m_iconTheme->selectedId() == 0 ); mUseIconTheme = (mWidget->m_iconTheme->selectedId() == 0);
config.writeEntry( "use_icon_theme", mUseIconTheme );
updateIconTheme(mUseIconTheme);
config.sync(); config.sync();
@ -133,4 +138,12 @@ void KCMWeatherService::defaults()
emit changed( true ); emit changed( true );
} }
void KCMWeatherService::updateIconTheme( bool useIconTheme )
{
DCOPRef ws( "KWeatherService", "WeatherService" );
DCOPReply reply = ws.call( "useIconTheme", useIconTheme );
if( ! reply.isValid() )
kdDebug(12004) << "[kcmweatherservice::updateIconTheme] DCOP call failed" << endl;
}
#include "kcmweatherservice.moc" #include "kcmweatherservice.moc"

@ -46,6 +46,9 @@ class KCMWeatherService : public TDECModule
serviceConfig *mWidget; serviceConfig *mWidget;
WeatherService_stub *mWeatherService; WeatherService_stub *mWeatherService;
int mViewMode; int mViewMode;
bool mUseIconTheme;
void updateIconTheme( bool useIconTheme );
}; };
#endif #endif

@ -217,7 +217,6 @@ void kweather::loadPrefs(){
fileName = kcConfig->readPathEntry("log_file_name"); fileName = kcConfig->readPathEntry("log_file_name");
reportLocation = kcConfig->readEntry("report_location"); reportLocation = kcConfig->readEntry("report_location");
mViewMode = kcConfig->readNumEntry("smallview_mode", dockwidget::ShowAll); mViewMode = kcConfig->readNumEntry("smallview_mode", dockwidget::ShowAll);
setUseIconTheme(kcConfig->readBoolEntry("use_icon_theme", true));
static TQColor black(TQt::black); static TQColor black(TQt::black);
mTextColor = kcConfig->readColorEntry("textColor", &black); mTextColor = kcConfig->readColorEntry("textColor", &black);
@ -233,23 +232,9 @@ void kweather::savePrefs(){
kcConfig->writeEntry("report_location", reportLocation); kcConfig->writeEntry("report_location", reportLocation);
kcConfig->writeEntry("smallview_mode", mViewMode); kcConfig->writeEntry("smallview_mode", mViewMode);
kcConfig->writePathEntry("log_file_name", fileName ); kcConfig->writePathEntry("log_file_name", fileName );
kcConfig->writeEntry("use_icon_theme", useIconTheme );
kcConfig->sync(); kcConfig->sync();
} }
void kweather::setUseIconTheme( bool use )
{
useIconTheme = use;
if ( !mWeatherService )
initDCOP();
DCOPRef ws( "KWeatherService", "WeatherService" );
DCOPReply reply = ws.call( "useIconTheme", useIconTheme );
if( ! reply.isValid() )
kdDebug() << "[kweather::setUseIconTheme] DCOP call failed" << endl;
}
void kweather::showWeather() void kweather::showWeather()
{ {
kdDebug(12004) << "Show weather" << endl; kdDebug(12004) << "Show weather" << endl;
@ -349,7 +334,6 @@ void kweather::slotPrefsAccepted()
dockWidget->setLocationCode(reportLocation); dockWidget->setLocationCode(reportLocation);
dockWidget->setViewMode(mViewMode); dockWidget->setViewMode(mViewMode);
setUseIconTheme(useIconTheme);
if ( !mWeatherService ) if ( !mWeatherService )
initDCOP(); initDCOP();
mWeatherService->forceUpdateAll(); mWeatherService->forceUpdateAll();

@ -68,7 +68,6 @@ private: // Private methods
void showWeather(); void showWeather();
void writeLogEntry(); void writeLogEntry();
void mousePressEvent(TQMouseEvent *e); void mousePressEvent(TQMouseEvent *e);
void setUseIconTheme(bool use);
bool attach(); bool attach();
@ -76,7 +75,6 @@ private: // Private methods
TQString fileName; TQString fileName;
TQString metarData; TQString metarData;
bool logOn; bool logOn;
bool useIconTheme;
bool mFirstRun; bool mFirstRun;
int mViewMode; int mViewMode;
TQTimer *timeOut; TQTimer *timeOut;

Loading…
Cancel
Save