View/Edit for Local Site....What happened to it?

Need help with FileZilla Client? Something does not work as expected? In this forum you may find an answer.

Moderator: Project members

Post Reply
Message
Author
airport
500 Command not understood
Posts: 3
Joined: 2007-11-16 15:18

View/Edit for Local Site....What happened to it?

#1 Post by airport » 2007-11-16 15:24

Just upgraded from Win2000 to WinXP and had to reinstall FileZilla. The previous version allowed me to right-click on a local file and get "View/Edit" in the menu, which launched the editor I had it configured to (I think it was under the interface setting). It was a very handy and time saving feature.

Version 3.03 doesn't seem to be able to do that. "View/Edit" is available when right-clicking on the *remote* file (which opens a browser which does me no good) but not the local file.

Am I missing something? If Ver 3.03 doesn't support that feature, where can I download the previous version?

Thanks.

User avatar
boco
Contributor
Posts: 25279
Joined: 2006-05-01 03:28
Location: Germany

#2 Post by boco » 2007-11-17 05:14

Not yet.

Latest 2.2 version download:

http://sourceforge.net/project/showfile ... _id=501534

Rocky
500 Command not understood
Posts: 2
Joined: 2007-11-20 19:17

#3 Post by Rocky » 2007-11-20 19:19

I agree that this is a very convenient feature because I usually edit files locally so that I have the a copy of the changed file.

Thanks!

Sam

airport
500 Command not understood
Posts: 3
Joined: 2007-11-16 15:18

#4 Post by airport » 2007-11-21 18:49

I now see that this has been thoroughly discussed in the General Discussion forum. I'll look forward to seeing it added as development progresses. Thanks to all for the work on a fine software.

eddan
226 Transfer OK
Posts: 423
Joined: 2004-02-25 08:44
Location: Norway
Contact:

Re: View/Edit for Local Site....What happened to it?

#5 Post by eddan » 2007-12-20 21:12

First of all, this is by no means official and it's not much tested, but for anyone that are able to compile FZ3 themselves, here is a quick and dirty hack so you can edit local files. I take no responsibility, but it works for me so I'm happy :)

Here's the patch:

Code: Select all

Index: src/interface/LocalListView.cpp
===================================================================
--- src/interface/LocalListView.cpp	(revision 1907)
+++ src/interface/LocalListView.cpp	(working copy)
@@ -10,6 +10,7 @@
 #include <wx/dnd.h>
 #include "dndobjects.h"
 #include "Options.h"
+#include "edithandler.h"
 #ifdef __WXMSW__
 #include "lm.h"
 #include <wx/msw/registry.h>
@@ -206,6 +207,7 @@
 	EVT_MENU(XRCID("ID_UPLOAD"), CLocalListView::OnMenuUpload)
 	EVT_MENU(XRCID("ID_ADDTOQUEUE"), CLocalListView::OnMenuUpload)
 	EVT_MENU(XRCID("ID_MKDIR"), CLocalListView::OnMenuMkdir)
+	EVT_MENU(XRCID("ID_EDIT"), CLocalListView::OnMenuEdit)
 	EVT_MENU(XRCID("ID_DELETE"), CLocalListView::OnMenuDelete)
 	EVT_MENU(XRCID("ID_RENAME"), CLocalListView::OnMenuRename)
 	EVT_KEY_DOWN(CLocalListView::OnKeyDown)
@@ -1000,6 +1002,7 @@
 	int index = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
 	int count = 0;
 	int fillCount = 0;
+	bool selectedDir = false;
 	while (index != -1)
 	{
 		count++;
@@ -1008,22 +1011,33 @@
 		{
 			pMenu->Enable(XRCID("ID_UPLOAD"), false);
 			pMenu->Enable(XRCID("ID_ADDTOQUEUE"), false);
+			pMenu->Enable(XRCID("ID_EDIT"), false);
 			pMenu->Enable(XRCID("ID_DELETE"), false);
 			pMenu->Enable(XRCID("ID_RENAME"), false);
 		}
 		if (data->flags == fill)
 			fillCount++;
+		if (data->dir)
+			selectedDir = true;
 		index = GetNextItem(index, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
 	}
 	if (!count || fillCount == count)
 	{
 		pMenu->Enable(XRCID("ID_UPLOAD"), false);
 		pMenu->Enable(XRCID("ID_ADDTOQUEUE"), false);
+		pMenu->Enable(XRCID("ID_EDIT"), false);
 		pMenu->Enable(XRCID("ID_DELETE"), false);
 		pMenu->Enable(XRCID("ID_RENAME"), false);
 	}
-	else if (count > 1)
-		pMenu->Enable(XRCID("ID_RENAME"), false);
+	else
+	{
+		if (selectedDir)
+		{
+			pMenu->Enable(XRCID("ID_EDIT"), false);
+		}
+		if (count > 1)
+			pMenu->Enable(XRCID("ID_RENAME"), false);
+	}
 
 	PopupMenu(pMenu);
 	delete pMenu;
@@ -1118,6 +1132,48 @@
 	DisplayDir(m_dir);
 }
 
