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