diff --git a/kcms/dateandtime/dtime.cpp b/kcms/dateandtime/dtime.cpp --- a/kcms/dateandtime/dtime.cpp +++ b/kcms/dateandtime/dtime.cpp @@ -43,7 +43,6 @@ #include #include #include -#include #include #include #include @@ -154,15 +153,17 @@ envpath.remove(0, 1); } - QString path = QStringLiteral("/sbin:/usr/sbin:"); + QStringList path = {"/sbin", "/usr/sbin"}; if (!envpath.isEmpty()) { - path += QFile::decodeName(envpath); + path += QFile::decodeName(envpath).split(QLatin1Char(':')); } else { - path += QLatin1String("/bin:/usr/bin"); + path += {"/bin", "/usr/bin"}; } - foreach(const QString &possible_ntputility, QStringList() << "ntpdate" << "rdate" ) { - if( !((ntpUtility = KStandardDirs::findExe(possible_ntputility, path)).isEmpty()) ) { + const auto possible_ntputilities = {"ntpdate", "rdate"}; + for (const QString &possible_ntputility : possible_ntputilities) { + auto ntpUtility = QStandardPaths::findExecutable(possible_ntputility, path); + if (!ntpUtility.isEmpty()) { qDebug() << "ntpUtility = " << ntpUtility; return; } diff --git a/kcms/dateandtime/helper.cpp b/kcms/dateandtime/helper.cpp --- a/kcms/dateandtime/helper.cpp +++ b/kcms/dateandtime/helper.cpp @@ -227,7 +227,7 @@ void ClockHelper::toHwclock() { - QString hwclock = KStandardDirs::findExe(QStringLiteral("hwclock"), exePath); + QString hwclock = QStandardPaths::findExecutable(QStringLiteral("hwclock"), exePath.split(QLatin1Char(':'))); if (!hwclock.isEmpty()) { KProcess::execute(hwclock, QStringList() << QStringLiteral("--systohc")); }