https://bugs.kde.org/show_bug.cgi?id=442092

Dave Kaye <d...@linuxmail.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |d...@linuxmail.org

--- Comment #2 from Dave Kaye <d...@linuxmail.org> ---
I want to have a screen saving program similar to KDE4 which was lost in an
upgrade to KDE5.  That would mean slide show capability with no password
required upon return to normal screen activity.  I have been following the
discussions on gitlab about kscreenlocker as well as general internet interest
on this subject.  I have modified less than 10 lines of code and achieved a
reasonable program.  

My system is:
KDE Plasma Version 5.18.5
KDE Frameworks Version 5.71.0
Qt Version 5.12.7
Linux Distribution openSUSE Leap 15.2

Within the kscreenlocker program, I modified 3 files changing only a couple of
lines per file:

--   in the file kcm/kcm.ui I changed the lock grace spinbox property
specialValueText from "Immediately" to "Forever", and the minimum value from 0
to -1.  This results in the line "Allow unlocking without password for:"
spinbox display to change from "Immediately, 1 second, 2 seconds ..." to
"Forever, 0 seconds, 1 second, 2 seconds...".  This would make sense to the
user, as 0 seconds and immediately are equivalent.  The selection of Forever
will give a time value of -1 which is invisible to the user.  No other
modifications to the user interface are needed. (I did change the step value to
1 from 10, a matter of personal preference and ease of usage - but not
necessary.)

--   in the file kcfg/kscreenlockersettings.kcfg I updated the minimum value
from 0 to -1.  This makes it consistent with the ui modification.

--   in the file ksldapp.cpp within the configure subroutine I added one
condition to the lock grace setup if statement.  This checked for a lock
request and grace time of -1 seconds.  If found, it set the variable
m_lockGrace to -1.  The variable m_lockGrace with a value of -1 already exists
in the code and causes the system not to require a password when exiting a
locked condition.  It appears to be active throughout the code, however on my
system I can only test with the XOrg screen control.

The diff file for the changes is as follows:

--- ksldapp.cpp
+++ ksldapp.cpp
@@ -341,7 +341,10 @@
         // timeout stored in minutes
         m_idleId = KIdleTime::instance()->addIdleTimeout(timeout*1000*60);
     }
-    if (KScreenSaverSettings::lock()) {
+    if (KScreenSaverSettings::lock() && (KScreenSaverSettings::lockGrace() ==
-1)) {
+         // lockGrace is forever, flag grace time to last forever
+         m_lockGrace = -1;
+    } else if (KScreenSaverSettings::lock()) {
         // lockGrace is stored in seconds
         m_lockGrace = KScreenSaverSettings::lockGrace() * 1000;
     } else {
--- kcm/kcm.ui
+++ kcm/kcm.ui
@@ -76,8 +76,11 @@
        <item row="2" column="1">
         <widget class="KPluralHandlingSpinBox" name="kcfg_LockGrace">
          <property name="specialValueText">
-          <string>Immediately</string>
+          <string>Forever</string>
          </property>
+         <property name="minimum">
+          <number>-1</number>
+         </property>
          <property name="maximum">
           <number>300</number>
          </property>
--- kcfg/kscreenlockersettings.kcfg
+++ kcfg/kscreenlockersettings.kcfg
@@ -23,7 +23,7 @@
     </entry>
     <entry key="LockGrace" type="Int">
       <default>5</default>
-      <min>0</min>
+      <min>-1</min>
       <max>300</max>
       <label></label>
       <whatsthis></whatsthis>

The user will setup the screen locker with the slide show or other lock screen
appearance and their normal lock screen settings.  In the variable labeled
"Allow unlocking without password for:" the user will select "Forever" to setup
the system as a no password needed screen saver.  I believe this is easier to
do than using a huge grace time value.  It also does not require a special
check button or similar constuct to indicate a screen saver verses a screen
locker.  The program interface flow appears to be readily understandable.

The program also acts as a password required screen locker, ignoring the grace
time settings, if it is activated by the hot key sequence.  This is in existing
code.  It will allow a rapid screen lock if such action is needed.

This is a demonstration/idea code only.  I do not have KDE6 and multiple screen
types to check the modifications for the newest release and make a MR.  In
going from my version of KDE5 to KDE6 it appears that the codes are the same
(line numbers slightly different) - only the ui file has been changed to a qml
file.  It may be possible to make a quick test KDE6 version and see if it is
worth consideration for inclusion in the kscreenlocker program.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to