File indexing completed on 2024-04-28 05:45:53

0001 /*
0002     SPDX-FileCopyrightText: 2008-2010 Volker Lanz <vl@fidra.de>
0003     SPDX-FileCopyrightText: 2016-2018 Andrius Štikonas <andrius@stikonas.eu>
0004 
0005     SPDX-License-Identifier: GPL-3.0-or-later
0006 */
0007 
0008 #include "jobs/checkfilesystemjob.h"
0009 #include "core/partition.h"
0010 #include "fs/filesystem.h"
0011 #include "util/report.h"
0012 
0013 #include <QDebug>
0014 
0015 #include <KLocalizedString>
0016 
0017 /** Creates a new CheckFileSystemJob
0018     @param p the Partition whose FileSystem is to be checked
0019 */
0020 CheckFileSystemJob::CheckFileSystemJob(Partition& p) :
0021     Job(),
0022     m_Partition(p)
0023 {
0024 }
0025 
0026 bool CheckFileSystemJob::run(Report& parent)
0027 {
0028     Report* report = jobStarted(parent);
0029 
0030     // if we cannot check, assume everything is fine
0031     bool rval = true;
0032 
0033     if (partition().fileSystem().supportCheck() == FileSystem::cmdSupportFileSystem)
0034         rval = partition().fileSystem().check(*report, partition().deviceNode());
0035 
0036     jobFinished(*report, rval);
0037 
0038     return rval;
0039 }
0040 
0041 QString CheckFileSystemJob::description() const
0042 {
0043     return xi18nc("@info:progress", "Check file system on partition <filename>%1</filename>", partition().deviceNode());
0044 }