Ticket #8406: focus_newly_created_directory.patch
File focus_newly_created_directory.patch, 5.8 KB (added by , 10 years ago) |
---|
-
src/interface/LocalListView.cpp
317 317 ExitComparisonMode(); 318 318 319 319 ClearSelection(); 320 focused = m_pState->GetPreviouslyVisitedLocalSubdir(); 320 321 CLocalPath lastFocusedPath(m_pState->GetPreviouslyVisitedLocalSubdir()); 322 if (lastFocusedPath.GetParent() == dirname) 323 focused = lastFocusedPath.GetLastSegment(); 324 321 325 ensureVisible = !focused.empty(); 322 326 if (focused.empty()) 323 327 focused = _T(".."); … … 867 871 wxString newdir = MenuMkdir(); 868 872 if (!newdir.empty()) { 869 873 m_pState->RefreshLocal(); 874 875 CLocalPath lp(newdir); 876 FocusSingleItem(lp.GetLastSegment()); 870 877 } 871 878 } 872 879 … … 1793 1800 } 1794 1801 } 1795 1802 } 1803 1804 void CLocalListView::FocusSingleItem(const wxString& itemName, long int state /*= wxLIST_STATE_FOCUSED*/) 1805 { 1806 if (itemName == _T("")) 1807 return; 1808 1809 for (unsigned int i = 0; i < m_indexMapping.size(); i++) 1810 { 1811 const CLocalFileData &data = m_fileData[m_indexMapping[i]]; 1812 if (data.name == itemName) 1813 { 1814 SetItemState(i, state, state); 1815 EnsureVisible(i); 1816 } 1817 else 1818 SetItemState(i, 0, state); 1819 } 1820 return; 1821 } -
src/interface/LocalListView.h
53 53 // ReselectItems 54 54 void ReselectItems(const std::list<wxString>& selectedNames, wxString focused, bool ensureVisible = false); 55 55 56 // Set focus (or other) state on the named item, remove the same state from every other 57 void FocusSingleItem(const wxString& itemName, long int state = wxLIST_STATE_FOCUSED); 58 56 59 #ifdef __WXMSW__ 57 60 void DisplayDrives(); 58 61 void DisplayShares(wxString computer); -
src/interface/RemoteListView.cpp
754 754 755 755 ClearSelection(); 756 756 757 prevFocused = m_pState->GetPreviouslyVisitedRemoteSubdir(); 757 CServerPath lastFocusedPath(m_pState->GetPreviouslyVisitedRemoteSubdir()); 758 if (pDirectoryListing && lastFocusedPath.GetParent() == pDirectoryListing->path) 759 prevFocused = lastFocusedPath.GetLastSegment(); 760 758 761 ensureVisible = !prevFocused.empty(); 759 762 } 760 763 else … … 761 764 { 762 765 // Remember which items were selected 763 766 selectedNames = RememberSelectedItems(prevFocused); 767 // instead of the previously focused item use the PreviouslySelectedRemoteSubdir 768 // if the m_pState have that information 769 if (!m_pState->GetPreviouslyVisitedRemoteSubdir().IsEmpty()) 770 { 771 CServerPath lastFocusedPath(m_pState->GetPreviouslyVisitedRemoteSubdir()); 772 if (pDirectoryListing && lastFocusedPath.GetParent().GetPath() == pDirectoryListing->path.GetPath()) 773 prevFocused = lastFocusedPath.GetLastSegment(); 774 } 764 775 } 765 776 766 777 if (m_pFilelistStatusBar) … … 1358 1369 return CServerPath(); 1359 1370 } 1360 1371 1372 CServerPath cp(path); 1373 m_pState->SetPreviouslyVisitedRemoteSubdir(cp.GetPath()); 1374 1361 1375 m_pState->m_pCommandQueue->ProcessCommand(new CMkdirCommand(path)); 1362 1376 1363 1377 // Return name of the New Directory -
src/interface/state.cpp
298 298 299 299 if (dir == m_localDir.GetParent() && rememberPreviousSubdir) { 300 300 #ifdef __WXMSW__ 301 if (dir.GetPath() == _T("\\")) { 302 m_previouslyVisitedLocalSubdir = m_localDir.GetPath(); 303 m_previouslyVisitedLocalSubdir.RemoveLast(); 304 } 301 if (dir.GetPath() == _T("\\")) 302 SetPreviouslyVisitedLocalSubdir(m_localDir.GetPath().RemoveLast()); 305 303 else 306 304 #endif 307 m_previouslyVisitedLocalSubdir = m_localDir.GetLastSegment();305 SetPreviouslyVisitedLocalSubdir(m_localDir.GetPath()); 308 306 } 309 307 else 310 m_previouslyVisitedLocalSubdir = _T("");308 SetPreviouslyVisitedLocalSubdir(_T("")); 311 309 312 310 313 311 m_localDir = dir; … … 331 329 m_pDirectoryListing = 0; 332 330 NotifyHandlers(STATECHANGE_REMOTE_DIR); 333 331 } 334 m_previouslyVisitedRemoteSubdir = _T("");332 SetPreviouslyVisitedLocalSubdir(_T("")); 335 333 return true; 336 334 } 337 335 … … 339 337 340 338 if (pDirectoryListing && m_pDirectoryListing && 341 339 pDirectoryListing->path == m_pDirectoryListing->path.GetParent()) 342 m_previouslyVisitedRemoteSubdir = m_pDirectoryListing->path.GetLastSegment();343 else 344 m_previouslyVisitedRemoteSubdir = _T("");340 SetPreviouslyVisitedRemoteSubdir(m_pDirectoryListing->path.GetPath()); 341 else if (!modified) 342 SetPreviouslyVisitedRemoteSubdir(_T("")); 345 343 346 344 if (modified) { 347 345 if (!m_pDirectoryListing || m_pDirectoryListing->path != pDirectoryListing->path) { -
src/interface/state.h
169 169 void SetSecurityInfo(CSftpEncryptionNotification const& info); 170 170 171 171 // If the previously selected directory was a direct child of the current directory, this 172 // returns the relative name of the subdirectory.172 // returns the full path of that subdirectory or an empty string otherwise. 173 173 wxString GetPreviouslyVisitedLocalSubdir() const { return m_previouslyVisitedLocalSubdir; } 174 174 wxString GetPreviouslyVisitedRemoteSubdir() const { return m_previouslyVisitedRemoteSubdir; } 175 void ClearPreviouslyVisitedLocalSubdir() { m_previouslyVisitedLocalSubdir = _T(""); }176 void ClearPreviouslyVisitedRemoteSubdir() { m_previouslyVisitedRemoteSubdir = _T(""); }175 void SetPreviouslyVisitedLocalSubdir(wxString path) { m_previouslyVisitedLocalSubdir = path; } 176 void SetPreviouslyVisitedRemoteSubdir(wxString path) { m_previouslyVisitedRemoteSubdir = path; } 177 177 178 178 protected: 179 179 void SetServer(const CServer* server);