Changeset View
Changeset View
Standalone View
Standalone View
src/sessionmodel.cpp
Show First 20 Lines • Show All 59 Lines • ▼ Show 20 Line(s) | 59 | { | |||
---|---|---|---|---|---|
60 | QDir dir(path); | 60 | QDir dir(path); | ||
61 | dir.setNameFilters(QStringList() << QStringLiteral("*.desktop")); | 61 | dir.setNameFilters(QStringList() << QStringLiteral("*.desktop")); | ||
62 | dir.setFilter(QDir::Files); | 62 | dir.setFilter(QDir::Files); | ||
63 | // read session | 63 | // read session | ||
64 | foreach(const QString &session, dir.entryList()) { | 64 | foreach(const QString &session, dir.entryList()) { | ||
65 | QFile inputFile(dir.absoluteFilePath(session)); | 65 | QFile inputFile(dir.absoluteFilePath(session)); | ||
66 | if (!inputFile.open(QIODevice::ReadOnly)) | 66 | if (!inputFile.open(QIODevice::ReadOnly)) | ||
67 | continue; | 67 | continue; | ||
68 | SessionPtr si { new Session { session, QString(), QString(), QString() } }; | 68 | SessionPtr si { new Session { session.chopped(strlen(".desktop")), QString(), QString(), QString() } }; | ||
69 | bool isHidden = false; | 69 | bool isHidden = false; | ||
70 | QString current_section; | 70 | QString current_section; | ||
71 | QTextStream in(&inputFile); | 71 | QTextStream in(&inputFile); | ||
72 | while (!in.atEnd()) { | 72 | while (!in.atEnd()) { | ||
73 | QString line = in.readLine(); | 73 | QString line = in.readLine(); | ||
74 | 74 | | |||
75 | if (line.startsWith(QLatin1String("["))) { | 75 | if (line.startsWith(QLatin1String("["))) { | ||
76 | // The section name ends before the last ] before the start of a comment | 76 | // The section name ends before the last ] before the start of a comment | ||
▲ Show 20 Lines • Show All 80 Lines • Show Last 20 Lines |