summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show 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.cpp130
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
@@ -63,24 +63,25 @@ public:
QLineEdit *currentPathEdit;
QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu;
QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton;
// QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton;
QDir currentDir, currentRemoteDir;
QComboBox *currentPathCombo;
QString filterStr;
QListViewItem * item;
bool b;
QStringList fileSystemTypeList, fsList;
int currentServerConfig;
protected slots:
+ void selectAll();
void addToDocs();
void doLocalCd();
void doRemoteCd();
// void copy();
void mkDir();
void del();
void rn();
void populateLocalView();
void populateRemoteView();
void showHidden();
void showMenuHidden();
void showRemoteHidden();
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
@@ -78,24 +78,25 @@ void AdvancedFm::init() {
homeButton->setPixmap(Resource::loadPixmap("home"));
homeButton->setFixedSize( QSize( 20, 20 ) );
layout->addMultiCellWidget( homeButton, 0, 0, 7, 7);
fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() ));
fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
fileMenu->insertSeparator();
fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() ));
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);
viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() ));
viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() ));
viewMenu->insertSeparator();
viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() ));
viewMenu->setCheckable(TRUE);
currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" );
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
@@ -190,118 +190,150 @@ 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();
- 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)
myFile = myFile.left( myFile.find(" -> ",0,TRUE));
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 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());
populateLocalView();
}
break;
case 1:
// exit
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);
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+
+ 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 {
- 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);
qDebug("currentItem "+curFile);
if( curFile !="../") {
InputDialog *fileDlg;
fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0);
fileDlg->setInputText((const QString &)curFile);
fileDlg->exec();
if( fileDlg->result() == 1 ) {
QString oldname = currentDir.canonicalPath() + "/" + curFile;
@@ -400,85 +432,97 @@ void AdvancedFm::upDir() {
dir.cdUp();
current = dir.canonicalPath();
chdir( current.latin1() );
currentRemoteDir.cd( current, TRUE);
populateRemoteView();
update();
}
}
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;
qDebug("Destination file is "+destFile);
curFile = currentDir.canonicalPath()+"/"+ item;
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;
}
}
populateRemoteView();
TabWidget->setCurrentTab(1);
} 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;
qDebug("Destination file is "+destFile);
curFile = currentRemoteDir.canonicalPath()+"/"+ item;;
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);
return;
}
}
populateLocalView();
TabWidget->setCurrentTab(0);
}
@@ -498,26 +542,26 @@ void AdvancedFm::copyAs() {
curFile = currentDir.canonicalPath()+"/"+(*it);
fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0);
fileDlg->setInputText((const QString &) destFile );
fileDlg->exec();
if( fileDlg->result() == 1 ) {
QString filename = fileDlg->LineEdit1->text();
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;
case 1:
return;
break;
};
}
if(!copyFile(destFile, curFile) ) {
QMessageBox::message("AdvancedFm",tr("Could not copy\n")
+curFile +tr("to\n")+destFile);
@@ -537,26 +581,26 @@ void AdvancedFm::copyAs() {
fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0);
QString destFile;
fileDlg->setInputText((const QString &) destFile);
fileDlg->exec();
if( fileDlg->result() == 1 ) {
QString filename = fileDlg->LineEdit1->text();
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;
case 1:
return;
break;
};
}
if(!copyFile(destFile, curFile) ) {
QMessageBox::message("AdvancedFm",tr("Could not copy\n")
+curFile +tr("to\n")+destFile);
@@ -953,12 +997,22 @@ 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);
+ }
+}