From 6668b34bc5deb36e73aa45e0457ed6740f828efd Mon Sep 17 00:00:00 2001 From: Mavridis Philippe Date: Sun, 12 Dec 2021 15:50:37 +0200 Subject: 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 --- kweather/kweather.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'kweather/kweather.cpp') 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(); -- cgit v1.2.1