Add keep password option to tdesu

This closes Bug 388
pull/2/head
Timothy Pearson 12 years ago
parent 8a61818a86
commit 8d7bb28418

@ -14,7 +14,7 @@
#include <tdesu/su.h>
#include "sudlg.h"
KDEsuDialog::KDEsuDialog(TQCString user, TQCString auth_user, bool enableKeep,const TQString& icon, bool withIgnoreButton)
KDEsuDialog::KDEsuDialog(TQCString user, TQCString auth_user, bool enableKeep,const TQString& icon, bool withIgnoreButton, int timeout)
: KPasswordDialog(Password, enableKeep, (withIgnoreButton ? User1:NoDefault), icon)
{
KConfig* config = KGlobal::config();
@ -43,6 +43,7 @@ KDEsuDialog::KDEsuDialog(TQCString user, TQCString auth_user, bool enableKeep,co
}
}
setPrompt(prompt);
setKeepWarning(i18n("<qt>The stored password will be:<br> * Kept for up to %1 hours<br> * Destroyed on logout").arg(timeout));
if( withIgnoreButton )
setButtonText(User1, i18n("&Ignore"));

@ -15,7 +15,7 @@ class KDEsuDialog
Q_OBJECT
public:
KDEsuDialog(TQCString user, TQCString auth_user, bool enableKeep, const TQString& icon , bool withIgnoreButton=false);
KDEsuDialog(TQCString user, TQCString auth_user, bool enableKeep, const TQString& icon , bool withIgnoreButton=false, int timeout=-1);
~KDEsuDialog();
enum ResultCodes { AsUser = 10 };

@ -274,7 +274,7 @@ static int startApp()
// Try to exec the command with tdesud.
bool keep = !args->isSet("n") && have_daemon;
bool terminal = true;
bool terminal = args->isSet("t");
bool new_dcop = args->isSet("newdcop");
bool withIgnoreButton = args->isSet("ignorebutton");
@ -360,7 +360,7 @@ static int startApp()
KStartupInfoData data;
data.setSilent( KStartupInfoData::Yes );
KStartupInfo::sendChange( id, data );
KDEsuDialog dlg(user, auth_user, keep && !terminal,icon, withIgnoreButton);
KDEsuDialog dlg(user, auth_user, keep && !terminal,icon, withIgnoreButton, timeout);
if (prompt)
dlg.addLine(i18n("Command:"), command);
if ((priority != 50) || (scheduler != SuProcess::SchedNormal))

Loading…
Cancel
Save