#4279 Octave Script Folders : Disable default search of sub folders and add option to search

This commit is contained in:
Magne Sjaastad 2019-04-03 15:01:13 +02:00
parent e486432391
commit 4ba6e6959b
2 changed files with 12 additions and 4 deletions

View File

@ -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();
}
}
//--------------------------------------------------------------------------------------------------

View File

@ -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;
};