MCPcopy Create free account
hub / github.com/KDE/kdevelop / startNextJob

Method startNextJob

kdevplatform/project/filemanagerlistjob.cpp:87–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85}
86
87void FileManagerListJob::startNextJob()
88{
89 if (m_listQueue.empty() || isCanceled()) {
90 return;
91 }
92
93#ifdef TIME_IMPORT_JOB
94 m_subTimer.start();
95#endif
96
97 m_item = m_listQueue.dequeue();
98 if (m_item->path().isLocalFile()) {
99 // optimized version for local projects using QDir directly
100 m_localFolderFuture = QtConcurrent::run([this] (const Path& path) {
101 if (isCanceled()) {
102 return;
103 }
104 QDir dir(path.toLocalFile());
105 const auto entries = dir.entryInfoList(QDir::NoDotAndDotDot | QDir::AllEntries | QDir::Hidden);
106 if (isCanceled()) {
107 return;
108 }
109 KIO::UDSEntryList results;
110 std::transform(entries.begin(), entries.end(), std::back_inserter(results), [] (const QFileInfo& info) -> KIO::UDSEntry {
111 KIO::UDSEntry entry;
112 entry.fastInsert(KIO::UDSEntry::UDS_NAME, info.fileName());
113 if (info.isDir()) {
114 entry.fastInsert(KIO::UDSEntry::UDS_FILE_TYPE, QT_STAT_DIR);
115 }
116 if (info.isSymLink()) {
117 entry.fastInsert(KIO::UDSEntry::UDS_LINK_DEST, info.symLinkTarget());
118 }
119 return entry;
120 });
121 QMetaObject::invokeMethod(this, "handleResults", Q_ARG(KIO::UDSEntryList, results));
122 }, m_item->path());
123 } else {
124 KIO::ListJob* job = KIO::listDir( m_item->path().toUrl(), KIO::HideProgressInfo );
125 job->addMetaData(QStringLiteral("details"), QStringLiteral("0"));
126 connect(job, &KIO::ListJob::entries, this, &FileManagerListJob::remoteFolderSubjobEntriesFound);
127 connect(job, &KJob::finished, this, &FileManagerListJob::remoteFolderSubjobFinished);
128
129 m_remoteFolderSubjob = job;
130 }
131}
132
133void FileManagerListJob::remoteFolderSubjobFinished(KJob* job)
134{

Callers

nothing calls this directly

Calls 11

transformFunction · 0.85
emptyMethod · 0.80
isLocalFileMethod · 0.80
toLocalFileMethod · 0.80
runFunction · 0.50
startMethod · 0.45
pathMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
fileNameMethod · 0.45
toUrlMethod · 0.45

Tested by

no test coverage detected