Commit ec0e1847 authored by Méven Car's avatar Méven Car
Browse files

[KCM/Datetime] Convert a foreach, port away from KStandardDirs

Reviewers: ervin, #plasma

Reviewed By: ervin

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D26295
parent 83b42833
......@@ -43,7 +43,6 @@
#include <QVBoxLayout>
#include <QDebug>
#include <kprocess.h>
#include <kstandarddirs.h>
#include <kmessagebox.h>
#include <kdialog.h>
#include <kconfig.h>
......@@ -154,15 +153,17 @@ void Dtime::findNTPutility(){
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;
}
......
......@@ -227,7 +227,7 @@ int ClockHelper::tzreset()
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"));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment