Ticket #5009: Patch4993.diff
File Patch4993.diff, 8.4 KB (added by , 15 years ago) |
---|
-
src/interface/settings/optionspage_transfer.h
8 8 virtual bool LoadPage(); 9 9 virtual bool SavePage(); 10 10 virtual bool Validate(); 11 12 // Added by Xishi Pan for #4993 - START 13 protected: 14 DECLARE_EVENT_TABLE() 15 void OnBrowseDefaultDownloadDirectory(wxCommandEvent& event); 16 // #4993 - END 11 17 }; 12 18 13 19 #endif //__OPTIONSPAGE_TRANSFER_H__ -
src/interface/settings/optionspage_transfer.cpp
4 4 #include "optionspage.h" 5 5 #include "optionspage_transfer.h" 6 6 7 BEGIN_EVENT_TABLE(COptionsPageTransfer, COptionsPage) 8 EVT_BUTTON(XRCID("ID_BROWSEDEFDIR"), COptionsPageTransfer::OnBrowseDefaultDownloadDirectory) 9 END_EVENT_TABLE() 10 11 7 12 bool COptionsPageTransfer::LoadPage() 8 13 { 9 14 bool failure = false; … … 39 44 wxString filtered = wxString::Format(_("The following character will be replaced: %s"), invalid.c_str()); 40 45 #endif 41 46 XRCCTRL(*this, "ID_REPLACED", wxStaticText)->SetLabel(filtered); 47 48 // Added by Xishi Pan for #4993 - START 49 SetTextFromOption(XRCID("ID_DEFAULTDIR"), OPTION_DEFAULT_DOWNLOAD_DIRECTORY, failure); 50 // #4993 - END 42 51 43 52 return !failure; 44 53 } … … 53 62 m_pOptions->SetOption(OPTION_SPEEDLIMIT_BURSTTOLERANCE, GetChoice(XRCID("ID_BURSTTOLERANCE"))); 54 63 SetOptionFromText(XRCID("ID_REPLACE"), OPTION_INVALID_CHAR_REPLACE); 55 64 SetOptionFromCheck(XRCID("ID_ENABLE_REPLACE"), OPTION_INVALID_CHAR_REPLACE_ENABLE); 65 66 // Added by Xishi Pan for #4993 - START 67 SetOptionFromText(XRCID("ID_DEFAULTDIR"), OPTION_DEFAULT_DOWNLOAD_DIRECTORY); 68 // #4993 - END 56 69 57 70 return true; 58 71 } … … 103 116 104 117 return true; 105 118 } 119 120 // Added by Xishi Pan for #4993 - START 121 void COptionsPageTransfer::OnBrowseDefaultDownloadDirectory(wxCommandEvent& event) 122 { 123 // Get control handler 124 wxTextCtrl* pTextCtrl = XRCCTRL(*this, "ID_DEFAULTDIR", wxTextCtrl); 125 126 // Select a folder for default download directory 127 const wxString& curDir = pTextCtrl->GetValue(); 128 129 // Open DirSelector 130 const wxString& dir = ::wxDirSelector(_("Default Download Directory"), curDir); 131 132 // Pressed OK 133 if (!dir.empty()) 134 { 135 // Update setting 136 wxTextCtrl* pTextCtrl = XRCCTRL(*this, "ID_DEFAULTDIR", wxTextCtrl); 137 138 pTextCtrl->ChangeValue(dir); 139 } 140 } 141 // #4993 - END -
src/interface/Mainfrm.cpp
3393 3393 } 3394 3394 3395 3395 context_controls.pLocalViewHeader = new CLocalViewHeader(context_controls.pLocalSplitter, pState); 3396 3397 // Added by Xishi Pan for #4993 - START 3398 { 3399 wxString error; 3400 3401 // Fetch setting 3402 const wxString& defaultDownloadDirectory = COptions::Get()->GetOption(OPTION_DEFAULT_DOWNLOAD_DIRECTORY); 3403 3404 // Set Local Dir 3405 if ((defaultDownloadDirectory != _T("")) && (!pState->SetLocalDir(defaultDownloadDirectory, &error))) 3406 { 3407 if (error != _T("")) 3408 { 3409 wxMessageBox(error, _("Failed to change default download directory"), wxICON_INFORMATION); 3410 } 3411 else 3412 { 3413 wxBell(); 3414 } 3415 } 3416 } 3417 // #4993 - END 3418 3396 3419 if (COptions::Get()->GetOptionVal(OPTION_SHOW_TREE_LOCAL)) 3397 3420 { 3398 3421 context_controls.pLocalTreeViewPanel->SetHeader(context_controls.pLocalViewHeader); -
src/interface/Options.h
79 79 OPTION_INVALID_CHAR_REPLACE_ENABLE, 80 80 OPTION_INVALID_CHAR_REPLACE, 81 81 OPTION_ALREADYCONNECTED_CHOICE, 82 83 OPTION_DEFAULT_DOWNLOAD_DIRECTORY, // Added by Xish Pan for #4993 82 84 83 85 // Has to be last element 84 86 OPTIONS_NUM -
src/interface/resources/menus.xrc
1 <?xml version="1.0" encoding=" ISO-8859-1"?>1 <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> 2 2 <resource version="2.3.0.1" xmlns="http://www.wxwindows.org/wxxrc"> 3 3 <object class="wxMenuBar" name="ID_MENUBAR"> 4 4 <object class="wxMenu"> -
src/interface/resources/settings.xrc
971 971 </object> 972 972 <flag>wxGROW</flag> 973 973 </object> 974 <object class="sizeritem"> 975 <option>1</option> 976 <flag>wxEXPAND</flag> 977 <border>5</border> 978 <object class="wxStaticBoxSizer"> 979 <orient>wxVERTICAL</orient> 980 <label>General</label> 981 <object class="sizeritem"> 982 <option>1</option> 983 <flag>wxEXPAND</flag> 984 <border>5</border> 985 <object class="wxFlexGridSizer"> 986 <rows>2</rows> 987 <cols>2</cols> 988 <vgap>0</vgap> 989 <hgap>0</hgap> 990 <growablecols></growablecols> 991 <growablerows></growablerows> 992 <object class="sizeritem"> 993 <option>1</option> 994 <flag>wxEXPAND</flag> 995 <border>5</border> 996 <object class="wxBoxSizer"> 997 <orient>wxHORIZONTAL</orient> 998 <object class="sizeritem"> 999 <option>0</option> 1000 <flag>wxALL</flag> 1001 <border>5</border> 1002 <object class="wxStaticText" name="m_staticText108"> 1003 <label>Default Download Directory:</label> 1004 </object> 1005 </object> 1006 <object class="sizeritem"> 1007 <option>0</option> 1008 <flag>wxALL</flag> 1009 <border>5</border> 1010 <object class="wxTextCtrl" name="ID_DEFAULTDIR"> 1011 <value></value> 1012 <maxlength>0</maxlength> 1013 </object> 1014 </object> 1015 <object class="sizeritem"> 1016 <option>0</option> 1017 <flag>wxALL</flag> 1018 <border>5</border> 1019 <object class="wxButton" name="ID_BROWSEDEFDIR"> 1020 <label>Browse</label> 1021 <default>0</default> 1022 </object> 1023 </object> 1024 </object> 1025 </object> 1026 </object> 1027 </object> 1028 </object> 1029 </object> 974 1030 </object> 975 1031 </object> 976 1032 <object class="wxPanel" name="ID_SETTINGS_FILETYPE"> … … 2159 2215 </object> 2160 2216 </object> 2161 2217 </object> 2162 </resource> 2163 No newline at end of file 2218 </resource> -
src/interface/resources/toolbar.xrc
1 <?xml version="1.0" encoding=" ISO-8859-1"?>1 <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> 2 2 <resource version="2.3.0.1" xmlns="http://www.wxwindows.org/wxxrc"> 3 3 <object class="wxToolBar" name="ID_TOOLBAR"> 4 4 <style>wxTB_FLAT|wxTB_DOCKABLE|wxTB_HORIZONTAL</style> -
src/interface/Options.cpp
147 147 { "Filteredit window size", string, _T(""), false }, 148 148 { "Enable invalid char filter", number, _T("1"), false }, 149 149 { "Invalid char replace", string, _T("_"), false }, 150 { "Already connected choice", number, _T("0"), false } 150 { "Already connected choice", number, _T("0"), false }, 151 { "Default Download Directory", string, _T(""), false } // Added by Xishi Pan for #4993 151 152 }; 152 153 153 154 struct t_default_option