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