author | llornkcor <llornkcor> | 2002-11-15 14:20:40 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-11-15 14:20:40 (UTC) |
commit | b35750b8fe75e055e014e0dd294c714976f5715f (patch) (side-by-side diff) | |
tree | 3a57c481f4b416e6bfe7ce6794077a2225165839 | |
parent | ab8d331905b59a86b50cd513123cdde67e4bfb8a (diff) | |
download | opie-b35750b8fe75e055e014e0dd294c714976f5715f.zip opie-b35750b8fe75e055e014e0dd294c714976f5715f.tar.gz opie-b35750b8fe75e055e014e0dd294c714976f5715f.tar.bz2 |
added select all, and changed delete of multi files to ask only once. Changed some messagebox strings
-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 @@ -73,4 +73,5 @@ public: int currentServerConfig; protected slots: + void selectAll(); void addToDocs(); void doLocalCd(); 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 @@ -88,4 +88,5 @@ void AdvancedFm::init() { 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() )); 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 @@ -200,5 +200,21 @@ 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 ) { @@ -212,5 +228,5 @@ void AdvancedFm::localDelete() { 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) ) { @@ -228,26 +244,42 @@ void AdvancedFm::localDelete() { } 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; @@ -261,5 +293,5 @@ void AdvancedFm::remoteDelete() { 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) ) { @@ -277,21 +309,21 @@ void AdvancedFm::remoteDelete() { } 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(); } @@ -410,10 +442,25 @@ 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)); @@ -427,10 +474,8 @@ void AdvancedFm::copy() { 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; @@ -438,4 +483,6 @@ void AdvancedFm::copy() { }; } + f.remove(); + } if(!copyFile(destFile, curFile) ) { QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); @@ -449,5 +496,4 @@ void AdvancedFm::copy() { 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)); @@ -461,14 +507,12 @@ void AdvancedFm::copy() { 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) ) { @@ -508,6 +552,6 @@ void AdvancedFm::copyAs() { 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: @@ -547,6 +591,6 @@ void AdvancedFm::copyAs() { 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: @@ -963,2 +1007,12 @@ void AdvancedFm::fileBeamFinished( Ir *) { } + +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); + } +} |