mirror of
https://github.com/OpenMW/openmw.git
synced 2026-02-01 12:48:27 +00:00
Lock replace button when no search results
This commit is contained in:
parent
294e62719b
commit
8a769464fb
2 changed files with 7 additions and 5 deletions
|
|
@ -22,10 +22,12 @@
|
|||
|
||||
void CSVTools::SearchSubView::replace(bool selection)
|
||||
{
|
||||
if (mLocked)
|
||||
if (!mAllowReplace)
|
||||
return;
|
||||
|
||||
std::vector<int> indices = mTable->getReplaceIndices(selection);
|
||||
if (indices.empty())
|
||||
return;
|
||||
|
||||
std::string replace = mSearchBox.getReplaceText();
|
||||
|
||||
|
|
@ -74,7 +76,6 @@ void CSVTools::SearchSubView::showEvent(QShowEvent* event)
|
|||
CSVTools::SearchSubView::SearchSubView(const CSMWorld::UniversalId& id, CSMDoc::Document& document)
|
||||
: CSVDoc::SubView(id)
|
||||
, mDocument(document)
|
||||
, mLocked(false)
|
||||
{
|
||||
QVBoxLayout* layout = new QVBoxLayout;
|
||||
|
||||
|
|
@ -112,8 +113,9 @@ CSVTools::SearchSubView::SearchSubView(const CSMWorld::UniversalId& id, CSMDoc::
|
|||
|
||||
void CSVTools::SearchSubView::setEditLock(bool locked)
|
||||
{
|
||||
mLocked = locked;
|
||||
mSearchBox.setEditLock(locked);
|
||||
int reportSize = mDocument.getReport(getUniversalId())->rowCount();
|
||||
mAllowReplace = !(locked || reportSize == 0);
|
||||
mSearchBox.setEditLock(locked || reportSize == 0);
|
||||
}
|
||||
|
||||
void CSVTools::SearchSubView::setStatusBar(bool show)
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ namespace CSVTools
|
|||
SearchBox mSearchBox;
|
||||
CSMDoc::Document& mDocument;
|
||||
CSMTools::Search mSearch;
|
||||
bool mLocked;
|
||||
bool mAllowReplace{ false };
|
||||
CSVWorld::TableBottomBox* mBottom;
|
||||
|
||||
private:
|
||||
|
|
|
|||
Loading…
Reference in a new issue