-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 29 |
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 @@ -175,60 +175,62 @@ void AdvancedFm::doDelete() { f += "/"; f += myFile; if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { //if file is a directory switch ( QMessageBox::warning( this, tr("Delete Directory?"), tr("<p>Really delete %1 and all it's contents?</p>" ).arg( f ) , tr("Yes"), tr("No"), 0, 0, 1) ) { case 0: { f=f.left(f.length()-1); QString cmd="rm -rf "+f; startProcess( (const QString)cmd.latin1() ); populateView(); } break; case 1: // exit break; default: break; }; } else { - if(doMsg) { - switch ( QMessageBox::warning(this,tr("Delete"), - tr("<p>Really delete %1?</p>").arg( myFile ), - tr("Yes"), tr("No"), 0, 0, 1) ) { - case 1: - return; - break; - default: - return; - break; - }; - } + if(doMsg) { + switch ( QMessageBox::warning(this,tr("Delete"), + tr("<p>Really delete %1?</p>").arg( myFile ), + tr("Yes"), tr("No"), 0, 0, 1) ) { + case 0; + break; + case 1: + return; + break; + default: + return; + break; + }; + } QString cmd="rm "+f; QFile file(f); QFileInfo fi(myFile); if( fi.fileName().find("../",0,TRUE)==-1) { // odebug << "remove link files "+myFile << oendl; // DocLnk lnk(f); DocLnk *lnk; lnk = new DocLnk(f); // odebug << "Deleting doclnk " + lnk->linkFile() << oendl; if(lnk->isValid()) lnk->removeLinkFile(); // delete lnk; file.remove(); } } } } populateView(); } void AdvancedFm::filePerms() { QStringList curFileList = getPath(); @@ -301,48 +303,50 @@ void AdvancedFm::copy() { default: return; break; }; } QString curFile, item, destFile; for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { item=(*it); if(item.find("->",0,TRUE)) //symlink item = item.left(item.find("->",0,TRUE)); curFile = thisDir->canonicalPath()+"/"+ item; destFile = thatDir->canonicalPath()+"/"+ item; // odebug << "Destination file is "+destFile << oendl; // odebug << "CurrentFile file is " + curFile << oendl; QFile f(destFile); if( f.exists()) { if(doMsg) { switch ( QMessageBox::warning(this,tr("File Exists!"), tr("<p>%1 already exists. Ok to overwrite?</P>").arg(item), tr("Yes"),tr("No"),0,0,1)) { + case 0; + break; case 1: return; break; default: return; break; }; } f.remove(); } if( !copyFile( curFile, destFile) ) { QMessageBox::message("AdvancedFm", tr( "<P>Could not copy %1 to %2</P>").arg(curFile).arg(destFile)); return; } } rePopulate(); } } void AdvancedFm::copyAsTimer() { QTimer::singleShot(125,this,SLOT(copyAs())); } @@ -409,49 +413,48 @@ void AdvancedFm::copySameDir() { QString curFile, item, destFile; InputDialog *fileDlg; QDir *thisDir = CurrentDir(); for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { item=(*it); curFile = thisDir->canonicalPath()+"/"+ item; fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); fileDlg->setInputText((const QString &) destFile ); fileDlg->exec(); if( fileDlg->result() == 1 ) { QString filename = fileDlg->LineEdit1->text(); destFile = thisDir->canonicalPath()+"/"+filename; QFile f(destFile); if( f.exists()) { switch (QMessageBox::warning(this,tr("Delete"), tr("<p> %1 already exists. Do you really want to delete it?</P>").arg(destFile), tr("Yes"),tr("No"),0,0,1) ) { case 0: - f.remove(); break; case 1: return; break; default: return; break; }; } if(!copyFile( curFile,destFile) ) { QMessageBox::message("AdvancedFm",tr("<P>Could not copy %1 to %2</P>").arg(curFile).arg(destFile)); return; } // odebug << "copy "+curFile+" as "+destFile << oendl; } delete fileDlg; } rePopulate(); } void AdvancedFm::moveTimer() { QTimer::singleShot(125,this,SLOT(move())); |