void ManagedFileListWidget::Download() { #ifdef HAVE_DOWNLOAD_MANAGER assert(Net::DownloadManager::IsAvailable()); if (items.empty()) return; const unsigned current = GetList().GetCursorIndex(); assert(current < items.size()); const FileItem &item = items[current]; const AvailableFile *remote_file_p = FindRemoteFile(repository, item.name); if (remote_file_p == NULL) return; const AvailableFile &remote_file = *remote_file_p; ACPToWideConverter base(remote_file.GetName()); if (!base.IsValid()) return; Net::DownloadManager::Enqueue(remote_file.uri.c_str(), base); #endif }
gcc_pure static const AvailableFile * FindRemoteFile(const FileRepository &repository, const TCHAR *name) { WideToACPConverter name2(name); if (!name2.IsValid()) return NULL; return FindRemoteFile(repository, name2); }
gcc_pure static const AvailableFile * FindRemoteFile(const FileRepository &repository, const TCHAR *name) { const WideToUTF8Converter name2(name); if (!name2.IsValid()) return nullptr; return FindRemoteFile(repository, name2); }
gcc_pure static bool CanDownload(const FileRepository &repository, const TCHAR *name) { return FindRemoteFile(repository, name) != NULL; }