mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 19:19:56 +00:00
remove rows from result table after a successful replace (configurable via user settings)
This commit is contained in:
parent
2ef8103cc7
commit
dab650a3d5
2 changed files with 12 additions and 2 deletions
|
@ -220,7 +220,10 @@ void CSMSettings::UserSettings::buildSettingModelDefaults()
|
||||||
"Characters after search string");
|
"Characters after search string");
|
||||||
after->setDefaultValue (10);
|
after->setDefaultValue (10);
|
||||||
after->setRange (0, 1000);
|
after->setRange (0, 1000);
|
||||||
after->setToolTip ("Maximum number of character to display in search result after the searched text");
|
after->setToolTip ("Maximum number of character to display in search result after the searched text");
|
||||||
|
|
||||||
|
Setting *autoDelete = createSetting (Type_CheckBox, "auto-delete", "Delete row from result table after a successful replace");
|
||||||
|
autoDelete->setDefaultValue ("true");
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "../../model/tools/search.hpp"
|
#include "../../model/tools/search.hpp"
|
||||||
#include "../../model/tools/reportmodel.hpp"
|
#include "../../model/tools/reportmodel.hpp"
|
||||||
#include "../../model/world/idtablebase.hpp"
|
#include "../../model/world/idtablebase.hpp"
|
||||||
|
#include "../../model/settings/usersettings.hpp"
|
||||||
|
|
||||||
#include "reporttable.hpp"
|
#include "reporttable.hpp"
|
||||||
#include "searchbox.hpp"
|
#include "searchbox.hpp"
|
||||||
|
@ -22,7 +23,10 @@ void CSVTools::SearchSubView::replace (bool selection)
|
||||||
|
|
||||||
const CSMTools::ReportModel& model =
|
const CSMTools::ReportModel& model =
|
||||||
dynamic_cast<const CSMTools::ReportModel&> (*mTable->model());
|
dynamic_cast<const CSMTools::ReportModel&> (*mTable->model());
|
||||||
|
|
||||||
|
bool autoDelete = CSMSettings::UserSettings::instance().setting (
|
||||||
|
"search/auto-delete", QString ("true"))=="true";
|
||||||
|
|
||||||
// We are running through the indices in reverse order to avoid messing up multiple results
|
// We are running through the indices in reverse order to avoid messing up multiple results
|
||||||
// in a single string.
|
// in a single string.
|
||||||
for (std::vector<int>::const_reverse_iterator iter (indices.rbegin()); iter!=indices.rend(); ++iter)
|
for (std::vector<int>::const_reverse_iterator iter (indices.rbegin()); iter!=indices.rend(); ++iter)
|
||||||
|
@ -38,6 +42,9 @@ void CSVTools::SearchSubView::replace (bool selection)
|
||||||
|
|
||||||
mSearch.replace (mDocument, table, id, hint, replace);
|
mSearch.replace (mDocument, table, id, hint, replace);
|
||||||
mTable->flagAsReplaced (*iter);
|
mTable->flagAsReplaced (*iter);
|
||||||
|
|
||||||
|
if (autoDelete)
|
||||||
|
mTable->model()->removeRows (*iter, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue