• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ SFTPSettings类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中SFTPSettings的典型用法代码示例。如果您正苦于以下问题:C++ SFTPSettings类的具体用法?C++ SFTPSettings怎么用?C++ SFTPSettings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: OnOpenTerminal

void SFTPTreeView::OnOpenTerminal(wxAuiToolBarEvent& event)
{
    // Open terminal to the selected account
    if(event.IsDropDownClicked()) {
        SFTPTreeViewBase::ShowAuiToolMenu(event);

    } else {
        SFTPSettings settings;
        settings.Load();

        wxString accountName = m_choiceAccount->GetStringSelection();
        if(accountName.IsEmpty()) {
            ::wxMessageBox(_("Please select an account to connect to"), "CodeLite", wxICON_ERROR | wxOK);
            return;
        }

        SSHAccountInfo account;
        if(!settings.GetAccount(accountName, account)) {
            ::wxMessageBox(wxString() << _("Could not find account: ") << accountName, "CodeLite", wxICON_ERROR | wxOK);
            return;
        }

        wxString connectString;
        connectString << account.GetUsername() << "@" << account.GetHost();

        const wxString& sshClient = settings.GetSshClient();
        FileUtils::OpenSSHTerminal(sshClient, connectString, account.GetPassword(), account.GetPort());
    }
}
开发者ID:Jactry,项目名称:codelite,代码行数:29,代码来源:SFTPTreeView.cpp


示例2: SFTPTreeViewBase

SFTPTreeView::SFTPTreeView(wxWindow* parent, SFTP* plugin)
    : SFTPTreeViewBase(parent)
    , m_plugin(plugin)
{
    wxImageList* il = m_bmpLoader.MakeStandardMimeImageList();
    m_treeListCtrl->AssignImageList(il);

    SFTPSettings settings;
    settings.Load();

    const SSHAccountInfo::Vect_t& accounts = settings.GetAccounts();
    SSHAccountInfo::Vect_t::const_iterator iter = accounts.begin();
    for(; iter != accounts.end(); ++iter) {
        m_choiceAccount->Append(iter->GetAccountName());
    }

    if(!m_choiceAccount->IsEmpty()) {
        m_choiceAccount->SetSelection(0);
    }

#ifdef __WXMSW__
    m_treeListCtrl->GetDataView()->SetIndent(16);
#endif
    m_treeListCtrl->SetItemComparator(new SFTPItemComparator);
    m_treeListCtrl->Connect(
        ID_OPEN, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(SFTPTreeView::OnMenuOpen), NULL, this);
    m_treeListCtrl->Connect(
        ID_DELETE, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(SFTPTreeView::OnMenuDelete), NULL, this);
    m_treeListCtrl->Connect(
        ID_NEW, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(SFTPTreeView::OnMenuNew), NULL, this);
    m_treeListCtrl->Connect(
        ID_RENAME, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(SFTPTreeView::OnMenuRename), NULL, this);
    m_treeListCtrl->Connect(
        ID_NEW_FILE, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(SFTPTreeView::OnMenuNewFile), NULL, this);
    m_treeListCtrl->Connect(ID_REFRESH_FOLDER,
                            wxEVT_COMMAND_MENU_SELECTED,
                            wxCommandEventHandler(SFTPTreeView::OnMenuRefreshFolder),
                            NULL,
                            this);
    m_treeListCtrl->Bind(wxEVT_MENU, &SFTPTreeView::OnShowTypeCol, this, ID_SHOW_TYPE_COL);
    m_treeListCtrl->Bind(wxEVT_MENU, &SFTPTreeView::OnShowSizeCol, this, ID_SHOW_SIZE_COL);

    wxTheApp->GetTopWindow()->Bind(wxEVT_COMMAND_MENU_SELECTED, &SFTPTreeView::OnCopy, this, wxID_COPY);
    wxTheApp->GetTopWindow()->Bind(wxEVT_COMMAND_MENU_SELECTED, &SFTPTreeView::OnCut, this, wxID_CUT);
    wxTheApp->GetTopWindow()->Bind(wxEVT_COMMAND_MENU_SELECTED, &SFTPTreeView::OnPaste, this, wxID_PASTE);
    wxTheApp->GetTopWindow()->Bind(wxEVT_COMMAND_MENU_SELECTED, &SFTPTreeView::OnSelectAll, this, wxID_SELECTALL);
    wxTheApp->GetTopWindow()->Bind(wxEVT_COMMAND_MENU_SELECTED, &SFTPTreeView::OnUndo, this, wxID_UNDO);
    wxTheApp->GetTopWindow()->Bind(wxEVT_COMMAND_MENU_SELECTED, &SFTPTreeView::OnRedo, this, wxID_REDO);

    bool sizeColVisible = clConfig::Get().Read("SFTP/TreeView/ShowSizeCol", true);
    bool typeColVisible = clConfig::Get().Read("SFTP/TreeView/ShowTypeCol", true);

    if(!sizeColVisible) {
        m_treeListCtrl->DeleteColumn(GetSizeColumnIndex());
    }

    if(!typeColVisible) {
        m_treeListCtrl->DeleteColumn(GetTypeColumnIndex());
    }
}
开发者ID:Jactry,项目名称:codelite,代码行数:60,代码来源:SFTPTreeView.cpp


示例3: dlg

void SFTPTreeView::OnOpenAccountManager(wxCommandEvent& event)
{
    SSHAccountManagerDlg dlg(EventNotifier::Get()->TopFrame());
    if(dlg.ShowModal() == wxID_OK) {
        SFTPSettings settings;
        settings.Load().SetAccounts(dlg.GetAccounts());
        settings.Save();
    }
}
开发者ID:lpc1996,项目名称:codelite,代码行数:9,代码来源:SFTPTreeView.cpp


示例4: dlg

void SFTPTreeView::ManageBookmarks()
{
    SFTPManageBookmarkDlg dlg(NULL, m_account.GetBookmarks());
    if(dlg.ShowModal() == wxID_OK) {
        m_account.SetBookmarks(dlg.GetBookmarks());
        SFTPSettings settings;
        settings.Load();
        settings.UpdateAccount(m_account);
        settings.Save();
    }
}
开发者ID:Jactry,项目名称:codelite,代码行数:11,代码来源:SFTPTreeView.cpp


示例5: wxUnusedVar

void SFTP::OnAccountManager(wxCommandEvent& e)
{
    wxUnusedVar(e);
    SSHAccountManagerDlg dlg(wxTheApp->GetTopWindow());
    if(dlg.ShowModal() == wxID_OK) {

        SFTPSettings settings;
        settings.Load();
        settings.SetAccounts(dlg.GetAccounts());
        settings.Save();
    }
}
开发者ID:Jactry,项目名称:codelite,代码行数:12,代码来源:sftp.cpp


示例6: SFTPTreeViewBase

