summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-04-28 13:40:18 (UTC)
committer llornkcor <llornkcor>2002-04-28 13:40:18 (UTC)
commitcaae6c7deade10081709daa8a0de8ad548b6e30d (patch) (side-by-side diff)
tree7bbc4d3b832101dd17a07ae1940ecca44a555eef
parent495103fd36f52dad3a564b924326519c9f52ccaf (diff)
downloadopie-caae6c7deade10081709daa8a0de8ad548b6e30d.zip
opie-caae6c7deade10081709daa8a0de8ad548b6e30d.tar.gz
opie-caae6c7deade10081709daa8a0de8ad548b6e30d.tar.bz2
changed remove dir function to be recursive and more dangerous
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index ab31c91..faa03dc 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -777,98 +777,108 @@ void AdvancedFm::localMakDir()
populateLocalView();
}
void AdvancedFm::remoteMakDir()
{
InputDialog *fileDlg;
fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0);
fileDlg->exec();
if( fileDlg->result() == 1 ) {
QString filename = fileDlg->LineEdit1->text();
currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename);
}
populateRemoteView();
}
void AdvancedFm::localDelete()
{
QStringList curFileList = getPath();
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 = currentDir.canonicalPath()+"/"+myFile;
+ QString f = currentDir.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+" ?"
+ 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: {
- QString cmd="rmdir -rf "+f;
+ f=f.left(f.length()-1);
+ QString cmd="rm -rf "+f;
system( cmd.latin1());
populateLocalView();
}
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());
populateLocalView();
}
break;
case 1:
// exit
break;
};
}
}
}
void AdvancedFm::remoteDelete()
{
QStringList curFileList = getPath();
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()+"/"+myFile;
+ QString f = currentDir.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+" ?",
+ 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: {
- QString cmd="rmdir -rf "+f;
+ f=f.left(f.length()-1);
+ QString cmd="rm -rf "+f;
system( cmd.latin1());
populateRemoteView();
}
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();
}
break;
case 1:
// exit
break;
};