~ubuntu-branches/ubuntu/karmic/filezilla/karmic

« back to all changes in this revision

Viewing changes to src/interface/quickconnectbar.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Adrien Cunin
  • Date: 2007-07-30 18:54:13 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070730185413-p60opijyw3p4dfc2
Tags: 3.0.0~beta11-0ubuntu1
* New upstream release
* Dropped dpatch
* debian/README.Debian: dropped, the warning is not correct
* debian/filezilla-common.docs: added AUTHORS and NEWS

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
EVT_BUTTON(XRCID("ID_QUICKCONNECT_DROPDOWN"), CQuickconnectBar::OnQuickconnectDropdown)
11
11
EVT_MENU(wxID_ANY, CQuickconnectBar::OnMenu)
12
12
EVT_TEXT_ENTER(wxID_ANY, CQuickconnectBar::OnQuickconnect)
 
13
EVT_NAVIGATION_KEY(CQuickconnectBar::OnKeyboardNavigation)
13
14
END_EVENT_TABLE();
14
15
 
15
16
CQuickconnectBar::CQuickconnectBar()
77
78
        ServerProtocol protocol = server.GetProtocol();
78
79
        switch (protocol)
79
80
        {
80
 
        case SFTP:
81
 
                host = _T("sftp://") + host;
82
 
                break;
83
 
        case FTPS:
84
 
                host = _T("ftps://") + host;
85
 
                break;
86
 
        case FTPES:
87
 
                host = _T("ftpes://") + host;
88
 
                break;
89
81
        case FTP:
90
 
        default:
 
82
        case UNKNOWN:
91
83
                if (CServer::GetProtocolFromPort(server.GetPort()) != FTP &&
92
84
                        CServer::GetProtocolFromPort(server.GetPort()) != UNKNOWN)
93
85
                        host = _T("ftp://") + host;
94
86
                break;
 
87
        default:
 
88
                {
 
89
                        const wxString prefix = server.GetPrefixFromProtocol(protocol);
 
90
                        if (prefix != _T(""))
 
91
                                host = prefix + _T("://") + host;
 
92
                }
 
93
                break;
95
94
        }
96
95
        
97
96
        XRCCTRL(*this, "ID_QUICKCONNECT_HOST", wxTextCtrl)->SetValue(host);
103
102
        XRCCTRL(*this, "ID_QUICKCONNECT_USER", wxTextCtrl)->SetValue(server.GetUser());
104
103
        XRCCTRL(*this, "ID_QUICKCONNECT_PASS", wxTextCtrl)->SetValue(server.GetPass());
105
104
 
 
105
        if (protocol == HTTP)
 
106
        {
 
107
                wxMessageBox(_("FileZilla does not support the HTTP protocol"), _("Syntax error"), wxICON_EXCLAMATION);
 
108
                return;
 
109
        }
 
110
 
106
111
        if (!m_pState->Connect(server, true))
107
112
                return;
108
113
 
160
165
        XRCCTRL(*this, "ID_QUICKCONNECT_USER", wxTextCtrl)->SetValue(_T(""));
161
166
        XRCCTRL(*this, "ID_QUICKCONNECT_PASS", wxTextCtrl)->SetValue(_T(""));
162
167
}
 
168
 
 
169
void CQuickconnectBar::OnKeyboardNavigation(wxNavigationKeyEvent& event)
 
170
{
 
171
        if (event.GetDirection() && event.GetEventObject() == XRCCTRL(*this, "ID_QUICKCONNECT_DROPDOWN", wxButton))
 
172
        {
 
173
                event.SetEventObject(this);
 
174
                GetParent()->ProcessEvent(event);
 
175
        }
 
176
        else if (!event.GetDirection() && event.GetEventObject() == XRCCTRL(*this, "ID_QUICKCONNECT_HOST", wxTextCtrl))
 
177
        {
 
178
                event.SetEventObject(this);
 
179
                GetParent()->ProcessEvent(event);
 
180
        }
 
181
        else
 
182
                event.Skip();
 
183
}