summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp162
-rw-r--r--noncore/apps/advancedfm/advancedfm.h1
2 files changed, 156 insertions, 7 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index 9e38d14..f97ae99 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -1187,4 +1187,14 @@ void AdvancedFm::copy()
QFile f(destFile);
- if( f.exists())
+ 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) ) {
@@ -1204,4 +1214,14 @@ void AdvancedFm::copy()
QFile f(destFile);
- if( f.exists())
+ 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) ) {
@@ -1239,4 +1259,14 @@ void AdvancedFm::copyAs()
QFile f(destFile);
- if( f.exists())
+ 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) ) {
@@ -1247,3 +1277,2 @@ void AdvancedFm::copyAs()
}
-
populateRemoteView();
@@ -1263,4 +1292,14 @@ void AdvancedFm::copyAs()
QFile f(destFile);
- if( f.exists())
+ 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) ) {
@@ -1269,2 +1308,3 @@ void AdvancedFm::copyAs()
}
+
}
@@ -1276,2 +1316,89 @@ void AdvancedFm::copyAs()
}
+
+}
+
+void AdvancedFm::copySameDir() {
+ QStringList curFileList = getPath();
+ if( curFileList.count() > 0) {
+ QString curFile;
+ InputDialog *fileDlg;
+
+ if (TabWidget->currentPageIndex() == 0) {
+ for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
+ QString destFile;
+ curFile = currentDir.canonicalPath()+"/"+(*it);
+ fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0);
+// InputDialog *fileDlg;
+// fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0);
+ 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?"),
+ tr("Yes"),tr("No"),0,0,1) ) {
+ case 0:
+ qDebug("");
+ f.remove();
+ break;
+ case 1:
+ return;
+ break;
+ };
+ }
+ if(!copyFile(destFile, curFile) ) {
+ QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile);
+ qWarning("nothin doing");
+ }
+
+ qDebug("copy "+curFile+" as "+destFile);
+ }
+ delete fileDlg;
+ }
+ populateRemoteView();
+ TabWidget->setCurrentPage(1);
+ } else {
+ if (TabWidget->currentPageIndex() == 0) {
+ for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
+
+ curFile = currentRemoteDir.canonicalPath()+"/"+(*it);
+ fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" 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?"),
+ 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);
+ qWarning("nothin doing");
+ }
+ qDebug("copy "+curFile+" as "+destFile);
+ }
+ delete fileDlg;
+ }
+ populateLocalView();
+ TabWidget->setCurrentPage(0);
+ }
+ }
+ }
+
}
@@ -1299,4 +1426,13 @@ void AdvancedFm::move() {
QFile f(destFile);
- if( f.exists())
+ 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) ) {
@@ -1307,2 +1443,3 @@ void AdvancedFm::move() {
}
+ }
TabWidget->setCurrentPage(1);
@@ -1321,4 +1458,13 @@ void AdvancedFm::move() {
QFile f(destFile);
- if( f.exists())
+ 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) ) {
@@ -1327,2 +1473,3 @@ void AdvancedFm::move() {
}
+ }
QFile::remove(curFile);
@@ -1757,2 +1904,3 @@ void AdvancedFm::showFileMenu() {
m->insertItem( tr( "Copy As" ), this, SLOT( copyAs() ));
+ m->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() ));
m->insertItem( tr( "Move" ), this, SLOT( move() ));
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h
index 7335773..7665fe9 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -126,2 +126,3 @@ protected slots:
void copyAs();
+ void copySameDir();
void currentPathComboActivated(const QString &);