gui/bouquetlist.cpp: allow to delete whole satellite from satellite bouquet view

This commit is contained in:
[CST] Focus
2014-03-13 16:06:20 +04:00
parent c5e1ab04e6
commit 90768b15ac
2 changed files with 24 additions and 13 deletions

View File

@@ -45,6 +45,7 @@
#include <gui/widget/menue.h> #include <gui/widget/menue.h>
#include <gui/widget/buttons.h> #include <gui/widget/buttons.h>
#include <gui/widget/icons.h> #include <gui/widget/icons.h>
#include <gui/widget/messagebox.h>
#include <driver/fontrenderer.h> #include <driver/fontrenderer.h>
#include <driver/screen_max.h> #include <driver/screen_max.h>
@@ -56,6 +57,7 @@
#include <global.h> #include <global.h>
#include <neutrino.h> #include <neutrino.h>
#include <zapit/getservices.h>
extern CBouquetManager *g_bouquetManager; extern CBouquetManager *g_bouquetManager;
@@ -230,7 +232,7 @@ int CBouquetList::doMenu()
zapitBouquet = Bouquets[selected]->zapitBouquet; zapitBouquet = Bouquets[selected]->zapitBouquet;
/* zapitBouquet not NULL only on real bouquets, not on virtual SAT or HD */ /* 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; return 0;
CMenuWidget* menu = new CMenuWidget(LOCALE_CHANNELLIST_EDIT, NEUTRINO_ICON_SETTINGS); CMenuWidget* menu = new CMenuWidget(LOCALE_CHANNELLIST_EDIT, NEUTRINO_ICON_SETTINGS);
@@ -238,7 +240,7 @@ int CBouquetList::doMenu()
CMenuSelectorTarget * selector = new CMenuSelectorTarget(&select); CMenuSelectorTarget * selector = new CMenuSelectorTarget(&select);
sprintf(cnt, "%d", i); 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->addItem(new CMenuForwarder(LOCALE_FAVORITES_COPY, true, NULL, selector, cnt, CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE), old_selected == i ++);
menu->exec(NULL, ""); menu->exec(NULL, "");
delete menu; delete menu;
@@ -289,17 +291,24 @@ int CBouquetList::doMenu()
printf("CBouquetList::doMenu: %d selected\n", select); printf("CBouquetList::doMenu: %d selected\n", select);
if(select >= 0) { if(select >= 0) {
old_selected = select; old_selected = select;
switch(select) { hide();
case 0:
hide(); int result = ShowMsg ( LOCALE_BOUQUETEDITOR_DELETE, Bouquets[selected]->channelList->getName(), CMessageBox::mbrNo, CMessageBox::mbYes | CMessageBox::mbNo );
bouquet_id = g_bouquetManager->existsUBouquet(Bouquets[selected]->channelList->getName()); if(result != CMessageBox::mbrYes)
if(bouquet_id >= 0) { return -1;
g_bouquetManager->deleteBouquet(bouquet_id);
return 1; if (zapitBouquet) {
} bouquet_id = g_bouquetManager->existsUBouquet(Bouquets[selected]->channelList->getName());
break; if(bouquet_id >= 0) {
default: g_bouquetManager->deleteBouquet(bouquet_id);
break; 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; return -1;

View File

@@ -58,12 +58,14 @@ class CBouquet
bool bLocked; bool bLocked;
CChannelList* channelList; CChannelList* channelList;
CZapitBouquet * zapitBouquet; CZapitBouquet * zapitBouquet;
t_satellite_position satellitePosition;
CBouquet(const int Unique_key, const char * const Name, const bool locked, bool vlist = false) CBouquet(const int Unique_key, const char * const Name, const bool locked, bool vlist = false)
{ {
zapitBouquet = NULL; zapitBouquet = NULL;
unique_key = Unique_key; unique_key = Unique_key;
bLocked = locked; bLocked = locked;
satellitePosition = INVALID_SAT_POSITION;
channelList = new CChannelList(Name, false, vlist); channelList = new CChannelList(Name, false, vlist);
} }