SFTPTreeView::SFTPTreeView(wxWindow* parent, SFTP* plugin)
    : SFTPTreeViewBase(parent)
    , m_plugin(plugin)
{
    wxImageList* il = m_bmpLoader.MakeStandardMimeImageList();
    m_treeListCtrl->AssignImageList(il);

    SFTPSettings settings;
    settings.Load();

    const SSHAccountInfo::Vect_t& accounts = settings.GetAccounts();
    SSHAccountInfo::Vect_t::const_iterator iter = accounts.begin();
    for(; iter != accounts.end(); ++iter) {
        m_choiceAccount->Append(iter->GetAccountName());
    }

    if(!m_choiceAccount->IsEmpty()) {
        m_choiceAccount->SetSelection(0);
    }

#ifdef __WXMSW__
    m_treeListCtrl->GetDataView()->SetIndent(16);
#endif
    m_treeListCtrl->SetItemComparator(new SFTPItemComparator);
    m_treeListCtrl->Connect(ID_OPEN, wxEVT_MENU, wxCommandEventHandler(SFTPTreeView::OnMenuOpen), NULL, this);
    m_treeListCtrl->Connect(ID_OPEN_WITH_DEFAULT_APP,
                            wxEVT_MENU,
                            wxCommandEventHandler(SFTPTreeView::OnMenuOpenWithDefaultApplication),
                            NULL,
                            this);
    m_treeListCtrl->Connect(ID_OPEN_CONTAINING_FOLDER,
                            wxEVT_MENU,
                            wxCommandEventHandler(SFTPTreeView::OnMenuOpenContainingFolder),
                            NULL,
                            this);
    m_treeListCtrl->Connect(ID_DELETE, wxEVT_MENU, wxCommandEventHandler(SFTPTreeView::OnMenuDelete), NULL, this);
    m_treeListCtrl->Connect(ID_NEW, wxEVT_MENU, wxCommandEventHandler(SFTPTreeView::OnMenuNew), NULL, this);
    m_treeListCtrl->Connect(ID_RENAME, wxEVT_MENU, wxCommandEventHandler(SFTPTreeView::OnMenuRename), NULL, this);
    m_treeListCtrl->Connect(ID_NEW_FILE, wxEVT_MENU, wxCommandEventHandler(SFTPTreeView::OnMenuNewFile), NULL, this);
    m_treeListCtrl->Connect(
        ID_REFRESH_FOLDER, wxEVT_MENU, wxCommandEventHandler(SFTPTreeView::OnMenuRefreshFolder), NULL, this);

    wxTheApp->GetTopWindow()->Bind(wxEVT_MENU, &SFTPTreeView::OnCopy, this, wxID_COPY);
    wxTheApp->GetTopWindow()->Bind(wxEVT_MENU, &SFTPTreeView::OnCut, this, wxID_CUT);
    wxTheApp->GetTopWindow()->Bind(wxEVT_MENU, &SFTPTreeView::OnPaste, this, wxID_PASTE);
    wxTheApp->GetTopWindow()->Bind(wxEVT_MENU, &SFTPTreeView::OnSelectAll, this, wxID_SELECTALL);
    wxTheApp->GetTopWindow()->Bind(wxEVT_MENU, &SFTPTreeView::OnUndo, this, wxID_UNDO);
    wxTheApp->GetTopWindow()->Bind(wxEVT_MENU, &SFTPTreeView::OnRedo, this, wxID_REDO);

    m_treeListCtrl->SetDropTarget(new clFileOrFolderDropTarget(this));
    Bind(wxEVT_DND_FILE_DROPPED, &SFTPTreeView::OnFileDropped, this);
}
开发者ID:capturePointer,项目名称:codelite,代码行数:52,代码来源:SFTPTreeView.cpp


示例7: SSHAccountManagerDlgBase

SSHAccountManagerDlg::SSHAccountManagerDlg(wxWindow* parent)
    : SSHAccountManagerDlgBase(parent)
{
    SFTPSettings settings;
    settings.Load();

    const SSHAccountInfo::Vect_t& accounts = settings.GetAccounts();
    SSHAccountInfo::Vect_t::const_iterator iter = accounts.begin();
    for(; iter != accounts.end(); ++iter) {
        DoAddAccount(*iter);
    }
    WindowAttrManager::Load(this, "SSHAccountManagerDlg", NULL);
}
开发者ID:LoviPanda,项目名称:codelite,代码行数:13,代码来源:SSHAccountManagerDlg.cpp


示例8: MSWInitiateConnection

void SFTP::MSWInitiateConnection()
{
#ifdef __WXMSW__
    // Under Windows, there seems to be a small problem with the connection establishment
    // only the first connection seems to be unstable (i.e. it takes up to 30 seconds to create it)
    // to workaround this, we initiate a dummy connection to the first connection we can find
    SFTPSettings settings;
    settings.Load();
    const SSHAccountInfo::Vect_t& accounts = settings.GetAccounts();
    if(accounts.empty()) return;
    const SSHAccountInfo& account = accounts.at(0);
    SFTPWorkerThread::Instance()->Add(new SFTPThreadRequet(account));
#endif
}
开发者ID:Jactry,项目名称:codelite,代码行数:14,代码来源:sftp.cpp


示例9: DoSaveRemoteFile

