Ticket #1531: filezilla_fileexist_mods_rev2390.patch
File filezilla_fileexist_mods_rev2390.patch, 39.4 KB (added by , 14 years ago) |
---|
-
src/interface/defaultfileexistsdlg.h
2 2 #define __DEFAULTFILEEXISTSDLG_H__ 3 3 4 4 #include "dialogex.h" 5 #include "notification.h" 5 6 6 7 class CDefaultFileExistsDlg : protected wxDialogEx 7 8 { … … 10 11 11 12 bool Load(wxWindow *parent, bool fromQueue); 12 13 13 static intGetDefault(bool download);14 static void SetDefault(bool download, intaction);14 static enum CFileExistsNotification::OverwriteAction GetDefault(bool download); 15 static void SetDefault(bool download, enum CFileExistsNotification::OverwriteAction action); 15 16 16 bool Run( int *downloadAction = 0, int*uploadAction = 0);17 bool Run(enum CFileExistsNotification::OverwriteAction *downloadAction = 0, enum CFileExistsNotification::OverwriteAction *uploadAction = 0); 17 18 18 19 protected: 19 static intm_defaults[2];20 static enum CFileExistsNotification::OverwriteAction m_defaults[2]; 20 21 }; 21 22 22 23 #endif //__DEFAULTFILEEXISTSDLG_H__ -
src/interface/defaultfileexistsdlg.cpp
1 1 #include "FileZilla.h" 2 2 #include "defaultfileexistsdlg.h" 3 #include "notification.h" 3 4 4 int CDefaultFileExistsDlg::m_defaults[2] = {-1, -1};5 enum CFileExistsNotification::OverwriteAction CDefaultFileExistsDlg::m_defaults[2] = {CFileExistsNotification::unknown, CFileExistsNotification::unknown}; 5 6 6 7 CDefaultFileExistsDlg::CDefaultFileExistsDlg() 7 8 { … … 24 25 25 26 switch (m_defaults[0]) 26 27 { 27 case 0:28 case CFileExistsNotification::ask: 28 29 XRCCTRL(*this, "ID_DL_ASK", wxRadioButton)->SetValue(true); 29 30 break; 30 case 1:31 case CFileExistsNotification::overwrite: 31 32 XRCCTRL(*this, "ID_DL_OVERWRITE", wxRadioButton)->SetValue(true); 32 33 break; 33 case 2:34 case CFileExistsNotification::overwriteNewer: 34 35 XRCCTRL(*this, "ID_DL_OVERWRITEIFNEWER", wxRadioButton)->SetValue(true); 35 36 break; 36 case 3: 37 case CFileExistsNotification::overwriteSize: 38 XRCCTRL(*this, "ID_DL_OVERWRITESIZE", wxRadioButton)->SetValue(true); 39 break; 40 case CFileExistsNotification::overwriteSizeOrNewer: 41 XRCCTRL(*this, "ID_DL_OVERWRITESIZEORNEWER", wxRadioButton)->SetValue(true); 42 break; 43 case CFileExistsNotification::resume: 37 44 XRCCTRL(*this, "ID_DL_RESUME", wxRadioButton)->SetValue(true); 38 45 break; 39 case 4:46 case CFileExistsNotification::rename: 40 47 XRCCTRL(*this, "ID_DL_RENAME", wxRadioButton)->SetValue(true); 41 48 break; 42 case 5:49 case CFileExistsNotification::skip: 43 50 XRCCTRL(*this, "ID_DL_SKIP", wxRadioButton)->SetValue(true); 44 51 break; 45 52 default: … … 49 56 50 57 switch (m_defaults[1]) 51 58 { 52 case 0:59 case CFileExistsNotification::ask: 53 60 XRCCTRL(*this, "ID_UL_ASK", wxRadioButton)->SetValue(true); 54 61 break; 55 case 1:62 case CFileExistsNotification::overwrite: 56 63 XRCCTRL(*this, "ID_UL_OVERWRITE", wxRadioButton)->SetValue(true); 57 64 break; 58 case 2:65 case CFileExistsNotification::CFileExistsNotification::overwriteNewer: 59 66 XRCCTRL(*this, "ID_UL_OVERWRITEIFNEWER", wxRadioButton)->SetValue(true); 60 67 break; 61 case 3: 68 case CFileExistsNotification::CFileExistsNotification::overwriteSize: 69 XRCCTRL(*this, "ID_UL_OVERWRITESIZE", wxRadioButton)->SetValue(true); 70 break; 71 case CFileExistsNotification::CFileExistsNotification::overwriteSizeOrNewer: 72 XRCCTRL(*this, "ID_UL_OVERWRITESIZEORNEWER", wxRadioButton)->SetValue(true); 73 break; 74 case CFileExistsNotification::resume: 62 75 XRCCTRL(*this, "ID_UL_RESUME", wxRadioButton)->SetValue(true); 63 76 break; 64 case 4:77 case CFileExistsNotification::rename: 65 78 XRCCTRL(*this, "ID_UL_RENAME", wxRadioButton)->SetValue(true); 66 79 break; 67 case 5:80 case CFileExistsNotification::skip: 68 81 XRCCTRL(*this, "ID_UL_SKIP", wxRadioButton)->SetValue(true); 69 82 break; 70 83 default: … … 75 88 return true; 76 89 } 77 90 78 intCDefaultFileExistsDlg::GetDefault(bool download)91 enum CFileExistsNotification::OverwriteAction CDefaultFileExistsDlg::GetDefault(bool download) 79 92 { 80 93 return m_defaults[download ? 0 : 1]; 81 94 } 82 95 83 bool CDefaultFileExistsDlg::Run( int *downloadAction, int*uploadAction)96 bool CDefaultFileExistsDlg::Run(enum CFileExistsNotification::OverwriteAction *downloadAction, enum CFileExistsNotification::OverwriteAction *uploadAction) 84 97 { 85 98 wxASSERT(!downloadAction || uploadAction); 86 99 wxASSERT(!uploadAction || downloadAction); … … 88 101 if (ShowModal() != wxID_OK) 89 102 return false; 90 103 91 intaction;104 enum CFileExistsNotification::OverwriteAction action; 92 105 if (XRCCTRL(*this, "ID_DL_ASK", wxRadioButton)->GetValue()) 93 action = 0;106 action = CFileExistsNotification::ask; 94 107 else if (XRCCTRL(*this, "ID_DL_OVERWRITE", wxRadioButton)->GetValue()) 95 action = 1;108 action = CFileExistsNotification::overwrite; 96 109 else if (XRCCTRL(*this, "ID_DL_OVERWRITEIFNEWER", wxRadioButton)->GetValue()) 97 action = 2; 110 action = CFileExistsNotification::overwriteNewer; 111 else if (XRCCTRL(*this, "ID_DL_OVERWRITESIZE", wxRadioButton)->GetValue()) 112 action = CFileExistsNotification::overwriteSize; 113 else if (XRCCTRL(*this, "ID_DL_OVERWRITESIZEORNEWER", wxRadioButton)->GetValue()) 114 action = CFileExistsNotification::overwriteSizeOrNewer; 98 115 else if (XRCCTRL(*this, "ID_DL_RESUME", wxRadioButton)->GetValue()) 99 action = 3;116 action = CFileExistsNotification::resume; 100 117 else if (XRCCTRL(*this, "ID_DL_RENAME", wxRadioButton)->GetValue()) 101 action = 4;118 action = CFileExistsNotification::rename; 102 119 else if (XRCCTRL(*this, "ID_DL_SKIP", wxRadioButton)->GetValue()) 103 action = 5;120 action = CFileExistsNotification::skip; 104 121 else 105 action = -1;122 action = CFileExistsNotification::unknown; 106 123 107 124 if (downloadAction) 108 125 *downloadAction = action; … … 110 127 m_defaults[0] = action; 111 128 112 129 if (XRCCTRL(*this, "ID_UL_ASK", wxRadioButton)->GetValue()) 113 action = 0;130 action = CFileExistsNotification::ask; 114 131 else if (XRCCTRL(*this, "ID_UL_OVERWRITE", wxRadioButton)->GetValue()) 115 action = 1;132 action = CFileExistsNotification::overwrite; 116 133 else if (XRCCTRL(*this, "ID_UL_OVERWRITEIFNEWER", wxRadioButton)->GetValue()) 117 action = 2; 134 action = CFileExistsNotification::overwriteNewer; 135 else if (XRCCTRL(*this, "ID_UL_OVERWRITESIZE", wxRadioButton)->GetValue()) 136 action = CFileExistsNotification::overwriteSize; 137 else if (XRCCTRL(*this, "ID_UL_OVERWRITESIZEORNEWER", wxRadioButton)->GetValue()) 138 action = CFileExistsNotification::overwriteSizeOrNewer; 118 139 else if (XRCCTRL(*this, "ID_UL_RESUME", wxRadioButton)->GetValue()) 119 action = 3;140 action = CFileExistsNotification::resume; 120 141 else if (XRCCTRL(*this, "ID_UL_RENAME", wxRadioButton)->GetValue()) 121 action = 4;142 action = CFileExistsNotification::rename; 122 143 else if (XRCCTRL(*this, "ID_UL_SKIP", wxRadioButton)->GetValue()) 123 action = 5;144 action = CFileExistsNotification::skip; 124 145 else 125 action = -1;146 action = CFileExistsNotification::unknown; 126 147 127 148 if (uploadAction) 128 149 *uploadAction = action; … … 132 153 return true; 133 154 } 134 155 135 void CDefaultFileExistsDlg::SetDefault(bool download, intaction)156 void CDefaultFileExistsDlg::SetDefault(bool download, enum CFileExistsNotification::OverwriteAction action) 136 157 { 137 if (action < -1 || action > 5)138 action = -1;158 if (action < CFileExistsNotification::unknown || action > CFileExistsNotification::ACTION_COUNT) 159 action = CFileExistsNotification::unknown; 139 160 m_defaults[download ? 0 : 1] = action; 140 161 } -
src/interface/resources/dialogs.xrc
797 797 <flag>wxLEFT|wxRIGHT|wxTOP</flag> 798 798 <border>5</border> 799 799 <object class="wxRadioButton" name="ID_ACTION1"> 800 <label>& Overwrite</label>800 <label>&1 - Overwrite</label> 801 801 <value>1</value> 802 802 </object> 803 803 </object> … … 805 805 <flag>wxLEFT|wxRIGHT|wxTOP</flag> 806 806 <border>5</border> 807 807 <object class="wxRadioButton" name="ID_ACTION2"> 808 <label> Overwrite &if source newer</label>808 <label>&2 - Overwrite if source newer</label> 809 809 <value>0</value> 810 810 </object> 811 811 </object> 812 812 <object class="sizeritem"> 813 813 <flag>wxLEFT|wxRIGHT|wxTOP</flag> 814 814 <border>5</border> 815 <object class="wxRadioButton" name="ID_ACTION7"> 816 <label>&3 - Overwrite if different size</label> 817 <value>0</value> 818 </object> 819 </object> 820 <object class="sizeritem"> 821 <flag>wxLEFT|wxRIGHT|wxTOP</flag> 822 <border>5</border> 823 <object class="wxRadioButton" name="ID_ACTION6"> 824 <label>&4 - Overwrite if different size or source newer</label> 825 <value>0</value> 826 </object> 827 </object> 828 <object class="sizeritem"> 829 <flag>wxLEFT|wxRIGHT|wxTOP</flag> 830 <border>5</border> 815 831 <object class="wxRadioButton" name="ID_ACTION3"> 816 <label>& Resume</label>832 <label>&5 - Resume</label> 817 833 <value>0</value> 818 834 </object> 819 835 </object> … … 821 837 <flag>wxLEFT|wxRIGHT|wxTOP</flag> 822 838 <border>5</border> 823 839 <object class="wxRadioButton" name="ID_ACTION4"> 824 <label> Re&name</label>840 <label>&6 - Rename</label> 825 841 <value>0</value> 826 842 </object> 827 843 </object> … … 829 845 <flag>wxALL</flag> 830 846 <border>5</border> 831 847 <object class="wxRadioButton" name="ID_ACTION5"> 832 <label>& Skip</label>848 <label>&7 - Skip</label> 833 849 <value>0</value> 834 850 </object> 835 851 </object> … … 3945 3961 <object class="wxGridSizer"> 3946 3962 <object class="sizeritem"> 3947 3963 <object class="wxRadioButton" name="ID_DL_DEFAULT"> 3948 <label> Use &default</label>3964 <label>&a - Use default</label> 3949 3965 <style>wxRB_GROUP</style> 3950 3966 </object> 3951 3967 </object> 3952 3968 <object class="sizeritem"> 3953 3969 <object class="wxRadioButton" name="ID_DL_ASK"> 3954 <label>& Ask for action</label>3970 <label>&b - Ask for action</label> 3955 3971 </object> 3956 3972 </object> 3957 3973 <object class="sizeritem"> 3958 3974 <object class="wxRadioButton" name="ID_DL_OVERWRITE"> 3959 <label>& Overwrite</label>3975 <label>&c - Overwrite</label> 3960 3976 </object> 3961 3977 </object> 3962 3978 <object class="sizeritem"> 3963 3979 <object class="wxRadioButton" name="ID_DL_OVERWRITEIFNEWER"> 3964 <label> Ov&erwrite if source newer</label>3980 <label>&d - Overwrite if source newer</label> 3965 3981 </object> 3966 3982 </object> 3967 3983 <object class="sizeritem"> 3984 <object class="wxRadioButton" name="ID_DL_OVERWRITESIZE"> 3985 <label>&e - Overwrite if different size</label> 3986 </object> 3987 </object> 3988 <object class="sizeritem"> 3989 <object class="wxRadioButton" name="ID_DL_OVERWRITESIZEORNEWER"> 3990 <label>&f - Overwrite if different size or source newer</label> 3991 </object> 3992 </object> 3993 <object class="sizeritem"> 3968 3994 <object class="wxRadioButton" name="ID_DL_RESUME"> 3969 <label>& Resume</label>3995 <label>&g - Resume</label> 3970 3996 </object> 3971 3997 </object> 3972 3998 <object class="sizeritem"> 3973 3999 <object class="wxRadioButton" name="ID_DL_RENAME"> 3974 <label> Re&name</label>4000 <label>&h - Rename</label> 3975 4001 </object> 3976 4002 </object> 3977 4003 <object class="sizeritem"> 3978 4004 <object class="wxRadioButton" name="ID_DL_SKIP"> 3979 <label> S&kip</label>4005 <label>&i - Skip</label> 3980 4006 </object> 3981 4007 </object> 3982 4008 <cols>1</cols> … … 3997 4023 <object class="wxGridSizer"> 3998 4024 <object class="sizeritem"> 3999 4025 <object class="wxRadioButton" name="ID_UL_DEFAULT"> 4000 <label> Use d&efault</label>4026 <label>&j - Use default</label> 4001 4027 <value>1</value> 4002 4028 <style>wxRB_GROUP</style> 4003 4029 </object> 4004 4030 </object> 4005 4031 <object class="sizeritem"> 4006 4032 <object class="wxRadioButton" name="ID_UL_ASK"> 4007 <label> A&sk for action</label>4033 <label>&k - Ask for action</label> 4008 4034 </object> 4009 4035 </object> 4010 4036 <object class="sizeritem"> 4011 4037 <object class="wxRadioButton" name="ID_UL_OVERWRITE"> 4012 <label> O&verwrite</label>4038 <label>&l - Overwrite</label> 4013 4039 </object> 4014 4040 </object> 4015 4041 <object class="sizeritem"> 4016 4042 <object class="wxRadioButton" name="ID_UL_OVERWRITEIFNEWER"> 4017 <label> Over&write if source newer</label>4043 <label>&m - Overwrite if source newer</label> 4018 4044 </object> 4019 4045 </object> 4020 4046 <object class="sizeritem"> 4047 <object class="wxRadioButton" name="ID_UL_OVERWRITESIZE"> 4048 <label>&n - Overwrite if different size</label> 4049 </object> 4050 </object> 4051 <object class="sizeritem"> 4052 <object class="wxRadioButton" name="ID_UL_OVERWRITESIZEORNEWER"> 4053 <label>&o - Overwrite if different size or source newer</label> 4054 </object> 4055 </object> 4056 <object class="sizeritem"> 4021 4057 <object class="wxRadioButton" name="ID_UL_RESUME"> 4022 <label> Res&ume</label>4058 <label>&p - Resume</label> 4023 4059 </object> 4024 4060 </object> 4025 4061 <object class="sizeritem"> 4026 4062 <object class="wxRadioButton" name="ID_UL_RENAME"> 4027 <label> Rena&me</label>4063 <label>&q - Rename</label> 4028 4064 </object> 4029 4065 </object> 4030 4066 <object class="sizeritem"> 4031 4067 <object class="wxRadioButton" name="ID_UL_SKIP"> 4032 <label> Sk&ip</label>4068 <label>&r - Skip</label> 4033 4069 </object> 4034 4070 </object> 4035 4071 <cols>1</cols> … … 4105 4141 <object class="wxFlexGridSizer"> 4106 4142 <object class="sizeritem"> 4107 4143 <object class="wxRadioButton" name="ID_DL_ASK"> 4108 <label>& Ask for action</label>4144 <label>&b - Ask for action</label> 4109 4145 <style>wxRB_GROUP</style> 4110 4146 </object> 4111 4147 </object> 4112 4148 <object class="sizeritem"> 4113 4149 <object class="wxRadioButton" name="ID_DL_OVERWRITE"> 4114 <label>& Overwrite</label>4150 <label>&d - Overwrite</label> 4115 4151 </object> 4116 4152 </object> 4117 4153 <object class="sizeritem"> 4118 4154 <object class="wxRadioButton" name="ID_DL_OVERWRITEIFNEWER"> 4119 <label> Ov&erwrite if source newer</label>4155 <label>&e - Overwrite if source newer</label> 4120 4156 </object> 4121 4157 </object> 4122 4158 <object class="sizeritem"> 4159 <object class="wxRadioButton" name="ID_DL_OVERWRITESIZE"> 4160 <label>&f - Overwrite if different size</label> 4161 </object> 4162 </object> 4163 <object class="sizeritem"> 4164 <object class="wxRadioButton" name="ID_DL_OVERWRITESIZEORNEWER"> 4165 <label>&g - Overwrite if different size or source newer</label> 4166 </object> 4167 </object> 4168 <object class="sizeritem"> 4123 4169 <object class="wxRadioButton" name="ID_DL_RESUME"> 4124 <label>& Resume</label>4170 <label>&h - Resume</label> 4125 4171 </object> 4126 4172 </object> 4127 4173 <object class="sizeritem"> 4128 4174 <object class="wxRadioButton" name="ID_DL_RENAME"> 4129 <label> Re&name</label>4175 <label>&i - Rename</label> 4130 4176 </object> 4131 4177 </object> 4132 4178 <object class="sizeritem"> 4133 4179 <object class="wxRadioButton" name="ID_DL_SKIP"> 4134 <label> S&kip</label>4180 <label>&j - Skip</label> 4135 4181 </object> 4136 4182 </object> 4137 4183 <cols>1</cols> … … 4152 4198 <object class="wxFlexGridSizer"> 4153 4199 <object class="sizeritem"> 4154 4200 <object class="wxRadioButton" name="ID_UL_ASK"> 4155 <label> A&sk for action</label>4201 <label>&k - Ask for action</label> 4156 4202 <style>wxRB_GROUP</style> 4157 4203 </object> 4158 4204 </object> 4159 4205 <object class="sizeritem"> 4160 4206 <object class="wxRadioButton" name="ID_UL_OVERWRITE"> 4161 <label> O&verwrite</label>4207 <label>&l - Overwrite</label> 4162 4208 </object> 4163 4209 </object> 4164 4210 <object class="sizeritem"> 4165 4211 <object class="wxRadioButton" name="ID_UL_OVERWRITEIFNEWER"> 4166 <label> Over&write if source newer</label>4212 <label>&m - Overwrite if source newer</label> 4167 4213 </object> 4168 4214 </object> 4169 4215 <object class="sizeritem"> 4216 <object class="wxRadioButton" name="ID_UL_OVERWRITESIZE"> 4217 <label>&n - Overwrite if different size</label> 4218 </object> 4219 </object> 4220 <object class="sizeritem"> 4221 <object class="wxRadioButton" name="ID_UL_OVERWRITESIZEORNEWER"> 4222 <label>&o - Overwrite if different size or source newer</label> 4223 </object> 4224 </object> 4225 <object class="sizeritem"> 4170 4226 <object class="wxRadioButton" name="ID_UL_RESUME"> 4171 <label> Res&ume</label>4227 <label>&q - Resume</label> 4172 4228 </object> 4173 4229 </object> 4174 4230 <object class="sizeritem"> 4175 4231 <object class="wxRadioButton" name="ID_UL_RENAME"> 4176 <label> Rena&me</label>4232 <label>&r - Rename</label> 4177 4233 </object> 4178 4234 </object> 4179 4235 <object class="sizeritem"> 4180 4236 <object class="wxRadioButton" name="ID_UL_SKIP"> 4181 <label> Sk&ip</label>4237 <label>&s - Skip</label> 4182 4238 </object> 4183 4239 </object> 4184 4240 <cols>1</cols> … … 4212 4268 </object> 4213 4269 <object class="sizeritem"> 4214 4270 <object class="wxCheckBox" name="ID_ASCIIRESUME"> 4215 <label> A&llow resume of ASCII files</label>4271 <label>&Allow resume of ASCII files</label> 4216 4272 </object> 4217 4273 </object> 4218 4274 <object class="sizeritem"> -
src/interface/fileexistsdlg.cpp
3 3 4 4 #include <wx/display.h> 5 5 #include <wx/string.h> 6 #include "notification.h" 6 7 7 8 BEGIN_EVENT_TABLE(CFileExistsDlg, wxDialogEx) 8 9 EVT_BUTTON(XRCID("wxID_OK"), CFileExistsDlg::OnOK) … … 13 14 CFileExistsDlg::CFileExistsDlg(CFileExistsNotification *pNotification) 14 15 { 15 16 m_pNotification = pNotification; 16 m_pAction1 = m_pAction2 = m_pAction3 = m_pAction4 = m_pAction5 = 0;17 m_action = 0;17 m_pAction1 = m_pAction2 = m_pAction3 = m_pAction4 = m_pAction5 = m_pAction6 = m_pAction7 = 0; 18 m_action = CFileExistsNotification::ask; 18 19 m_always = false; 19 20 m_queueOnly = false; 20 21 m_directionOnly = false; … … 39 40 m_pAction3 = wxDynamicCast(FindWindow(XRCID("ID_ACTION3")), wxRadioButton); 40 41 m_pAction4 = wxDynamicCast(FindWindow(XRCID("ID_ACTION4")), wxRadioButton); 41 42 m_pAction5 = wxDynamicCast(FindWindow(XRCID("ID_ACTION5")), wxRadioButton); 43 m_pAction6 = wxDynamicCast(FindWindow(XRCID("ID_ACTION6")), wxRadioButton); 44 m_pAction7 = wxDynamicCast(FindWindow(XRCID("ID_ACTION7")), wxRadioButton); 42 45 43 46 wxString localFile = m_pNotification->localFile; 44 47 … … 255 258 void CFileExistsDlg::OnOK(wxCommandEvent& event) 256 259 { 257 260 if (m_pAction1 && m_pAction1->GetValue()) 258 m_action = 0;261 m_action = CFileExistsNotification::overwrite; 259 262 else if (m_pAction2 && m_pAction2->GetValue()) 260 m_action = 1;263 m_action = CFileExistsNotification::overwriteNewer; 261 264 else if (m_pAction3 && m_pAction3->GetValue()) 262 m_action = 2;265 m_action = CFileExistsNotification::resume; 263 266 else if (m_pAction4 && m_pAction4->GetValue()) 264 m_action = 3;267 m_action = CFileExistsNotification::rename; 265 268 else if (m_pAction5 && m_pAction5->GetValue()) 266 m_action = 4; 269 m_action = CFileExistsNotification::skip; 270 else if (m_pAction6 && m_pAction6->GetValue()) 271 m_action = CFileExistsNotification::overwriteSizeOrNewer; 272 else if (m_pAction7 && m_pAction7->GetValue()) 273 m_action = CFileExistsNotification::overwriteSize; 267 274 else 268 m_action = 0;275 m_action = CFileExistsNotification::overwrite; 269 276 270 277 m_always = XRCCTRL(*this, "ID_ALWAYS", wxCheckBox)->GetValue(); 271 278 m_directionOnly = XRCCTRL(*this, "ID_UPDOWNONLY", wxCheckBox)->GetValue(); … … 273 280 EndModal(wxID_OK); 274 281 } 275 282 276 intCFileExistsDlg::GetAction() const283 enum CFileExistsNotification::OverwriteAction CFileExistsDlg::GetAction() const 277 284 { 278 285 return m_action; 279 286 } 280 287 281 288 void CFileExistsDlg::OnCancel(wxCommandEvent& event) 282 289 { 283 m_action = 4;290 m_action = CFileExistsNotification::skip; 284 291 EndModal(wxID_CANCEL); 285 292 } 286 293 -
src/interface/fileexistsdlg.h
2 2 #define __FILEEXISTSDLG_H__ 3 3 4 4 #include "dialogex.h" 5 #include "notification.h" 5 6 6 7 class CFileExistsDlg: public wxDialogEx 7 8 { … … 17 18 /// Creates the controls and sizers 18 19 void CreateControls(); 19 20 20 intGetAction() const;21 enum CFileExistsNotification::OverwriteAction GetAction() const; 21 22 bool Always(bool &directionOnly, bool &queueOnly) const; 22 23 23 24 protected: … … 29 30 wxString GetPathEllipsis(wxString path, wxWindow *window); 30 31 31 32 CFileExistsNotification *m_pNotification; 32 wxRadioButton *m_pAction1, *m_pAction2, *m_pAction3, *m_pAction4, *m_pAction5 ;33 intm_action;33 wxRadioButton *m_pAction1, *m_pAction2, *m_pAction3, *m_pAction4, *m_pAction5, *m_pAction6, *m_pAction7; 34 enum CFileExistsNotification::OverwriteAction m_action; 34 35 bool m_always; 35 36 bool m_directionOnly; 36 37 bool m_queueOnly; -
src/interface/optionspage_fileexists.cpp
3 3 #include "settingsdialog.h" 4 4 #include "optionspage.h" 5 5 #include "optionspage_fileexists.h" 6 #include "notification.h" 6 7 7 8 bool COptionsPageFileExists::LoadPage() 8 9 { 9 10 bool failure = false; 10 11 11 const int dlAction = m_pOptions->GetOptionVal(OPTION_FILEEXISTS_DOWNLOAD);12 const enum CFileExistsNotification::OverwriteAction dlAction = (enum CFileExistsNotification::OverwriteAction)(m_pOptions->GetOptionVal(OPTION_FILEEXISTS_DOWNLOAD)); 12 13 switch (dlAction) 13 14 { 14 case 1:15 case CFileExistsNotification::overwrite: 15 16 SetRCheck(XRCID("ID_DL_OVERWRITE"), true, failure); 16 17 break; 17 case 2:18 case CFileExistsNotification::overwriteNewer: 18 19 SetRCheck(XRCID("ID_DL_OVERWRITEIFNEWER"), true, failure); 19 20 break; 20 case 3: 21 case CFileExistsNotification::overwriteSize: 22 SetRCheck(XRCID("ID_DL_OVERWRITESIZE"), true, failure); 23 break; 24 case CFileExistsNotification::overwriteSizeOrNewer: 25 SetRCheck(XRCID("ID_DL_OVERWRITESIZEORNEWER"), true, failure); 26 break; 27 case CFileExistsNotification::resume: 21 28 SetRCheck(XRCID("ID_DL_RESUME"), true, failure); 22 29 break; 23 case 4:30 case CFileExistsNotification::rename: 24 31 SetRCheck(XRCID("ID_DL_RENAME"), true, failure); 25 32 break; 26 case 5:33 case CFileExistsNotification::skip: 27 34 SetRCheck(XRCID("ID_DL_SKIP"), true, failure); 28 35 break; 29 36 default: … … 31 38 break; 32 39 }; 33 40 34 const int ulAction = m_pOptions->GetOptionVal(OPTION_FILEEXISTS_UPLOAD);41 const enum CFileExistsNotification::OverwriteAction ulAction = (enum CFileExistsNotification::OverwriteAction)(m_pOptions->GetOptionVal(OPTION_FILEEXISTS_UPLOAD)); 35 42 switch (ulAction) 36 43 { 37 case 1:44 case CFileExistsNotification::overwrite: 38 45 SetRCheck(XRCID("ID_UL_OVERWRITE"), true, failure); 39 46 break; 40 case 2:47 case CFileExistsNotification::overwriteNewer: 41 48 SetRCheck(XRCID("ID_UL_OVERWRITEIFNEWER"), true, failure); 42 49 break; 43 case 3: 50 case CFileExistsNotification::overwriteSize: 51 SetRCheck(XRCID("ID_UL_OVERWRITESIZE"), true, failure); 52 break; 53 case CFileExistsNotification::overwriteSizeOrNewer: 54 SetRCheck(XRCID("ID_UL_OVERWRITESIZEORNEWER"), true, failure); 55 break; 56 case CFileExistsNotification::resume: 44 57 SetRCheck(XRCID("ID_UL_RESUME"), true, failure); 45 58 break; 46 case 4:59 case CFileExistsNotification::rename: 47 60 SetRCheck(XRCID("ID_UL_RENAME"), true, failure); 48 61 break; 49 case 5:62 case CFileExistsNotification::skip: 50 63 SetRCheck(XRCID("ID_UL_SKIP"), true, failure); 51 64 break; 52 65 default: … … 61 74 62 75 bool COptionsPageFileExists::SavePage() 63 76 { 64 intvalue;77 enum CFileExistsNotification::OverwriteAction value; 65 78 if (GetRCheck(XRCID("ID_DL_OVERWRITE"))) 66 value = 1;79 value = CFileExistsNotification::overwrite; 67 80 else if (GetRCheck(XRCID("ID_DL_OVERWRITEIFNEWER"))) 68 value = 2; 81 value = CFileExistsNotification::overwriteNewer; 82 else if (GetRCheck(XRCID("ID_DL_OVERWRITESIZE"))) 83 value = CFileExistsNotification::overwriteSize; 84 else if (GetRCheck(XRCID("ID_DL_OVERWRITESIZEORNEWER"))) 85 value = CFileExistsNotification::overwriteSizeOrNewer; 69 86 else if (GetRCheck(XRCID("ID_DL_RESUME"))) 70 value = 3;87 value = CFileExistsNotification::resume; 71 88 else if (GetRCheck(XRCID("ID_DL_RENAME"))) 72 value = 4;89 value = CFileExistsNotification::rename; 73 90 else if (GetRCheck(XRCID("ID_DL_SKIP"))) 74 value = 5;91 value = CFileExistsNotification::skip; 75 92 else 76 value = 0;93 value = CFileExistsNotification::ask; 77 94 m_pOptions->SetOption(OPTION_FILEEXISTS_DOWNLOAD, value); 78 95 79 96 if (GetRCheck(XRCID("ID_UL_OVERWRITE"))) 80 value = 1;97 value = CFileExistsNotification::overwrite; 81 98 else if (GetRCheck(XRCID("ID_UL_OVERWRITEIFNEWER"))) 82 value = 2; 99 value = CFileExistsNotification::overwriteNewer; 100 else if (GetRCheck(XRCID("ID_UL_OVERWRITESIZE"))) 101 value = CFileExistsNotification::overwriteSize; 102 else if (GetRCheck(XRCID("ID_UL_OVERWRITESIZEORNEWER"))) 103 value = CFileExistsNotification::overwriteSizeOrNewer; 83 104 else if (GetRCheck(XRCID("ID_UL_RESUME"))) 84 value = 3;105 value = CFileExistsNotification::resume; 85 106 else if (GetRCheck(XRCID("ID_UL_RENAME"))) 86 value = 4;107 value = CFileExistsNotification::rename; 87 108 else if (GetRCheck(XRCID("ID_UL_SKIP"))) 88 value = 5;109 value = CFileExistsNotification::skip; 89 110 else 90 value = 0;111 value = CFileExistsNotification::ask; 91 112 m_pOptions->SetOption(OPTION_FILEEXISTS_UPLOAD, value); 92 113 93 114 m_pOptions->SetOption(OPTION_ASCIIRESUME, GetCheck(XRCID("ID_ASCIIRESUME"))); -
src/interface/asyncrequestqueue.cpp
38 38 39 39 // Get the action, go up the hierarchy till one is found 40 40 int action = pFileExistsNotification->overwriteAction; 41 if (action == -1)41 if (action == CFileExistsNotification::unknown) 42 42 action = CDefaultFileExistsDlg::GetDefault(pFileExistsNotification->download); 43 if (action == -1)43 if (action == CFileExistsNotification::unknown) 44 44 action = COptions::Get()->GetOptionVal(pFileExistsNotification->download ? OPTION_FILEEXISTS_DOWNLOAD : OPTION_FILEEXISTS_UPLOAD); 45 45 46 46 // Ask and rename options require user interaction 47 if ( !action || action == 4)47 if (action == CFileExistsNotification::ask || action == CFileExistsNotification::rename) 48 48 break; 49 49 50 if (action == 3&& pFileExistsNotification->ascii)50 if (action == CFileExistsNotification::resume && pFileExistsNotification->ascii) 51 51 { 52 52 // Check if resuming ascii files is allowed 53 53 if (!COptions::Get()->GetOptionVal(OPTION_ASCIIRESUME)) 54 54 // Overwrite instead 55 action = 1;55 action = CFileExistsNotification::overwrite; 56 56 } 57 57 58 58 pFileExistsNotification->overwriteAction = (enum CFileExistsNotification::OverwriteAction)action; … … 124 124 CFileExistsNotification *pNotification = reinterpret_cast<CFileExistsNotification *>(entry.pNotification); 125 125 126 126 // Get the action, go up the hierarchy till one is found 127 intaction = pNotification->overwriteAction;128 if (action == -1)127 enum CFileExistsNotification::OverwriteAction action = pNotification->overwriteAction; 128 if (action == CFileExistsNotification::unknown) 129 129 action = CDefaultFileExistsDlg::GetDefault(pNotification->download); 130 if (action == -1)131 action = COptions::Get()->GetOptionVal(pNotification->download ? OPTION_FILEEXISTS_DOWNLOAD : OPTION_FILEEXISTS_UPLOAD);130 if (action == CFileExistsNotification::unknown) 131 action = (enum CFileExistsNotification::OverwriteAction)(COptions::Get()->GetOptionVal(pNotification->download ? OPTION_FILEEXISTS_DOWNLOAD : OPTION_FILEEXISTS_UPLOAD)); 132 132 133 if ( !action)133 if (action == CFileExistsNotification::ask) 134 134 { 135 135 CFileExistsDlg dlg(pNotification); 136 136 dlg.Create(m_pMainFrame); … … 138 138 139 139 if (res == wxID_OK) 140 140 { 141 action = dlg.GetAction() + 1;141 action = dlg.GetAction(); 142 142 143 143 bool directionOnly, queueOnly; 144 144 if (dlg.Always(directionOnly, queueOnly)) … … 182 182 } 183 183 } 184 184 else 185 action = 5;185 action = CFileExistsNotification::skip; 186 186 } 187 187 188 if (action < 1|| action >= CFileExistsNotification::ACTION_COUNT)188 if (action == CFileExistsNotification::unknown || action == CFileExistsNotification::ask || action >= CFileExistsNotification::ACTION_COUNT) 189 189 action = CFileExistsNotification::skip; 190 190 191 191 if (action == CFileExistsNotification::resume && pNotification->ascii) … … 193 193 // Check if resuming ascii files is allowed 194 194 if (!COptions::Get()->GetOptionVal(OPTION_ASCIIRESUME)) 195 195 // Overwrite instead 196 action = 1;196 action = CFileExistsNotification::overwrite; 197 197 } 198 198 199 199 switch (action) -
src/interface/QueueView.cpp
2251 2251 if (!dlg.Load(this, true)) 2252 2252 return; 2253 2253 2254 intdownloadAction, uploadAction;2254 enum CFileExistsNotification::OverwriteAction downloadAction, uploadAction; 2255 2255 if (!dlg.Run(&downloadAction, &uploadAction)) 2256 2256 return; 2257 2257 -
src/include/notification.h
153 153 ask, 154 154 overwrite, 155 155 overwriteNewer, // Overwrite if source file is newer than target file 156 overwriteSize, // Overwrite if source file is is different in size than target file 157 overwriteSizeOrNewer, // Overwrite if source file is different in size or newer than target file 156 158 resume, // Overwrites if cannot be resumed 157 159 rename, 158 160 skip, -
src/engine/sftpcontrolsocket.cpp
793 793 ResetOperation(FZ_REPLY_OK); 794 794 } 795 795 break; 796 case CFileExistsNotification::overwriteSize: 797 if (pFileExistsNotification->localSize != pFileExistsNotification->remoteSize) 798 SendNextCommand(); 799 else 800 { 801 if (pData->download) 802 { 803 wxString filename = pData->remotePath.FormatFilename(pData->remoteFile); 804 LogMessage(Status, _("Skipping download of %s"), filename.c_str()); 805 } 806 else 807 { 808 LogMessage(Status, _("Skipping upload of %s"), pData->localFile.c_str()); 809 } 810 ResetOperation(FZ_REPLY_OK); 811 } 812 break; 813 case CFileExistsNotification::overwriteSizeOrNewer: 814 if (!pFileExistsNotification->localTime.IsValid() || !pFileExistsNotification->remoteTime.IsValid()) 815 SendNextCommand(); 816 else if (pFileExistsNotification->localSize != pFileExistsNotification->remoteSize) 817 SendNextCommand(); 818 else if (pFileExistsNotification->download && pFileExistsNotification->localTime.IsEarlierThan(pFileExistsNotification->remoteTime)) 819 SendNextCommand(); 820 else if (!pFileExistsNotification->download && pFileExistsNotification->localTime.IsLaterThan(pFileExistsNotification->remoteTime)) 821 SendNextCommand(); 822 else 823 { 824 if (pData->download) 825 { 826 wxString filename = pData->remotePath.FormatFilename(pData->remoteFile); 827 LogMessage(Status, _("Skipping download of %s"), filename.c_str()); 828 } 829 else 830 { 831 LogMessage(Status, _("Skipping upload of %s"), pData->localFile.c_str()); 832 } 833 ResetOperation(FZ_REPLY_OK); 834 } 835 break; 796 836 case CFileExistsNotification::resume: 797 837 if (pData->download && pFileExistsNotification->localSize != -1) 798 838 pData->resume = true; -
src/engine/httpcontrolsocket.cpp
215 215 ResetOperation(FZ_REPLY_OK); 216 216 } 217 217 break; 218 case CFileExistsNotification::overwriteSize: 219 if (pFileExistsNotification->localSize != pFileExistsNotification->remoteSize) 220 SendNextCommand(); 221 else 222 { 223 if (pData->download) 224 { 225 wxString filename = pData->remotePath.FormatFilename(pData->remoteFile); 226 LogMessage(Status, _("Skipping download of %s"), filename.c_str()); 227 } 228 else 229 { 230 LogMessage(Status, _("Skipping upload of %s"), pData->localFile.c_str()); 231 } 232 ResetOperation(FZ_REPLY_OK); 233 } 234 break; 235 case CFileExistsNotification::overwriteSizeOrNewer: 236 if (!pFileExistsNotification->localTime.IsValid() || !pFileExistsNotification->remoteTime.IsValid()) 237 SendNextCommand(); 238 else if (pFileExistsNotification->localSize != pFileExistsNotification->remoteSize) 239 SendNextCommand(); 240 else if (pFileExistsNotification->download && pFileExistsNotification->localTime.IsEarlierThan(pFileExistsNotification->remoteTime)) 241 SendNextCommand(); 242 else if (!pFileExistsNotification->download && pFileExistsNotification->localTime.IsLaterThan(pFileExistsNotification->remoteTime)) 243 SendNextCommand(); 244 else 245 { 246 if (pData->download) 247 { 248 wxString filename = pData->remotePath.FormatFilename(pData->remoteFile); 249 LogMessage(Status, _("Skipping download of %s"), filename.c_str()); 250 } 251 else 252 { 253 LogMessage(Status, _("Skipping upload of %s"), pData->localFile.c_str()); 254 } 255 ResetOperation(FZ_REPLY_OK); 256 } 257 break; 218 258 case CFileExistsNotification::resume: 219 259 ResetOperation(FZ_REPLY_CRITICALERROR | FZ_REPLY_NOTSUPPORTED); 220 260 break; -
src/engine/ftpcontrolsocket.cpp
2726 2726 ResetOperation(FZ_REPLY_OK); 2727 2727 } 2728 2728 break; 2729 case CFileExistsNotification::overwriteSize: 2730 if (pFileExistsNotification->localSize != pFileExistsNotification->remoteSize) 2731 SendNextCommand(); 2732 else 2733 { 2734 if (pData->download) 2735 { 2736 wxString filename = pData->remotePath.FormatFilename(pData->remoteFile); 2737 LogMessage(Status, _("Skipping download of %s"), filename.c_str()); 2738 } 2739 else 2740 { 2741 LogMessage(Status, _("Skipping upload of %s"), pData->localFile.c_str()); 2742 } 2743 ResetOperation(FZ_REPLY_OK); 2744 } 2745 break; 2746 case CFileExistsNotification::overwriteSizeOrNewer: 2747 if (!pFileExistsNotification->localTime.IsValid() || !pFileExistsNotification->remoteTime.IsValid()) 2748 SendNextCommand(); 2749 else if (pFileExistsNotification->localSize != pFileExistsNotification->remoteSize) 2750 SendNextCommand(); 2751 else if (pFileExistsNotification->download && pFileExistsNotification->localTime.IsEarlierThan(pFileExistsNotification->remoteTime)) 2752 SendNextCommand(); 2753 else if (!pFileExistsNotification->download && pFileExistsNotification->localTime.IsLaterThan(pFileExistsNotification->remoteTime)) 2754 SendNextCommand(); 2755 else 2756 { 2757 if (pData->download) 2758 { 2759 wxString filename = pData->remotePath.FormatFilename(pData->remoteFile); 2760 LogMessage(Status, _("Skipping download of %s"), filename.c_str()); 2761 } 2762 else 2763 { 2764 LogMessage(Status, _("Skipping upload of %s"), pData->localFile.c_str()); 2765 } 2766 ResetOperation(FZ_REPLY_OK); 2767 } 2768 break; 2729 2769 case CFileExistsNotification::resume: 2730 2770 if (pData->download && pData->localFileSize != -1) 2731 2771 pData->resume = true;