-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index e770304..6abdc85 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp | |||
@@ -153,99 +153,99 @@ void AdvancedFm::doDelete() { | |||
153 | { | 153 | { |
154 | case 0: | 154 | case 0: |
155 | doMsg=false; | 155 | doMsg=false; |
156 | break; | 156 | break; |
157 | case 1: | 157 | case 1: |
158 | return; | 158 | return; |
159 | break; | 159 | break; |
160 | default: | 160 | default: |
161 | return; | 161 | return; |
162 | break; | 162 | break; |
163 | }; | 163 | }; |
164 | } | 164 | } |
165 | 165 | ||
166 | QString myFile; | 166 | QString myFile; |
167 | 167 | ||
168 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 168 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
169 | myFile = (*it); | 169 | myFile = (*it); |
170 | if( myFile.find(" -> ",0,TRUE) != -1) | 170 | if( myFile.find(" -> ",0,TRUE) != -1) |
171 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); | 171 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); |
172 | 172 | ||
173 | QString f = CurrentDir()->canonicalPath(); | 173 | QString f = CurrentDir()->canonicalPath(); |
174 | if(f.right(1).find("/",0,TRUE) == -1) | 174 | if(f.right(1).find("/",0,TRUE) == -1) |
175 | f += "/"; | 175 | f += "/"; |
176 | f += myFile; | 176 | f += myFile; |
177 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 177 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
178 | //if file is a directory | 178 | //if file is a directory |
179 | 179 | ||
180 | switch ( QMessageBox::warning( this, tr("Delete Directory?"), | 180 | switch ( QMessageBox::warning( this, tr("Delete Directory?"), |
181 | tr("<p>Really delete %1 and all it's contents?</p>" ).arg( f ) , | 181 | tr("<p>Really delete %1 and all it's contents?</p>" ).arg( f ) , |
182 | tr("Yes"), tr("No"), 0, 0, 1) ) { | 182 | tr("Yes"), tr("No"), 0, 0, 1) ) { |
183 | case 0: | 183 | case 0: |
184 | { | 184 | { |
185 | f=f.left(f.length()-1); | 185 | f=f.left(f.length()-1); |
186 | QString cmd="rm -rf "+f; | 186 | QString cmd="rm -rf "+f; |
187 | startProcess( (const QString)cmd.latin1() ); | 187 | startProcess( (const QString)cmd.latin1() ); |
188 | populateView(); | 188 | populateView(); |
189 | } | 189 | } |
190 | break; | 190 | break; |
191 | case 1: | 191 | case 1: |
192 | // exit | 192 | // exit |
193 | break; | 193 | break; |
194 | default: | 194 | default: |
195 | break; | 195 | break; |
196 | }; | 196 | }; |
197 | 197 | ||
198 | } else { | 198 | } else { |
199 | if(doMsg) { | 199 | if(doMsg) { |
200 | switch ( QMessageBox::warning(this,tr("Delete"), | 200 | switch ( QMessageBox::warning(this,tr("Delete"), |
201 | tr("<p>Really delete %1?</p>").arg( myFile ), | 201 | tr("<p>Really delete %1?</p>").arg( myFile ), |
202 | tr("Yes"), tr("No"), 0, 0, 1) ) { | 202 | tr("Yes"), tr("No"), 0, 0, 1) ) { |
203 | case 0; | 203 | case 0: |
204 | break; | 204 | break; |
205 | case 1: | 205 | case 1: |
206 | return; | 206 | return; |
207 | break; | 207 | break; |
208 | default: | 208 | default: |
209 | return; | 209 | return; |
210 | break; | 210 | break; |
211 | }; | 211 | }; |
212 | } | 212 | } |
213 | 213 | ||
214 | QString cmd="rm "+f; | 214 | QString cmd="rm "+f; |
215 | QFile file(f); | 215 | QFile file(f); |
216 | QFileInfo fi(myFile); | 216 | QFileInfo fi(myFile); |
217 | if( fi.fileName().find("../",0,TRUE)==-1) { | 217 | if( fi.fileName().find("../",0,TRUE)==-1) { |
218 | // odebug << "remove link files "+myFile << oendl; | 218 | // odebug << "remove link files "+myFile << oendl; |
219 | 219 | ||
220 | // DocLnk lnk(f); | 220 | // DocLnk lnk(f); |
221 | DocLnk *lnk; | 221 | DocLnk *lnk; |
222 | lnk = new DocLnk(f); | 222 | lnk = new DocLnk(f); |
223 | // odebug << "Deleting doclnk " + lnk->linkFile() << oendl; | 223 | // odebug << "Deleting doclnk " + lnk->linkFile() << oendl; |
224 | if(lnk->isValid()) | 224 | if(lnk->isValid()) |
225 | lnk->removeLinkFile(); | 225 | lnk->removeLinkFile(); |
226 | // delete lnk; | 226 | // delete lnk; |
227 | file.remove(); | 227 | file.remove(); |
228 | } | 228 | } |
229 | } | 229 | } |
230 | } | 230 | } |
231 | } | 231 | } |
232 | populateView(); | 232 | populateView(); |
233 | } | 233 | } |
234 | 234 | ||
235 | void AdvancedFm::filePerms() { | 235 | void AdvancedFm::filePerms() { |
236 | QStringList curFileList = getPath(); | 236 | QStringList curFileList = getPath(); |
237 | QString filePath; | 237 | QString filePath; |
238 | 238 | ||
239 | filePath = CurrentDir()->canonicalPath()+"/"; | 239 | filePath = CurrentDir()->canonicalPath()+"/"; |
240 | 240 | ||
241 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 241 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
242 | filePermissions *filePerm; | 242 | filePermissions *filePerm; |
243 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); | 243 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); |
244 | QPEApplication::execDialog( filePerm ); | 244 | QPEApplication::execDialog( filePerm ); |
245 | if( filePerm ) | 245 | if( filePerm ) |
246 | delete filePerm; | 246 | delete filePerm; |
247 | } | 247 | } |
248 | populateView(); | 248 | populateView(); |
249 | } | 249 | } |
250 | 250 | ||
251 | void AdvancedFm::doProperties() { | 251 | void AdvancedFm::doProperties() { |
@@ -279,97 +279,97 @@ void AdvancedFm::copyTimer() { | |||
279 | QTimer::singleShot(125,this,SLOT(copy())); | 279 | QTimer::singleShot(125,this,SLOT(copy())); |
280 | } | 280 | } |
281 | 281 | ||
282 | void AdvancedFm::copy() { | 282 | void AdvancedFm::copy() { |
283 | QStringList curFileList = getPath(); | 283 | QStringList curFileList = getPath(); |
284 | 284 | ||
285 | QDir *thisDir = CurrentDir(); | 285 | QDir *thisDir = CurrentDir(); |
286 | QDir *thatDir = OtherDir(); | 286 | QDir *thatDir = OtherDir(); |
287 | 287 | ||
288 | bool doMsg = true; | 288 | bool doMsg = true; |
289 | int count = curFileList.count(); | 289 | int count = curFileList.count(); |
290 | if( count > 0) { | 290 | if( count > 0) { |
291 | if(count > 1 ){ | 291 | if(count > 1 ){ |
292 | QString msg; | 292 | QString msg; |
293 | msg=tr("<p>Really copy %1 files?</p>").arg(count); | 293 | msg=tr("<p>Really copy %1 files?</p>").arg(count); |
294 | switch ( QMessageBox::warning(this,tr("Copy"),msg | 294 | switch ( QMessageBox::warning(this,tr("Copy"),msg |
295 | ,tr("Yes"),tr("No"),0,0,1) ) | 295 | ,tr("Yes"),tr("No"),0,0,1) ) |
296 | { | 296 | { |
297 | case 0: | 297 | case 0: |
298 | doMsg=false; | 298 | doMsg=false; |
299 | break; | 299 | break; |
300 | case 1: | 300 | case 1: |
301 | return; | 301 | return; |
302 | break; | 302 | break; |
303 | default: | 303 | default: |
304 | return; | 304 | return; |
305 | break; | 305 | break; |
306 | }; | 306 | }; |
307 | } | 307 | } |
308 | 308 | ||
309 | QString curFile, item, destFile; | 309 | QString curFile, item, destFile; |
310 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 310 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
311 | item=(*it); | 311 | item=(*it); |
312 | if(item.find("->",0,TRUE)) //symlink | 312 | if(item.find("->",0,TRUE)) //symlink |
313 | item = item.left(item.find("->",0,TRUE)); | 313 | item = item.left(item.find("->",0,TRUE)); |
314 | 314 | ||
315 | curFile = thisDir->canonicalPath()+"/"+ item; | 315 | curFile = thisDir->canonicalPath()+"/"+ item; |
316 | destFile = thatDir->canonicalPath()+"/"+ item; | 316 | destFile = thatDir->canonicalPath()+"/"+ item; |
317 | 317 | ||
318 | // odebug << "Destination file is "+destFile << oendl; | 318 | // odebug << "Destination file is "+destFile << oendl; |
319 | // odebug << "CurrentFile file is " + curFile << oendl; | 319 | // odebug << "CurrentFile file is " + curFile << oendl; |
320 | 320 | ||
321 | QFile f(destFile); | 321 | QFile f(destFile); |
322 | if( f.exists()) { | 322 | if( f.exists()) { |
323 | if(doMsg) { | 323 | if(doMsg) { |
324 | switch ( QMessageBox::warning(this,tr("File Exists!"), | 324 | switch ( QMessageBox::warning(this,tr("File Exists!"), |
325 | tr("<p>%1 already exists. Ok to overwrite?</P>").arg(item), | 325 | tr("<p>%1 already exists. Ok to overwrite?</P>").arg(item), |
326 | tr("Yes"),tr("No"),0,0,1)) { | 326 | tr("Yes"),tr("No"),0,0,1)) { |
327 | case 0; | 327 | case 0: |
328 | break; | 328 | break; |
329 | case 1: | 329 | case 1: |
330 | return; | 330 | return; |
331 | break; | 331 | break; |
332 | default: | 332 | default: |
333 | return; | 333 | return; |
334 | break; | 334 | break; |
335 | }; | 335 | }; |
336 | } | 336 | } |
337 | f.remove(); | 337 | f.remove(); |
338 | } | 338 | } |
339 | 339 | ||
340 | if( !copyFile( curFile, destFile) ) { | 340 | if( !copyFile( curFile, destFile) ) { |
341 | QMessageBox::message("AdvancedFm", | 341 | QMessageBox::message("AdvancedFm", |
342 | tr( "<P>Could not copy %1 to %2</P>").arg(curFile).arg(destFile)); | 342 | tr( "<P>Could not copy %1 to %2</P>").arg(curFile).arg(destFile)); |
343 | return; | 343 | return; |
344 | } | 344 | } |
345 | } | 345 | } |
346 | rePopulate(); | 346 | rePopulate(); |
347 | } | 347 | } |
348 | } | 348 | } |
349 | 349 | ||
350 | void AdvancedFm::copyAsTimer() { | 350 | void AdvancedFm::copyAsTimer() { |
351 | QTimer::singleShot(125,this,SLOT(copyAs())); | 351 | QTimer::singleShot(125,this,SLOT(copyAs())); |
352 | } | 352 | } |
353 | 353 | ||
354 | void AdvancedFm::copyAs() { | 354 | void AdvancedFm::copyAs() { |
355 | 355 | ||
356 | QStringList curFileList = getPath(); | 356 | QStringList curFileList = getPath(); |
357 | QString curFile, item; | 357 | QString curFile, item; |
358 | InputDialog *fileDlg; | 358 | InputDialog *fileDlg; |
359 | 359 | ||
360 | QDir *thisDir = CurrentDir(); | 360 | QDir *thisDir = CurrentDir(); |
361 | QDir *thatDir = OtherDir(); | 361 | QDir *thatDir = OtherDir(); |
362 | 362 | ||
363 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 363 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
364 | QString destFile; | 364 | QString destFile; |
365 | item=(*it); | 365 | item=(*it); |
366 | curFile = thisDir->canonicalPath()+"/"+(*it); | 366 | curFile = thisDir->canonicalPath()+"/"+(*it); |
367 | fileDlg = new InputDialog( this, tr("Copy %1 As").arg(curFile), TRUE, 0); | 367 | fileDlg = new InputDialog( this, tr("Copy %1 As").arg(curFile), TRUE, 0); |
368 | 368 | ||
369 | fileDlg->setInputText((const QString &) destFile ); | 369 | fileDlg->setInputText((const QString &) destFile ); |
370 | fileDlg->exec(); | 370 | fileDlg->exec(); |
371 | 371 | ||
372 | if( fileDlg->result() == 1 ) { | 372 | if( fileDlg->result() == 1 ) { |
373 | QString filename = fileDlg->LineEdit1->text(); | 373 | QString filename = fileDlg->LineEdit1->text(); |
374 | destFile = thatDir->canonicalPath()+"/"+filename; | 374 | destFile = thatDir->canonicalPath()+"/"+filename; |
375 | 375 | ||