Changeset View
Changeset View
Standalone View
Standalone View
src/core/deletejob.cpp
Show First 20 Lines • Show All 104 Lines • ▼ Show 20 Line(s) | 70 | public: | |||
---|---|---|---|---|---|
105 | 105 | | |||
106 | static inline DeleteJob *newJob(const QList<QUrl> &src, JobFlags flags) | 106 | static inline DeleteJob *newJob(const QList<QUrl> &src, JobFlags flags) | ||
107 | { | 107 | { | ||
108 | DeleteJob *job = new DeleteJob(*new DeleteJobPrivate(src)); | 108 | DeleteJob *job = new DeleteJob(*new DeleteJobPrivate(src)); | ||
109 | job->setUiDelegate(KIO::createDefaultJobUiDelegate()); | 109 | job->setUiDelegate(KIO::createDefaultJobUiDelegate()); | ||
110 | if (!(flags & HideProgressInfo)) { | 110 | if (!(flags & HideProgressInfo)) { | ||
111 | KIO::getJobTracker()->registerJob(job); | 111 | KIO::getJobTracker()->registerJob(job); | ||
112 | } | 112 | } | ||
113 | if (!(flags & NoPrivilegeExecution)) { | ||||
114 | job->d_func()->m_privilegeExecutionEnabled = true; | ||||
115 | job->d_func()->m_operationType = Delete; | ||||
116 | } | ||||
113 | return job; | 117 | return job; | ||
114 | } | 118 | } | ||
115 | }; | 119 | }; | ||
116 | 120 | | |||
117 | } // namespace KIO | 121 | } // namespace KIO | ||
118 | 122 | | |||
119 | using namespace KIO; | 123 | using namespace KIO; | ||
120 | 124 | | |||
▲ Show 20 Lines • Show All 179 Lines • ▼ Show 20 Line(s) | 297 | if ((*it).isLocalFile() && QFile::remove((*it).toLocalFile())) { | |||
300 | } | 304 | } | ||
301 | } else { | 305 | } else { | ||
302 | // if remote - or if unlink() failed (we'll use the job's error handling in that case) | 306 | // if remote - or if unlink() failed (we'll use the job's error handling in that case) | ||
303 | //qDebug() << "calling file_delete on" << *it; | 307 | //qDebug() << "calling file_delete on" << *it; | ||
304 | if (isHttpProtocol(it->scheme())) { | 308 | if (isHttpProtocol(it->scheme())) { | ||
305 | job = KIO::http_delete(*it, KIO::HideProgressInfo); | 309 | job = KIO::http_delete(*it, KIO::HideProgressInfo); | ||
306 | } else { | 310 | } else { | ||
307 | job = KIO::file_delete(*it, KIO::HideProgressInfo); | 311 | job = KIO::file_delete(*it, KIO::HideProgressInfo); | ||
312 | job->setParentJob(q); | ||||
308 | } | 313 | } | ||
309 | Scheduler::setJobPriority(job, 1); | 314 | Scheduler::setJobPriority(job, 1); | ||
310 | m_currentURL = (*it); | 315 | m_currentURL = (*it); | ||
311 | } | 316 | } | ||
312 | if (isLink) { | 317 | if (isLink) { | ||
313 | symlinks.erase(it); | 318 | symlinks.erase(it); | ||
314 | } else { | 319 | } else { | ||
315 | files.erase(it); | 320 | files.erase(it); | ||
Show All 22 Lines | 341 | if ((*it).isLocalFile() && QDir().rmdir((*it).toLocalFile())) { | |||
338 | if (m_processedDirs % 100 == 1) { // update progress info every 100 dirs | 343 | if (m_processedDirs % 100 == 1) { // update progress info every 100 dirs | ||
339 | m_currentURL = *it; | 344 | m_currentURL = *it; | ||
340 | slotReport(); | 345 | slotReport(); | ||
341 | } | 346 | } | ||
342 | } else { | 347 | } else { | ||
343 | // Call rmdir - works for kioslaves with canDeleteRecursive too, | 348 | // Call rmdir - works for kioslaves with canDeleteRecursive too, | ||
344 | // CMD_DEL will trigger the recursive deletion in the slave. | 349 | // CMD_DEL will trigger the recursive deletion in the slave. | ||
345 | SimpleJob *job = KIO::rmdir(*it); | 350 | SimpleJob *job = KIO::rmdir(*it); | ||
351 | job->setParentJob(q); | ||||
346 | job->addMetaData(QStringLiteral("recurse"), QStringLiteral("true")); | 352 | job->addMetaData(QStringLiteral("recurse"), QStringLiteral("true")); | ||
347 | Scheduler::setJobPriority(job, 1); | 353 | Scheduler::setJobPriority(job, 1); | ||
348 | dirs.erase(it); | 354 | dirs.erase(it); | ||
349 | q->addSubjob(job); | 355 | q->addSubjob(job); | ||
350 | return; | 356 | return; | ||
351 | } | 357 | } | ||
352 | dirs.erase(it); | 358 | dirs.erase(it); | ||
353 | } while (!dirs.isEmpty()); | 359 | } while (!dirs.isEmpty()); | ||
▲ Show 20 Lines • Show All 154 Lines • Show Last 20 Lines |