mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-08 23:23:01 -06:00
#4279 Octave Script Folders : Disable default search of sub folders and add option to search
This commit is contained in:
parent
e486432391
commit
4ba6e6959b
@ -43,6 +43,8 @@ RimScriptCollection::RimScriptCollection()
|
||||
CAF_PDM_InitFieldNoDefault(&subDirectories, "SubDirectories", "", "", "", "");
|
||||
subDirectories.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&m_searchSubFolders, "SearchSubFolders", false, "Add Subfolders", "", "", "");
|
||||
|
||||
directory.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
||||
}
|
||||
|
||||
@ -100,13 +102,12 @@ void RimScriptCollection::readContentFromDisc()
|
||||
}
|
||||
}
|
||||
|
||||
// Add subfolders
|
||||
subDirectories.deleteAllChildObjects();
|
||||
|
||||
if (m_searchSubFolders())
|
||||
{
|
||||
QDir dir(directory);
|
||||
QFileInfoList fileInfoList = dir.entryInfoList(QDir::AllDirs | QDir::NoDotAndDotDot | QDir::Readable);
|
||||
subDirectories.deleteAllChildObjects();
|
||||
|
||||
QStringList retFileNames;
|
||||
|
||||
QListIterator<QFileInfo> it(fileInfoList);
|
||||
while (it.hasNext())
|
||||
@ -179,6 +180,10 @@ void RimScriptCollection::fieldChangedByUi(const caf::PdmFieldHandle *changedFie
|
||||
this->setUiName(fi.baseName());
|
||||
this->readContentFromDisc();
|
||||
}
|
||||
else if (&m_searchSubFolders == changedField)
|
||||
{
|
||||
this->readContentFromDisc();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -59,4 +59,7 @@ public: // Methods
|
||||
|
||||
protected:
|
||||
void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_searchSubFolders;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user