HaikuDepot: Show alert when scheduling package action failed

This commit is contained in:
Stephan Aßmus 2014-10-12 23:16:52 +02:00
parent c8b83b1708
commit 1783f96af9
1 changed files with 13 additions and 2 deletions

View File

@ -8,6 +8,7 @@
#include <algorithm>
#include <stdio.h>
#include <Alert.h>
#include <Autolock.h>
#include <Bitmap.h>
#include <Button.h>
@ -612,8 +613,18 @@ public:
->SchedulePackageActions(actions);
if (result != B_OK) {
fprintf(stderr, "Failed to schedule action: "
"%s '%s'\n", action->Label(),
action->Package()->Title().String());
"%s '%s': %s\n", action->Label(),
action->Package()->Title().String(),
strerror(result));
BString message(B_TRANSLATE("The package action "
"could not be scheduled: %Error%"));
message.ReplaceAll("%Error%", strerror(result));
BAlert* alert = new(std::nothrow) BAlert(
B_TRANSLATE("Package action failed"),
message, B_TRANSLATE("OK"), NULL, NULL,
B_WIDTH_AS_USUAL, B_WARNING_ALERT);
if (alert != NULL)
alert->Go();
}
}
}