Delete Stores with <SELECT>.

This commit is contained in:
StackZ
2020-01-06 08:46:52 +01:00
parent 3121f82d61
commit 021f1ebabd
3 changed files with 31 additions and 1 deletions
+28
View File
@@ -476,6 +476,28 @@ void UniStore::SubMenuLogic(u32 hDown, u32 hHeld, touchPosition touch) {
}
}
void UniStore::deleteStore(int selectedStore) {
std::string path = Config::StorePath;
path += dirContents[selectedStore].name;
deleteFile(path.c_str());
// Refresh the list.
dirContents.clear();
storeInfo.clear();
chdir(Config::StorePath.c_str());
getDirectoryContents(dirContents, {"unistore"});
for(uint i=0;i<dirContents.size();i++) {
storeInfo.push_back(parseStoreInfo(dirContents[i].name));
descript();
loadStoreDesc();
}
if (dirContents.size() == 0) {
dirContents.clear();
storeInfo.clear();
mode = 0;
}
}
bool UniStore::handleIfDisplayText() {
if (appStoreJson.at("storeInfo").contains("displayInformation")) {
if (appStoreJson["storeInfo"]["displayInformation"] != true) {
@@ -579,6 +601,12 @@ void UniStore::StoreSelectionLogic(u32 hDown, u32 hHeld, touchPosition touch) {
}
}
if (hDown & KEY_SELECT) {
if (Gui::promptMsg(Lang::get("DELETE_STORE"))) {
deleteStore(selection);
}
}
if (hDown & KEY_TOUCH) {
if (Config::viewMode == 0) {
for(int i=0;i<ENTRIES_PER_SCREEN && i<(int)storeInfo.size();i++) {