Ticket #2989: diff-rup.patch
File diff-rup.patch, 5.8 KB (added by , 12 years ago) |
---|
-
src/interface/edithandler.cpp
diff -rup filezilla/src/interface/edithandler.cpp filezilla-new/src/interface/edithandler.cpp
old new void CEditHandler::Release() 204 204 if (m_lockfile_descriptor >= 0) 205 205 close(m_lockfile_descriptor); 206 206 #endif 207 207 208 if (wxFileExists(m_localDir + _T("empty_file_yq744zm"))) 209 wxRemoveFile(m_localDir + _T("empty_file_yq744zm")); 210 208 211 RemoveAll(true); 209 212 wxRmdir(m_localDir); 210 213 } -
src/interface/RemoteListView.cpp
diff -rup filezilla/src/interface/RemoteListView.cpp filezilla-new/src/interface/RemoteListView.cpp
old new BEGIN_EVENT_TABLE(CRemoteListView, CFile 338 338 EVT_MENU(XRCID("ID_DOWNLOAD"), CRemoteListView::OnMenuDownload) 339 339 EVT_MENU(XRCID("ID_ADDTOQUEUE"), CRemoteListView::OnMenuDownload) 340 340 EVT_MENU(XRCID("ID_MKDIR"), CRemoteListView::OnMenuMkdir) 341 EVT_MENU(XRCID("ID_NEW_FILE"), CRemoteListView::OnMenuNewfile) 341 342 EVT_MENU(XRCID("ID_DELETE"), CRemoteListView::OnMenuDelete) 342 343 EVT_MENU(XRCID("ID_RENAME"), CRemoteListView::OnMenuRename) 343 344 EVT_MENU(XRCID("ID_CHMOD"), CRemoteListView::OnMenuChmod) … … void CRemoteListView::OnContextMenu(wxCo 1402 1403 wxMenu* pMenu = wxXmlResource::Get()->LoadMenu(_T("ID_MENU_REMOTEFILELIST")); 1403 1404 if (!pMenu) 1404 1405 return; 1405 1406 1406 1407 if (!m_pState->IsRemoteConnected() || !m_pState->IsRemoteIdle()) 1407 1408 { 1408 1409 pMenu->Delete(XRCID("ID_ENTER")); … … void CRemoteListView::OnContextMenu(wxCo 1415 1416 pMenu->Enable(XRCID("ID_EDIT"), false); 1416 1417 pMenu->Enable(XRCID("ID_GETURL"), false); 1417 1418 pMenu->Enable(XRCID("ID_CONTEXT_REFRESH"), false); 1419 pMenu->Enable(XRCID("ID_NEW_FILE"), false); 1418 1420 } 1419 1421 else if ((GetItemCount() && GetItemState(0, wxLIST_STATE_SELECTED))) 1420 1422 { … … void CRemoteListView::OnContextMenu(wxCo 1425 1427 pMenu->Enable(XRCID("ID_CHMOD"), false); 1426 1428 pMenu->Enable(XRCID("ID_EDIT"), false); 1427 1429 pMenu->Enable(XRCID("ID_GETURL"), false); 1430 pMenu->Delete(XRCID("ID_NEW_FILE")); 1428 1431 } 1429 1432 else if (GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED) == -1) 1430 1433 { … … void CRemoteListView::OnContextMenu(wxCo 1467 1470 pMenu->Enable(XRCID("ID_CHMOD"), false); 1468 1471 pMenu->Enable(XRCID("ID_EDIT"), false); 1469 1472 pMenu->Enable(XRCID("ID_GETURL"), false); 1473 pMenu->Enable(XRCID("ID_NEW_FILE"), true); 1470 1474 } 1471 1475 else 1472 { 1476 { 1473 1477 if (selectedDir) 1474 1478 pMenu->Enable(XRCID("ID_EDIT"), false); 1475 1479 else … … void CRemoteListView::OnNavigationEvent( 3148 3152 m_pState->ChangeRemoteDir(m_pDirectoryListing->path, _T("..")); 3149 3153 } 3150 3154 } 3155 3156 void CRemoteListView::OnMenuNewfile(wxCommandEvent& event) 3157 { 3158 CInputDialog dlg; 3159 if (!dlg.Create(this, _("Create empty file"), _("Please enter the name of the file which should be created:"))) 3160 return; 3161 3162 if (dlg.ShowModal() != wxID_OK) 3163 return; 3164 3165 if (dlg.GetValue() == _T("")) 3166 { 3167 wxBell(); 3168 return; 3169 } 3170 3171 wxString newFileName = dlg.GetValue(); 3172 3173 if ((newFileName.Find('/') != -1) || 3174 (newFileName.Find('\\') != -1) || 3175 (newFileName.Find(':') != -1) || 3176 (newFileName.Find('*') != -1) || 3177 (newFileName.Find('?') != -1) || 3178 (newFileName.Find('"') != -1) || 3179 (newFileName.Find('<') != -1) || 3180 (newFileName.Find('>') != -1) || 3181 (newFileName.Find('|') != -1)) 3182 { 3183 wxMessageBox(_("Filename may not contain any of the following characters: / \\ : * ? \" < > |"), _("Invalid filename"), wxICON_EXCLAMATION); 3184 return; 3185 } 3186 3187 // Check if target file already exists 3188 for (unsigned int i = 0; i < m_pDirectoryListing->GetCount(); i++) 3189 { 3190 if (newFileName == (*m_pDirectoryListing)[i].name) 3191 { 3192 wxMessageBox(_("Target filename already exists!")); 3193 return; 3194 } 3195 } 3196 3197 CEditHandler* edithandler = CEditHandler::Get(); //Used to get the temporary folder 3198 3199 wxString emptyfile_name = _T("empty_file_yq744zm"); 3200 wxString emptyfile_path = edithandler->GetLocalDirectory(); 3201 3202 wxString emptyfile = emptyfile_path.Append(emptyfile_name); 3203 fclose(fopen((const char*)emptyfile.mb_str(wxConvUTF8), "w")); // Create the empty file 3204 3205 const CServer* pServer = m_pState->GetServer(); 3206 if (!pServer) 3207 { 3208 wxBell(); 3209 return; 3210 } 3211 3212 CLocalPath localPath(emptyfile_path, &emptyfile_name); 3213 3214 m_pQueue->QueueFile(false, false, emptyfile_name, newFileName, localPath, m_pDirectoryListing->path, *pServer, 0); 3215 m_pQueue->QueueFile_Finish(true); 3216 3217 //m_pState->m_pCommandQueue->ProcessCommand( 3218 //new CRenameCommand(m_pDirectoryListing->path, emptyfile_name, m_pDirectoryListing->path, newFileName) //Old name decided by fair dice roll. Guaranteed to be random. 3219 //); 3220 } -
src/interface/RemoteListView.h
diff -rup filezilla/src/interface/RemoteListView.h filezilla-new/src/interface/RemoteListView.h
old new protected: 115 115 void OnMenuEnter(wxCommandEvent& event); 116 116 void OnMenuGeturl(wxCommandEvent& event); 117 117 void OnMenuRefresh(wxCommandEvent& event); 118 void OnMenuNewfile(wxCommandEvent& event); 118 119 }; 119 120 120 121 #endif -
src/interface/resources/menus.xrc
diff -rup filezilla/src/interface/resources/menus.xrc filezilla-new/src/interface/resources/menus.xrc
old new 299 299 <label>&Create directory</label> 300 300 <help>Create a new subdirectory in the current directory</help> 301 301 </object> 302 <object class="wxMenuItem" name="ID_NEW_FILE"> 303 <label>Cre&ate new file</label> 304 <help>Create a new, empty file in the current directory</help> 305 </object> 302 306 <object class="wxMenuItem" name="ID_CONTEXT_REFRESH"> 303 307 <label>Re&fresh</label> 304 308 </object>