Ignore:
Timestamp:
04/03/09 21:17:30 (11 years ago)
Author:
Eoin
Message:

Cleaning up torrent removal code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/HaliteListView.cpp

    r737 r739  
    225225} 
    226226 
     227void HaliteListViewCtrl::remove_to_bin(hal::fs::wpath root, boost::shared_ptr<hal::file_details_vec> files) 
     228{ 
     229        std::vector<wchar_t> file_names_buffer; 
     230 
     231        foreach(hal::file_details file, *files) 
     232        { 
     233                std::wstring file_location = (hal::wform(L"File %1%\\%2%\\%3%")  
     234                        % root.file_string() % file.branch % file.filename).str(); 
     235 
     236                wstring full_file = hal::fs::wpath(root / file.branch / file.filename).file_string(); 
     237                  
     238                HAL_DEV_MSG(hal::wform(L"File %1%") % full_file); 
     239 
     240                std::copy(full_file.begin(), full_file.end(),  
     241                        std::back_inserter(file_names_buffer)); 
     242                file_names_buffer.push_back(L'\0'); 
     243        } 
     244        file_names_buffer.push_back(L'\0'); 
     245 
     246        SHFILEOPSTRUCT shf; 
     247 
     248        shf.hwnd = *this; 
     249        shf.wFunc = FO_DELETE; 
     250        shf.pFrom = &file_names_buffer[0]; 
     251        shf.pTo = 0; 
     252        shf.fFlags = FOF_ALLOWUNDO; 
     253 
     254        SHFileOperation(&shf); 
     255} 
     256 
    227257LRESULT HaliteListViewCtrl::OnRemoveWipeFiles(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) 
    228258{ 
     
    235265 
    236266        foreach(wstring name, torrent_names) 
    237                 hal::bittorrent().remove_torrent_wipe_files(name); 
     267                hal::bittorrent().remove_torrent_wipe_files(name, bind(&HaliteListViewCtrl::remove_to_bin, this, _1, _2)); 
    238268 
    239269        return 0; 
Note: See TracChangeset for help on using the changeset viewer.