Skip to content

Commit

Permalink
[nemo-qml-plugin-filemanager] Add option to show system files
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewvogt committed Sep 22, 2016
1 parent 66cd3cb commit 8b56731
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 7 deletions.
16 changes: 16 additions & 0 deletions src/plugin/filemodel.cpp
Expand Up @@ -94,6 +94,7 @@ FileModel::FileModel(QObject *parent) :
m_includeDirectories(true),
m_includeParentDirectory(false),
m_includeHiddenFiles(false),
m_includeSystemFiles(false),
m_active(false),
m_dirty(false),
m_populated(false),
Expand Down Expand Up @@ -260,6 +261,15 @@ void FileModel::setIncludeHiddenFiles(bool include)
scheduleUpdate(IncludeHiddenFilesChanged | ContentChanged);
}

void FileModel::setIncludeSystemFiles(bool include)
{
if (m_includeSystemFiles == include)
return;

m_includeSystemFiles = include;
scheduleUpdate(IncludeSystemFilesChanged | ContentChanged);
}

void FileModel::setDirectorySort(DirectorySort sort)
{
if (m_directorySort == sort)
Expand Down Expand Up @@ -529,6 +539,9 @@ QDir FileModel::directory() const
if (m_includeHiddenFiles) {
filters |= QDir::Hidden;
}
if (m_includeSystemFiles) {
filters |= QDir::System;
}

QDir::SortFlags sortFlags(QDir::LocaleAware);

Expand Down Expand Up @@ -606,6 +619,9 @@ void FileModel::update()
if (m_changedFlags & IncludeHiddenFilesChanged) {
emit includeHiddenFilesChanged();
}
if (m_changedFlags & IncludeSystemFilesChanged) {
emit includeSystemFilesChanged();
}
if (m_changedFlags & DirectorySortChanged) {
emit directorySortChanged();
}
Expand Down
21 changes: 14 additions & 7 deletions src/plugin/filemodel.h
Expand Up @@ -64,6 +64,7 @@ class FileModel : public QAbstractListModel
Q_PROPERTY(bool includeDirectories READ includeDirectories WRITE setIncludeDirectories NOTIFY includeDirectoriesChanged)
Q_PROPERTY(bool includeParentDirectory READ includeParentDirectory WRITE setIncludeParentDirectory NOTIFY includeParentDirectoryChanged)
Q_PROPERTY(bool includeHiddenFiles READ includeHiddenFiles WRITE setIncludeHiddenFiles NOTIFY includeHiddenFilesChanged)
Q_PROPERTY(bool includeSystemFiles READ includeSystemFiles WRITE setIncludeSystemFiles NOTIFY includeSystemFilesChanged)
Q_PROPERTY(DirectorySort directorySort READ directorySort WRITE setDirectorySort NOTIFY directorySortChanged)
Q_PROPERTY(QStringList nameFilters READ nameFilters WRITE setNameFilters NOTIFY nameFiltersChanged)
Q_PROPERTY(bool populated READ populated NOTIFY populatedChanged)
Expand Down Expand Up @@ -127,6 +128,9 @@ class FileModel : public QAbstractListModel
bool includeHiddenFiles() const { return m_includeHiddenFiles; }
void setIncludeHiddenFiles(bool include);

bool includeSystemFiles() const { return m_includeSystemFiles; }
void setIncludeSystemFiles(bool include);

DirectorySort directorySort() const { return m_directorySort; }
void setDirectorySort(DirectorySort sort);

Expand Down Expand Up @@ -170,6 +174,7 @@ public slots:
void includeDirectoriesChanged();
void includeParentDirectoryChanged();
void includeHiddenFilesChanged();
void includeSystemFilesChanged();
void directorySortChanged();
void nameFiltersChanged();
void populatedChanged();
Expand All @@ -190,13 +195,14 @@ private slots:
IncludeDirectoriesChanged = (1 << 4),
IncludeParentDirectoryChanged = (1 << 5),
IncludeHiddenFilesChanged = (1 << 6),
DirectorySortChanged = (1 << 7),
NameFiltersChanged = (1 << 8),
PopulatedChanged = (1 << 9),
CountChanged = (1 << 10),
ActiveChanged = (1 << 11),
SelectedCountChanged = (1 << 12),
ContentChanged = (1 << 13),
IncludeSystemFilesChanged = (1 << 7),
DirectorySortChanged = (1 << 8),
NameFiltersChanged = (1 << 9),
PopulatedChanged = (1 << 10),
CountChanged = (1 << 11),
ActiveChanged = (1 << 12),
SelectedCountChanged = (1 << 13),
ContentChanged = (1 << 14),
};
Q_DECLARE_FLAGS(ChangedFlags, Changed);

Expand All @@ -223,6 +229,7 @@ private slots:
bool m_includeDirectories;
bool m_includeParentDirectory;
bool m_includeHiddenFiles;
bool m_includeSystemFiles;
bool m_active;
bool m_dirty;
bool m_populated;
Expand Down

0 comments on commit 8b56731

Please sign in to comment.