pull/16/merge
std::_Rb_tree 1 year ago committed by GitHub
commit 4db201d8e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -61,7 +61,15 @@ LauncherModel::LauncherModel(QObject *parent)
QtConcurrent::run(LauncherModel::refresh, this);
m_fileWatcher->addPath("/usr/share/applications");
m_appPaths << "/usr/share/applications";
m_appPaths << QDir::homePath() + "/.local/share/applications";
m_appPaths << "/var/lib/flatpak/exports/share/applications";
m_appPaths << QDir::homePath() + "/.local/share/flatpak/exports/share/applications";
for (const auto & appPath : m_appPaths) {
m_fileWatcher->addPath(appPath);
}
connect(m_fileWatcher, &QFileSystemWatcher::fileChanged, this, &LauncherModel::onFileChanged);
connect(m_fileWatcher, &QFileSystemWatcher::directoryChanged, this, [this](const QString &) {
QtConcurrent::run(LauncherModel::refresh, this);
@ -224,14 +232,17 @@ void LauncherModel::refresh(LauncherModel *manager)
addedEntries.append(item.id);
QStringList allEntries;
QDirIterator it("/usr/share/applications", { "*.desktop" }, QDir::NoFilter, QDirIterator::Subdirectories);
while (it.hasNext()) {
const auto fileName = it.next();
if (!QFile::exists(fileName))
continue;
for (const auto & appPath : manager->m_appPaths) {
QDirIterator it(appPath, { "*.desktop" }, QDir::NoFilter, QDirIterator::Subdirectories);
while (it.hasNext()) {
const auto fileName = it.next();
if (!QFile::exists(fileName))
continue;
allEntries.append(fileName);
allEntries.append(fileName);
}
}
for (const QString &fileName : allEntries) {

@ -94,6 +94,8 @@ private Q_SLOTS:
void removeApp(const QString &fileName);
private:
QList<QString> m_appPaths;
QList<AppItem> m_appItems;
QList<AppItem> m_searchItems;

Loading…
Cancel
Save