Bug 411584

Summary: The Apply button is inactive in Night Color KCM
Product: [Applications] systemsettings Reporter: Victor Ryzhykh <victorr2007>
Component: kcm_nightcolorAssignee: Vlad Zahorodnii <vlad.zahorodnii>
Status: RESOLVED FIXED    
Severity: normal CC: admin, amdev1, aspotashev, cacaddv, ddascalescu+kde, kde, kwin-bugs-null, lucabs2112, markovs.i.mail, med.medin.2014, nate, squeakypancakes, trujillo.a, zawertun
Priority: VHI    
Version: 5.18.1   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.19.0
Sentry Crash Report:
Attachments: Image of always inactive button
Enable the “Times”
After restarting the systemsettings.
After deleting the line “Mode = Times”
File kwinrc
Apply Night Color Not Working
fix_#411584.patch
Impossible to change night mode settings
Screencast

Description Victor Ryzhykh 2019-09-04 08:27:25 UTC
Created attachment 122483 [details]
Image of always inactive button

The Apply button is inactive in Night Color KCM

The apply button is always inactive and there is no way to save changes or disable this option.

plasma-5.16.80 from 09/03/2019
Comment 1 Victor Ryzhykh 2019-09-04 08:48:52 UTC
The “Apply” button is inactive for any actions on this tab.
The “Apply” button is inactive when unchecking a parameter.
The “Apply” button is inactive when changing the operating mode.
The “Apply” button is inactive when changing color temperature.
Comment 2 Victor Ryzhykh 2019-09-05 15:39:51 UTC
The “Apply” button stops working after the “Times” mode is activated.
Before turning on this mode, the rest works fine.
To fix, you can delete the line “Mode=Times" from the file
~/.config/kwinrc and restart the session.
Comment 3 Vlad Zahorodnii 2019-09-19 12:00:56 UTC
I can't reproduce this bug. Could you provide output of `qdbus org.kde.KWin /ColorCorrect nightColorInfo` please?
Comment 4 Victor Ryzhykh 2019-09-19 16:00:30 UTC
Created attachment 122730 [details]
Enable the “Times”

In order for the problem to start to reproduce, you must enable the “Times” mode and restart the systemsettings.
After that, no changes to the settings work anymore.
If you don’t turn on “Times” mode at all, then on other modes it works without problems.


Чтобы проблема начала воспроизводится, нужно включить именно режим «По расписанию» и перезапустить «Параметры системы».
После этого больше не работают никакие изменения в настройках.
Если же вообще не включать режим «По расписанию»,
то на остальных режимах работает без проблем.

alex@asus:~$ qdbus org.kde.KWin /ColorCorrect nightColorInfo
Active: true
ActiveEnabled: true
Available: true
CurrentColorTemperature: 6500
EveningBeginFixed: 18:00:00
LatitudeAuto: 64.5722
LatitudeFixed: 64.5722
LocationEnabled: true
LongitudeAuto: 39.8475
LongitudeFixed: 39.8475
Mode: 2
ModeEnabled: true
MorningBeginFixed: 06:00:00
NightTemperature: 4500
NightTemperatureEnabled: true
Running: true
TimingsEnabled: true
TransitionTime: 30
alex@asus:~$
Comment 5 Victor Ryzhykh 2019-09-19 16:01:38 UTC
Created attachment 122731 [details]
After restarting the systemsettings.

After restarting the systemsettings.
The apply button does not work.
Comment 6 Victor Ryzhykh 2019-09-19 16:02:39 UTC
Created attachment 122732 [details]
After deleting the line “Mode = Times”

After deleting the line “Mode = Times” from the file
~/.config/kwinrc and restart the session.
The apply button works again.

После удаления строки «Mode = Times» из файла
~/.config/kwinrc и перезапуска сеанса.
Кнопка применить опять работает.


