From f6ecb93d460b16c10933b35605f7ac1d60eac705 Mon Sep 17 00:00:00 2001 From: Al12rs Date: Wed, 18 Jul 2018 16:00:19 +0200 Subject: Set delete Key to recursively clear overwrite with confirmation message. --- src/modlist.cpp | 9 +++++++++ src/modlist.h | 5 +++++ src/organizercore.cpp | 2 ++ 3 files changed, 16 insertions(+) (limited to 'src') diff --git a/src/modlist.cpp b/src/modlist.cpp index aaa4ba79..87cbbfb2 100644 --- a/src/modlist.cpp +++ b/src/modlist.cpp @@ -999,6 +999,15 @@ bool ModList::removeRows(int row, int count, const QModelIndex &parent) bool success = false; + if (count == 1) { + ModInfo::Ptr modInfo = ModInfo::getByIndex(row); + std::vector flags = modInfo->getFlags(); + if (std::find(flags.begin(), flags.end(), ModInfo::FLAG_OVERWRITE) != flags.end()) { + emit clearOverwrite(); + success = true; + } + } + for (int i = 0; i < count; ++i) { ModInfo::Ptr modInfo = ModInfo::getByIndex(row + i); if (!modInfo->isRegular()) { diff --git a/src/modlist.h b/src/modlist.h index b5f18e98..2db98bd1 100644 --- a/src/modlist.h +++ b/src/modlist.h @@ -244,6 +244,11 @@ signals: */ void fileMoved(const QString &relativePath, const QString &oldOriginName, const QString &newOriginName); + /** + * @brief emitted to have the overwrite folder cleared + */ + void clearOverwrite(); + void aboutToChangeData(); void postDataChanged(); diff --git a/src/organizercore.cpp b/src/organizercore.cpp index 142faabe..74ec752e 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -552,6 +552,8 @@ void OrganizerCore::setUserInterface(IUserInterface *userInterface, SLOT(modRemoved(QString))); connect(&m_ModList, SIGNAL(removeSelectedMods()), widget, SLOT(removeMod_clicked())); + connect(&m_ModList, SIGNAL(clearOverwrite()), widget, + SLOT(clearOverwrite())); connect(&m_ModList, SIGNAL(requestColumnSelect(QPoint)), widget, SLOT(displayColumnSelection(QPoint))); connect(&m_ModList, SIGNAL(fileMoved(QString, QString, QString)), widget, -- cgit v1.3.1