Do not list hidden files in file lists

This makes browsing $HOME a lot less cluttered.
This commit is contained in:
Aurélien Gâteau 2015-05-11 09:38:30 +02:00
parent 0bd85f93a5
commit 1257060825
3 changed files with 16 additions and 1 deletions

View File

@ -84,6 +84,7 @@ public:
bool isFolder() const;
bool isBrowsable() const;
bool isHidden() const;
std::string getKeyName() const;
std::string getFileName() const;
@ -313,6 +314,17 @@ bool FileItem::isBrowsable() const
return is_folder;
}
bool FileItem::isHidden() const
{
ASSERT(this->displayname != NOTINITIALIZED);
#ifdef _WIN32
return false;
#else
return this->displayname[0] == '.';
#endif
}
std::string FileItem::getKeyName() const
{
ASSERT(this->keyname != NOTINITIALIZED);

View File

@ -68,6 +68,7 @@ namespace app {
virtual bool isFolder() const = 0;
virtual bool isBrowsable() const = 0;
virtual bool isHidden() const = 0;
virtual std::string getKeyName() const = 0;
virtual std::string getFileName() const = 0;

View File

@ -497,7 +497,9 @@ void FileList::regenerateList()
it=m_list.begin();
it!=m_list.end(); ) {
IFileItem* fileitem = *it;
if (!fileitem->isFolder() &&
if (fileitem->isHidden())
it = m_list.erase(it);
else if (!fileitem->isFolder() &&
!fileitem->hasExtension(m_exts.c_str())) {
it = m_list.erase(it);
}