Add feed-removal confirmation alert

This commit is contained in:
Jaidyn Ann 2021-03-24 13:06:00 -05:00
parent 59c9cc5c3f
commit cf5a6ce843

View File

@ -5,6 +5,7 @@
#include "FeedsView.h" #include "FeedsView.h"
#include <Alert.h>
#include <Catalog.h> #include <Catalog.h>
#include <Message.h> #include <Message.h>
#include <GroupView.h> #include <GroupView.h>
@ -197,6 +198,16 @@ FeedsView::_EditSelectedFeed()
void void
FeedsView::_RemoveSelectedFeed() FeedsView::_RemoveSelectedFeed()
{ {
BAlert* alert = new BAlert(B_TRANSLATE("Confirm removal"),
B_TRANSLATE("Are you sure you want to remove the selected feed?"),
NULL, B_TRANSLATE("OK"), B_TRANSLATE("Cancel"),
B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->SetShortcut(1, B_ESCAPE);
int32 button = alert->Go();
if (button != 0)
return;
int32 selIndex = fFeedsListView->CurrentSelection(); int32 selIndex = fFeedsListView->CurrentSelection();
FeedListItem* selected = (FeedListItem*)fFeedsListView->ItemAt(selIndex); FeedListItem* selected = (FeedListItem*)fFeedsListView->ItemAt(selIndex);
Feed delFeed = Feed(BEntry(selected->FeedPath())); Feed delFeed = Feed(BEntry(selected->FeedPath()));