MCPcopy Create free account
hub / github.com/ashkulz/NppFTP / LoadCacheMaps

Method LoadCacheMaps

src/Windows/ProfilesDialog.cpp:825–868  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

823}
824
825int 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
870int ProfilesDialog::EnableCacheMapUI() {
871 HWND hListview = ::GetDlgItem(m_hPageCache, IDC_LIST_CACHE);

Callers

nothing calls this directly

Calls 2

GetCacheMethod · 0.80
GetPathMapCountMethod · 0.80

Tested by

no test coverage detected