show an error popup when demo deletion fails

This commit is contained in:
oy 2011-01-05 22:22:07 +01:00
parent 64e36b5095
commit 13902fef6c
3 changed files with 13 additions and 19 deletions

View file

@ -53,7 +53,6 @@ CMenus::CMenus()
m_NeedSendinfo = false;
m_MenuActive = true;
m_UseMouseButtons = true;
m_DemolistDelEntry = false;
m_EscapePressed = false;
m_EnterPressed = false;
@ -1034,7 +1033,19 @@ int CMenus::Render()
if(DoButton_Menu(&s_ButtonTryAgain, Localize("Yes"), 0, &Yes) || m_EnterPressed)
{
m_Popup = POPUP_NONE;
m_DemolistDelEntry = true;
// delete demo
if(m_DemolistSelectedIndex >= 0 && !m_DemolistSelectedIsDir)
{
char aBuf[512];
str_format(aBuf, sizeof(aBuf), "%s/%s", m_aCurrentDemoFolder, m_lDemos[m_DemolistSelectedIndex].m_aFilename);
if(Storage()->RemoveFile(aBuf, m_lDemos[m_DemolistSelectedIndex].m_StorageType))
{
DemolistPopulate();
DemolistOnUpdate(false);
}
else
PopupMessage(Localize("Error"), Localize("Unable to delete the demo"), Localize("Ok"));
}
}
}
else if(m_Popup == POPUP_FIRST_LAUNCH)

View file

@ -180,7 +180,6 @@ class CMenus : public CComponent
sorted_array<CDemoItem> m_lDemos;
char m_aCurrentDemoFolder[256];
bool m_DemolistDelEntry;
int m_DemolistSelectedIndex;
bool m_DemolistSelectedIsDir;
int m_DemolistStorageType;

View file

@ -477,22 +477,6 @@ void CMenus::RenderDemoList(CUIRect MainView)
s_Inited = 1;
}
// delete demo
if(m_DemolistDelEntry)
{
if(m_DemolistSelectedIndex >= 0 && !m_DemolistSelectedIsDir)
{
char aBuf[512];
str_format(aBuf, sizeof(aBuf), "%s/%s", m_aCurrentDemoFolder, m_lDemos[m_DemolistSelectedIndex].m_aFilename);
if(Storage()->RemoveFile(aBuf, m_lDemos[m_DemolistSelectedIndex].m_StorageType))
{
DemolistPopulate();
DemolistOnUpdate(false);
}
}
m_DemolistDelEntry = false;
}
char aFooterLabel[128] = {0};
if(m_DemolistSelectedIndex >= 0)
{