| 1302 | } |
| 1303 | |
| 1304 | void Backend::deleteOneDriveItem(const QString &itemId, const QString &token, uint appId) |
| 1305 | { |
| 1306 | QUrl url(QString("https://graph.microsoft.com/v1.0/me/drive/items/%1").arg(itemId)); |
| 1307 | |
| 1308 | QNetworkRequest req(url); |
| 1309 | req.setRawHeader("Authorization", ("Bearer " + token).toUtf8()); |
| 1310 | |
| 1311 | auto *reply = m_nam->deleteResource(req); |
| 1312 | connect(reply, &QNetworkReply::finished, this, [reply, itemId, appId]() { |
| 1313 | reply->deleteLater(); |
| 1314 | int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); |
| 1315 | if (status >= 200 && status < 300) { |
| 1316 | fprintf(stderr, "[Backend] Deleted OneDrive file %s for app %u\n", |
| 1317 | itemId.toUtf8().constData(), appId); |
| 1318 | } else if (status == 404) { |
| 1319 | // Already deleted |
| 1320 | } else { |
| 1321 | fprintf(stderr, "[Backend] Failed to delete OneDrive file %s for app %u: HTTP %d\n", |
| 1322 | itemId.toUtf8().constData(), appId, status); |
| 1323 | } |
| 1324 | }); |
| 1325 | } |
| 1326 | |
| 1327 | QVariantList Backend::listBackups() |
| 1328 | { |
nothing calls this directly
no outgoing calls
no test coverage detected