Ticket #5091: 5091.patch
File 5091.patch, 10.7 KB (added by , 14 years ago) |
---|
-
docs/filezilla.man
4 4 .SH SYNOPSIS 5 5 .B filezilla 6 6 .br 7 .B filezilla [ \-l <logontype>] <FTP URL>7 .B filezilla [-s] [\-l <logontype>] [<FTP URL>]... [fzsite://<SITE>]... 8 8 .br 9 9 .B filezilla \-h|\-s|\-v 10 .br11 .B filezilla \-c <site>12 10 .SH DESCRIPTION 13 11 FileZilla is a powerful client for plain FTP, FTP over SSL/TLS (FTPS) and the SSH File Transfer Protocol (SFTP). 14 12 .SH OPTIONS 15 13 16 14 .TP 17 .B \-c <site>, \-\-site <site> 18 Connect to the given site from the Site Manager. 15 .B <FTP URL>... 16 Connect to the given FTP URL(s). 17 18 .TP 19 .B fzsite://<SITE> 20 Connect to the given site(s) from the Site Manager. 19 21 Site has to be given as complete path, with a slash as separation character. Any slash or backslash that is part of a segment has to be escaped with a backslash. Path has to be prefixed with 0 for user defined entries or 1 for default entries. Site path may not contain double quotation marks. 20 22 .IP 21 Example: filezilla \-c 0/foo/bar/sl\\/ash connects to the user site sl/ash in the site directory foo/bar 22 .IP 23 May not be used together with 24 .B \-s 25 nor with URL parameter. 23 Example: filezilla fzsite://0/foo/bar/sl\\/ash connects to the user site sl/ash in the site directory foo/bar 26 24 27 25 .TP 28 26 .B \-h, \-\-help … … 30 28 31 29 .TP 32 30 .B \-l <logontype>, \-\-logontype <logontype> 33 Set a special logontype, can only be used in combination with a FTP URL as argument.31 Set a special logontype, will only be used in combination with FTP URL(s). 34 32 35 33 Logontype has to be either 36 34 .B ask -
src/interface/cmdline.cpp
5 5 { 6 6 m_parser.AddSwitch(_T("h"), _T("help"), _("Shows this help dialog"), wxCMD_LINE_OPTION_HELP); 7 7 m_parser.AddSwitch(_T("s"), _T("site-manager"), _("Start with opened Site Manager")); 8 m_parser.AddOption(_T("c"), _T("site"), _("Connect to specified Site Manager site"));9 8 10 wxString desc = wxString::Format(_("Logontype, can only be used together with FTP URL. Argument has to be either '%s' or '%s'"), _T("ask"), _T("interactive"));9 wxString desc = wxString::Format(_("Logontype, will only be used together with FTP URL(s). Argument has to be either '%s' or '%s'"), _T("ask"), _T("interactive")); 11 10 m_parser.AddOption(_T("l"), _T("logontype"), desc); 12 11 13 12 #ifdef __WXMSW__ … … 15 14 #endif 16 15 m_parser.AddSwitch(_T(""), _T("verbose"), _("Verbose log messages from wxWidgets")); 17 16 m_parser.AddSwitch(_T("v"), _T("version"), _("Print version information to stdout and exit")); 18 wxString str = _T("<"); 19 str += _("FTP URL"); 20 str += _T(">"); 21 m_parser.AddParam(str, wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL); 17 m_parser.AddParam(_("FTP URL"), wxCMD_LINE_VAL_STRING, (wxCMD_LINE_PARAM_OPTIONAL|wxCMD_LINE_PARAM_MULTIPLE)); 22 18 19 wxString str = _T("fzsite://"); 20 str += _("SITE"); 21 m_parser.AddParam(str, wxCMD_LINE_VAL_STRING, (wxCMD_LINE_PARAM_OPTIONAL|wxCMD_LINE_PARAM_MULTIPLE)); 22 23 23 m_parser.SetCmdLine(argc, argv); 24 24 25 25 m_parser.SetSwitchChars(_T("-")); … … 63 63 if (res != 0) 64 64 return false; 65 65 66 if (HasSwitch(sitemanager) && GetOption(site) != _T(""))67 {68 wxMessageBox(_("-s and -c cannot be present at the same time."), _("Syntax error in command line"));69 return false;70 }71 72 if (HasSwitch(sitemanager) && m_parser.GetParamCount())73 {74 wxMessageBox(_("-s cannot be used together with an FTP URL."), _("Syntax error in command line"));75 return false;76 }77 78 if (GetOption(site) != _T("") && m_parser.GetParamCount())79 {80 wxMessageBox(_("-c cannot be used together with an FTP URL."), _("Syntax error in command line"));81 return false;82 }83 84 66 wxString type = GetOption(logontype); 85 67 if (type != _T("")) 86 68 { … … 108 90 m_parser.Usage(); 109 91 } 110 92 111 wxString CCommandLine::GetParameter() const93 void CCommandLine::GetParameters(std::vector<wxString> ¶ms) const 112 94 { 113 if (!m_parser.GetParamCount()) 114 return _T(""); 95 size_t paramCount = m_parser.GetParamCount(); 96 params.clear(); 97 params.reserve(paramCount); 115 98 116 return m_parser.GetParam(); 99 for(size_t i = 0; i < paramCount; i++) 100 { 101 params.push_back(m_parser.GetParam(i)); 102 } 117 103 } -
src/interface/cmdline.h
25 25 26 26 bool HasSwitch(enum t_switches s) const; 27 27 wxString GetOption(enum t_option option) const; 28 wxString GetParameter() const; 28 // Fetch all parameters 29 void GetParameters(std::vector<wxString> ¶ms) const; 29 30 30 31 protected: 31 32 wxCmdLineParser m_parser; -
src/interface/Mainfrm.cpp
1963 1963 ShowDropdownMenu(pMenu, m_pToolBar, event); 1964 1964 } 1965 1965 1966 bool CMainFrame::ConnectToSite(CSiteManagerItemData_Site* const pData )1966 bool CMainFrame::ConnectToSite(CSiteManagerItemData_Site* const pData, bool newtab /*=false*/) 1967 1967 { 1968 1968 wxASSERT(pData); 1969 1969 … … 1974 1974 return false; 1975 1975 } 1976 1976 1977 if (!ConnectToServer(pData->m_server, pData->m_remoteDir ))1977 if (!ConnectToServer(pData->m_server, pData->m_remoteDir, newtab)) 1978 1978 return false; 1979 1979 1980 1980 if (pData->m_localDir != _T("")) … … 2425 2425 if (!pCommandLine) 2426 2426 return; 2427 2427 2428 wxString site; 2429 if (pCommandLine->HasSwitch(CCommandLine::sitemanager)) 2428 std::vector<wxString> params; 2429 pCommandLine->GetParameters(params); 2430 if (!params.empty()) 2430 2431 { 2431 Show();2432 OpenSiteManager();2433 }2434 else if ((site = pCommandLine->GetOption(CCommandLine::site)) != _T(""))2435 {2436 CSiteManagerItemData_Site* pData = CSiteManager::GetSiteByPath(site);2437 2438 if (pData)2439 {2440 if (ConnectToSite(pData))2441 {2442 SetBookmarksFromPath(site);2443 if (m_pMenuBar)2444 m_pMenuBar->UpdateBookmarkMenu();2445 }2446 delete pData;2447 }2448 }2449 2450 wxString param = pCommandLine->GetParameter();2451 if (param != _T(""))2452 {2453 2432 wxString error; 2454 2455 2433 CServer server; 2456 2434 2457 2435 wxString logontype = pCommandLine->GetOption(CCommandLine::logontype); … … 2460 2438 else if (logontype == _T("interactive")) 2461 2439 server.SetLogonType(INTERACTIVE); 2462 2440 2463 CServerPath path;2464 if (!server.ParseUrl(param, 0, _T(""), _T(""), error, path))2441 // Iterate over available parameters 2442 for(std::vector<wxString>::iterator iter = params.begin(); iter != params.end(); ++iter) 2465 2443 { 2466 wxString str = _("Parameter not a valid URL"); 2467 str += _T("\n") + error; 2468 wxMessageBox(error, _("Syntax error in command line")); 2469 } 2444 wxString site; 2470 2445 2471 if (server.GetLogonType() == ASK || 2472 (server.GetLogonType() == INTERACTIVE && server.GetUser() == _T(""))) 2473 { 2474 if (!CLoginManager::Get().GetPassword(server, false)) 2446 // Check if parameter is a site 2447 if (iter->StartsWith(_T("fzsite://"), &site)) 2448 { 2449 CSiteManagerItemData_Site* pData = CSiteManager::GetSiteByPath(site); 2450 2451 if (pData) 2452 { 2453 if (ConnectToSite(pData, true)) 2454 { 2455 SetBookmarksFromPath(site); 2456 if (m_pMenuBar) 2457 m_pMenuBar->UpdateBookmarkMenu(); 2458 } 2459 delete pData; 2460 } 2461 continue; 2462 } 2463 2464 // Not a site, try parsing as URL 2465 CServerPath path; 2466 if (!server.ParseUrl(*iter, 0, _T(""), _T(""), error, path)) 2467 { 2468 wxString str = _("Parameter not a valid URL"); 2469 str += _T("\n") + error; 2470 wxMessageBox(error, _("Syntax error in command line")); 2471 continue; 2472 } 2473 2474 if (server.GetLogonType() == ASK || 2475 (server.GetLogonType() == INTERACTIVE && server.GetUser() == _T(""))) 2476 { 2477 if (!CLoginManager::Get().GetPassword(server, false)) 2478 continue; 2479 } 2480 2481 CState* pState = CContextManager::Get()->GetCurrentContext(); 2482 if (!pState) 2475 2483 return; 2484 2485 ConnectToServer(server, path, true); 2476 2486 } 2477 2478 CState* pState = CContextManager::Get()->GetCurrentContext();2479 if (!pState)2480 return;2481 2482 ConnectToServer(server, path);2483 2487 } 2488 2489 if (pCommandLine->HasSwitch(CCommandLine::sitemanager)) 2490 { 2491 Show(); 2492 OpenSiteManager(); 2493 } 2484 2494 } 2485 2495 2486 2496 void CMainFrame::OnFilterRightclicked(wxCommandEvent& event) … … 2695 2705 } 2696 2706 } 2697 2707 2698 bool CMainFrame::ConnectToServer(const CServer &server, const CServerPath &path /*=CServerPath()*/ )2708 bool CMainFrame::ConnectToServer(const CServer &server, const CServerPath &path /*=CServerPath()*/, bool newtab /*=false*/) 2699 2709 { 2700 2710 CState* pState = CContextManager::Get()->GetCurrentContext(); 2701 2711 if (!pState) … … 2703 2713 2704 2714 if (pState->IsRemoteConnected() || !pState->IsRemoteIdle()) 2705 2715 { 2706 wxDialogEx dlg; 2707 if (dlg.Load(this, _T("ID_ALREADYCONNECTED"))) 2716 if (newtab) 2708 2717 { 2709 if (COptions::Get()->GetOptionVal(OPTION_ALREADYCONNECTED_CHOICE) != 0) 2710 XRCCTRL(dlg, "ID_OLDTAB", wxRadioButton)->SetValue(true); 2711 else 2712 XRCCTRL(dlg, "ID_NEWTAB", wxRadioButton)->SetValue(true); 2718 m_pContextControl->CreateTab(); 2719 pState = CContextManager::Get()->GetCurrentContext(); 2720 } 2721 else 2722 { 2723 wxDialogEx dlg; 2724 if (dlg.Load(this, _T("ID_ALREADYCONNECTED"))) 2725 { 2726 if (COptions::Get()->GetOptionVal(OPTION_ALREADYCONNECTED_CHOICE) != 0) 2727 XRCCTRL(dlg, "ID_OLDTAB", wxRadioButton)->SetValue(true); 2728 else 2729 XRCCTRL(dlg, "ID_NEWTAB", wxRadioButton)->SetValue(true); 2713 2730 2714 if (dlg.ShowModal() != wxID_OK)2715 return false;2731 if (dlg.ShowModal() != wxID_OK) 2732 return false; 2716 2733 2717 if (XRCCTRL(dlg, "ID_NEWTAB", wxRadioButton)->GetValue()) 2718 { 2719 m_pContextControl->CreateTab(); 2720 pState = CContextManager::Get()->GetCurrentContext(); 2721 COptions::Get()->SetOption(OPTION_ALREADYCONNECTED_CHOICE, 0); 2734 if (XRCCTRL(dlg, "ID_NEWTAB", wxRadioButton)->GetValue()) 2735 { 2736 m_pContextControl->CreateTab(); 2737 pState = CContextManager::Get()->GetCurrentContext(); 2738 COptions::Get()->SetOption(OPTION_ALREADYCONNECTED_CHOICE, 0); 2739 } 2740 else 2741 COptions::Get()->SetOption(OPTION_ALREADYCONNECTED_CHOICE, 1); 2722 2742 } 2723 else2724 COptions::Get()->SetOption(OPTION_ALREADYCONNECTED_CHOICE, 1);2725 2743 } 2726 2744 } 2727 2745 -
src/interface/Mainfrm.h
56 56 57 57 void PostInitialize(); 58 58 59 bool ConnectToServer(const CServer& server, const CServerPath& path = CServerPath() );59 bool ConnectToServer(const CServer& server, const CServerPath& path = CServerPath(), bool newtab = false); 60 60 61 61 CContextControl* GetContextControl() { return m_pContextControl; } 62 62 63 bool ConnectToSite(CSiteManagerItemData_Site* const pData );63 bool ConnectToSite(CSiteManagerItemData_Site* const pData, bool newtab = false); 64 64 65 65 protected: 66 66 bool CreateMenus();