Ticket #5009: Patch4993.2.diff
File Patch4993.2.diff, 7.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 protected: 13 DECLARE_EVENT_TABLE() 14 void OnBrowseDefaultDownloadDirectory(wxCommandEvent& event); 11 15 }; 12 16 13 17 #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; … … 40 45 #endif 41 46 XRCCTRL(*this, "ID_REPLACED", wxStaticText)->SetLabel(filtered); 42 47 48 SetCheckFromOption(XRCID("ID_ENABLE_DEFDOWNLOADDIR"), OPTION_ENABLE_DEFAULT_DOWNLOAD_DIRECTORY, failure); 49 50 SetTextFromOption(XRCID("ID_DEFAULTDIR"), OPTION_DEFAULT_DOWNLOAD_DIRECTORY, failure); 51 43 52 return !failure; 44 53 } 45 54 … … 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 SetOptionFromCheck(XRCID("ID_ENABLE_DEFDOWNLOADDIR"), OPTION_ENABLE_DEFAULT_DOWNLOAD_DIRECTORY); 67 SetOptionFromText(XRCID("ID_DEFAULTDIR"), OPTION_DEFAULT_DOWNLOAD_DIRECTORY); 56 68 57 69 return true; 58 70 } … … 103 115 104 116 return true; 105 117 } 118 119 void COptionsPageTransfer::OnBrowseDefaultDownloadDirectory(wxCommandEvent& event) 120 { 121 // Get control handler 122 wxTextCtrl* pTextCtrl = XRCCTRL(*this, "ID_DEFAULTDIR", wxTextCtrl); 123 124 // Select a folder for default download directory 125 const wxString& curDir = pTextCtrl->GetValue(); 126 127 // Open DirSelector 128 const wxString& dir = ::wxDirSelector(_("Default Download Directory"), curDir); 129 130 // Pressed OK 131 if (!dir.empty()) 132 { 133 // Update setting 134 wxTextCtrl* pTextCtrl = XRCCTRL(*this, "ID_DEFAULTDIR", wxTextCtrl); 135 136 pTextCtrl->ChangeValue(dir); 137 } 138 } 139 -
src/interface/Mainfrm.cpp
3393 3393 } 3394 3394 3395 3395 context_controls.pLocalViewHeader = new CLocalViewHeader(context_controls.pLocalSplitter, pState); 3396 3397 // Check if "Default Download Directory" is enabled 3398 if (COptions::Get()->GetOptionVal(OPTION_ENABLE_DEFAULT_DOWNLOAD_DIRECTORY)) 3399 { 3400 wxString error; 3401 3402 // Fetch setting 3403 const wxString& defaultDownloadDirectory = COptions::Get()->GetOption(OPTION_DEFAULT_DOWNLOAD_DIRECTORY); 3404 3405 // Set Local Dir 3406 if ((defaultDownloadDirectory != _T("")) && (!pState->SetLocalDir(defaultDownloadDirectory, &error))) 3407 { 3408 if (error != _T("")) 3409 { 3410 wxMessageBox(error, _("Failed to change default download directory"), wxICON_INFORMATION); 3411 } 3412 else 3413 { 3414 wxBell(); 3415 } 3416 } 3417 } 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 OPTION_ENABLE_DEFAULT_DOWNLOAD_DIRECTORY, 83 OPTION_DEFAULT_DOWNLOAD_DIRECTORY, 82 84 83 85 // Has to be last element 84 86 OPTIONS_NUM -
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>Default Download Directory</label> 981 <object class="sizeritem"> 982 <option>1</option> 983 <flag>wxEXPAND</flag> 984 <border>5</border> 985 <object class="wxFlexGridSizer"> 986 <vgap>0</vgap> 987 <hgap>0</hgap> 988 <growablecols></growablecols> 989 <growablerows></growablerows> 990 <object class="sizeritem"> 991 <option>1</option> 992 <flag>wxEXPAND</flag> 993 <border>5</border> 994 <object class="wxBoxSizer"> 995 <orient>wxHORIZONTAL</orient> 996 <object class="sizeritem"> 997 <option>0</option> 998 <flag>wxALIGN_CENTER|wxALL</flag> 999 <border>5</border> 1000 <object class="wxCheckBox" name="ID_ENABLE_DEFDOWNLOADDIR"> 1001 <label>Enable default download directory</label> 1002 <checked>0</checked> 1003 </object> 1004 </object> 1005 <object class="sizeritem"> 1006 <option>0</option> 1007 <flag>wxALIGN_CENTER|wxALL</flag> 1008 <border>5</border> 1009 <object class="wxTextCtrl" name="ID_DEFAULTDIR"> 1010 <value></value> 1011 <maxlength>0</maxlength> 1012 </object> 1013 </object> 1014 <object class="sizeritem"> 1015 <option>0</option> 1016 <flag>wxALIGN_CENTER|wxALL</flag> 1017 <border>5</border> 1018 <object class="wxButton" name="ID_BROWSEDEFDIR"> 1019 <label>Browse</label> 1020 <default>0</default> 1021 </object> 1022 </object> 1023 </object> 1024 </object> 1025 </object> 1026 </object> 1027 </object> 1028 </object> 974 1029 </object> 975 1030 </object> 976 1031 <object class="wxPanel" name="ID_SETTINGS_FILETYPE"> … … 2159 2214 </object> 2160 2215 </object> 2161 2216 </object> 2162 </resource> 2163 No newline at end of file 2217 </resource> -
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 { "Use default download dir", number, _T("0"), false }, 152 { "Default Download Directory", string, _T(""), false } 151 153 }; 152 154 153 155 struct t_default_option