File kdesu-add-some-i18n-love.patch of Package kdebase4-runtime
From abee9c239f74f60a77c0931be23ad1d8670feda6 Mon Sep 17 00:00:00 2001
From: Hrvoje Senjan <hrvoje.senjan@gmail.com>
Date: Tue, 3 Dec 2013 19:31:13 +0100
Subject: [PATCH 1/1] kdesu Add some love
From/toUTF8 in practice covers more ground than 8bit.
Furthermore, make the kdesu 'command' translatable, it's used
in openSUSE with dolphin and konsole 'Start as root'
BUG: bnc#852256
---
kdesu/kdesu/kdesu.cpp | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/kdesu/kdesu/kdesu.cpp b/kdesu/kdesu/kdesu.cpp
index 2c181df..e871a1c 100644
--- a/kdesu/kdesu/kdesu.cpp
+++ b/kdesu/kdesu/kdesu.cpp
@@ -141,7 +141,7 @@ int main(int argc, char *argv[])
if (result == 127 && !commandWasOk)
{
- KMessageBox::sorry(0, i18n("Cannot execute command '%1'.", QString::fromLocal8Bit(command)));
+ KMessageBox::sorry(0, i18n("Cannot execute command '%1'.", QString::fromUtf8(command)));
}
return result;
@@ -177,7 +177,7 @@ static int startApp()
prompt = false;
// Get target uid
- QByteArray user = args->getOption("u").toLocal8Bit();
+ QByteArray user = args->getOption("u").toUtf8();
QByteArray auth_user = user;
struct passwd *pw = getpwnam(user);
if (pw == 0L)
@@ -238,7 +238,7 @@ static int startApp()
// Get command
if (args->isSet("c"))
{
- command = args->getOption("c").toLocal8Bit();
+ command = args->getOption("c").toUtf8();
// Accepting additional arguments here is somewhat weird,
// but one can conceive use cases: have a complex command with
// redirections and additional file names which need to be quoted
@@ -257,7 +257,7 @@ static int startApp()
command += ' ';
command += QFile::encodeName(KShell::quoteArg(args->arg(i)));
}
- QStringList commandItems = QString::fromLocal8Bit( command ).split( ' ' );
+ QStringList commandItems = QString::fromUtf8( command ).split( ' ' );
commandWasOk = ( !commandItems.isEmpty() && !KStandardDirs::findExe( commandItems.first()).isEmpty());
// Don't change uid if we're don't need to.
@@ -327,7 +327,7 @@ static int startApp()
}
KUser u;
- env << (QByteArray) ("KDESU_USER=" + u.loginName().toLocal8Bit());
+ env << (QByteArray) ("KDESU_USER=" + u.loginName().toUtf8());
if (keep && !terminal && !just_started)
{
@@ -436,7 +436,7 @@ static int startApp()
}
else if (keep && have_daemon)
{
- client.setPass(password.toLocal8Bit(), timeout);
+ client.setPass(password.toUtf8(), timeout);
client.setPriority(priority);
client.setScheduler(scheduler);
int result = client.exec(command, user, options, env);
@@ -455,7 +455,7 @@ static int startApp()
proc.setPriority(priority);
proc.setScheduler(scheduler);
proc.setCommand(command);
- int result = proc.exec(password.toLocal8Bit());
+ int result = proc.exec(password.toUtf8());
return result;
}
return -1;
--
1.8.4.4