generic: avoid global static KStandardDirs instance access

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2021-06-15 05:17:45 +03:00
parent ff8a5fea40
commit be7d2cf633
5 changed files with 14 additions and 9 deletions

View file

@ -51,7 +51,7 @@ QString getSetxkbmapExe()
return "";
if( setxkbmapExe.isEmpty() ) {
setxkbmapExe = KGlobal::dirs()->findExe(SETXKBMAP_EXEC);
setxkbmapExe = KStandardDirs::findExe(SETXKBMAP_EXEC);
if( setxkbmapExe.isEmpty() ) {
setxkbmapNotFound = true;
kError() << "Can't find" << SETXKBMAP_EXEC << "- keyboard layouts won't be configured";
@ -70,7 +70,7 @@ void executeXmodmap(const QString& configFileName)
if( QFile(configFileName).exists() ) {
if( xmodmapExe.isEmpty() ) {
xmodmapExe = KGlobal::dirs()->findExe(XMODMAP_EXEC);
xmodmapExe = KStandardDirs::findExe(XMODMAP_EXEC);
if( xmodmapExe.isEmpty() ) {
xmodmapNotFound = true;
kError() << "Can't find" << XMODMAP_EXEC << "- xmodmap files won't be run";

View file

@ -21,6 +21,7 @@
#include <QtCore/QFile>
#include <QtCore/QCoreApplication>
#include <QtCore/QProcess>
#include <QtDBus/QtDBus>
#include <kaboutdata.h>
@ -146,13 +147,17 @@ int main(int argc, char **argv)
args.append("--incremental");
args.append("--checkstamps");
QString command = KStandardDirs::findExe(KBUILDSYCOCA_EXENAME);
if (command.isEmpty())
{
error(4, i18n("Could not find '%1' executable.", KBUILDSYCOCA_EXENAME));
}
QDBusMessage reply = KToolInvocation::klauncher()->call("kdeinit_exec_wait", command, args, QStringList(), QString());
if (reply.type() != QDBusMessage::ReplyMessage)
{
qWarning("Can not talk to klauncher!");
command = KGlobal::dirs()->findExe(command);
command += ' ' + args.join(" ");
system(command.toLocal8Bit());
if (QProcess::execute(command, args) != 0) {
error(5, i18n("Could not execute '%1'.", KBUILDSYCOCA_EXENAME));
}
}
}

View file

@ -193,7 +193,7 @@ void KHostName::changeStdDirs(const QByteArray &type)
}
if (result != 0)
{
const QString lnusertemp = KGlobal::dirs()->findExe( "lnusertemp" );
const QString lnusertemp = KStandardDirs::findExe( "lnusertemp" );
QProcess::execute( lnusertemp, QStringList() << type );
}
}

View file

@ -456,7 +456,7 @@ Status SetAuthentication (int count, IceListenObj *listenObjs,
fclose(addAuthFile);
fclose(remAuthFile);
QString iceAuth = KGlobal::dirs()->findExe("iceauth");
QString iceAuth = KStandardDirs::findExe("iceauth");
if (iceAuth.isEmpty())
{
qWarning("KSMServer: could not find iceauth");
@ -484,7 +484,7 @@ void FreeAuthenticationData(int count, IceAuthDataEntry *authDataEntries)
free (authDataEntries);
QString iceAuth = KGlobal::dirs()->findExe("iceauth");
QString iceAuth = KStandardDirs::findExe("iceauth");
if (iceAuth.isEmpty())
{
qWarning("KSMServer: could not find iceauth");

View file

@ -117,7 +117,7 @@ void KWalletExecuter::execute_kwallet(int toWalletPipe[2], int envSocket)
sprintf(sockIn, "%d", envSocket);
qDebug() << "Executing kwalletd";
QByteArray wallet = KStandardDirs::locate("exe", "kwalletd").toLocal8Bit();
QByteArray wallet = KStandardDirs::findExec("kwalletd").toLocal8Bit();
char *args[] = {wallet.data(), (char*)"--pam-login", pipeInt, sockIn, NULL};
execve(args[0], args, environ);
qFatal("Couldn't execute kwalletd");