HaikuDepot: Add UninstallPackageAction class. Not yet used.

This commit is contained in:
Rene Gollent 2013-09-19 11:55:58 +02:00
parent db259584ca
commit f7bf1d3282

View File

@ -89,6 +89,42 @@ public:
};
// #pragma mark - UninstallPackageAction
class UninstallPackageAction : public PackageAction {
public:
UninstallPackageAction(const PackageInfo& package, PackageManager* manager)
:
PackageAction(package, manager)
{
}
virtual const char* Label() const
{
return B_TRANSLATE("Uninstall");
}
virtual status_t Perform()
{
const char* packageName = Package().Title().String();
try {
fPackageManager->Uninstall(&packageName, 1);
} catch (BFatalErrorException ex) {
fprintf(stderr, "Fatal error occurred while uninstalling package "
"%s: %s (%s)\n", packageName, ex.Message().String(),
ex.Details().String());
return ex.Error();
} catch (BException ex) {
fprintf(stderr, "Exception occurred while uninstalling package "
"%s: %s\n", packageName, ex.Message().String());
}
return B_OK;
}
};
// #pragma mark - PackageManager