Changeset View
Changeset View
Standalone View
Standalone View
src/core/deletejob.cpp
Show First 20 Lines • Show All 287 Lines • ▼ Show 20 Line(s) | 286 | if (!files.isEmpty() || !symlinks.isEmpty()) { | |||
---|---|---|---|---|---|
288 | do { | 288 | do { | ||
289 | // Take first file to delete out of list | 289 | // Take first file to delete out of list | ||
290 | QList<QUrl>::iterator it = files.begin(); | 290 | QList<QUrl>::iterator it = files.begin(); | ||
291 | bool isLink = false; | 291 | bool isLink = false; | ||
292 | if (it == files.end()) { // No more files | 292 | if (it == files.end()) { // No more files | ||
293 | it = symlinks.begin(); // Pick up a symlink to delete | 293 | it = symlinks.begin(); // Pick up a symlink to delete | ||
294 | isLink = true; | 294 | isLink = true; | ||
295 | } | 295 | } | ||
296 | // Normal deletion | 296 | | ||
297 | // If local file, try do it directly | | |||
298 | if ((*it).isLocalFile() && QFile::remove((*it).toLocalFile())) { | | |||
299 | //kdDebug(7007) << "DeleteJob deleted" << (*it).toLocalFile(); | | |||
300 | job = nullptr; | | |||
301 | m_processedFiles++; | | |||
302 | if (m_processedFiles % 300 == 1 || m_totalFilesDirs < 300) { // update progress info every 300 files | | |||
303 | m_currentURL = *it; | | |||
304 | slotReport(); | | |||
305 | } | | |||
306 | } else { | | |||
307 | // if remote - or if unlink() failed (we'll use the job's error handling in that case) | | |||
308 | //qDebug() << "calling file_delete on" << *it; | 297 | // qDebug() << "calling file_delete on" << *it; | ||
309 | if (isHttpProtocol(it->scheme())) { | 298 | if (isHttpProtocol(it->scheme())) { | ||
310 | job = KIO::http_delete(*it, KIO::HideProgressInfo); | 299 | job = KIO::http_delete(*it, KIO::HideProgressInfo); | ||
311 | } else { | 300 | } else { | ||
312 | job = KIO::file_delete(*it, KIO::HideProgressInfo); | 301 | job = KIO::file_delete(*it, KIO::HideProgressInfo); | ||
313 | job->setParentJob(q); | 302 | job->setParentJob(q); | ||
314 | } | 303 | } | ||
315 | Scheduler::setJobPriority(job, 1); | 304 | Scheduler::setJobPriority(job, 1); | ||
316 | m_currentURL = (*it); | 305 | m_currentURL = (*it); | ||
306 | | ||||
307 | m_processedFiles++; | ||||
308 | // update progress info every 300 files or if there are less than 300 delete operations | ||||
309 | if (m_processedFiles % 300 == 1 || m_totalFilesDirs < 300) { | ||||
310 | m_currentURL = *it; | ||||
311 | slotReport(); | ||||
317 | } | 312 | } | ||
313 | | ||||
318 | if (isLink) { | 314 | if (isLink) { | ||
319 | symlinks.erase(it); | 315 | symlinks.erase(it); | ||
320 | } else { | 316 | } else { | ||
321 | files.erase(it); | 317 | files.erase(it); | ||
322 | } | 318 | } | ||
323 | if (job) { | 319 | if (job) { | ||
324 | q->addSubjob(job); | 320 | q->addSubjob(job); | ||
325 | return; | 321 | return; | ||
▲ Show 20 Lines • Show All 189 Lines • Show Last 20 Lines |