Changeset View
Changeset View
Standalone View
Standalone View
src/ioslaves/file/file.cpp
Context not available. | |||||
1331 | } else { | 1331 | } else { | ||
---|---|---|---|---|---|
1332 | //qDebug() << "QFile::remove" << itemPath; | 1332 | //qDebug() << "QFile::remove" << itemPath; | ||
1333 | if (!QFile::remove(itemPath)) { | 1333 | if (!QFile::remove(itemPath)) { | ||
1334 | error(KIO::ERR_CANNOT_DELETE, itemPath); | 1334 | if (errno == EACCES || errno == EPERM) { | ||
1335 | if (execWithRoot(QStringLiteral("del"), QStringLiteral("delete_file"), | ||||
1336 | itemPath, WARN_PRIVILEDGE_DEL)) { | ||||
1337 | return true; | ||||
1338 | } | ||||
1339 | error(KIO::ERR_ACCESS_DENIED, itemPath); | ||||
1340 | } else { | ||||
1341 | error(KIO::ERR_CANNOT_DELETE, itemPath); | ||||
1342 | } | ||||
1335 | return false; | 1343 | return false; | ||
1336 | } | 1344 | } | ||
1337 | } | 1345 | } | ||
Context not available. | |||||
1340 | Q_FOREACH (const QString &itemPath, dirsToDelete) { | 1348 | Q_FOREACH (const QString &itemPath, dirsToDelete) { | ||
1341 | //qDebug() << "QDir::rmdir" << itemPath; | 1349 | //qDebug() << "QDir::rmdir" << itemPath; | ||
1342 | if (!dir.rmdir(itemPath)) { | 1350 | if (!dir.rmdir(itemPath)) { | ||
1343 | error(KIO::ERR_CANNOT_DELETE, itemPath); | 1351 | if (errno == EACCES || errno == EPERM) { | ||
1352 | if (execWithRoot(QStringLiteral("del"), QStringLiteral("delete_dir"), | ||||
1353 | itemPath, WARN_PRIVILEDGE_RMDIR)) { | ||||
1354 | return true; | ||||
1355 | } | ||||
1356 | error(KIO::ERR_ACCESS_DENIED, itemPath); | ||||
1357 | } else { | ||||
1358 | error(KIO::ERR_CANNOT_DELETE, itemPath); | ||||
1359 | } | ||||
1344 | return false; | 1360 | return false; | ||
1345 | } | 1361 | } | ||
1346 | } | 1362 | } | ||
1363 | | ||||
1347 | return true; | 1364 | return true; | ||
1348 | } | 1365 | } | ||
1349 | 1366 | | |||
Context not available. |