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

List:       kde-commits
Subject:    branches/KDE/4.5/kdebase/workspace/plasma/generic/runners/shell
From:       Matthias Fuchs <mat69 () gmx ! net>
Date:       2010-11-17 17:04:35
Message-ID: 20101117170435.5951CAC8A0 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1198163 by mfuchs:

Backport r1198162
The "run as different user" command works again now by using KDESu::SuProcess instead \
of KDESu::KDEsuClient. The later's behavior was hard to understand, like which pw to \
enter and how long they will be kept, now the pw will be only kept for this command \
and has to be always reentered.

Further improvements:
*The input-fields look different when deactivated.
*Also automatically changes the focus to the username-input-field if "use as a \
different user" is enabled.

CCBUG:205229

 M  +3 -2      shell_config.cpp  
 M  +7 -21     shellrunner.cpp  


--- branches/KDE/4.5/kdebase/workspace/plasma/generic/runners/shell/shell_config.cpp \
#1198162:1198163 @@ -53,8 +53,9 @@
 
 void ShellConfig::slotUpdateUser(bool b)
 {
-    m_ui.leUsername->setEnabled(b);
-    m_ui.lePassword->setEnabled(b);
+    if (b) {
+        m_ui.leUsername->setFocus();
 }
+}
 
 #include "shell_config.moc"
--- branches/KDE/4.5/kdebase/workspace/plasma/generic/runners/shell/shellrunner.cpp \
#1198162:1198163 @@ -24,7 +24,7 @@
 #include <KAuthorized>
 #include <KDebug>
 #ifdef Q_OS_UNIX
-#include <KDEsuClient>
+#include <KDE/SuProcess>
 #endif
 #include <KIcon>
 #include <KLocale>
@@ -76,15 +76,6 @@
     }
 }
 
-#ifdef Q_OS_UNIX
-class MySuClient : public KDESu::KDEsuClient
-{
-public:
-    MySuClient() : KDESu::KDEsuClient() {}
-    ~MySuClient() { kDebug() << "buh bye"; }
-};
-#endif
-
 void ShellRunner::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch \
&match)  {
     Q_UNUSED(match);
@@ -103,7 +94,6 @@
                 // we have to reimplement this from KToolInvocation because we need \
to use KDESu  KConfigGroup confGroup( KGlobal::config(), "General" );
                 exec = confGroup.readPathEntry("TerminalApplication", "konsole");
-
                 if (!exec.isEmpty()) {
                     if (exec == "konsole") {
                         args += " --noclose";
@@ -124,18 +114,14 @@
 
             if (!exec.isEmpty()) {
                 exec = KStandardDirs::findExe(exec);
+                exec.append(args);
                 if (!exec.isEmpty()) {
-                    KDESu::KDEsuClient client;
-                    client.startServer();
-                    //kDebug() << "executing" << exec << m_username << m_password << \
                args;
-                    if (client.exec(exec.toLocal8Bit(), m_username.toLocal8Bit(), \
                args.toLocal8Bit()) == -1) {
-                        if (!m_password.isEmpty()) {
+                    KDESu::SuProcess client(m_username.toLocal8Bit(), \
                exec.toLocal8Bit());
                             const QByteArray password = m_password.toLocal8Bit();
-                            client.exec(exec.toLocal8Bit(), \
m_username.toLocal8Bit(), args.toLocal8Bit()); +                    //TODO handle \
errors like wrong password via KNotifications in 4.7 +                    \
client.exec(password.constData());  }
                     }
-                }
-            }
         } else
 #endif
         if (m_inTerminal) {
@@ -160,8 +146,8 @@
 
     QPalette pal = configWidget->palette();
     Plasma::Theme *theme = Plasma::Theme::defaultTheme();
-    pal.setColor(QPalette::Window, theme->color(Plasma::Theme::BackgroundColor));
-    pal.setColor(QPalette::WindowText, theme->color(Plasma::Theme::TextColor));
+    pal.setColor(QPalette::Normal, QPalette::Window, \
theme->color(Plasma::Theme::BackgroundColor)); +    pal.setColor(QPalette::Normal, \
QPalette::WindowText, theme->color(Plasma::Theme::TextColor));  \
configWidget->setPalette(pal);  
     connect(configWidget->m_ui.cbRunAsOther, SIGNAL(clicked(bool)), this, \
SLOT(setRunAsOtherUser(bool)));


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

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