Ticket #8406: focus_newly_created_directory_local_only.patch

File focus_newly_created_directory_local_only.patch, 4.2 KB (added by dudu, 11 years ago)

Patch implementing the ticket, only on the local side

  • src/interface/LocalListView.cpp

     
    12201220        wxBell();
    12211221
    12221222    DisplayDir(m_dir);
     1223
     1224    if (res)
     1225    {
     1226        CLocalPath lp(fn.GetPath());
     1227        FocusSingleItem(lp.GetLastSegment());
    12231228}
     1229}
    12241230
    12251231void CLocalListView::OnMenuDelete(wxCommandEvent& event)
    12261232{
     
    13111317        wxCommandEvent cmdEvent;
    13121318        OnMenuUpload(cmdEvent);
    13131319    }
     1320    else if (code == 'N' && event.ControlDown() && event.ShiftDown())
     1321    {
     1322        wxCommandEvent cmdEvent;
     1323        OnMenuMkdir(cmdEvent);
     1324    }
    13141325    else
    13151326        event.Skip();
    13161327}
     
    15931604    }
    15941605}
    15951606
     1607void CLocalListView::FocusSingleItem(const wxString& itemName, long int state /*= wxLIST_STATE_FOCUSED*/)
     1608{
     1609    if (itemName == _T(""))
     1610        return;
     1611
     1612    for (unsigned int i = 0; i < m_indexMapping.size(); i++)
     1613    {
     1614        const CLocalFileData &data = m_fileData[m_indexMapping[i]];
     1615        if (data.name == itemName)
     1616        {
     1617            SetItemState(i, state, state);
     1618            EnsureVisible(i);
     1619        }
     1620        else
     1621        {
     1622            SetItemState(i, 0, state);
     1623        }
     1624    }
     1625    return;
     1626}
     1627
    15961628void CLocalListView::OnStateChange(CState* pState, enum t_statechange_notifications notification, const wxString& data, const void* data2)
    15971629{
    15981630    if (notification == STATECHANGE_LOCAL_DIR)
  • src/interface/state.h

     
    169169    wxString GetPreviouslyVisitedLocalSubdir() const { return m_previouslyVisitedLocalSubdir; }
    170170    wxString GetPreviouslyVisitedRemoteSubdir() const { return m_previouslyVisitedRemoteSubdir; }
    171171
     172    void SetPreviouslyVisitedLocalSubdir(wxString new_subdir) { m_previouslyVisitedLocalSubdir = new_subdir; }
     173    void SetPreviouslyVisitedRemoteSubdir(wxString new_subdir) { m_previouslyVisitedRemoteSubdir = new_subdir; }
     174
    172175protected:
    173176    void SetServer(const CServer* server);
    174177
  • src/interface/RemoteListView.cpp

     
    18451851        wxCommandEvent cmdEvent;
    18461852        OnMenuDownload(cmdEvent);
    18471853    }
     1854    else if (code == 'N' && event.ControlDown() && event.ShiftDown())
     1855    {
     1856        wxCommandEvent cmdEvent;
     1857        OnMenuMkdir(cmdEvent);
     1858    }
    18481859    else
    18491860        event.Skip();
    18501861}
  • src/interface/LocalListView.h

     
    5353    // ReselectItems
    5454    void ReselectItems(const std::list<wxString>& selectedNames, wxString focused);
    5555
     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
    5659#ifdef __WXMSW__
    5760    void DisplayDrives();
    5861    void DisplayShares(wxString computer);
  • src/interface/state.cpp

     
    308308    }
    309309
    310310    if (p == m_localDir.GetParent())
    311         m_previouslyVisitedLocalSubdir = m_localDir.GetLastSegment();
     311        SetPreviouslyVisitedLocalSubdir(m_localDir.GetLastSegment());
    312312    else
    313         m_previouslyVisitedLocalSubdir = _T("");
     313        SetPreviouslyVisitedLocalSubdir(_T(""));
    314314   
    315315
    316316    m_localDir = p;
     
    335335            m_pDirectoryListing = 0;
    336336            NotifyHandlers(STATECHANGE_REMOTE_DIR);
    337337        }
    338         m_previouslyVisitedRemoteSubdir = _T("");
     338        SetPreviouslyVisitedRemoteSubdir(_T(""));
    339339        return true;
    340340    }
    341341
     
    343343   
    344344    if (pDirectoryListing && m_pDirectoryListing &&
    345345        pDirectoryListing->path == m_pDirectoryListing->path.GetParent())
    346         m_previouslyVisitedRemoteSubdir = m_pDirectoryListing->path.GetLastSegment();
    347     else
    348         m_previouslyVisitedRemoteSubdir = _T("");
     346        SetPreviouslyVisitedRemoteSubdir(m_pDirectoryListing->path.GetLastSegment());
     347    else if (!modified) // On modification (like mkdir), there might be hinting stored so we don't clear the m_previouslyVisitedRemoteSubdir
     348        SetPreviouslyVisitedRemoteSubdir(_T(""));
    349349
    350350    if (modified)
    351351    {