Changeset View
Changeset View
Standalone View
Standalone View
recentdocuments/recentdocuments.cpp
1 | #include <QCoreApplication> | 1 | #include <QCoreApplication> | ||
---|---|---|---|---|---|
2 | #include <QDBusInterface> | 2 | #include <QDBusInterface> | ||
3 | #include <QFileInfo> | 3 | #include <QFileInfo> | ||
4 | #include <QDebug> | 4 | #include <QDebug> | ||
5 | #include <QUrl> | 5 | #include <QUrl> | ||
6 | 6 | | |||
7 | #include <KRecentDocument> | 7 | #include <KRecentDocument> | ||
8 | #include <KDirWatch> | 8 | #include <KDirWatch> | ||
9 | #include <KDesktopFile> | 9 | #include <KDesktopFile> | ||
10 | #include <KIO/Job> | 10 | #include <KIO/Job> | ||
11 | #include <KLocalizedString> | 11 | #include <KLocalizedString> | ||
12 | #include <KProtocolManager> | ||||
12 | 13 | | |||
13 | #include <stdio.h> | 14 | #include <stdio.h> | ||
14 | 15 | | |||
15 | #include "recentdocuments.h" | 16 | #include "recentdocuments.h" | ||
16 | 17 | | |||
17 | extern "C" int Q_DECL_EXPORT kdemain(int argc, char **argv) | 18 | extern "C" int Q_DECL_EXPORT kdemain(int argc, char **argv) | ||
18 | { | 19 | { | ||
19 | // necessary to use other kio slaves | 20 | // necessary to use other kio slaves | ||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Line(s) | 70 | if (isRootUrl(url)) { | |||
72 | QSet<QString> urlSet; | 73 | QSet<QString> urlSet; | ||
73 | Q_FOREACH(const QString & entry, list) { | 74 | Q_FOREACH(const QString & entry, list) { | ||
74 | if (KDesktopFile::isDesktopFile(entry)) { | 75 | if (KDesktopFile::isDesktopFile(entry)) { | ||
75 | QFileInfo info(entry); | 76 | QFileInfo info(entry); | ||
76 | KDesktopFile file(entry); | 77 | KDesktopFile file(entry); | ||
77 | 78 | | |||
78 | QUrl urlInside(file.readUrl()); | 79 | QUrl urlInside(file.readUrl()); | ||
79 | QString toDisplayString = urlInside.toDisplayString(); | 80 | QString toDisplayString = urlInside.toDisplayString(); | ||
80 | if (urlInside.scheme() == "recentdocuments" || urlSet.contains(toDisplayString)) | 81 | | ||
82 | // Filter out things that can't be viewed in a file manager because they don't | ||||
83 | // meet the user definition of a file for the purpose of "recently accessed files" | ||||
markg: Comments inside a multi-line if statement! Unheard of!
Please move that to a more appropriate… | |||||
84 | if (urlInside.scheme() == "recentdocuments" | ||||
85 | || !KProtocolManager::supportsListing(urlInside) | ||||
86 | || urlSet.contains(toDisplayString)) | ||||
81 | continue; | 87 | continue; | ||
82 | 88 | | |||
83 | KIO::UDSEntry uds; | 89 | KIO::UDSEntry uds; | ||
84 | if (urlInside.isLocalFile()) { | 90 | if (urlInside.isLocalFile()) { | ||
85 | KIO::StatJob* job = KIO::stat(urlInside, KIO::HideProgressInfo); | 91 | KIO::StatJob* job = KIO::stat(urlInside, KIO::HideProgressInfo); | ||
86 | // we do not want to wait for the event loop to delete the job | 92 | // we do not want to wait for the event loop to delete the job | ||
87 | QScopedPointer<KIO::StatJob> sp(job); | 93 | QScopedPointer<KIO::StatJob> sp(job); | ||
88 | job->setAutoDelete(false); | 94 | job->setAutoDelete(false); | ||
▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines |
Comments inside a multi-line if statement! Unheard of!
Please move that to a more appropriate place.