alex@asus:~$ qdbus org.kde.KWin /ColorCorrect nightColorInfo
Active: true
ActiveEnabled: true
Available: true
CurrentColorTemperature: 5470
EveningBeginFixed: 20:00:00
LatitudeAuto: 64.5722
LatitudeFixed: 64.5722
LocationEnabled: true
LongitudeAuto: 39.8475
LongitudeFixed: 0
Mode: 0
ModeEnabled: true
MorningBeginFixed: 06:00:00
NightTemperature: 4500
NightTemperatureEnabled: true
Running: true
TimingsEnabled: true
TransitionTime: 30
alex@asus:~$
Comment 7 Vlad Zahorodnii 2019-09-20 07:38:20 UTC
(In reply to Victor Ryzhykh from comment #4)
> In order for the problem to start to reproduce, you must enable the “Times”
> mode and restart the systemsettings.
> After that, no changes to the settings work anymore.
> If you don’t turn on “Times” mode at all, then on other modes it works
> without problems.
I followed your instructions however I'm still able to change Night Color settings, e.g. color temperature, operation mode, etc. plasma-desktop is built from source code.

Can you change night color settings in a new user account?
Comment 8 Squeaky Pancakes 2019-10-20 21:43:22 UTC
I can confirm this happens to me on 5.17 on Artix Linux. However mine was flickering on and off randomly untill I removed the night color block from .config/kwinrc
Comment 9 Nate Graham 2019-10-28 18:03:20 UTC
*** Bug 413536 has been marked as a duplicate of this bug. ***
Comment 10 Yaroslav Sidlovsky 2019-10-28 21:37:37 UTC
Duplicate - https://bugs.kde.org/show_bug.cgi?id=413005 (or vice versa?).
Comment 11 Vlad Zahorodnii 2019-10-29 10:21:42 UTC
(In reply to Squeaky Pancakes from comment #8)
> I can confirm this happens to me on 5.17 on Artix Linux. However mine was
> flickering on and off randomly untill I removed the night color block from
> .config/kwinrc

Do you have the old kwinrc file by any chance?
Comment 12 Vlad Zahorodnii 2019-10-29 10:24:43 UTC
*** Bug 413005 has been marked as a duplicate of this bug. ***
Comment 13 Victor Ryzhykh 2019-10-29 11:10:30 UTC
Created attachment 123562 [details]
File kwinrc

File kwinrc
Comment 14 psymole 2019-10-30 04:30:07 UTC
SUMMARY

The Apply button is inactive in Night Color

STEPS TO REPRODUCE
1. Use the time option in the night color dialogue
2. Click Apply. Or apply by going to different settings tab and clicking apply on the popUp dialogue.
3. Close settings app and re-open
4. Change any night color option.

OBSERVED RESULT

Next time, when browsing Nigth color, no changes can be applied. Not even using the reset to defaults button.


EXPECTED RESULT

Options can be changed, and the apply button is activated when appropriate.


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
DISTRIB_DESCRIPTION="Ubuntu 19.10"
Kernel: 5.3.0-19-generic
KDE Plasma Version: 5.17.1
KDE Frameworks Version: 5.62.0.
Qt Version: 5.12.4

Can also confirm that After deleting the line “Mode = Times” from the file
~/.config/kwinrc and restarting the session, it works as expected.

Also, I noticed that the apply button needs to be clicked twice to change into time mode and trigger the bug.

qdbus org.kde.KWin /ColorCorrect nightColorInfo
ActiveEnabled: true
Available: true
CurrentColorTemperature: 3000
EveningBeginFixed: 18:00:51
LatitudeAuto: (myLat)
LatitudeFixed: 0
LocationEnabled: true
LongitudeAuto: (myLong)
LongitudeFixed: 0
Mode: 2
ModeEnabled: true
MorningBeginFixed: 06:00:51
NightTemperature: 3000
NightTemperatureEnabled: true
Running: true
TimingsEnabled: true
TransitionTime: 30
Comment 15 aancw 2019-10-30 05:10:59 UTC
Whenever click back to All setting after visiting the Night Color setting, always trigger KDE System Setting crash. 

Crash Report: https://hastebin.com/olugecaseg.shell
Comment 16 Vlad Zahorodnii 2019-10-31 09:59:08 UTC
(In reply to psymole from comment #14)
> Also, I noticed that the apply button needs to be clicked twice to change
> into time mode and trigger the bug.
This issue has been fixed in 5.17.3.

> qdbus org.kde.KWin /ColorCorrect nightColorInfo
> EveningBeginFixed: 18:00:51
> MorningBeginFixed: 06:00:51
Hmm, this two look suspicious. Given how Night Color stores timings, seconds has to be set to 0. I recommend to delete Night Color settings in kwinrc after 5.17.3 is released and check whether you can still reproduce the bug.

Dev note: For some reason, Night Color receives timings over D-Bus in Qt::IsoDate format, but stores them in another format, without seconds included.
Comment 17 Vlad Zahorodnii 2019-10-31 10:01:30 UTC
Edit: s/this two/these two/
Comment 18 raf 2019-12-07 23:52:49 UTC
Would like to mention here that the same problem has been reported on https://bugs.kde.org/show_bug.cgi?id=414337
Comment 19 Vlad Zahorodnii 2019-12-09 09:11:52 UTC
*** Bug 414337 has been marked as a duplicate of this bug. ***
Comment 20 Victor Ryzhykh 2020-01-12 15:26:59 UTC
(In reply to Victor Ryzhykh from comment #0)
> Created attachment 122483 [details]
> Image of always inactive button
> 
> The Apply button is inactive in Night Color KCM
> 
> The apply button is always inactive and there is no way to save changes or
> disable this option.
> 
> plasma-5.16.80 from 09/03/2019

I have this problem no longer present.
Fixed with an update in colorcorrection
https://cgit.kde.org/kwin.git/commit/?id=5bec89ac90d5c9d72b03b60cf62bb6ef9ffb0808

Версия KDE Plasma: 5.17.80
Версия KDE Frameworks: 5.66.0
Версия Qt: 5.14.0
Comment 21 Nate Graham 2020-01-12 15:48:38 UTC
Great!
Comment 22 Nate Graham 2020-01-22 16:31:59 UTC
*** Bug 416555 has been marked as a duplicate of this bug. ***
Comment 23 medin 2020-02-19 09:30:38 UTC
The problem is still present with 5.18.1, see my attached video for more info.
Comment 24 medin 2020-02-19 09:31:19 UTC
Created attachment 126155 [details]
Apply Night Color Not Working
Comment 25 David Edmundson 2020-02-19 09:34:49 UTC
I suspect it's this: https://phabricator.kde.org/D27384#611241

that we saw in another KCM.
Comment 26 David Edmundson 2020-02-24 09:55:24 UTC
Git commit 1dd4668f1bf15e057b841ce6e538073f1538ec27 by David Edmundson.
Committed on 24/02/2020 at 09:55.
Pushed by davidedmundson into branch 'Plasma/5.18'.

Calculate needsSave on checkbox toggle not on change

Summary:
Otherwise we will trigger it during load, which is wasteful.

But worse potentially we haven't evaluated the other settings yet, so it
could trigger that we have changed the settings, and prematurely set
apply to enabled prematurely which currently breaks things.

I suspect it will fix the bug below, I couldn't reproduce reliably
enough to prove it.

Please reopen if it remains an issue
Fixed-in: 5.18.2

Test Plan:
Opened KCM
toggling still worked as expected

Reviewers: #plasma, apol, ngraham

Reviewed By: apol, ngraham

Subscribers: apol, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D27590

M  +1    -1    kcms/nightcolor/package/contents/ui/main.qml

https://commits.kde.org/plasma-desktop/1dd4668f1bf15e057b841ce6e538073f1538ec27
Comment 27 Yaroslav Sidlovsky 2020-02-24 15:02:02 UTC
Bug is still present for me after applying this patch.

I don't get why patch changes only behavior of the checkboxes.
Apply button is not active after editing any editable widget on the night color form.
You can see it on the attached video.
Comment 28 David Edmundson 2020-02-24 16:02:15 UTC
>I don't get why patch changes only behavior of the checkboxes.

See my comment in #25 explaining the probably cause.
Comment 29 Yaroslav Sidlovsky 2020-02-24 17:51:04 UTC
Created attachment 126381 [details]
fix_#411584.patch

Looks like this patch kinda fixes issue for me.
Thanks to the David Edmundson.

Can somebody review this small patch or provide better alternative?
Comment 30 David Edmundson 2020-02-26 01:03:50 UTC
I'm sure that works,  but it doesn't answer the original question. why is the KCM reporting itself as changed upon load?
Comment 31 David Edmundson 2020-02-27 00:31:30 UTC
*** Bug 418240 has been marked as a duplicate of this bug. ***
Comment 32 medin 2020-02-27 09:38:26 UTC
Now with 5.18.2 it's impossible to apply new settings after clicking on ok button, and the apply button is still disabled, see my attached video for more info.
Comment 33 medin 2020-02-27 09:39:05 UTC
Created attachment 126452 [details]
Impossible to change night mode settings
Comment 34 David Edmundson 2020-03-02 12:48:52 UTC
https://phabricator.kde.org/D27724

should act as a fix
Comment 35 David Edmundson 2020-05-18 19:39:05 UTC
Git commit e460fc4809c458ebc0a485db1e04428271b9e328 by David Edmundson.
Committed on 18/05/2020 at 10:52.
Pushed by davidedmundson into branch 'Plasma/5.19'.

[kcms/nightcolour] Reset needsSave after loading initial QML properties

Sequence of events is:

1) KCModule::showEvent()
2) this queues up a load and queues up a KCModule::changed(false)

3)  during load ConfigModule::setNeedsSave(true) is called we set
d->_needsSave to true
4) we emit ConfigModule::changed(true) which we proxy through to
KCModule::changed(true)

