2022-02-05 14:09:53 +00:00
|
|
|
#include "stdafx.h"
|
|
|
|
#include "BoxJob.h"
|
|
|
|
#include "SbiePlusAPI.h"
|
|
|
|
#include "../QSbieAPI/SbieUtils.h"
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// CCleanUpJob
|
|
|
|
//
|
|
|
|
|
|
|
|
SB_PROGRESS CCleanUpJob::Start()
|
|
|
|
{
|
|
|
|
CSandBoxPlus* pBox = GetBox();
|
|
|
|
|
|
|
|
SB_PROGRESS Status;
|
2023-02-03 07:00:11 +00:00
|
|
|
if (!m_DeleteSnapshots && pBox->HasSnapshots()) {
|
2022-02-05 14:09:53 +00:00
|
|
|
QString Current;
|
|
|
|
QString Default = pBox->GetDefaultSnapshot(&Current);
|
|
|
|
if (m_bOnAutoDelete) {
|
|
|
|
Default = Current; // on auto delete always return to the latest
|
|
|
|
}
|
|
|
|
Status = pBox->SelectSnapshot(Default);
|
|
|
|
}
|
|
|
|
else // if there are no snapshots jut use the normal cleaning procedure
|
|
|
|
Status = pBox->CleanBox();
|
|
|
|
|
|
|
|
if (Status.GetStatus() == OP_ASYNC)
|
|
|
|
m_pProgress = Status.GetValue();
|
|
|
|
|
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
2023-01-29 09:49:41 +00:00
|
|
|
void CCleanUpJob::Finished()
|
|
|
|
{
|
|
|
|
CSandBoxPlus* pBox = GetBox();
|
|
|
|
|
|
|
|
emit theAPI->BoxCleaned(pBox);
|
|
|
|
}
|
|
|
|
|
2022-02-05 14:09:53 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// COnDeleteJob
|
|
|
|
//
|
|
|
|
|
|
|
|
SB_PROGRESS COnDeleteJob::Start()
|
|
|
|
{
|
|
|
|
m_pProgress = CSbieUtils::RunCommand(m_Command, true);
|
|
|
|
if (m_pProgress.isNull())
|
|
|
|
return SB_ERR();
|
|
|
|
return SB_PROGRESS(OP_ASYNC, m_pProgress);
|
|
|
|
}
|