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:25:34 +03:00
parent 68af32dbe4
commit 07522192c3
4 changed files with 10 additions and 10 deletions

View file

@ -131,7 +131,7 @@ void KMimeTypeTest::initTestCase()
if ( mustUpdateKSycoca ) {
// Update ksycoca in ~/.kde-unit-test after creating the above
QProcess::execute( KGlobal::dirs()->findExe(KBUILDSYCOCA_EXENAME) );
QProcess::execute( KStandardDirs::findExe(KBUILDSYCOCA_EXENAME) );
}
QVERIFY(KService::serviceByStorageId("fake_nonkde_application.desktop"));

View file

@ -112,7 +112,7 @@ void KServiceTest::initTestCase()
if ( mustUpdateKSycoca ) {
// Update ksycoca in ~/.kde-unit-test after creating the above
QProcess::execute( KGlobal::dirs()->findExe(KBUILDSYCOCA_EXENAME), QStringList() << "--noincremental" );
QProcess::execute( KStandardDirs::findExe(KBUILDSYCOCA_EXENAME), QStringList() << "--noincremental" );
kDebug() << "waiting for signal";
QVERIFY(QTest::kWaitForSignal(KSycoca::self(), SIGNAL(databaseChanged(QStringList)), 10000));
kDebug() << "got signal";
@ -498,7 +498,7 @@ void KServiceTest::testKSycocaUpdate()
QVERIFY(spy.isValid());
QFile::remove(servPath);
kDebug() << QThread::currentThread() << "executing kbuildsycoca";
QProcess::execute( KGlobal::dirs()->findExe(KBUILDSYCOCA_EXENAME) );
QProcess::execute( KStandardDirs::findExe(KBUILDSYCOCA_EXENAME) );
kDebug() << QThread::currentThread() << "done";
while (spy.isEmpty())
QTest::qWait(50);
@ -515,7 +515,7 @@ void KServiceTest::testKSycocaUpdate()
createFakeService();
QVERIFY(QFile::exists(servPath));
kDebug() << QThread::currentThread() << "executing kbuildsycoca (2)";
QProcess::execute( KGlobal::dirs()->findExe(KBUILDSYCOCA_EXENAME) );
QProcess::execute( KStandardDirs::findExe(KBUILDSYCOCA_EXENAME) );
kDebug() << QThread::currentThread() << "done (2)";
while (spy.isEmpty())
QTest::qWait(50);

View file

@ -946,7 +946,7 @@ void FileProtocol::mount( bool _ro, const char *_fstype, const QString& _dev, co
bool fstype_empty = !_fstype || !*_fstype;
QByteArray fstype = KShell::quoteArg(QString::fromLatin1(_fstype)).toLatin1(); // good guess
QByteArray readonly = _ro ? "-r" : "";
QByteArray mountProg = KGlobal::dirs()->findRootExe(QLatin1String("mount")).toLocal8Bit();
QByteArray mountProg = KStandardDirs::findRootExe(QLatin1String("mount")).toLocal8Bit();
if (mountProg.isEmpty()){
error( KIO::ERR_COULD_NOT_MOUNT, i18n("Could not find program \"mount\""));
return;
@ -1090,7 +1090,7 @@ void FileProtocol::unmount( const QString& _point )
ptr = strrchr( devname, '/' );
*ptr = '\0';
QByteArray ejectProg = KGlobal::dirs()->findRootExe(QLatin1String("eject")).toLocal8Bit();
QByteArray ejectProg = KStandardDirs::findRootExe(QLatin1String("eject")).toLocal8Bit();
if (ejectProg.isEmpty()) {
error( KIO::ERR_COULD_NOT_UNMOUNT, i18n("Could not find program \"eject\""));
@ -1127,7 +1127,7 @@ void FileProtocol::unmount( const QString& _point )
return;
}
#else
QByteArray umountProg = KGlobal::dirs()->findRootExe(QLatin1String("umount")).toLocal8Bit();
QByteArray umountProg = KStandardDirs::findRootExe(QLatin1String("umount")).toLocal8Bit();
if (umountProg.isEmpty()) {
error( KIO::ERR_COULD_NOT_UNMOUNT, i18n("Could not find program \"umount\""));
@ -1152,7 +1152,7 @@ void FileProtocol::unmount( const QString& _point )
bool FileProtocol::pmount(const QString &dev)
{
QString pmountProg = KGlobal::dirs()->findRootExe(QLatin1String("pmount"));
QString pmountProg = KStandardDirs::findRootExe(QLatin1String("pmount"));
if (pmountProg.isEmpty())
return false;
@ -1173,7 +1173,7 @@ bool FileProtocol::pumount(const QString &point)
QString dev = mp->realDeviceName();
if (dev.isEmpty()) return false;
QString pumountProg = KGlobal::dirs()->findRootExe(QLatin1String("pumount"));
QString pumountProg = KStandardDirs::findRootExe(QLatin1String("pumount"));
if (pumountProg.isEmpty())
return false;

View file

@ -217,7 +217,7 @@ QProcess *Solid::Backends::Fstab::FstabHandling::callSystemCommand(const QString
const QStringList &args,
QObject *obj, const char *slot)
{
QString commandExe = KGlobal::dirs()->findRootExe(commandName);
QString commandExe = KStandardDirs::findRootExe(commandName);
if (commandExe.isEmpty()) {
return 0;
}