| 823 | } |
| 824 | |
| 825 | int ProfilesDialog::LoadCacheMaps() { |
| 826 | HWND hListview = ::GetDlgItem(m_hPageCache, IDC_LIST_CACHE); |
| 827 | if (!m_currentProfile) { |
| 828 | ListView_DeleteAllItems(hListview); |
| 829 | return 0; |
| 830 | } |
| 831 | |
| 832 | FTPCache * cache = m_currentProfile->GetCache(); |
| 833 | |
| 834 | int curSelection = ListView_GetNextItem(hListview, -1, LVNI_ALL|LVNI_SELECTED); |
| 835 | |
| 836 | if (curSelection >= cache->GetPathMapCount()) |
| 837 | curSelection = cache->GetPathMapCount()-1; |
| 838 | if (curSelection == -1) |
| 839 | curSelection = 0; |
| 840 | |
| 841 | ListView_DeleteAllItems(hListview); |
| 842 | |
| 843 | LVITEM lvi; |
| 844 | lvi.mask = LVIF_TEXT | LVIF_STATE; |
| 845 | lvi.state = 0; |
| 846 | lvi.stateMask = LVIS_SELECTED; |
| 847 | lvi.iItem = 0; |
| 848 | lvi.iSubItem = 0; |
| 849 | |
| 850 | for(int i = 0; i < cache->GetPathMapCount(); i++) { |
| 851 | const PathMap & pathmap = cache->GetPathMap(i); |
| 852 | lvi.state = (i == curSelection)?LVIS_SELECTED:0; |
| 853 | lvi.iItem = i; |
| 854 | lvi.iSubItem = 0; |
| 855 | lvi.pszText = (TCHAR*)pathmap.localpath; |
| 856 | int index = ListView_InsertItem(hListview, &lvi); |
| 857 | if (index == -1) |
| 858 | return -1; |
| 859 | TCHAR * external = SU::Utf8ToTChar(pathmap.externalpath); |
| 860 | ListView_SetItemText(hListview, index, 1, external); |
| 861 | SU::FreeTChar(external); |
| 862 | } |
| 863 | |
| 864 | OnCacheMapSelect(); |
| 865 | EnableCacheMapUI(); |
| 866 | |
| 867 | return 0; |
| 868 | } |
| 869 | |
| 870 | int ProfilesDialog::EnableCacheMapUI() { |
| 871 | HWND hListview = ::GetDlgItem(m_hPageCache, IDC_LIST_CACHE); |
nothing calls this directly
no test coverage detected