summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-11-15 14:20:40 (UTC)
committer llornkcor <llornkcor>2002-11-15 14:20:40 (UTC)
commitb35750b8fe75e055e014e0dd294c714976f5715f (patch) (side-by-side diff)
tree3a57c481f4b416e6bfe7ce6794077a2225165839
parentab8d331905b59a86b50cd513123cdde67e4bfb8a (diff)
downloadopie-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
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.h1
-rw-r--r--noncore/apps/advancedfm/advancedfmData.cpp1
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp220
3 files changed, 139 insertions, 83 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
@@ -74,2 +74,3 @@ public:
protected slots:
+ void selectAll();
void addToDocs();
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
@@ -89,2 +89,3 @@ void AdvancedFm::init() {
fileMenu->insertSeparator();
+ fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() ));
fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() ));
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
@@ -201,4 +201,20 @@ void AdvancedFm::localDelete() {
QStringList curFileList = getPath();
- if(curFileList.count() > 0) {
- QString myFile;
+ 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 ) {
@@ -213,3 +229,3 @@ void AdvancedFm::localDelete() {
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 ?"
@@ -229,16 +245,15 @@ 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: {
- QString cmd="rm "+f;
- QFile file(f);
- file.remove();
- // system( cmd.latin1());
- populateLocalView();
- }
- break;
- case 1:
- // exit
- break;
+ case 1:
+ return;
+ break;
};
+ }
+ QString cmd="rm "+f;
+ QFile file(f);
+ if(QFileInfo(myFile).fileName().find("../",0,TRUE)==-1)
+ file.remove();
+ // system( cmd.latin1());
}
@@ -246,2 +261,3 @@ void AdvancedFm::localDelete() {
}
+ populateLocalView();
}
@@ -249,48 +265,64 @@ void AdvancedFm::localDelete() {
void AdvancedFm::remoteDelete() {
- QStringList curFileList = getPath();
- if( curFileList.count() > 0) {
- QString myFile;
-
- for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
- myFile = (*it);
- if(myFile.find(" -> ",0,TRUE) != -1)
- myFile = myFile.left(myFile.find(" -> ",0,TRUE));
- QString f = currentRemoteDir.canonicalPath();
- 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+
- "\nand all it's contents ?",
- tr("Yes"),tr("No"),0,0,1) ) {
- case 0: {
- f=f.left(f.length()-1);
- QString cmd="rm -rf "+f;
- system( cmd.latin1());
- populateRemoteView();
+ 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:
+ return;
+ break;
+ };
}
- break;
- case 1:
- // exit
- break;
- };
- } else {
- switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f
- +" ?",tr("Yes"),tr("No"),0,0,1) ) {
- case 0: {
- QString cmd="rm "+f;
- QFile file(f);
- file.remove();
- // system( cmd.latin1());
- populateRemoteView();
+ QString myFile;
+
+ for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
+ myFile = (*it);
+ if(myFile.find(" -> ",0,TRUE) != -1)
+ myFile = myFile.left(myFile.find(" -> ",0,TRUE));
+ QString f = currentRemoteDir.canonicalPath();
+ if(f.right(1).find("/",0,TRUE) == -1)
+ f+="/";
+ f+=myFile;
+ if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) {
+ 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);
+ QString cmd="rm -rf "+f;
+ system( cmd.latin1());
+ populateRemoteView();
+ }
+ break;
+ case 1:
+ // exit
+ break;
+ };
+
+ } else {
+ if(doMsg) {
+ switch ( QMessageBox::warning(this,tr("Delete"),tr("Really delete\n")+f
+ +" ?",tr("Yes"),tr("No"),0,0,1) ) {
+ case 1:
+ return;
+ break;
+ };
+ }
+ QString cmd="rm "+f;
+ QFile file(f);
+ if(QFileInfo(myFile).fileName().find("../",0,TRUE)==-1)
+ file.remove();
+ // system( cmd.latin1());
+ }
}
- break;
- case 1:
- // exit
- break;
- };
- }
}
- }
+ populateRemoteView();
}
@@ -411,8 +443,23 @@ void AdvancedFm::copy() {
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 ) {
+ for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
item=(*it);
-
if(item.find("->",0,TRUE)) //symlink
@@ -428,15 +475,15 @@ void AdvancedFm::copy() {
if( f.exists()) {
- switch ( QMessageBox::warning(this,tr("Delete"),
- destFile+tr(" already exists\nDo you really want to delete it?"),
- tr("Yes"),tr("No"),0,0,1) ) {
- case 0:
- f.remove();
- break;
- case 1:
- return;
- break;
- };
- }
- if(!copyFile(destFile, curFile) ) {
- QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile);
+ if(doMsg) {
+ switch ( QMessageBox::warning(this,tr("File Exists!"),
+ item+tr("\nexists. Ok to overwrite?"),
+ tr("Yes"),tr("No"),0,0,1) ) {
+ case 1:
+ return;
+ break;
+ };
+ }
+ f.remove();
+ }
+ if(!copyFile(destFile, curFile) ) {
+ QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile);
return;
@@ -450,3 +497,2 @@ void AdvancedFm::copy() {
item= (*it);
-
if(item.find("->",0,TRUE)) //symlink
@@ -462,8 +508,5 @@ void AdvancedFm::copy() {
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:
@@ -472,2 +515,3 @@ void AdvancedFm::copy() {
};
+ f.remove();
}
@@ -509,4 +553,4 @@ void AdvancedFm::copyAs() {
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) ) {
@@ -548,4 +592,4 @@ void AdvancedFm::copyAs() {
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) ) {
@@ -964 +1008,11 @@ 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);
+ }
+}