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 <kcombobox.h>
#include <kcolorbutton.h>
#include <dcopclient.h>
#include <dcopref.h>
#include "dockwidget.h"
#include "serviceconfig.h"
@ -101,7 +103,8 @@ void KCMWeatherService::load()
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 );
}
@ -115,7 +118,9 @@ void KCMWeatherService::save()
config.writeEntry( "logging", mWidget->m_enableLog->isChecked() );
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();
@ -133,4 +138,12 @@ void KCMWeatherService::defaults()
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"

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

@ -217,7 +217,6 @@ void kweather::loadPrefs(){
fileName = kcConfig->readPathEntry("log_file_name");
reportLocation = kcConfig->readEntry("report_location");
mViewMode = kcConfig->readNumEntry("smallview_mode", dockwidget::ShowAll);
setUseIconTheme(kcConfig->readBoolEntry("use_icon_theme", true));
static TQColor black(TQt::black);
mTextColor = kcConfig->readColorEntry("textColor", &black);
@ -233,23 +232,9 @@ void kweather::savePrefs(){
kcConfig->writeEntry("report_location", reportLocation);
kcConfig->writeEntry("smallview_mode", mViewMode);
kcConfig->writePathEntry("log_file_name", fileName );
kcConfig->writeEntry("use_icon_theme", useIconTheme );
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()
{
kdDebug(12004) << "Show weather" << endl;
@ -349,7 +334,6 @@ void kweather::slotPrefsAccepted()
dockWidget->setLocationCode(reportLocation);
dockWidget->setViewMode(mViewMode);
setUseIconTheme(useIconTheme);
if ( !mWeatherService )
initDCOP();
mWeatherService->forceUpdateAll();

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

Loading…
Cancel
Save