summaryrefslogtreecommitdiffstats
path: root/kweather/kweather.cpp
diff options
context:
space:
mode:
authorMavridis Philippe <mavridisf@gmail.com>2021-12-12 15:50:37 +0200
committerMavridis Philippe <mavridisf@gmail.com>2022-01-14 12:39:01 +0200
commit6668b34bc5deb36e73aa45e0457ed6740f828efd (patch)
treef2ff95858cc06d5eaad187b6750717a58a175a60 /kweather/kweather.cpp
parent67e995b6fc4da17811aefb7c8d841c9812e4eec9 (diff)
downloadtdetoys-6668b34bc5deb36e73aa45e0457ed6740f828efd.tar.gz
tdetoys-6668b34bc5deb36e73aa45e0457ed6740f828efd.zip
Implemented icon theme option.
Changes in this commit include: * The option itself; * A method of updating the option right after Apply or Ok is pressed in the settings dialog; * A new WeatherIconPrivate class to store the methods previously in WeatherIcons, as well as the settings; * Improved icon name helper function in METAR parser; * A few cleanups to the WeatherIcon class. Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
Diffstat (limited to 'kweather/kweather.cpp')
-rw-r--r--kweather/kweather.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/kweather/kweather.cpp b/kweather/kweather.cpp
index eb87f98..2682a72 100644
--- a/kweather/kweather.cpp
+++ b/kweather/kweather.cpp
@@ -216,6 +216,7 @@ 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);
@@ -231,9 +232,23 @@ 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;
@@ -332,6 +347,10 @@ void kweather::slotPrefsAccepted()
dockWidget->setLocationCode(reportLocation);
dockWidget->setViewMode(mViewMode);
+
+ setUseIconTheme(useIconTheme);
+ slotUpdateNow();
+
setLabelColor();
emit updateLayout();