void SFTP::DoFileSaved(const wxString& filename)
{
    if(filename.IsEmpty()) return;

    // Check to see if this file is part of a remote files managed by our plugin
    if(m_remoteFiles.count(filename)) {
        // ----------------------------------------------------------------------------------------------
        // this file was opened by the SFTP explorer
        // ----------------------------------------------------------------------------------------------
        DoSaveRemoteFile(m_remoteFiles.find(filename)->second);

    } else {
        // ----------------------------------------------------------------------------------------------
        // Not a remote file, see if have a sychronization setup between this workspace and a remote one
        // ----------------------------------------------------------------------------------------------

        // check if we got a workspace file opened
        if(!m_workspaceFile.IsOk()) return;

        // check if mirroring is setup for this workspace
        if(!m_workspaceSettings.IsOk()) return;

        wxFileName file(filename);
        file.MakeRelativeTo(m_workspaceFile.GetPath());
        file.MakeAbsolute(wxFileName(m_workspaceSettings.GetRemoteWorkspacePath(), wxPATH_UNIX).GetPath());
        wxString remoteFile = file.GetFullPath(wxPATH_UNIX);

        SFTPSettings settings;
        settings.Load();

        SSHAccountInfo account;
        if(settings.GetAccount(m_workspaceSettings.GetAccount(), account)) {
            SFTPWorkerThread::Instance()->Add(new SFTPThreadRequet(account, remoteFile, filename));

        } else {

            wxString msg;
            msg << _("Failed to synchronize file '") << filename << "'\n" << _("with remote server\n")
                << _("Could not locate account: ") << m_workspaceSettings.GetAccount();
            ::wxMessageBox(msg, _("SFTP"), wxOK | wxICON_ERROR);

            // Disable the workspace mirroring for this workspace
            m_workspaceSettings.Clear();
            SFTPWorkspaceSettings::Save(m_workspaceSettings, m_workspaceFile);
        }
    }
}
开发者ID:Jactry,项目名称:codelite,代码行数:47,代码来源:sftp.cpp


示例10: OnSaveFile

void SFTP::OnSaveFile(clSFTPEvent& e)
{
    SFTPSettings settings;
    settings.Load();

    wxString accName = e.GetAccount();
    wxString localFile = e.GetLocalFile();
    wxString remoteFile = e.GetRemoteFile();

    SSHAccountInfo account;
    if(settings.GetAccount(accName, account)) {
        SFTPWorkerThread::Instance()->Add(new SFTPThreadRequet(account, remoteFile, localFile));

    } else {
        wxString msg;
        msg << _("Failed to synchronize file '") << localFile << "'\n" << _("with remote server\n")
            << _("Could not locate account: ") << accName;
        ::wxMessageBox(msg, _("SFTP"), wxOK | wxICON_ERROR);
    }
}
开发者ID:Jactry,项目名称:codelite,代码行数:20,代码来源:sftp.cpp


示例11: OnOpenTerminal

void SFTPTreeView::OnOpenTerminal(wxAuiToolBarEvent& event)
{
    // Open terminal to the selected account
    if(event.IsDropDownClicked()) {
        SFTPTreeViewBase::ShowAuiToolMenu(event);

    } else {
        SSHAccountInfo account;
        if(!GetAccountFromUser(account)) { return; }

        wxString connectString;
        connectString << account.GetUsername() << "@" << account.GetHost();

        SFTPSettings settings;
        settings.Load();

        const wxString& sshClient = settings.GetSshClient();
        FileUtils::OpenSSHTerminal(sshClient, connectString, account.GetPassword(), account.GetPort());
    }
}
开发者ID:lpc1996,项目名称:codelite,代码行数:20,代码来源:SFTPTreeView.cpp


示例12: DoCloseSession

