[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/kdesu/kdesu
From:       David Faure <faure () kde ! org>
Date:       2006-04-12 13:15:55
Message-ID: 1144847755.047721.3103.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 529045 by dfaure:

FEATURE: --noignorebutton, based on patch by "Nicolas Lécureuil" <neoclust.kde \
gmail.com>


 M  +9 -7      kdesu.cpp  
 M  +13 -6     sudlg.cpp  
 M  +4 -4      sudlg.h  


--- trunk/KDE/kdebase/kdesu/kdesu/kdesu.cpp #529044:529045
@@ -63,6 +63,7 @@
     { "p <prio>", I18N_NOOP("Set priority value: 0 <= prio <= 100, 0 is lowest"), \
"50" },  { "r", I18N_NOOP("Use realtime scheduling"), 0 },
     { "nonewdcop", I18N_NOOP("Let command use existing dcopserver"), 0 },
+    { "noignorebutton", I18N_NOOP("Do not display ignore button"), 0 },
     { "i <icon name>", I18N_NOOP("Specify icon to use in the password dialog"), 0},
     { "d", I18N_NOOP("Do not show the command to be run in the dialog"), 0},
     KCmdLineLastOption
@@ -156,7 +157,7 @@
 
     QString icon;
     if ( args->isSet("i"))
-	icon = args->getOption("i");	
+	icon = args->getOption("i");
 
     bool prompt = true;
     if ( args->isSet("d"))
@@ -227,7 +228,7 @@
             command += QFile::encodeName(arg);
         }
     }
-    else 
+    else
     {
         if( args->count() == 0 )
         {
@@ -275,20 +276,21 @@
     bool keep = !args->isSet("n") && have_daemon;
     bool terminal = args->isSet("t");
     bool new_dcop = args->isSet("newdcop");
+    bool withIgnoreButton = args->isSet("ignorebutton");
 
     QList<QByteArray> env;
     QByteArray options;
     env << ( "DESKTOP_STARTUP_ID=" + kapp->startupId());
-    
+
     if (pw->pw_uid)
     {
        // Only propagate KDEHOME for non-root users,
        // root uses KDEROOTHOME
-       
+
        // Translate the KDEHOME of this user to the new user.
        QString kdeHome = KGlobal::dirs()->relativeLocation("home", \
KGlobal::dirs()->localkdedir());  if (kdeHome[0] != '/')
-          kdeHome.prepend("~/"); 
+          kdeHome.prepend("~/");
        else
           kdeHome=QString(); // Use default
 
@@ -297,7 +299,7 @@
 
     KUser u;
     env << (QByteArray) ("KDESU_USER=" + u.loginName().toLocal8Bit());
-    
+
     if (!new_dcop)
     {
         QByteArray ksycoca = "KDESYCOCA="+QFile::encodeName(locateLocal("cache", \
"ksycoca")); @@ -360,7 +362,7 @@
         data.setSilent( KStartupInfoData::Yes );
         KStartupInfo::sendChange( id, data );
 #endif
-        KDEsuDialog dlg(user, auth_user, keep && !terminal, icon);
+        KDEsuDialog dlg(user, auth_user, keep && !terminal, icon, withIgnoreButton);
 	if (prompt)
 	    dlg.addLine(i18n("Command:"), command);
         if ((priority != 50) || (scheduler != SuProcess::SchedNormal))
--- trunk/KDE/kdebase/kdesu/kdesu/sudlg.cpp #529044:529045
@@ -13,24 +13,31 @@
 #include "sudlg.h"
 
 
-KDEsuDialog::KDEsuDialog(QByteArray user, QByteArray auth_user, bool enableKeep, \
                const QString& icon)
-    : KPasswordDialog(Password, enableKeep, User1, icon)
+KDEsuDialog::KDEsuDialog(QByteArray user, QByteArray auth_user, bool enableKeep, \
const QString& icon, bool withIgnoreButton) +    : KPasswordDialog(Password, \
enableKeep, withIgnoreButton?User1:NoDefault, icon)  {
     m_User = auth_user;
     setCaption(i18n("Run as %1", QString::fromLatin1(user)));
 
     QString prompt;
     if (m_User == "root")
-	prompt = i18n("The action you requested needs root privileges. "
-		"Please enter root's password below or click "
-		"Ignore to continue with your current privileges.");
+    {
+        if ( withIgnoreButton )
+            prompt = i18n("The action you requested needs root privileges. "
+                          "Please enter root's password below or click "
+                          "Ignore to continue with your current privileges.");
+        else
+            prompt = i18n("The action you requested needs root privileges. "
+                          "Please enter root's password below ");
+    }
     else
 	prompt = i18n("The action you requested needs additional privileges. "
 		"Please enter the password for \"%1\" below or click "
 		"Ignore to continue with your current privileges.", QString::fromLatin1(m_User));
     setPrompt(prompt);
 
-    setButtonText(User1, i18n("&Ignore"));
+    if( withIgnoreButton )
+        setButtonText(User1, i18n("&Ignore"));
 }
 
 
--- trunk/KDE/kdebase/kdesu/kdesu/sudlg.h #529044:529045
@@ -16,18 +16,18 @@
     Q_OBJECT
 
 public:
-    KDEsuDialog(QByteArray user, QByteArray auth_user, bool enableKeep, const \
QString& icon ); +    KDEsuDialog(QByteArray user, QByteArray auth_user, bool \
enableKeep, const QString& icon , bool withIgnoreButton);  ~KDEsuDialog();
 
     enum ResultCodes { AsUser = 10 };
-    
+
 protected:
     bool checkPassword(const char *password);
     void slotUser1();
-    
+
 private:
     QByteArray m_User;
 };
-    
 
+
 #endif // __SuDlg_h_Included__


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic