MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / deleteContainer

Method deleteContainer

source/ui/controls/containersView.cpp:537–570  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

535}
536
537void ContainersView::deleteContainer(BoxedContainer* container) {
538 BString label;
539 if (!container->getApps().size()) {
540 label = getTranslationWithFormat(Msg::CONTAINER_VIEW_DELETE_CONFIRMATION, true, container->getName());
541 } else {
542 label = "";
543
544 for (auto& app : container->getApps()) {
545 if (label.length() != 0) {
546 label += ", ";
547 }
548 label += app->getName();
549 }
550 label = getTranslationWithFormat(Msg::CONTAINER_VIEW_DELETE_CONFIRMATION_WITH_APPS, true, container->getName(), label);
551 }
552 runOnMainUI([label, this, container]() {
553 new YesNoDlg(Msg::GENERIC_DLG_CONFIRM_TITLE, label, [this, container](bool yes) {
554 if (yes) {
555 runOnMainUI([this, container]() {
556 container->deleteContainerFromFilesystem();
557 BString containerDir;
558
559 if (currentContainer != container) {
560 containerDir = currentContainer->getDir();
561 }
562 BoxedwineData::reloadContainers();
563 gotoView(VIEW_CONTAINERS, containerDir);
564 return false;
565 });
566 }
567 });
568 return false;
569 });
570}
571
572bool ContainersView::saveChanges() {
573 if (this->currentContainer && containerNameControl->getText().length() == 0) {

Callers 1

ContainersViewMethod · 0.95

Calls 8

getTranslationWithFormatFunction · 0.85
runOnMainUIFunction · 0.85
gotoViewFunction · 0.85
getDirMethod · 0.80
sizeMethod · 0.45
getNameMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected