|
@@ -758,87 +758,6 @@ void Loader::abortTestingFans()
|
|
|
hwmon->abortTestingFans();
|
|
|
}
|
|
|
|
|
|
-void Loader::detectSensors()
|
|
|
-{
|
|
|
- emit info(i18n("Start detecting Sensors"));
|
|
|
- auto program = QStringLiteral("sensors-detect");
|
|
|
- auto arguments = QStringList() << QStringLiteral("--auto");
|
|
|
-
|
|
|
- auto process = new QProcess(this);
|
|
|
- process->start(program, arguments);
|
|
|
-
|
|
|
- connect(process, static_cast<void(QProcess::*)(int)>(&QProcess::finished),
|
|
|
- this, static_cast<void(Loader::*)(int)>(&Loader::handleDetectSensorsResult));
|
|
|
-}
|
|
|
-
|
|
|
-void Loader::handleDetectSensorsResult(int exitCode)
|
|
|
-{
|
|
|
- auto process = qobject_cast<QProcess *>(sender());
|
|
|
-
|
|
|
- if (exitCode)
|
|
|
- {
|
|
|
- if (process)
|
|
|
- emit error(process->readAllStandardOutput());
|
|
|
-
|
|
|
- auto action = newFancontrolAction();
|
|
|
-
|
|
|
- if (action.isValid())
|
|
|
- {
|
|
|
- QVariantMap map;
|
|
|
- map[QStringLiteral("action")] = QVariant("detectSensors");
|
|
|
-
|
|
|
- action.setArguments(map);
|
|
|
- auto job = action.execute();
|
|
|
-
|
|
|
- connect(job, &KAuth::ExecuteJob::result, this, static_cast<void(Loader::*)(KJob *)>(&Loader::handleDetectSensorsResult));
|
|
|
- job->start();
|
|
|
- }
|
|
|
- else
|
|
|
- emit error(i18n("Action not supported! Try running the application as root."), true);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (!m_sensorsDetected)
|
|
|
- {
|
|
|
- m_sensorsDetected = true;
|
|
|
- emit sensorsDetectedChanged();
|
|
|
- }
|
|
|
-
|
|
|
- parseHwmons();
|
|
|
- }
|
|
|
-
|
|
|
- if (process)
|
|
|
- process->deleteLater();
|
|
|
-
|
|
|
- emit info(i18n("Finished detecting Sensors"));
|
|
|
-}
|
|
|
-
|
|
|
-void Loader::handleDetectSensorsResult(KJob *job)
|
|
|
-{
|
|
|
- if (job->error())
|
|
|
- {
|
|
|
- if (job->error() == 4)
|
|
|
- {
|
|
|
-// qDebug() << "Aborted by user";
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- emit error(job->errorString() + job->errorText(), true);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (!m_sensorsDetected)
|
|
|
- {
|
|
|
- m_sensorsDetected = true;
|
|
|
- emit sensorsDetectedChanged();
|
|
|
- }
|
|
|
-
|
|
|
- parseHwmons();
|
|
|
- }
|
|
|
-
|
|
|
- emit info(i18n("Finished detecting Sensors"));
|
|
|
-}
|
|
|
-
|
|
|
QList<QObject *> Loader::hwmonsAsObjects() const
|
|
|
{
|
|
|
auto list = QList<QObject *>();
|