void SFTPTreeView::DoOpenSession()
{
    DoCloseSession();
    wxString accountName = m_choiceAccount->GetStringSelection();
    if(accountName.IsEmpty()) {
        return;
    }

    SFTPSettings settings;
    settings.Load();

    m_account = SSHAccountInfo();
    if(!settings.GetAccount(accountName, m_account)) {
        ::wxMessageBox(wxString() << _("Could not find account: ") << accountName, "codelite", wxICON_ERROR | wxOK);
        return;
    }

    clSSH::Ptr_t ssh(
        new clSSH(m_account.GetHost(), m_account.GetUsername(), m_account.GetPassword(), m_account.GetPort()));
    try {
        wxString message;
        m_plugin->GetManager()->SetStatusMessage(wxString() << _("Connecting to: ") << accountName << "...");
        ssh->Connect();
        if(!ssh->AuthenticateServer(message)) {
            if(::wxMessageBox(message, "SSH", wxYES_NO | wxCENTER | wxICON_QUESTION) == wxYES) {
                ssh->AcceptServerAuthentication();
            }
        }

        ssh->Login();
        m_sftp.reset(new clSFTP(ssh));
        m_sftp->Initialize();
        m_sftp->SetAccount(m_account.GetAccountName());
        m_plugin->GetManager()->SetStatusMessage(wxString() << _("Done!"));
        DoBuildTree("/");

    } catch(clException& e) {
        ::wxMessageBox(e.What(), "codelite", wxICON_ERROR | wxOK);
        DoCloseSession();
    }
}
开发者ID:LoviPanda,项目名称:codelite,代码行数:41,代码来源:SFTPTreeView.cpp


示例13: EnsureAccountExists

bool PhpSFTPHandler::EnsureAccountExists(SSHWorkspaceSettings& workspaceSettings)
{
    // Do we need to sync?
    if(!(workspaceSettings.IsRemoteUploadSet() && workspaceSettings.IsRemoteUploadEnabled())) { return false; }
    
    SFTPSettings sftpSettings;
    sftpSettings.Load();
    
    // Try to locate hte SSH account for this workspace
    SSHAccountInfo account;
    if(!sftpSettings.GetAccount(workspaceSettings.GetAccount(), account)) {
        // Failed to locate the SSH account, disable sync
        wxString msg;
        msg << _("Failed to locate SSH account: ") << workspaceSettings.GetAccount() << "\n";
        ::wxMessageBox(msg, _("SFTP"), wxOK | wxICON_ERROR);
        // Clear the sync settings and return
        workspaceSettings.Reset();
        workspaceSettings.Save();
        return false;
    }
    return true;
}
开发者ID:lpc1996,项目名称:codelite,代码行数:22,代码来源:PhpSFTPHandler.cpp


示例14: SFTPTreeViewBase

