diff --git a/apps/opencs/model/tools/search.cpp b/apps/opencs/model/tools/search.cpp index f37425ea8..9e22f82dd 100644 --- a/apps/opencs/model/tools/search.cpp +++ b/apps/opencs/model/tools/search.cpp @@ -24,7 +24,7 @@ void CSMTools::Search::searchTextCell (const CSMWorld::IdTableBase *model, while ((pos = text.indexOf (search, pos, Qt::CaseInsensitive))!=-1) { std::ostringstream message; - message << text.mid (pos).toUtf8().data(); + message << getLocation (model, index, id) << text.mid (pos).toUtf8().data(); std::ostringstream hint; hint << "r: " << index.column() << " " << pos << " " << search.length(); @@ -49,7 +49,7 @@ void CSMTools::Search::searchRegExCell (const CSMWorld::IdTableBase *model, while ((pos = mRegExp.indexIn (text, pos))!=-1) { std::ostringstream message; - message << text.mid (pos).toUtf8().data(); + message << getLocation (model, index, id) << text.mid (pos).toUtf8().data(); int length = mRegExp.matchedLength(); @@ -76,7 +76,7 @@ void CSMTools::Search::searchRecordStateCell (const CSMWorld::IdTableBase *model CSMWorld::Columns::getEnums (CSMWorld::Columns::ColumnId_Modification); std::ostringstream message; - message << id.getId() << " " << states.at (data); + message << getLocation (model, index, id) << states.at (data); std::ostringstream hint; hint << "r: " << index.column(); @@ -85,6 +85,19 @@ void CSMTools::Search::searchRecordStateCell (const CSMWorld::IdTableBase *model } } +std::string CSMTools::Search::getLocation (const CSMWorld::IdTableBase *model, const QModelIndex& index, const CSMWorld::UniversalId& id) const +{ + std::ostringstream stream; + + stream + << id.getId() + << ", " + << model->headerData (index.column(), Qt::Horizontal).toString().toUtf8().data() + << ": "; + + return stream.str(); +} + CSMTools::Search::Search() : mType (Type_None) {} CSMTools::Search::Search (Type type, const std::string& value) diff --git a/apps/opencs/model/tools/search.hpp b/apps/opencs/model/tools/search.hpp index 3683f9c9b..7e95a2846 100644 --- a/apps/opencs/model/tools/search.hpp +++ b/apps/opencs/model/tools/search.hpp @@ -55,6 +55,8 @@ namespace CSMTools void searchRecordStateCell (const CSMWorld::IdTableBase *model, const QModelIndex& index, const CSMWorld::UniversalId& id, CSMDoc::Messages& messages) const; + + std::string getLocation (const CSMWorld::IdTableBase *model, const QModelIndex& index, const CSMWorld::UniversalId& id) const; public: