summaryrefslogtreecommitdiffstats
path: root/kweather
diff options
context:
space:
mode:
authorMavridis Philippe <mavridisf@gmail.com>2021-12-24 12:55:58 +0200
committerMavridis Philippe <mavridisf@gmail.com>2022-01-14 12:39:21 +0200
commit56e84d9ab2061588e46dd2448c1fb420d0eafe10 (patch)
treea620d327a0ada90f93b6e44cd795224d0338e3ee /kweather
parentb1d0b204e125214893eb84c05d25772ac3afaa28 (diff)
downloadtdetoys-56e84d9ab2061588e46dd2448c1fb420d0eafe10.tar.gz
tdetoys-56e84d9ab2061588e46dd2448c1fb420d0eafe10.zip
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>
Diffstat (limited to 'kweather')
-rw-r--r--kweather/kcmweatherservice.cpp17
-rw-r--r--kweather/kcmweatherservice.h3
-rw-r--r--kweather/kweather.cpp16
-rw-r--r--kweather/kweather.h2
4 files changed, 18 insertions, 20 deletions
diff --git a/kweather/kcmweatherservice.cpp b/kweather/kcmweatherservice.cpp
index cf0828c..4e5c7a7 100644
--- a/kweather/kcmweatherservice.cpp
+++ b/kweather/kcmweatherservice.cpp
@@ -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"
diff --git a/kweather/kcmweatherservice.h b/kweather/kcmweatherservice.h
index 9e61e86..d6dee62 100644
--- a/kweather/kcmweatherservice.h
+++ b/kweather/kcmweatherservice.h
@@ -46,6 +46,9 @@ class KCMWeatherService : public TDECModule
serviceConfig *mWidget;
WeatherService_stub *mWeatherService;
int mViewMode;
+ bool mUseIconTheme;
+
+ void updateIconTheme( bool useIconTheme );
};
#endif \ No newline at end of file
diff --git a/kweather/kweather.cpp b/kweather/kweather.cpp
index 76ffb48..1edc9cd 100644
--- a/kweather/kweather.cpp
+++ b/kweather/kweather.cpp
@@ -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();
diff --git a/kweather/kweather.h b/kweather/kweather.h
index c8b7113..28c4e25 100644
--- a/kweather/kweather.h
+++ b/kweather/kweather.h
@@ -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;