Failure to remove a tag shouldn't be fatal

This commit is contained in:
Tamás Bálint Misius 2020-02-02 12:16:04 +01:00
parent a3d51b4138
commit cb419cd85c
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2
2 changed files with 10 additions and 6 deletions

View File

@ -83,7 +83,16 @@ void TagsView::NotifyTagsChanged(TagsModel * sender)
tempButton->Appearance.Margin.Top += 2;
tempButton->Appearance.HorizontalAlign = ui::Appearance::AlignCentre;
tempButton->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
tempButton->SetActionCallback({ [this, tag] { c->RemoveTag(tag); } });
tempButton->SetActionCallback({ [this, tag] {
try
{
c->RemoveTag(tag);
}
catch(TagsModelException & ex)
{
new ErrorMessage("Could not remove tag", ByteString(ex.what()).FromUtf8());
}
} });
tags.push_back(tempButton);
AddComponent(tempButton);
}
@ -125,7 +134,3 @@ void TagsView::addTag()
}
tagInput->SetText("");
}
TagsView::~TagsView() {
}

View File

@ -27,7 +27,6 @@ public:
void AttachController(TagsController * c_) { c = c_; }
void OnKeyPress(int key, int scan, bool repeat, bool shift, bool ctrl, bool alt) override;
void NotifyTagsChanged(TagsModel * sender);
virtual ~TagsView();
};
#endif /* TAGSVIEW_H_ */