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
---
kdesu/kdesu/kdesu.cpp | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/kdesu/kdesu/kdesu.cpp b/kdesu/kdesu/kdesu.cpp
index cfd37ec..3640545 100644
--- a/kdesu/kdesu/kdesu.cpp
+++ b/kdesu/kdesu/kdesu.cpp
@@ -350,6 +350,9 @@ static int startApp()
// 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;
@@ -381,8 +384,7 @@ static int startApp()
KDEsuDialog dlg(user, auth_user, keep && !terminal, icon, withIgnoreButton);
if (prompt)
dlg.addCommentLine(i18n("Command:"), QFile::decodeName(command));
- if (defKeep)
- dlg.setKeepPassword(true);
+ dlg.setKeepPassword(keepByDefault);
if ((priority != 50) || (scheduler != SuProcess::SchedNormal))
{
@@ -411,6 +413,7 @@ static int startApp()
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 );
--
1.8.4.4