Sandboxie/SandboxiePlus/SandMan/BoxJob.h

67 lines
1.5 KiB
C
Raw Normal View History

2022-02-05 14:09:53 +00:00
#pragma once
#include "../QSbieAPI/SbieStatus.h"
#include "../QSbieAPI/SbieAPI.h"
class CSandBoxPlus;
class CBoxJob : public QObject
{
Q_OBJECT
public:
CBoxJob(QObject* parent = NULL) : QObject(parent) { }
virtual SB_PROGRESS Start() = 0;
2023-01-29 09:49:41 +00:00
virtual void Finished() = 0;
2022-02-05 14:09:53 +00:00
CSbieProgressPtr GetProgress() { return m_pProgress; }
QString GetDescription(){ return m_Description; }
CSandBoxPlus* GetBox() { return (CSandBoxPlus*)parent(); }
protected:
CSbieProgressPtr m_pProgress;
QString m_Description;
};
///////////////////////////////////////////////////////////////////////////////
// CCleanUpBoxJob
//
class CCleanUpJob : public CBoxJob
{
protected:
friend CSandBoxPlus;
2023-02-03 07:00:11 +00:00
CCleanUpJob(CSandBoxPlus* pBox, bool DeleteSnapshots = true, bool bOnAutoDelete = false) : CBoxJob((QObject*)pBox) {
2022-02-05 14:09:53 +00:00
m_Description = tr("Deleting Content");
2023-02-03 07:00:11 +00:00
m_DeleteSnapshots = DeleteSnapshots;
2022-02-05 14:09:53 +00:00
m_bOnAutoDelete = bOnAutoDelete;
}
virtual SB_PROGRESS Start();
2023-01-29 09:49:41 +00:00
virtual void Finished();
2022-02-05 14:09:53 +00:00
protected:
2023-02-03 07:00:11 +00:00
bool m_DeleteSnapshots;
2022-02-05 14:09:53 +00:00
bool m_bOnAutoDelete;
};
///////////////////////////////////////////////////////////////////////////////
// COnDeleteJob
//
class COnDeleteJob : public CBoxJob
{
protected:
friend CSandBoxPlus;
COnDeleteJob(CSandBoxPlus* pBox, const QString& Command) : CBoxJob((QObject*)pBox) {
m_Description = tr("OnDelete: %1").arg(Command);
m_Command = Command;
}
virtual SB_PROGRESS Start();
2023-01-29 09:49:41 +00:00
virtual void Finished() {}
2022-02-05 14:09:53 +00:00
protected:
QString m_Command;
};