From 9ecee4b49b04aaf6d4e47be333f1d0be597e3c6f Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Thu, 13 Mar 2014 16:06:20 +0400 Subject: [PATCH] gui/bouquetlist.cpp: allow to delete whole satellite from satellite bouquet view Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/90768b15acc5a1b9bc878fbb54823bf4866560d2 Author: [CST] Focus Date: 2014-03-13 (Thu, 13 Mar 2014) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/bouquetlist.cpp | 35 ++++++++++++++++++++++------------- src/gui/bouquetlist.h | 2 ++ 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/gui/bouquetlist.cpp b/src/gui/bouquetlist.cpp index 8132fa3a2..2093e52dd 100644 --- a/src/gui/bouquetlist.cpp +++ b/src/gui/bouquetlist.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -56,6 +57,7 @@ #include #include +#include extern CBouquetManager *g_bouquetManager; @@ -230,7 +232,7 @@ int CBouquetList::doMenu() zapitBouquet = Bouquets[selected]->zapitBouquet; /* zapitBouquet not NULL only on real bouquets, not on virtual SAT or HD */ - if(!zapitBouquet) + if(!zapitBouquet && Bouquets[selected]->satellitePosition == INVALID_SAT_POSITION) return 0; CMenuWidget* menu = new CMenuWidget(LOCALE_CHANNELLIST_EDIT, NEUTRINO_ICON_SETTINGS); @@ -238,7 +240,7 @@ int CBouquetList::doMenu() CMenuSelectorTarget * selector = new CMenuSelectorTarget(&select); sprintf(cnt, "%d", i); - if(!zapitBouquet->bUser) { + if (zapitBouquet && !zapitBouquet->bUser) { menu->addItem(new CMenuForwarder(LOCALE_FAVORITES_COPY, true, NULL, selector, cnt, CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE), old_selected == i ++); menu->exec(NULL, ""); delete menu; @@ -289,17 +291,24 @@ int CBouquetList::doMenu() printf("CBouquetList::doMenu: %d selected\n", select); if(select >= 0) { old_selected = select; - switch(select) { - case 0: - hide(); - bouquet_id = g_bouquetManager->existsUBouquet(Bouquets[selected]->channelList->getName()); - if(bouquet_id >= 0) { - g_bouquetManager->deleteBouquet(bouquet_id); - return 1; - } - break; - default: - break; + hide(); + + int result = ShowMsg ( LOCALE_BOUQUETEDITOR_DELETE, Bouquets[selected]->channelList->getName(), CMessageBox::mbrNo, CMessageBox::mbYes | CMessageBox::mbNo ); + if(result != CMessageBox::mbrYes) + return -1; + + if (zapitBouquet) { + bouquet_id = g_bouquetManager->existsUBouquet(Bouquets[selected]->channelList->getName()); + if(bouquet_id >= 0) { + g_bouquetManager->deleteBouquet(bouquet_id); + return 1; + } + } else { + CServiceManager::getInstance()->RemovePosition(Bouquets[selected]->satellitePosition); + g_bouquetManager->loadBouquets(); + g_bouquetManager->deletePosition(Bouquets[selected]->satellitePosition); + CServiceManager::getInstance()->SetServicesChanged(true); + return 1; } } return -1; diff --git a/src/gui/bouquetlist.h b/src/gui/bouquetlist.h index c8eb4b3ec..1b5968fe2 100644 --- a/src/gui/bouquetlist.h +++ b/src/gui/bouquetlist.h @@ -58,12 +58,14 @@ class CBouquet bool bLocked; CChannelList* channelList; CZapitBouquet * zapitBouquet; + t_satellite_position satellitePosition; CBouquet(const int Unique_key, const char * const Name, const bool locked, bool vlist = false) { zapitBouquet = NULL; unique_key = Unique_key; bLocked = locked; + satellitePosition = INVALID_SAT_POSITION; channelList = new CChannelList(Name, false, vlist); }