bool MtpDevice::StartCopy(QList<Song::FileType>* supported_types) { // Ensure only one "organise files" can be active at any one time db_busy_.lock(); // Connect to the device connection_.reset(new MtpConnection(url_)); // Did the caller want a list of supported types? if (supported_types) { if (!GetSupportedFiletypes(supported_types, connection_->device())) { FinishCopy(false); return false; } } return true; }
bool WmdmDevice::StartCopy(QList<Song::FileType>* supported_types) { // Ensure only one "organise files" can be active at any one time db_busy_.lock(); // This initialises COM and gets a connection to the device thread_.reset(new WmdmThread); if (!thread_->manager()) return false; // Find a place to put the files. We default to the root folder for now, but // could look for a "Music" folder in the future? WmdmLister* wmdm_lister = static_cast<WmdmLister*>(lister()); QString canonical_name = wmdm_lister->DeviceCanonicalName(unique_id()); IWMDMStorage* destination = thread_->GetRootStorage(canonical_name); // Get the control interface destination->QueryInterface(IID_IWMDMStorageControl3, (void**)&storage_control_); // Get the storage3 interface for CreateEmptyMetadataObject later destination->QueryInterface(IID_IWMDMStorage3, (void**)&storage_); destination->Release(); // Did the caller want a list of supported filetypes? if (supported_types) { IWMDMDevice* device = thread_->GetDeviceByCanonicalName(canonical_name); if (!GetSupportedFiletypes(supported_types, device)) { device->Release(); FinishCopy(false); return false; } device->Release(); } return true; }
void MtpDevice::FinishDelete(bool success) { FinishCopy(success); }