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