SFTPTreeView::SFTPTreeView(wxWindow* parent, SFTP* plugin)
    : SFTPTreeViewBase(parent)
    , m_plugin(plugin)
{
    m_bmpLoader = clGetManager()->GetStdIcons();
    wxImageList* il = m_bmpLoader->MakeStandardMimeImageList();
    m_treeCtrl->AssignImageList(il);

    SFTPSettings settings;
    settings.Load();

    m_treeCtrl->Connect(ID_OPEN, wxEVT_MENU, wxCommandEventHandler(SFTPTreeView::OnMenuOpen), NULL, this);
    m_treeCtrl->Connect(ID_OPEN_WITH_DEFAULT_APP, wxEVT_MENU,
                        wxCommandEventHandler(SFTPTreeView::OnMenuOpenWithDefaultApplication), NULL, this);
    m_treeCtrl->Connect(ID_OPEN_CONTAINING_FOLDER, wxEVT_MENU,
                        wxCommandEventHandler(SFTPTreeView::OnMenuOpenContainingFolder), NULL, this);
    m_treeCtrl->Connect(ID_DELETE, wxEVT_MENU, wxCommandEventHandler(SFTPTreeView::OnMenuDelete), NULL, this);
    m_treeCtrl->Connect(ID_NEW, wxEVT_MENU, wxCommandEventHandler(SFTPTreeView::OnMenuNew), NULL, this);
    m_treeCtrl->Connect(ID_RENAME, wxEVT_MENU, wxCommandEventHandler(SFTPTreeView::OnMenuRename), NULL, this);
    m_treeCtrl->Connect(ID_NEW_FILE, wxEVT_MENU, wxCommandEventHandler(SFTPTreeView::OnMenuNewFile), NULL, this);
    m_treeCtrl->Connect(ID_REFRESH_FOLDER, wxEVT_MENU, wxCommandEventHandler(SFTPTreeView::OnMenuRefreshFolder), NULL,
                        this);

    wxTheApp->GetTopWindow()->Bind(wxEVT_MENU, &SFTPTreeView::OnCopy, this, wxID_COPY);
    wxTheApp->GetTopWindow()->Bind(wxEVT_MENU, &SFTPTreeView::OnCut, this, wxID_CUT);
    wxTheApp->GetTopWindow()->Bind(wxEVT_MENU, &SFTPTreeView::OnPaste, this, wxID_PASTE);
    wxTheApp->GetTopWindow()->Bind(wxEVT_MENU, &SFTPTreeView::OnSelectAll, this, wxID_SELECTALL);
    wxTheApp->GetTopWindow()->Bind(wxEVT_MENU, &SFTPTreeView::OnUndo, this, wxID_UNDO);
    wxTheApp->GetTopWindow()->Bind(wxEVT_MENU, &SFTPTreeView::OnRedo, this, wxID_REDO);
    EventNotifier::Get()->Bind(wxEVT_EDITOR_CLOSING, &SFTPTreeView::OnEditorClosing, this);
    m_treeCtrl->SetDropTarget(new clFileOrFolderDropTarget(this));
    Bind(wxEVT_DND_FILE_DROPPED, &SFTPTreeView::OnFileDropped, this);

    m_keyboardHelper.reset(new clTreeKeyboardInput(m_treeCtrl));
    ::MSWSetNativeTheme(m_treeCtrl);
}
开发者ID:lpc1996,项目名称:codelite,代码行数:36,代码来源:SFTPTreeView.cpp


示例15: DoCloseSession

void SFTPTreeView::DoOpenSession()
{
    DoCloseSession();
    if(!GetAccountFromUser(m_account)) { return; }

    wxString message;
    wxProgressDialog dlg(_("SFTP"), wxString(' ', 100) + "\n\n", 10);
    dlg.Show();
    dlg.Update(1, wxString() << _("Connecting to: ") << m_account.GetAccountName() << "..."
                             << _("\n(this may take a few seconds)"));

    // We know that there is a bug that libssh succeeded on connecting only on the second attempt..
    // to workaround it, we issue first connect with 1 second timeout, and then re-open the connection
    try {
        clSSH::Ptr_t ssh(
            new clSSH(m_account.GetHost(), m_account.GetUsername(), m_account.GetPassword(), m_account.GetPort()));
        ssh->Connect(wxNOT_FOUND);
    } catch(...) {
    }

    try {
        clSSH::Ptr_t ssh(
            new clSSH(m_account.GetHost(), m_account.GetUsername(), m_account.GetPassword(), m_account.GetPort()));
        ssh->Connect(5);
        dlg.Update(5, _("Connected!"));
        dlg.Update(6, _("Authenticating server..."));

        if(!ssh->AuthenticateServer(message)) {
            if(::wxMessageBox(message, "SSH", wxYES_NO | wxCENTER | wxICON_QUESTION) == wxYES) {
                dlg.Update(7, _("Accepting server authentication server..."));
                ssh->AcceptServerAuthentication();
            }
        } else {
            dlg.Update(7, _("Server authenticated"));
        }

        dlg.Update(8, _("Logging in.."));
        ssh->Login();
        m_sftp.reset(new clSFTP(ssh));
        m_sftp->Initialize();
        m_sftp->SetAccount(m_account.GetAccountName());
        m_plugin->GetManager()->SetStatusMessage(wxString() << _("Done!"));

        dlg.Update(9, _("Fetching directory list..."));
        DoBuildTree(m_account.GetDefaultFolder().IsEmpty() ? "/" : m_account.GetDefaultFolder());
        dlg.Update(10, _("Done"));

        CallAfter(&SFTPTreeView::DoLoadSession);

        // If this is a new account, offer the user to save it
        SFTPSettings s;
        s.Load();
        SSHAccountInfo dummy;
        if(!s.GetAccount(m_account.GetAccountName(), dummy)) {
            wxString message;
            message << _("Would you like to save this account?\n") << _("It will be saved as '")
                    << m_account.GetAccountName() << "'";
            wxStandardID res = ::PromptForYesNoCancelDialogWithCheckbox(message, "SFTPQuickConnectSaveDlg");
            if(res == wxID_YES) {
                // This 'Connect' was via Quick Connect option
                SSHAccountInfo::Vect_t accounts = s.GetAccounts();
                accounts.push_back(m_account);
                s.SetAccounts(accounts);
                s.Save();
            }
        }

    } catch(clException& e) {
        ::wxMessageBox(e.What(), "CodeLite", wxICON_ERROR | wxOK);
        DoCloseSession();
    }
}
开发者ID:lpc1996,项目名称:codelite,代码行数:72,代码来源:SFTPTreeView.cpp


