-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 1 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmData.cpp | 1 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 130 |
3 files changed, 94 insertions, 38 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index 12ebbf2..7bccce9 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h @@ -71,8 +71,9 @@ public: bool b; QStringList fileSystemTypeList, fsList; int currentServerConfig; protected slots: + void selectAll(); void addToDocs(); void doLocalCd(); void doRemoteCd(); // void copy(); diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp index 7188640..f0a0a35 100644 --- a/noncore/apps/advancedfm/advancedfmData.cpp +++ b/noncore/apps/advancedfm/advancedfmData.cpp @@ -86,8 +86,9 @@ void AdvancedFm::init() { fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); fileMenu->insertSeparator(); + fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() )); fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); fileMenu->setCheckable(TRUE); diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index 27a119f..bef701a 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp @@ -198,9 +198,25 @@ void AdvancedFm::remoteMakDir() { } void AdvancedFm::localDelete() { QStringList curFileList = getPath(); - if(curFileList.count() > 0) { + bool doMsg=true; + int count=curFileList.count(); + if( count > 0) { + if(count > 1 ){ + QString msg; + msg=tr("Really delete\n%1 files?").arg(count); + switch ( QMessageBox::warning(this,tr("Delete"),msg + ,tr("Yes"),tr("No"),0,0,1) ) { + case 0: + doMsg=false; + break; + case 1: + return; + break; + }; + } + QString myFile; for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { myFile = (*it); if( myFile.find(" -> ",0,TRUE) != -1) @@ -210,9 +226,9 @@ void AdvancedFm::localDelete() { if(f.right(1).find("/",0,TRUE) == -1) f+="/"; f+=myFile; if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { - switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ + switch ( QMessageBox::warning(this,tr("Delete Directory?"),tr("Really delete\n")+f+ "\nand all it's contents ?" ,tr("Yes"),tr("No"),0,0,1) ) { case 0: { f=f.left(f.length()-1); @@ -226,30 +242,46 @@ void AdvancedFm::localDelete() { break; }; } else { - switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f + if(doMsg) { + switch ( QMessageBox::warning(this,tr("Delete"),tr("Really delete\n")+f +" ?",tr("Yes"),tr("No"),0,0,1) ) { - case 0: { + case 1: + return; + break; + }; + } QString cmd="rm "+f; QFile file(f); + if(QFileInfo(myFile).fileName().find("../",0,TRUE)==-1) file.remove(); // system( cmd.latin1()); + } + } + } populateLocalView(); } + +void AdvancedFm::remoteDelete() { + QStringList curFileList = getPath(); + bool doMsg=true; + int count=curFileList.count(); + if( count > 0) { + if(count > 1 ){ + QString msg; + msg=tr("Really delete\n%1 files?").arg(count); + switch ( QMessageBox::warning(this,tr("Delete"),msg + ,tr("Yes"),tr("No"),0,0,1) ) { + case 0: + doMsg=false; break; case 1: - // exit + return; break; }; } - } - } -} -void AdvancedFm::remoteDelete() { - QStringList curFileList = getPath(); - if( curFileList.count() > 0) { QString myFile; for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { myFile = (*it); @@ -259,9 +291,9 @@ void AdvancedFm::remoteDelete() { if(f.right(1).find("/",0,TRUE) == -1) f+="/"; f+=myFile; if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { - switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ + switch ( QMessageBox::warning(this,tr("Delete Directory"),tr("Really delete\n")+f+ "\nand all it's contents ?", tr("Yes"),tr("No"),0,0,1) ) { case 0: { f=f.left(f.length()-1); @@ -275,25 +307,25 @@ void AdvancedFm::remoteDelete() { break; }; } else { - switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f + if(doMsg) { + switch ( QMessageBox::warning(this,tr("Delete"),tr("Really delete\n")+f +" ?",tr("Yes"),tr("No"),0,0,1) ) { - case 0: { + case 1: + return; + break; + }; + } QString cmd="rm "+f; QFile file(f); + if(QFileInfo(myFile).fileName().find("../",0,TRUE)==-1) file.remove(); // system( cmd.latin1()); - populateRemoteView(); - } - break; - case 1: - // exit - break; - }; } } } + populateRemoteView(); } void AdvancedFm::localRename() { QString curFile = Local_View->currentItem()->text(0); @@ -408,14 +440,29 @@ void AdvancedFm::upDir() { void AdvancedFm::copy() { qApp->processEvents(); QStringList curFileList = getPath(); - if( curFileList.count() > 0) { + bool doMsg=true; + int count=curFileList.count(); + if( count > 0) { + if(count > 1 ){ + QString msg; + msg=tr("Really copy\n%1 files?").arg(count); + switch ( QMessageBox::warning(this,tr("Delete"),msg + ,tr("Yes"),tr("No"),0,0,1) ) { + case 0: + doMsg=false; + break; + case 1: + return; + break; + }; + } + QString curFile, item, destFile; if (TabWidget->getCurrentTab() == 0) { 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)); destFile = currentRemoteDir.canonicalPath()+"/"+ item; @@ -425,19 +472,19 @@ void AdvancedFm::copy() { qDebug("CurrentFile file is " + curFile); QFile f(destFile); if( f.exists()) { - switch ( QMessageBox::warning(this,tr("Delete"), - destFile+tr(" already exists\nDo you really want to delete it?"), + if(doMsg) { + switch ( QMessageBox::warning(this,tr("File Exists!"), + item+tr("\nexists. Ok to overwrite?"), tr("Yes"),tr("No"),0,0,1) ) { - case 0: - f.remove(); - break; case 1: return; break; }; } + f.remove(); + } if(!copyFile(destFile, curFile) ) { QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); return; } @@ -447,9 +494,8 @@ void AdvancedFm::copy() { } else { 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)); destFile = currentDir.canonicalPath()+"/"+ item; @@ -459,18 +505,16 @@ void AdvancedFm::copy() { qDebug("CurrentFile file is " + curFile); QFile f(destFile); if( f.exists()) { - switch ( QMessageBox::warning(this,tr("Delete"), - destFile+tr(" already exists\nDo you really want to delete it?"), + switch ( QMessageBox::warning(this,tr("File Exists!"), + item+tr("\nexists. Ok to overwrite?"), tr("Yes"),tr("No"),0,0,1) ) { - case 0: - f.remove(); - break; case 1: return; break; }; + f.remove(); } if(!copyFile(destFile, curFile) ) { QMessageBox::message("AdvancedFm",tr("Could not copy\n") +curFile +tr("to\n")+destFile); @@ -506,10 +550,10 @@ void AdvancedFm::copyAs() { destFile = currentRemoteDir.canonicalPath()+"/"+filename; QFile f(destFile); if( f.exists()) { - switch (QMessageBox::warning(this,tr("Delete"), - destFile+tr(" already exists\nDo you really want to delete it?"), + switch (QMessageBox::warning(this,tr("File Exists!"), + item+tr("\nexists. Ok to overwrite?"), tr("Yes"),tr("No"),0,0,1) ) { case 0: f.remove(); break; @@ -545,10 +589,10 @@ void AdvancedFm::copyAs() { destFile = currentDir.canonicalPath()+"/"+filename; QFile f( destFile); if( f.exists()) { - switch ( QMessageBox::warning(this,tr("Delete"), - destFile+tr(" already exists\nDo you really want to delete it?"), + switch ( QMessageBox::warning(this,tr("File Exists!"), + item+tr("\nexists. Ok to overwrite?"), tr("Yes"),tr("No"),0,0,1) ) { case 0: f.remove(); break; @@ -961,4 +1005,14 @@ void AdvancedFm::doBeam() { void AdvancedFm::fileBeamFinished( Ir *) { QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); } + +void AdvancedFm::selectAll() { + if (TabWidget->getCurrentTab() == 0) { + Local_View->selectAll(true); + Local_View->setSelected( Local_View->firstChild(),false); + } else { + Remote_View->selectAll(true); + Remote_View->setSelected( Remote_View->firstChild(),false); + } +} |