+void CLocalListView::OnMenuEdit(wxCommandEvent& event)
+{
+	CEditHandler* pEditHandler = CEditHandler::Get();
+	
+	long item = -1;
+	while (true)
+	{
+		item = GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
+		if (item == -1)
+			break;
+
+		if (!item && m_hasParent)
+			return;
+	}
+
+	item = -1;
+	while (true)
+	{
+		item = GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
+		if (item == -1)
+			break;
+
+		CLocalFileData *data = GetData(item);
+		if (!data)
+			return;
+
+		if (data->flags == fill)
+			continue;
+
+		if (!data->dir)
+		{
+			wxFileName fn(m_dir, data->name);
+
+			wxString cmd = pEditHandler->GetOpenCommand(fn.GetFullPath());
+			if (cmd == _T(""))
+				return;
+
+			wxExecute(cmd);
+		}
+	}
+}
+
 void CLocalListView::OnMenuDelete(wxCommandEvent& event)
 {
 	// Under Windows use SHFileOperation to delete files and directories.
Index: src/interface/resources/menus.xrc
===================================================================
--- src/interface/resources/menus.xrc	(revision 1907)
+++ src/interface/resources/menus.xrc	(working copy)
@@ -117,6 +117,10 @@
       <help>Create a new subdirectory in the current directory</help>
     </object>
     <object class="separator"/>
+    <object class="wxMenuItem" name="ID_EDIT">
+      <label>&Edit</label>
+      <help>Edit selected files</help>
+    </object>
     <object class="wxMenuItem" name="ID_DELETE">
       <label>D&elete</label>
       <help>Delete selected files and folders</help>
Index: src/interface/LocalListView.h
===================================================================
--- src/interface/LocalListView.h	(revision 1907)
+++ src/interface/LocalListView.h	(working copy)
@@ -82,6 +82,7 @@
 	void OnContextMenu(wxContextMenuEvent& event);
 	void OnMenuUpload(wxCommandEvent& event);
 	void OnMenuMkdir(wxCommandEvent& event);
+	void OnMenuEdit(wxCommandEvent& event);
 	void OnMenuDelete(wxCommandEvent& event);
 	void OnMenuRename(wxCommandEvent& event);
 	void OnChar(wxKeyEvent& event);
Index: src/interface/edithandler.h
===================================================================
--- src/interface/edithandler.h	(revision 1907)
+++ src/interface/edithandler.h	(working copy)
@@ -70,6 +70,8 @@
 	const std::list<t_fileData>& GetFiles() const { return m_fileDataList; }
 
 	bool UploadFile(const wxString& fileName, bool unedit);
+
+	wxString GetOpenCommand(const wxString& file);
 
 protected:
 	CEditHandler();
@@ -81,7 +83,6 @@
 
 	bool StartEditing(t_fileData &data);
 
-	wxString GetOpenCommand(const wxString& file);
 	wxString GetSystemOpenCommand(const wxString& file);
 	wxString GetCustomOpenCommand(const wxString& file);
This is the beauty of open source apps, you add what you like. I agree with botg that using your standard file manager (like explorer under Windows) is better suited for this, but I'm lazy.

Edit: Downloadable version: http://home.no.net/eddan/local-edit.diff
For help and support, check out the support page on the wiki.

Kerry
504 Command not implemented
Posts: 9
Joined: 2007-12-19 23:41
First name: Kerry
Last name: King

Re: View/Edit for Local Site....What happened to it?

#6 Post by Kerry » 2007-12-25 21:16

I'm not certain, I'll have to play with it some more, but, I believe I right-clicked a php file in the remote window and selected edit/view and it opened in my EditPadPro and I edited it. When I pressed save it actually saved it to the remote (giving me the option "one exists, do you want to overwrite etc.). Whereas before I had to download a file from the server and edit it and then upload the saved file. Anyone else noticing this, for me, great change?

I'd also like the option of being able to edit/view from my local pane so I was about to try your patch eddan
this is by no means official
but I couldn't find the file to edit, where it's located, and where exactly the code should be inserted.

Kerry

Post Reply