File kdesu-remember-keep-password.diff of Package kdebase4-runtime
Subject: Default to kdesu password remembering on, but remember last state
From: Lubos Lunak
Feature: bnc#386531
Patch-upstream: no
Relates: kdebase3/kdesu-remember-keep-password.diff, kdelibs4/kdesu-settings.diff
Index: kdesu/kdesu/kdesu.cpp
===================================================================
--- kdesu/kdesu/kdesu.cpp (revision 810350)
+++ kdesu/kdesu/kdesu.cpp (working copy)
@@ -333,6 +333,9 @@
// Read configuration
KConfigGroup config(KGlobal::config(), "Passwords");
int timeout = config.readEntry("Timeout", defTimeout);
+ // 'keep' means whether to show the checkbox, 'keepByDefault' means
+ // whether it should be checked by default
+ bool keepByDefault = config.readEntry("Keep", bool(defKeep));
// Check if we need a password
SuProcess proc;
@@ -364,8 +367,7 @@
KDEsuDialog dlg(user, auth_user, keep && !terminal, icon, withIgnoreButton);
if (prompt)
dlg.addCommentLine(i18n("Command:"), command);
- if (defKeep)
- dlg.setKeepPassword(true);
+ dlg.setKeepPassword(keepByDefault);
if ((priority != 50) || (scheduler != SuProcess::SchedNormal))
{
@@ -388,6 +390,7 @@
change_uid = false;
password = dlg.password();
keep = dlg.keepPassword();
+ config.writeEntry("Keep", keep);
#ifdef Q_WS_X11
data.setSilent( KStartupInfoData::No );
KStartupInfo::sendChange( id, data );