mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-18 06:55:48 +03:00
@@ -139,6 +139,8 @@ class EE_API FileSystemModel : public Model {
|
||||
void refreshIfNeeded( const FileSystemModel& );
|
||||
|
||||
bool fetchData( const String& fullPath );
|
||||
|
||||
void updateMimeType();
|
||||
};
|
||||
|
||||
static std::shared_ptr<FileSystemModel>
|
||||
|
||||
@@ -26,11 +26,7 @@ FileSystemModel::Node::Node( FileInfo&& info, FileSystemModel::Node* parent ) :
|
||||
mParent( parent ), mInfo( info ) {
|
||||
mInfoDirty = false;
|
||||
mName = FileSystem::fileNameFromPath( mInfo.getFilepath() );
|
||||
if ( !mInfo.isDirectory() ) {
|
||||
mMimeType = UIIconThemeManager::getIconNameFromFileName( mName );
|
||||
} else {
|
||||
mMimeType = "folder";
|
||||
}
|
||||
updateMimeType();
|
||||
}
|
||||
|
||||
const std::string& FileSystemModel::Node::fullPath() const {
|
||||
@@ -117,6 +113,7 @@ FileSystemModel::Node* FileSystemModel::Node::createChild( const std::string& ch
|
||||
void FileSystemModel::Node::rename( const FileInfo& file ) {
|
||||
mInfo = file;
|
||||
mName = file.getFileName();
|
||||
updateMimeType();
|
||||
}
|
||||
|
||||
ModelIndex FileSystemModel::Node::index( const FileSystemModel& model, int column ) const {
|
||||
@@ -260,6 +257,14 @@ bool FileSystemModel::Node::fetchData( const String& fullPath ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void FileSystemModel::Node::updateMimeType() {
|
||||
if ( !mInfo.isDirectory() ) {
|
||||
mMimeType = UIIconThemeManager::getIconNameFromFileName( mName );
|
||||
} else {
|
||||
mMimeType = "folder";
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<FileSystemModel> FileSystemModel::New( const std::string& rootPath,
|
||||
const FileSystemModel::Mode& mode,
|
||||
const DisplayConfig displayConfig ) {
|
||||
@@ -600,6 +605,12 @@ bool FileSystemModel::handleFileEventLocked( const FileEvent& event ) {
|
||||
if ( !childNode->getName().empty() ) {
|
||||
size_t pos = getFileIndex( parent, file );
|
||||
|
||||
const auto& displayCfg = getDisplayConfig();
|
||||
|
||||
if ( displayCfg.fileIsVisibleFn &&
|
||||
!displayCfg.fileIsVisibleFn( file.getFilepath() ) )
|
||||
return false;
|
||||
|
||||
if ( pos == INDEX_ALREADY_EXISTS )
|
||||
return false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user