summaryrefslogtreecommitdiff
path: root/noncore/apps/advancedfm/advancedfmMenu.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/advancedfm/advancedfmMenu.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp62
1 files changed, 55 insertions, 7 deletions
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp
index c0be948..90c887f 100644
--- a/noncore/apps/advancedfm/advancedfmMenu.cpp
+++ b/noncore/apps/advancedfm/advancedfmMenu.cpp
@@ -68,8 +68,8 @@ void AdvancedFm::showMenuHidden() {
OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
fileMenu->setItemChecked( fileMenu->idAt(0),FALSE);
}
- rePopulate();
b = !b;
+ populateView();
}
void AdvancedFm::showHidden() {
@@ -80,7 +80,7 @@ void AdvancedFm::showHidden() {
CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
}
- rePopulate();
+ populateView();
}
QString AdvancedFm::dealWithSymName(const QString &fileName) {
@@ -339,8 +339,8 @@ void AdvancedFm::copy() {
return;
}
}
- rePopulate();
setOtherTabCurrent();
+ rePopulate();
}
}
@@ -438,7 +438,7 @@ void AdvancedFm::copySameDir() {
}
delete fileDlg;
}
- populateView();
+ rePopulate();
}
void AdvancedFm::move() {
@@ -465,6 +465,12 @@ void AdvancedFm::move() {
curFile+= item;
// qDebug("CurrentFile file is " + curFile);
+ if(QFileInfo(curFile).isDir()) {
+ moveDirectory( curFile, destFile );
+ rePopulate();
+ return;
+ }
+
QFile f( curFile);
if( f.exists()) {
if( !copyFile( curFile, destFile) ) {
@@ -480,7 +486,49 @@ void AdvancedFm::move() {
setOtherTabCurrent();
}
+bool AdvancedFm::moveDirectory( const QString & src, const QString & dest ) {
+ int err = 0;
+ if( copyDirectory( src, dest ) ) { QString cmd = "rm -rf " + src;
+ err = system((const char*)cmd);
+ } else
+ err = -1;
+
+ if(err!=0) {
+ QMessageBox::message(tr("Note"),tr("Could not move\n") + src);
+ return false;
+ }
+ return true;
+}
+
+bool AdvancedFm::copyDirectory( const QString & src, const QString & dest ) {
+
+ QString cmd = "/bin/cp -fpR " + src + " " + dest;
+ qWarning(cmd);
+ int err = system( (const char *) cmd );
+ if ( err != 0 ) {
+ QMessageBox::message("AdvancedFm",
+ tr( "Could not copy \n%1 \nto \n%2").arg( src ).arg( dest ) );
+ return false;
+ }
+
+ return true;
+}
+
+
bool AdvancedFm::copyFile( const QString & src, const QString & dest ) {
+
+
+ if(QFileInfo(src).isDir()) {
+ if( copyDirectory( src, dest )) {
+ setOtherTabCurrent();
+ populateView();
+ return true;
+ }
+ else
+ return false;
+ }
+
+
bool success = true;
struct stat status;
QFile srcFile(src);
@@ -687,7 +735,7 @@ void AdvancedFm::startProcess(const QString & cmd) {
}
void AdvancedFm::processEnded(OProcess *) {
- populateView();
+ rePopulate();
}
void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) {
@@ -775,7 +823,7 @@ void AdvancedFm::renameIt() {
QListView *thisView = CurrentView();
oldName = thisView->currentItem()->text(0);
doRename( thisView );
- populateView();
+ rePopulate();
}
void AdvancedFm::okRename() {
@@ -794,7 +842,7 @@ void AdvancedFm::okRename() {
view->takeItem( view->currentItem() );
delete view->currentItem();
- populateView();
+ rePopulate();
}
void AdvancedFm::openSearch() {