calamares/src/modules/partition/jobs/RemoveVolumeGroupJob.cpp
Adriaan de Groot e37c7da60d [partition] Introduce dummy argument to LVM jobs
- Give LVM jobs a dummy argument Device* so that they
  fit the functionality of makeJob for partitioning.
  For those jobs that already take an LVMDevice*, this should
  be the self-same device, but that isn't checked.
2020-09-21 16:46:24 +02:00

56 lines
1.4 KiB
C++

/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2018 Caio Jordão Carvalho <caiojcarvalho@gmail.com>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Calamares is Free Software: see the License-Identifier above.
*
*/
#include "RemoveVolumeGroupJob.h"
#include <kpmcore/core/lvmdevice.h>
#include <kpmcore/ops/removevolumegroupoperation.h>
#include <kpmcore/util/report.h>
RemoveVolumeGroupJob::RemoveVolumeGroupJob( Device*, LvmDevice* device )
: m_device( device )
{
}
QString
RemoveVolumeGroupJob::prettyName() const
{
return tr( "Remove Volume Group named %1." ).arg( m_device->name() );
}
QString
RemoveVolumeGroupJob::prettyDescription() const
{
return tr( "Remove Volume Group named <strong>%1</strong>." ).arg( m_device->name() );
}
QString
RemoveVolumeGroupJob::prettyStatusMessage() const
{
return tr( "Remove Volume Group named %1." ).arg( m_device->name() );
}
Calamares::JobResult
RemoveVolumeGroupJob::exec()
{
Report report( nullptr );
RemoveVolumeGroupOperation op( *m_device );
op.setStatus( Operation::OperationStatus::StatusRunning );
QString message = tr( "The installer failed to remove a volume group named '%1'." ).arg( m_device->name() );
if ( op.execute( report ) )
{
return Calamares::JobResult::ok();
}
return Calamares::JobResult::error( message, report.toText() );
}