示例16: DoCloseSession

void SFTPTreeView::DoOpenSession()
{
    DoCloseSession();
    wxString accountName = m_choiceAccount->GetStringSelection();
    if(accountName.IsEmpty()) {
        return;
    }

    SFTPSettings settings;
    settings.Load();

    m_account = SSHAccountInfo();
    if(!settings.GetAccount(accountName, m_account)) {
        ::wxMessageBox(wxString() << _("Could not find account: ") << accountName, "codelite", wxICON_ERROR | wxOK);
        return;
    }

    wxString message;
#ifndef _WIN64
    wxProgressDialog dlg(_("SFTP"), wxString(' ', 100) + "\n\n", 10);
    dlg.Show();
    dlg.Update(1, wxString() << _("Connecting to: ") << accountName << "..." << _("\n(this may take a few seconds)"));
#else
    wxBusyCursor bc;
    clGetManager()->SetStatusMessage(wxString() << _("Connecting to: ") << accountName);
#endif

    // We know that there is a bug that libssh succeeded on connecting only on the second attempt..
    // to workaround it, we issue first connect with 1 second timeout, and then re-open the connection

    try {
        clSSH::Ptr_t ssh(
            new clSSH(m_account.GetHost(), m_account.GetUsername(), m_account.GetPassword(), m_account.GetPort()));
        ssh->Connect(wxNOT_FOUND);
    } catch(...) {
    }

    try {
        clSSH::Ptr_t ssh(
            new clSSH(m_account.GetHost(), m_account.GetUsername(), m_account.GetPassword(), m_account.GetPort()));
        ssh->Connect(5);
#ifndef _WIN64
        dlg.Update(5, _("Connected!"));
        dlg.Update(6, _("Authenticating server..."));
#endif

        if(!ssh->AuthenticateServer(message)) {
            if(::wxMessageBox(message, "SSH", wxYES_NO | wxCENTER | wxICON_QUESTION) == wxYES) {
#ifndef _WIN64
                dlg.Update(7, _("Accepting server authentication server..."));
#endif
                ssh->AcceptServerAuthentication();
            }
        } else {
#ifndef _WIN64
            dlg.Update(7, _("Server authenticated"));
#endif
        }

#ifndef _WIN64
        dlg.Update(8, _("Logging..."));
#endif
        ssh->Login();
        m_sftp.reset(new clSFTP(ssh));
        m_sftp->Initialize();
        m_sftp->SetAccount(m_account.GetAccountName());
        m_plugin->GetManager()->SetStatusMessage(wxString() << _("Done!"));

#ifndef _WIN64
        dlg.Update(9, _("Fetching directory list..."));
#endif
        DoBuildTree(m_account.GetDefaultFolder().IsEmpty() ? "/" : m_account.GetDefaultFolder());
#ifndef _WIN64
        dlg.Update(10, _("Done"));
#endif
    } catch(clException& e) {
        ::wxMessageBox(e.What(), "codelite", wxICON_ERROR | wxOK);
        DoCloseSession();
    }
}
开发者ID:Jactry,项目名称:codelite,代码行数:80,代码来源:SFTPTreeView.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ SFXBuffer类代码示例发布时间:2022-05-31
下一篇:
C++ SFNT_Service类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap