当前位置: 首页>>代码示例>>C++>>正文


C++ CServerPath::GetPath方法代码示例

本文整理汇总了C++中CServerPath::GetPath方法的典型用法代码示例。如果您正苦于以下问题:C++ CServerPath::GetPath方法的具体用法?C++ CServerPath::GetPath怎么用?C++ CServerPath::GetPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CServerPath的用法示例。


在下文中一共展示了CServerPath::GetPath方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnMkdir

void CRemoteTreeView::OnMkdir(wxCommandEvent& event)
{
    if (!m_pState->IsRemoteIdle())
        return;

    if (!m_contextMenuItem)
        return;

    const CServerPath& path = GetPathFromItem(m_contextMenuItem);
    if (path.IsEmpty())
        return;

    CInputDialog dlg;
    if (!dlg.Create(this, _("Create directory"), _("Please enter the name of the directory which should be created:")))
        return;

    CServerPath newPath = path;

    // Append a long segment which does (most likely) not exist in the path and
    // replace it with "New directory" later. This way we get the exact position of
    // "New directory" and can preselect it in the dialog.
    wxString tmpName = _T("25CF809E56B343b5A12D1F0466E3B37A49A9087FDCF8412AA9AF8D1E849D01CF");
    if (newPath.AddSegment(tmpName))
    {
        wxString pathName = newPath.GetPath();
        int pos = pathName.Find(tmpName);
        wxASSERT(pos != -1);
        wxString newName = _("New directory");
        pathName.Replace(tmpName, newName);
        dlg.SetValue(pathName);
        dlg.SelectText(pos, pos + newName.Length());
    }

    if (dlg.ShowModal() != wxID_OK)
        return;

    newPath = path;
    if (!newPath.ChangePath(dlg.GetValue()))
    {
        wxBell();
        return;
    }

    m_pState->m_pCommandQueue->ProcessCommand(new CMkdirCommand(newPath));
    CServerPath listed;
    if (newPath.HasParent())
    {
        listed = newPath.GetParent();
        m_pState->ChangeRemoteDir(listed);
    }

    CServerPath currentPath;
    const wxTreeItemId selected = GetSelection();
    if (selected)
        currentPath = GetPathFromItem(selected);
    if (!currentPath.IsEmpty() && currentPath != listed)
        m_pState->ChangeRemoteDir(currentPath);
}
开发者ID:AbelTian,项目名称:filezilla,代码行数:58,代码来源:RemoteTreeView.cpp

示例2: GetCurrentPath

//---------------------------------------------------------------------------
bool TFileZillaIntf::GetCurrentPath(wchar_t * Path, size_t MaxLen)
{
  CServerPath APath;
  bool Result = Check(FFileZillaApi->GetCurrentPath(APath), L"getcurrentpath");
  if (Result)
  {
    wcsncpy(Path, APath.GetPath(), MaxLen);
    Path[MaxLen - 1] = L'\0';
  }
  return Result;
}
开发者ID:kocicjelena,项目名称:Far-NetBox,代码行数:12,代码来源:FileZillaIntf.cpp

示例3: ParsePwdReply

bool CControlSocket::ParsePwdReply(wxString reply, bool unquoted /*=false*/, const CServerPath& defaultPath /*=CServerPath()*/)
{
    if (!unquoted)
    {
        int pos1 = reply.Find('"');
        int pos2 = reply.Find('"', true);
        if (pos1 == -1 || pos1 >= pos2)
        {
            pos1 = reply.Find('\'');
            pos2 = reply.Find('\'', true);

            if (pos1 != -1 && pos1 < pos2)
                LogMessage(__TFILE__, __LINE__, this, Debug_Info, _T("Broken server sending single-quoted path instead of double-quoted path."));
        }
        if (pos1 == -1 || pos1 >= pos2)
        {
            LogMessage(__TFILE__, __LINE__, this, Debug_Info, _T("Broken server, no quoted path found in pwd reply, trying first token as path"));
            pos1 = reply.Find(' ');
            if (pos1 != -1)
            {
                reply = reply.Mid(pos1 + 1);
                pos2 = reply.Find(' ');
                if (pos2 != -1)
                    reply = reply.Left(pos2);
            }
            else
                reply = _T("");
        }
        else
        {
            reply = reply.Mid(pos1 + 1, pos2 - pos1 - 1);
            reply.Replace(_T("\"\""), _T("\""));
        }
    }

    m_CurrentPath.SetType(m_pCurrentServer->GetType());
    if (reply == _T("") || !m_CurrentPath.SetPath(reply))
    {
        if (reply != _T(""))
            LogMessage(::Error, _("Failed to parse returned path."));
        else
            LogMessage(::Error, _("Server returned empty path."));

        if (!defaultPath.IsEmpty())
        {
            LogMessage(Debug_Warning, _T("Assuming path is '%s'."), defaultPath.GetPath().c_str());
            m_CurrentPath = defaultPath;
            return true;
        }
        return false;
    }

    return true;
}
开发者ID:erich0929,项目名称:programming,代码行数:54,代码来源:ControlSocket.cpp

示例4: Run

int CNewBookmarkDialog::Run(const wxString &local_path, const CServerPath &remote_path)
{
    if (!Load(m_parent, _T("ID_NEWBOOKMARK")))
        return wxID_CANCEL;

    XRCCTRL(*this, "ID_LOCALPATH", wxTextCtrl)->ChangeValue(local_path);
    if (!remote_path.empty())
        XRCCTRL(*this, "ID_REMOTEPATH", wxTextCtrl)->ChangeValue(remote_path.GetPath());

    if (!m_server)
        XRCCTRL(*this, "ID_TYPE_SITE", wxRadioButton)->Enable(false);

    return ShowModal();
}
开发者ID:juaristi,项目名称:filezilla,代码行数:14,代码来源:bookmarks_dialog.cpp

示例5: Load

bool CSearchDialog::Load()
{
    if (!wxDialogEx::Load(m_parent, _T("ID_SEARCH")))
        return false;

    /* XRCed complains if adding a status bar to a dialog, so do it here instead */
    CFilelistStatusBar* pStatusBar = new CFilelistStatusBar(this);
    pStatusBar->SetEmptyString(_("No search results"));

    GetSizer()->Add(pStatusBar, 0, wxGROW);

    if (!CreateListControl(filter_name | filter_size | filter_path | filter_date))
        return false;

    m_results = new CSearchDialogFileList(this, m_pState, 0);
    ReplaceControl(XRCCTRL(*this, "ID_RESULTS", wxWindow), m_results);

    m_results->SetFilelistStatusBar(pStatusBar);

    const CServerPath path = m_pState->GetRemotePath();
    if (!path.IsEmpty())
        XRCCTRL(*this, "ID_PATH", wxTextCtrl)->ChangeValue(path.GetPath());

    SetCtrlState();

    m_pWindowStateManager = new CWindowStateManager(this);
    m_pWindowStateManager->Restore(OPTION_SEARCH_SIZE, wxSize(750, 500));

    Layout();

    LoadConditions();
    EditFilter(m_search_filter);
    XRCCTRL(*this, "ID_CASE", wxCheckBox)->SetValue(m_search_filter.matchCase);

    return true;
}
开发者ID:pappacurds,项目名称:filezilla,代码行数:36,代码来源:search.cpp

示例6: MakeParent