5) we then process the queued KCModule::setChanged(false) from the
earlier KCModule::showEvent
6) so we disable the button

7) any subsequent changes in the KCM will call
ConfigModule::setNeedsSave(true)
but this now matches d->_needsSave so it no-ops. Even though KCModule is
out of sync.

Systemsettings only knows what KCModule signals, not ConfigModule.

This patch resets ConfigModule::d->_needsSave after step 3

See also https://phabricator.kde.org/D27384#611241

M  +1    -0    kcms/nightcolor/kcm.cpp

https://invent.kde.org/plasma/plasma-desktop/commit/e460fc4809c458ebc0a485db1e04428271b9e328
Comment 36 Aleix Pol 2020-05-23 00:27:04 UTC
Git commit c8eeee480157c61cbf7a3c6b0b147ee63516def9 by Aleix Pol, on behalf of David Edmundson.
Committed on 23/05/2020 at 00:26.
Pushed by apol into branch 'master'.

[kcms/nightcolour] Reset needsSave after loading initial QML properties

Sequence of events is:

1) KCModule::showEvent()
2) this queues up a load and queues up a KCModule::changed(false)

3)  during load ConfigModule::setNeedsSave(true) is called we set
d->_needsSave to true
4) we emit ConfigModule::changed(true) which we proxy through to
KCModule::changed(true)

5) we then process the queued KCModule::setChanged(false) from the
earlier KCModule::showEvent
6) so we disable the button

7) any subsequent changes in the KCM will call
ConfigModule::setNeedsSave(true)
but this now matches d->_needsSave so it no-ops. Even though KCModule is
out of sync.

Systemsettings only knows what KCModule signals, not ConfigModule.

This patch resets ConfigModule::d->_needsSave after step 3

See also https://phabricator.kde.org/D27384#611241

M  +1    -0    kcms/nightcolor/kcm.cpp

https://invent.kde.org/plasma/plasma-desktop/commit/c8eeee480157c61cbf7a3c6b0b147ee63516def9
Comment 37 Dan Dascalescu 2021-02-12 12:55:34 UTC
Created attachment 135633 [details]
Screencast

I still see this issue in Plasma 5.18.5, though it didn't happen the first couple times I changed the settings.

Now however, no matter what I change, the "Apply" button stays disabled.

PS: the time input box tries to be smart about accepting only numeric input, but it ends up being really annoying. I can barely change anything, and need to contort myself to selecting text and typing over it.