From ef6d378c5e401954308260d1fe3a53429fa66f4c Mon Sep 17 00:00:00 2001 From: Maarten ter Huurne Date: Fri, 24 Apr 2015 14:46:27 +0200 Subject: [PATCH] Removed the "Rename section" option This option is not compatible with section names being provided by other sources than user-created links. Examples of other sources are built-in action links, links installed by a distro in a read-only directory and metadata from OPK files. --- src/contextmenu.cpp | 3 --- src/gmenu2x.cpp | 32 -------------------------------- src/gmenu2x.h | 1 - src/menu.cpp | 4 ---- src/menu.h | 1 - 5 files changed, 41 deletions(-) diff --git a/src/contextmenu.cpp b/src/contextmenu.cpp index f8c9392..503fe44 100644 --- a/src/contextmenu.cpp +++ b/src/contextmenu.cpp @@ -71,9 +71,6 @@ ContextMenu::ContextMenu(GMenu2X &gmenu2x, Menu &menu) options.push_back(std::make_shared( tr["Add section"], std::bind(&GMenu2X::addSection, &gmenu2x))); - options.push_back(std::make_shared( - tr["Rename section"], - std::bind(&GMenu2X::renameSection, &gmenu2x))); options.push_back(std::make_shared( tr["Delete section"], std::bind(&GMenu2X::deleteSection, &gmenu2x))); diff --git a/src/gmenu2x.cpp b/src/gmenu2x.cpp index 5604791..6cdc1d5 100644 --- a/src/gmenu2x.cpp +++ b/src/gmenu2x.cpp @@ -1020,38 +1020,6 @@ void GMenu2X::addSection() { } } -void GMenu2X::renameSection() { - InputDialog id(*this, input, tr["Insert a new name for this section"],menu->selSection()); - if (id.exec()) { - //only if a section with the same name does not exist & !samename - if (menu->selSection() != id.getInput() - && find(menu->getSections().begin(),menu->getSections().end(), id.getInput()) - == menu->getSections().end()) { - //section directory doesn't exists - string newsectiondir = getHome() + "/sections/" + id.getInput(); - string sectiondir = getHome() + "/sections/" + menu->selSection(); - - if (!rename(sectiondir.c_str(), newsectiondir.c_str())) { - string oldpng = menu->selSection() + ".png"; - string newpng = id.getInput() + ".png"; - string oldicon = sc.getSkinFilePath(oldpng); - string newicon = sc.getSkinFilePath(newpng); - - if (!oldicon.empty() && newicon.empty()) { - newicon = oldicon; - newicon.replace(newicon.find(oldpng), oldpng.length(), newpng); - - if (!fileExists(newicon)) { - rename(oldicon.c_str(), newicon.c_str()); - sc.move("skin:"+oldpng, "skin:"+newpng); - } - } - menu->renameSection(menu->selSectionIndex(), id.getInput()); - } - } - } -} - void GMenu2X::deleteSection() { MessageBox mb(*this,tr["You will lose all the links in this section."]+"\n"+tr["Are you sure?"]); mb.setButton(InputManager::ACCEPT, tr["Yes"]); diff --git a/src/gmenu2x.h b/src/gmenu2x.h index 403a4cf..79aaae0 100644 --- a/src/gmenu2x.h +++ b/src/gmenu2x.h @@ -199,7 +199,6 @@ public: void editLink(); void deleteLink(); void addSection(); - void renameSection(); void deleteSection(); int drawButton(Surface& s, const std::string &btn, const std::string &text, int x=5, int y=-10); diff --git a/src/menu.cpp b/src/menu.cpp index 89dc84a..facbaa5 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -820,7 +820,3 @@ void Menu::readLinksOfSection( closedir(dirp); } - -void Menu::renameSection(int index, string const& name) { - sections[index] = name; -} diff --git a/src/menu.h b/src/menu.h index c3215f2..bab6ec9 100644 --- a/src/menu.h +++ b/src/menu.h @@ -160,7 +160,6 @@ public: void setLinkIndex(int i); const std::vector &getSections() { return sections; } - void renameSection(int index, std::string const& name); }; #endif // MENU_H