summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2004-10-13 22:09:54 (UTC)
committer llornkcor <llornkcor>2004-10-13 22:09:54 (UTC)
commit9cc9ed1e746477c59b1fd3d572cdce052f0ccf85 (patch) (unidiff)
tree1ee7d27ca3292c4f1dbef01fcb22b4b24c0a6fa2
parent1f59ac9b59393b46a7ae5d4e1a46e1c1aaf05b23 (diff)
downloadopie-9cc9ed1e746477c59b1fd3d572cdce052f0ccf85.zip
opie-9cc9ed1e746477c59b1fd3d572cdce052f0ccf85.tar.gz
opie-9cc9ed1e746477c59b1fd3d572cdce052f0ccf85.tar.bz2
add proper case handling
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp29
1 files changed, 16 insertions, 13 deletions
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp
index 8b98898..e770304 100644
--- a/noncore/apps/advancedfm/advancedfmMenu.cpp
+++ b/noncore/apps/advancedfm/advancedfmMenu.cpp
@@ -167,76 +167,78 @@ void AdvancedFm::doDelete() {
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 1: 203 case 0;
204 return; 204 break;
205 break; 205 case 1:
206 default: 206 return;
207 return; 207 break;
208 break; 208 default:
209 }; 209 return;
210 } 210 break;
211 };
212 }
211 213
212 QString cmd="rm "+f; 214 QString cmd="rm "+f;
213 QFile file(f); 215 QFile file(f);
214 QFileInfo fi(myFile); 216 QFileInfo fi(myFile);
215 if( fi.fileName().find("../",0,TRUE)==-1) { 217 if( fi.fileName().find("../",0,TRUE)==-1) {
216// odebug << "remove link files "+myFile << oendl; 218// odebug << "remove link files "+myFile << oendl;
217 219
218// DocLnk lnk(f); 220// DocLnk lnk(f);
219 DocLnk *lnk; 221 DocLnk *lnk;
220 lnk = new DocLnk(f); 222 lnk = new DocLnk(f);
221// odebug << "Deleting doclnk " + lnk->linkFile() << oendl; 223// odebug << "Deleting doclnk " + lnk->linkFile() << oendl;
222 if(lnk->isValid()) 224 if(lnk->isValid())
223 lnk->removeLinkFile(); 225 lnk->removeLinkFile();
224 // delete lnk; 226 // delete lnk;
225 file.remove(); 227 file.remove();
226 } 228 }
227 } 229 }
228 } 230 }
229 } 231 }
230 populateView(); 232 populateView();
231} 233}
232 234
233void AdvancedFm::filePerms() { 235void AdvancedFm::filePerms() {
234 QStringList curFileList = getPath(); 236 QStringList curFileList = getPath();
235 QString filePath; 237 QString filePath;
236 238
237 filePath = CurrentDir()->canonicalPath()+"/"; 239 filePath = CurrentDir()->canonicalPath()+"/";
238 240
239 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 241 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
240 filePermissions *filePerm; 242 filePermissions *filePerm;
241 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); 243 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it));
242 QPEApplication::execDialog( filePerm ); 244 QPEApplication::execDialog( filePerm );
@@ -293,64 +295,66 @@ void AdvancedFm::copy() {
293 ,tr("Yes"),tr("No"),0,0,1) ) 295 ,tr("Yes"),tr("No"),0,0,1) )
294 { 296 {
295 case 0: 297 case 0:
296 doMsg=false; 298 doMsg=false;
297 break; 299 break;
298 case 1: 300 case 1:
299 return; 301 return;
300 break; 302 break;
301 default: 303 default:
302 return; 304 return;
303 break; 305 break;
304 }; 306 };
305 } 307 }
306 308
307 QString curFile, item, destFile; 309 QString curFile, item, destFile;
308 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 310 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
309 item=(*it); 311 item=(*it);
310 if(item.find("->",0,TRUE)) //symlink 312 if(item.find("->",0,TRUE)) //symlink
311 item = item.left(item.find("->",0,TRUE)); 313 item = item.left(item.find("->",0,TRUE));
312 314
313 curFile = thisDir->canonicalPath()+"/"+ item; 315 curFile = thisDir->canonicalPath()+"/"+ item;
314 destFile = thatDir->canonicalPath()+"/"+ item; 316 destFile = thatDir->canonicalPath()+"/"+ item;
315 317
316// odebug << "Destination file is "+destFile << oendl; 318// odebug << "Destination file is "+destFile << oendl;
317// odebug << "CurrentFile file is " + curFile << oendl; 319// odebug << "CurrentFile file is " + curFile << oendl;
318 320
319 QFile f(destFile); 321 QFile f(destFile);
320 if( f.exists()) { 322 if( f.exists()) {
321 if(doMsg) { 323 if(doMsg) {
322 switch ( QMessageBox::warning(this,tr("File Exists!"), 324 switch ( QMessageBox::warning(this,tr("File Exists!"),
323 tr("<p>%1 already exists. Ok to overwrite?</P>").arg(item), 325 tr("<p>%1 already exists. Ok to overwrite?</P>").arg(item),
324 tr("Yes"),tr("No"),0,0,1)) { 326 tr("Yes"),tr("No"),0,0,1)) {
327 case 0;
328 break;
325 case 1: 329 case 1:
326 return; 330 return;
327 break; 331 break;
328 default: 332 default:
329 return; 333 return;
330 break; 334 break;
331 }; 335 };
332 } 336 }
333 f.remove(); 337 f.remove();
334 } 338 }
335 339
336 if( !copyFile( curFile, destFile) ) { 340 if( !copyFile( curFile, destFile) ) {
337 QMessageBox::message("AdvancedFm", 341 QMessageBox::message("AdvancedFm",
338 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));
339 return; 343 return;
340 } 344 }
341 } 345 }
342 rePopulate(); 346 rePopulate();
343 } 347 }
344} 348}
345 349
346void AdvancedFm::copyAsTimer() { 350void AdvancedFm::copyAsTimer() {
347 QTimer::singleShot(125,this,SLOT(copyAs())); 351 QTimer::singleShot(125,this,SLOT(copyAs()));
348} 352}
349 353
350void AdvancedFm::copyAs() { 354void AdvancedFm::copyAs() {
351 355
352 QStringList curFileList = getPath(); 356 QStringList curFileList = getPath();
353 QString curFile, item; 357 QString curFile, item;
354 InputDialog *fileDlg; 358 InputDialog *fileDlg;
355 359
356 QDir *thisDir = CurrentDir(); 360 QDir *thisDir = CurrentDir();
@@ -401,65 +405,64 @@ void AdvancedFm::copyAs() {
401 405
402void AdvancedFm::copySameDirTimer() { 406void AdvancedFm::copySameDirTimer() {
403 QTimer::singleShot(125,this,SLOT(copySameDir())); 407 QTimer::singleShot(125,this,SLOT(copySameDir()));
404} 408}
405 409
406void AdvancedFm::copySameDir() { 410void AdvancedFm::copySameDir() {
407 qApp->processEvents(); 411 qApp->processEvents();
408 QStringList curFileList = getPath(); 412 QStringList curFileList = getPath();
409 QString curFile, item, destFile; 413 QString curFile, item, destFile;
410 InputDialog *fileDlg; 414 InputDialog *fileDlg;
411 415
412 QDir *thisDir = CurrentDir(); 416 QDir *thisDir = CurrentDir();
413 417
414 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 418 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
415 item=(*it); 419 item=(*it);
416 curFile = thisDir->canonicalPath()+"/"+ item; 420 curFile = thisDir->canonicalPath()+"/"+ item;
417 421
418 fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); 422 fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0);
419 fileDlg->setInputText((const QString &) destFile ); 423 fileDlg->setInputText((const QString &) destFile );
420 fileDlg->exec(); 424 fileDlg->exec();
421 425
422 if( fileDlg->result() == 1 ) { 426 if( fileDlg->result() == 1 ) {
423 427
424 QString filename = fileDlg->LineEdit1->text(); 428 QString filename = fileDlg->LineEdit1->text();
425 destFile = thisDir->canonicalPath()+"/"+filename; 429 destFile = thisDir->canonicalPath()+"/"+filename;
426 430
427 QFile f(destFile); 431 QFile f(destFile);
428 if( f.exists()) { 432 if( f.exists()) {
429 switch (QMessageBox::warning(this,tr("Delete"), 433 switch (QMessageBox::warning(this,tr("Delete"),
430 tr("<p> %1 already exists. Do you really want to delete it?</P>").arg(destFile), 434 tr("<p> %1 already exists. Do you really want to delete it?</P>").arg(destFile),
431 tr("Yes"),tr("No"),0,0,1) ) { 435 tr("Yes"),tr("No"),0,0,1) ) {
432 case 0: 436 case 0:
433
434 f.remove(); 437 f.remove();
435 break; 438 break;
436 case 1: 439 case 1:
437 return; 440 return;
438 break; 441 break;
439 default: 442 default:
440 return; 443 return;
441 break; 444 break;
442 }; 445 };
443 } 446 }
444 if(!copyFile( curFile,destFile) ) { 447 if(!copyFile( curFile,destFile) ) {
445 QMessageBox::message("AdvancedFm",tr("<P>Could not copy %1 to %2</P>").arg(curFile).arg(destFile)); 448 QMessageBox::message("AdvancedFm",tr("<P>Could not copy %1 to %2</P>").arg(curFile).arg(destFile));
446 return; 449 return;
447 } 450 }
448 451
449// odebug << "copy "+curFile+" as "+destFile << oendl; 452// odebug << "copy "+curFile+" as "+destFile << oendl;
450 } 453 }
451 delete fileDlg; 454 delete fileDlg;
452 } 455 }
453 rePopulate(); 456 rePopulate();
454} 457}
455 458
456void AdvancedFm::moveTimer() { 459void AdvancedFm::moveTimer() {
457 QTimer::singleShot(125,this,SLOT(move())); 460 QTimer::singleShot(125,this,SLOT(move()));
458} 461}
459 462
460void AdvancedFm::move() { 463void AdvancedFm::move() {
461 464
462 QStringList curFileList = getPath(); 465 QStringList curFileList = getPath();
463 if( curFileList.count() > 0) { 466 if( curFileList.count() > 0) {
464 QString curFile, destFile, item; 467 QString curFile, destFile, item;
465 468