diff --git a/kcms/baloo/filteredfoldermodel.h b/kcms/baloo/filteredfoldermodel.h --- a/kcms/baloo/filteredfoldermodel.h +++ b/kcms/baloo/filteredfoldermodel.h @@ -51,7 +51,6 @@ private: QString folderDisplayName(const QString& url) const; - bool shouldShowMountPoint(const QString& mountPoint); QString fetchMountPoint(const QString& url) const; void showMessage(const QString& message); diff --git a/kcms/baloo/filteredfoldermodel.cpp b/kcms/baloo/filteredfoldermodel.cpp --- a/kcms/baloo/filteredfoldermodel.cpp +++ b/kcms/baloo/filteredfoldermodel.cpp @@ -53,6 +53,22 @@ return QString(url).replace(0, QDir::homePath().length(), QStringLiteral("~")); return url; } + + bool ignoreMountPoint(const QString& mountPoint) { + if (mountPoint == QLatin1String("/")) + return true; + + if (mountPoint.startsWith(QLatin1String("/boot"))) + return true; + + if (mountPoint.startsWith(QLatin1String("/tmp"))) + return true; + + // The user's home directory is forcibly added so we can ignore /home + // if /home actually contains the home directory + return mountPoint.startsWith(QLatin1String("/home")) && + QDir::homePath().startsWith(QLatin1String("/home")); + } } FilteredFolderModel::FilteredFolderModel(BalooSettings *settings, QObject *parent) @@ -75,7 +91,7 @@ continue; const QString mountPath = sa->filePath(); - if (!shouldShowMountPoint(mountPath)) + if (ignoreMountPoint(mountPath)) continue; m_mountPoints.append(mountPath); @@ -209,22 +225,6 @@ return name; } -bool FilteredFolderModel::shouldShowMountPoint(const QString& mountPoint) -{ - if (mountPoint == QLatin1String("/")) - return false; - - if (mountPoint.startsWith(QLatin1String("/boot"))) - return false; - - if (mountPoint.startsWith(QLatin1String("/tmp"))) - return false; - - // The user's home directory is forcibly added so we can ignore /home - // if /home actually contains the home directory - return !(mountPoint.startsWith(QLatin1String("/home")) || !QDir::homePath().startsWith(QLatin1String("/home"))); -} - QHash FilteredFolderModel::roleNames() const { return {