2 * KFontInst - KDE Font Installer
4 * Copyright 2003-2007 Craig Drummond <craig@kde.org>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; see the file COPYING. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
25 #include "KfiConstants.h"
26 #include <QtCore/QFile>
28 #include <KDE/KStandardDirs>
29 #include <KDE/SuProcess>
32 #include <config-workspace.h>
37 CSuProc::CSuProc(QByteArray
&sock
, QString
&passwd
)
40 QString
exe(KStandardDirs::findExe(QLatin1String("kio_fonts_helper"), KStandardDirs::installPath("libexec")));
43 kError(7000) << "Could not locate kio_fonts_helper";
46 itsCmd
=QByteArray(QFile::encodeName(KShell::quoteArg(exe
)));
49 itsCmd
+=QFile::encodeName(KShell::quoteArg(sock
));
51 itsCmd
+=QString().setNum(getuid()).toLatin1();
59 KDESu::SuProcess
proc(KFI_SYS_USER
);
60 proc
.setCommand(itsCmd
);
61 proc
.exec(itsPasswd
.toLocal8Bit());