void deleteItem(GroupItem *item);
Ui::GenItem *getNextItem(Model::Group &group);
+ void createDeletePopup(Ux::SelectResults results);
bool onDeleteFinished();
void onDeleteSelected(Ux::SelectResults results, void *data);
void deleteGroups(Ux::SelectResults results, bool shouldDeleteMembers);
setCancelCallback(std::bind(&GroupsView::onDeleteFinished, this));
setSelectCallback([this](SelectResults results) {
- ListPopup *popup = new ListPopup();
- popup->create(getEvasObject());
- popup->setTitle("IDS_PB_HEADER_DELETE_GROUPS_ABB");
-
- popup->addItem("IDS_PB_OPT_GROUPS_ONLY_ABB", (void *)false);
- popup->addItem("IDS_PB_OPT_GROUPS_AND_MEMBERS_ABB", (void *)true);
- popup->setSelectCallback(std::bind(&GroupsView::onDeleteSelected,
- this, std::move(results), _1));
- popup->show();
-
+ bool hasMembers = false;
+ for (auto &&result : results) {
+ if (static_cast<Group *>(result.value.data)->getMembersCount()) {
+ hasMembers = true;
+ break;
+ }
+ }
+ if (hasMembers) {
+ createDeletePopup(std::move(results));
+ } else {
+ onDeleteSelected(std::move(results), (void *)false);
+ }
return false;
});
});
return m_CreateItem;
}
+void GroupsView::createDeletePopup(SelectResults results)
+{
+ ListPopup *popup = new ListPopup();
+ popup->create(getEvasObject());
+ popup->setTitle("IDS_PB_HEADER_DELETE_GROUPS_ABB");
+
+ popup->addItem("IDS_PB_OPT_GROUPS_ONLY_ABB", (void *)false);
+ popup->addItem("IDS_PB_OPT_GROUPS_AND_MEMBERS_ABB", (void *)true);
+ popup->setSelectCallback(std::bind(&GroupsView::onDeleteSelected,
+ this, std::move(results), _1));
+ popup->show();
+}
+
bool GroupsView::onDeleteFinished()
{
setSelectMode(SelectNone);