wxTreeItemId CRemoteTreeView::MakeParent(CServerPath path, bool select)
{
    std::vector<wxString> pieces;
    pieces.reserve(path.SegmentCount() + 1);
    while (path.HasParent()) {
        pieces.push_back(path.GetLastSegment());
        path = path.GetParent();
    }
    wxASSERT(!path.GetPath().empty());
    pieces.push_back(path.GetPath());

    const wxTreeItemId root = GetRootItem();
    wxTreeItemId parent = root;

    for (std::vector<wxString>::const_reverse_iterator iter = pieces.rbegin(); iter != pieces.rend(); ++iter) {
        if (iter != pieces.rbegin())
            path.AddSegment(*iter);

        wxTreeItemIdValue cookie;
        wxTreeItemId child = GetFirstChild(parent, cookie);
        if (child && GetItemText(child).empty()) {
            Delete(child);
            child = wxTreeItemId();
            if (parent != root)
                ListExpand(parent);
        }
        for (child = GetFirstChild(parent, cookie); child; child = GetNextSibling(child)) {
            const wxString& text = GetItemText(child);
            if (text == *iter)
                break;
        }
        if (!child) {
            CDirectoryListing listing;

            if (m_pState->m_pEngine->CacheLookup(path, listing) == FZ_REPLY_OK) {
                child = AppendItem(parent, *iter, 0, 2, path.HasParent() ? 0 : new CItemData(path));
                SetItemImages(child, false);
            }
            else {
                child = AppendItem(parent, *iter, 1, 3, path.HasParent() ? 0 : new CItemData(path));
                SetItemImages(child, true);
            }
            SortChildren(parent);

            auto nextIter = iter;
            ++nextIter;
            if (nextIter != pieces.rend())
                DisplayItem(child, listing);
        }
        if (select && iter != pieces.rbegin()) {
#ifndef __WXMSW__
            // Prevent CalculatePositions from being called
            wxGenericTreeItem *anchor = m_anchor;
            m_anchor = 0;
#endif
            Expand(parent);
#ifndef __WXMSW__
            m_anchor = anchor;
#endif
        }

        parent = child;
    }

    return parent;
}
开发者ID:oneminot,项目名称:filezilla3,代码行数:66,代码来源:RemoteTreeView.cpp

示例7: ApplyFilters

void CRemoteTreeView::ApplyFilters(bool resort)
{
    std::list<struct _parents> parents;

    const wxTreeItemId root = GetRootItem();
    wxTreeItemIdValue cookie;
    for (wxTreeItemId child = GetFirstChild(root, cookie); child; child = GetNextSibling(child)) {
        CServerPath path = GetPathFromItem(child);
        if (path.empty())
            continue;

        struct _parents dir;
        dir.item = child;
        dir.path = path;
        parents.push_back(dir);
    }

    CFilterManager filter;
    while (!parents.empty()) {
        struct _parents parent = parents.back();
        parents.pop_back();

        if (resort) {
            SortChildren(parent.item);
        }

        CDirectoryListing listing;
        if (m_pState->m_pEngine->CacheLookup(parent.path, listing) == FZ_REPLY_OK)
            RefreshItem(parent.item, listing, false);
        else if (filter.HasActiveFilters()) {
            for (wxTreeItemId child = GetFirstChild(parent.item, cookie); child; child = GetNextSibling(child)) {
                CServerPath path = GetPathFromItem(child);
                if (path.empty())
                    continue;

                if (filter.FilenameFiltered(GetItemText(child), path.GetPath(), true, -1, false, 0, CDateTime())) {
                    wxTreeItemId sel = GetSelection();
                    while (sel && sel != child)
                        sel = GetItemParent(sel);
                    if (!sel) {
                        Delete(child);
                        continue;
                    }
                }

                struct _parents dir;
                dir.item = child;
                dir.path = path;
                parents.push_back(dir);
            }

            // The stuff below has already been done above in this one case
            continue;
        }
        for (wxTreeItemId child = GetFirstChild(parent.item, cookie); child; child = GetNextSibling(child)) {
            CServerPath path = GetPathFromItem(child);
            if (path.empty())
                continue;

            struct _parents dir;
            dir.item = child;
            dir.path = path;
            parents.push_back(dir);
        }
    }
}
开发者ID:oneminot,项目名称:filezilla3,代码行数:66,代码来源:RemoteTreeView.cpp


注:本文中的CServerPath::GetPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。