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

List:       kde-commits
Subject:    Re: [kdelibs/frameworks] kdecore/util: Respect the HOME environment variable
From:       Lukáš Tinkl <ltinkl () redhat ! com>
Date:       2013-06-11 11:26:07
Message-ID: 51B7094F.7050006 () redhat ! com
[Download RAW message or body]

Dne 11.6.2013 13:00, Kevin Ottens napsal(a):
> Git commit 07ce6442a3d30e82df750c2c81d9af0edf97c1b0 by Kevin Ottens, on behalf of Jon Severinsson.
> Committed on 14/01/2013 at 16:52.
> Pushed by ervin into branch 'frameworks'.
>
> Respect the HOME environment variable
>
> This turns KUser::homeDir (and thus KShell::tildeExpand) closer to
> QDir::homePath, which only consults the environment variable.
>
> REVIEW: 108389
>
> M  +4    -1    kdecore/util/kuser_unix.cpp
>
> http://commits.kde.org/kdelibs/07ce6442a3d30e82df750c2c81d9af0edf97c1b0
>
> diff --git a/kdecore/util/kuser_unix.cpp b/kdecore/util/kuser_unix.cpp
> index 6a612a6..f6e8589 100644
> --- a/kdecore/util/kuser_unix.cpp
> +++ b/kdecore/util/kuser_unix.cpp
> @@ -64,7 +64,10 @@ public:
>               properties[KUser::RoomNumber] = QVariant(gecosList[1]);
>               properties[KUser::WorkPhone] = QVariant(gecosList[2]);
>               properties[KUser::HomePhone] = QVariant(gecosList[3]);
> -            homeDir = QString::fromLocal8Bit(p->pw_dir);
> +            if (uid == ::getuid() && uid == ::geteuid())
> +                homeDir = QString::fromLocal8Bit(qgetenv("HOME"));
> +            if (homeDir.isEmpty())
> +                homeDir = QString::fromLocal8Bit(p->pw_dir);
>               shell = QString::fromLocal8Bit(p->pw_shell);
>           }
>       }
>

QFile::decodeName() works better for paths

-- 
Lukáš Tinkl <ltinkl@redhat.com>
Software Engineer - KDE desktop team, Brno
KDE developer <lukas@kde.org>
Red Hat Inc.                               http://cz.redhat.com
[prev in list] [next in list] [prev in thread] [next in thread] 

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