Ticket #4694: fz-3.3.4-direct-upload.patch

File fz-3.3.4-direct-upload.patch, 9.6 KB (added by Vinicius Massuchetto, 9 years ago)

Patch to create an option that bypasses upload confirmation while editing remote files

Line 
1diff -crB filezilla-3.3.4//src/interface/edithandler.cpp filezilla/src/interface/edithandler.cpp
2*** filezilla-3.3.4//src/interface/edithandler.cpp  2010-08-05 00:30:18.000000000 -0300
3--- filezilla/src/interface/edithandler.cpp 2010-08-15 22:18:32.000000000 -0300
4***************
5*** 676,682 ****
6            }
7 
8            bool remove;
9!           int res = DisplayChangeNotification(CEditHandler::fileType(i), iter, remove);
10            if (res == -1)
11                continue;
12 
13--- 677,687 ----
14            }
15 
16            bool remove;
17!
18!           int res = wxID_YES;
19!           if (!COptions::Get()->GetOptionVal(OPTION_EDIT_SKIP_VERIFICATION))
20!               res = DisplayChangeNotification(CEditHandler::fileType(i), iter, remove);
21!
22            if (res == -1)
23                continue;
24 
25***************
26*** 740,746 ****
27        int pos = file.Find(wxFileName::GetPathSeparator(), true);
28        wxASSERT(pos != -1);
29        file = file.Mid(pos + 1);
30!   
31        if (file == iter->name)
32        {
33            XRCCTRL(dlg, "ID_DESC_OPENEDAS", wxStaticText)->Hide();
34--- 746,752 ----
35        int pos = file.Find(wxFileName::GetPathSeparator(), true);
36        wxASSERT(pos != -1);
37        file = file.Mid(pos + 1);
38!
39        if (file == iter->name)
40        {
41            XRCCTRL(dlg, "ID_DESC_OPENEDAS", wxStaticText)->Hide();
42***************
43*** 1071,1077 ****
44            program_exists = false;
45            return prog;
46        }
47!       
48        program_exists = true;
49        return command + _T(" \"") + fn.GetFullPath() + _T("\"");
50    }
51--- 1077,1083 ----
52            program_exists = false;
53            return prog;
54        }
55!
56        program_exists = true;
57        return command + _T(" \"") + fn.GetFullPath() + _T("\"");
58    }
59***************
60*** 1152,1158 ****
61            return name.Left(max - pathlen - extlen) + name.Mid(pos);
62        }
63    }
64!   
65    return name;
66  }
67 
68--- 1158,1164 ----
69            return name.Left(max - pathlen - extlen) + name.Mid(pos);
70        }
71    }
72!
73    return name;
74  }
75 
76***************
77*** 1382,1388 ****
78 
79        enum CEditHandler::fileType type;
80        CEditHandler::t_fileData* pData = GetDataFromItem(i, type);
81!       
82        if (type == CEditHandler::local)
83        {
84            pEditHandler->Remove(pData->file);
85--- 1388,1394 ----
86 
87        enum CEditHandler::fileType type;
88        CEditHandler::t_fileData* pData = GetDataFromItem(i, type);
89!
90        if (type == CEditHandler::local)
91        {
92            pEditHandler->Remove(pData->file);
93***************
94*** 1467,1473 ****
95    while ((item = pListCtrl->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED)) != -1)
96    {
97        pListCtrl->SetItemState(item, 0, wxLIST_STATE_SELECTED);
98!       
99        enum CEditHandler::fileType type;
100        CEditHandler::t_fileData* pData = GetDataFromItem(item, type);
101 
102--- 1473,1479 ----
103    while ((item = pListCtrl->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED)) != -1)
104    {
105        pListCtrl->SetItemState(item, 0, wxLIST_STATE_SELECTED);
106!
107        enum CEditHandler::fileType type;
108        CEditHandler::t_fileData* pData = GetDataFromItem(item, type);
109 
110***************
111*** 1559,1565 ****
112    if (!pos)
113        m_ext = _T(".");
114    else if (pos != -1)
115!       m_ext = file.Mid(pos + 1); 
116    else
117        m_ext.clear();
118 
119--- 1565,1571 ----
120    if (!pos)
121        m_ext = _T(".");
122    else if (pos != -1)
123!       m_ext = file.Mid(pos + 1);
124    else
125        m_ext.clear();
126 
127diff -crB filezilla-3.3.4//src/interface/Options.cpp filezilla/src/interface/Options.cpp
128*** filezilla-3.3.4//src/interface/Options.cpp  2010-08-09 00:30:16.000000000 -0300
129--- filezilla/src/interface/Options.cpp 2010-08-15 10:45:42.000000000 -0300
130***************
131*** 166,176 ****
132    { "Comparison hide identical", number, _T("0"), normal },
133    { "Search sort order", string, _T(""), normal },
134    { "Edit track local", number, _T("1"), normal },
135    { "Prevent idle sleep", number, _T("1"), normal },
136    { "Filteredit window size", string, _T(""), normal },
137    { "Enable invalid char filter", number, _T("1"), normal },
138    { "Invalid char replace", string, _T("_"), normal },
139!   { "Already connected choice", number, _T("0"), normal },   
140    { "Edit status dialog size", string, _T(""), normal },
141    { "Display current speed", number, _T("0"), normal },
142    { "Toolbar hidden", number, _T("0"), normal },
143--- 166,178 ----
144    { "Comparison hide identical", number, _T("0"), normal },
145    { "Search sort order", string, _T(""), normal },
146    { "Edit track local", number, _T("1"), normal },
147+   //! Skip
148+   { "Skip verification on edit", number, _T("0"), normal },
149    { "Prevent idle sleep", number, _T("1"), normal },
150    { "Filteredit window size", string, _T(""), normal },
151    { "Enable invalid char filter", number, _T("1"), normal },
152    { "Invalid char replace", string, _T("_"), normal },
153!   { "Already connected choice", number, _T("0"), normal },
154    { "Edit status dialog size", string, _T(""), normal },
155    { "Display current speed", number, _T("0"), normal },
156    { "Toolbar hidden", number, _T("0"), normal },
157***************
158*** 346,352 ****
159            wxString s(wxString::Format(_T("%d"), m_optionsCache[i].numValue));
160            SetXmlValue(i, s);
161        }
162!       
163    }
164 
165    m_pXmlFile->Save();
166--- 348,354 ----
167            wxString s(wxString::Format(_T("%d"), m_optionsCache[i].numValue));
168            SetXmlValue(i, s);
169        }
170!
171    }
172 
173    m_pXmlFile->Save();
174***************
175*** 545,551 ****
176 
177    if (GetOptionVal(OPTION_DEFAULT_KIOSKMODE) == 2)
178        return;
179!   
180    CInterProcessMutex mutex(MUTEX_OPTIONS);
181    m_pXmlFile->Save();
182  }
183--- 547,553 ----
184 
185    if (GetOptionVal(OPTION_DEFAULT_KIOSKMODE) == 2)
186        return;
187!
188    CInterProcessMutex mutex(MUTEX_OPTIONS);
189    m_pXmlFile->Save();
190  }
191***************
192*** 713,719 ****
193    const wxString& defaultsDir = wxGetApp().GetDefaultsDir();
194    if (defaultsDir == _T(""))
195        return;
196!   
197    wxFileName name(defaultsDir, _T("fzdefaults.xml"));
198    CXmlFile file(name);
199    if (!file.Load())
200--- 715,721 ----
201    const wxString& defaultsDir = wxGetApp().GetDefaultsDir();
202    if (defaultsDir == _T(""))
203        return;
204!
205    wxFileName name(defaultsDir, _T("fzdefaults.xml"));
206    CXmlFile file(name);
207    if (!file.Load())
208diff -crB filezilla-3.3.4//src/interface/Options.h filezilla/src/interface/Options.h
209*** filezilla-3.3.4//src/interface/Options.h    2010-07-19 00:30:18.000000000 -0300
210--- filezilla/src/interface/Options.h   2010-08-15 09:29:15.000000000 -0300
211***************
212*** 72,77 ****
213--- 72,79 ----
214    OPTION_COMPARE_HIDEIDENTICAL,
215    OPTION_SEARCH_SORTORDER,
216    OPTION_EDIT_TRACK_LOCAL,
217+   //! Skip
218+   OPTION_EDIT_SKIP_VERIFICATION,
219    OPTION_PREVENT_IDLESLEEP,
220    OPTION_FILTEREDIT_SIZE,
221    OPTION_INVALID_CHAR_REPLACE_ENABLE,
222***************
223*** 107,113 ****
224 
225    virtual bool SetOption(unsigned int nID, int value);
226    virtual bool SetOption(unsigned int nID, wxString value);
227!   
228    void SetLastServer(const CServer& server);
229    bool GetLastServer(CServer& server);
230 
231--- 109,115 ----
232 
233    virtual bool SetOption(unsigned int nID, int value);
234    virtual bool SetOption(unsigned int nID, wxString value);
235!
236    void SetLastServer(const CServer& server);
237    bool GetLastServer(CServer& server);
238 
239Somente em filezilla/src/interface: Options.h.gch
240diff -crB filezilla-3.3.4//src/interface/resources/settings.xrc filezilla/src/interface/resources/settings.xrc
241*** filezilla-3.3.4//src/interface/resources/settings.xrc   2010-04-05 00:30:21.000000000 -0300
242--- filezilla/src/interface/resources/settings.xrc  2010-08-15 11:24:08.000000000 -0300
243***************
244*** 1884,1889 ****
245--- 1884,1894 ----
246                <label>&amp;Watch locally edited files and prompt to upload modifications</label>
247              </object>
248            </object>
249+           <object class="sizeritem">
250+             <object class="wxCheckBox" name="ID_EDIT_SKIP_VERIFICATION">
251+               <label>&amp;Do not ask to upload on file editions (Warning! Always backup your files as this can corrupt them!)</label>
252+             </object>
253+           </object>
254            <cols>1</cols>
255            <vgap>5</vgap>
256            <growablecols>0</growablecols>
257***************
258*** 2203,2206 ****
259        </object>
260      </object>
261    </object>
262! </resource>
263\ Falta o caracter nova linha no final do arquivo
264--- 2208,2211 ----
265        </object>
266      </object>
267    </object>
268! </resource>
269diff -crB filezilla-3.3.4//src/interface/settings/optionspage_edit.cpp filezilla/src/interface/settings/optionspage_edit.cpp
270*** filezilla-3.3.4//src/interface/settings/optionspage_edit.cpp    2010-02-07 13:40:20.000000000 -0200
271--- filezilla/src/interface/settings/optionspage_edit.cpp   2010-08-15 10:01:28.000000000 -0300
272***************
273*** 36,41 ****
274--- 36,42 ----
275        SetRCheck(XRCID("ID_USEASSOCIATIONS"), true, failure);
276 
277    SetCheckFromOption(XRCID("ID_EDIT_TRACK_LOCAL"), OPTION_EDIT_TRACK_LOCAL, failure);
278+   SetCheckFromOption(XRCID("ID_EDIT_SKIP_VERIFICATION"), OPTION_EDIT_SKIP_VERIFICATION, failure);
279 
280    if (!failure)
281        SetCtrlState();
282***************
283*** 49,55 ****
284 
285    if (GetRCheck(XRCID("ID_DEFAULT_CUSTOM")))
286        pOptions->SetOption(OPTION_EDIT_DEFAULTEDITOR, _T("2") + GetText(XRCID("ID_EDITOR")));
287!   else
288        pOptions->SetOption(OPTION_EDIT_DEFAULTEDITOR, GetRCheck(XRCID("ID_DEFAULT_TEXT")) ? _T("1") : _T("0"));
289 
290    if (GetRCheck(XRCID("ID_USEDEFAULT")))
291--- 50,56 ----
292 
293    if (GetRCheck(XRCID("ID_DEFAULT_CUSTOM")))
294        pOptions->SetOption(OPTION_EDIT_DEFAULTEDITOR, _T("2") + GetText(XRCID("ID_EDITOR")));
295!   else
296        pOptions->SetOption(OPTION_EDIT_DEFAULTEDITOR, GetRCheck(XRCID("ID_DEFAULT_TEXT")) ? _T("1") : _T("0"));
297 
298    if (GetRCheck(XRCID("ID_USEDEFAULT")))
299***************
300*** 58,64 ****
301        pOptions->SetOption(OPTION_EDIT_ALWAYSDEFAULT, 0);
302 
303    SetOptionFromCheck(XRCID("ID_EDIT_TRACK_LOCAL"), OPTION_EDIT_TRACK_LOCAL);
304!       
305    return true;
306  }
307 
308--- 59,66 ----
309        pOptions->SetOption(OPTION_EDIT_ALWAYSDEFAULT, 0);
310 
311    SetOptionFromCheck(XRCID("ID_EDIT_TRACK_LOCAL"), OPTION_EDIT_TRACK_LOCAL);
312!   SetOptionFromCheck(XRCID("ID_EDIT_SKIP_VERIFICATION"), OPTION_EDIT_SKIP_VERIFICATION);
313!
314    return true;
315  }
316