Skip to content

Commit dcffeec

Browse files
committed
use auto everywhere
1 parent f5ab65d commit dcffeec

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

src/core/desktopentry.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -418,17 +418,17 @@ QString DesktopEntryManager::extractIdFromPath(const QString& path) {
418418
// e.g., /usr/share/applications/firefox.desktop -> firefox
419419
// e.g., /usr/share/applications/kde4/kate.desktop -> kde4-kate
420420

421-
QFileInfo info(path);
422-
QString id = info.completeBaseName();
421+
auto info = QFileInfo(path);
422+
auto id = info.completeBaseName();
423423

424424
// Find the applications directory in the path
425-
int appIdx = path.lastIndexOf("/applications/");
425+
auto appIdx = path.lastIndexOf("/applications/");
426426
if (appIdx != -1) {
427-
QString relativePath = path.mid(appIdx + 14); // Skip "/applications/"
428-
QFileInfo relInfo(relativePath);
427+
auto relativePath = path.mid(appIdx + 14); // Skip "/applications/"
428+
auto relInfo = QFileInfo(relativePath);
429429

430430
// Replace directory separators with dashes
431-
QString dirPath = relInfo.path();
431+
auto dirPath = relInfo.path();
432432
if (dirPath != ".") {
433433
id = dirPath.replace('/', '-') + '-' + relInfo.completeBaseName();
434434
}

src/core/desktopentrymonitor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ void DesktopEntryMonitor::onDirectoryChanged(const QString& path) {
8585
// Check for new subdirectories
8686
auto subdirs = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
8787
for (const QString& subdir: subdirs) {
88-
QString subdirPath = dir.absoluteFilePath(subdir);
88+
auto subdirPath = dir.absoluteFilePath(subdir);
8989
if (!this->watcher->directories().contains(subdirPath)) {
9090
this->scanAndWatch(subdirPath);
9191
}
@@ -109,6 +109,6 @@ void DesktopEntryMonitor::processChanges() {
109109
this->pendingChanges.clear();
110110

111111
// Emit with empty hash to signal full rescan needed
112-
QHash<QString, ChangeEvent> emptyChanges;
112+
auto emptyChanges = QHash<QString, ChangeEvent> {};
113113
emit desktopEntriesChanged(emptyChanges);
114114
}

src/core/desktoputils.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
#include <qtenvironmentvariables.h>
55

66
QList<QString> DesktopUtils::getDesktopDirectories() {
7-
QList<QString> dataPaths;
7+
auto dataPaths = QList<QString> {};
88

99
// XDG_DATA_HOME
10-
QString dataHome = qEnvironmentVariable("XDG_DATA_HOME");
10+
auto dataHome = qEnvironmentVariable("XDG_DATA_HOME");
1111
if (dataHome.isEmpty()) {
1212
if (qEnvironmentVariableIsSet("HOME")) {
1313
dataHome = qEnvironmentVariable("HOME") + "/.local/share";
@@ -18,7 +18,7 @@ QList<QString> DesktopUtils::getDesktopDirectories() {
1818
}
1919

2020
// XDG_DATA_DIRS
21-
QString dataDirs = qEnvironmentVariable("XDG_DATA_DIRS");
21+
auto dataDirs = qEnvironmentVariable("XDG_DATA_DIRS");
2222
if (dataDirs.isEmpty()) {
2323
dataDirs = "/usr/local/share:/usr/share";
2424
}

0 commit comments

Comments
 (0)