Bug 1036862 - [MTP] Support 'Delete files/folders', r=dhylands

With this patch, users can delete files and folders on Firefox OS
devices while using MTP. My host is Ubuntu 13.04.
This commit is contained in:
Eric Chou 2014-07-22 11:12:22 +08:00
Родитель c7bc18daec
Коммит f834cccf61
1 изменённых файлов: 12 добавлений и 4 удалений

Просмотреть файл

@ -261,7 +261,7 @@ MozMtpDatabase::getObjectList(MtpStorageID aStorageID,
DbArray::index_type entryIndex;
for (entryIndex = 1; entryIndex < numEntries; entryIndex++) {
RefPtr<DbEntry> entry = mDb[entryIndex];
if (entry->mParent == aParent) {
if (entry && entry->mParent == aParent) {
list->push(entry->mHandle);
}
}
@ -785,11 +785,19 @@ MozMtpDatabase::getObjectFilePath(MtpObjectHandle aHandle,
MtpResponseCode
MozMtpDatabase::deleteFile(MtpObjectHandle aHandle)
{
MTP_LOG("Handle: 0x%08x (NOT SUPPORTED)", aHandle);
RefPtr<DbEntry> entry = GetEntry(aHandle);
if (!entry) {
MTP_ERR("Invalid Handle: 0x%08x", aHandle);
return MTP_RESPONSE_INVALID_OBJECT_HANDLE;
}
//TODO
MTP_LOG("Handle: 0x%08x '%s'", aHandle, entry->mPath.get());
return MTP_RESPONSE_OPERATION_NOT_SUPPORTED;
// File deletion will happen in lower level implementation.
// The only thing we need to do is removing the entry from the db.
RemoveEntry(aHandle);
return MTP_RESPONSE_OK;
}
#if 0