summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-07-11 16:36:34 (UTC)
committer llornkcor <llornkcor>2002-07-11 16:36:34 (UTC)
commit1651f048bb129b8e748a01c514d84c8626e0f1e2 (patch) (side-by-side diff)
tree9b2783cfbb8b754a5aae098b2f4ae165b65f340c
parentf568737c20bea96fb79d85681a72e142ec05d66f (diff)
downloadopie-1651f048bb129b8e748a01c514d84c8626e0f1e2.zip
opie-1651f048bb129b8e748a01c514d84c8626e0f1e2.tar.gz
opie-1651f048bb129b8e748a01c514d84c8626e0f1e2.tar.bz2
added messageboc when copy, or move fileif file exists to ask ok to delete, added copy same dir to menu
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp314
-rw-r--r--noncore/apps/advancedfm/advancedfm.h1
2 files changed, 232 insertions, 83 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
@@ -95,5 +95,5 @@ AdvancedFm::AdvancedFm( )
qpeDirButton= new QToolButton(this,"QPEButton");
- qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton");
+ qpeDirButton->setPixmap( Resource::loadPixmap("launcher/opielogo16x16"));//,"",this,"QPEButton");
// qpeDirButton= new QPushButton(Resource::loadIconSet("launcher/opielogo16x16"),"",this,"QPEButton");
qpeDirButton ->setFixedSize( QSize( 20, 20 ) );
@@ -103,5 +103,5 @@ AdvancedFm::AdvancedFm( )
cfButton = new QToolButton( this,"CFButton");
- cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia"));
+ cfButton->setPixmap(Resource::loadPixmap("cardmon/pcmcia"));
// cfButton = new QPushButton(Resource::loadIconSet("cardmon/pcmcia"),"",this,"CFButton");
cfButton ->setFixedSize( QSize( 20, 20 ) );
@@ -111,5 +111,5 @@ AdvancedFm::AdvancedFm( )
sdButton = new QToolButton( this,"SDButton");
- sdButton->setPixmap(Resource::loadPixmap("sdmon/sdcard"));
+ sdButton->setPixmap(Resource::loadPixmap("sdmon/sdcard"));
// sdButton = new QPushButton(Resource::loadIconSet("sdmon/sdcard"),"",this,"SDButton");
sdButton->setFixedSize( QSize( 20, 20 ) );
@@ -119,5 +119,5 @@ AdvancedFm::AdvancedFm( )
cdUpButton = new QToolButton( this,"cdUpButton");
- cdUpButton->setPixmap(Resource::loadPixmap("up"));
+ cdUpButton->setPixmap(Resource::loadPixmap("up"));
// cdUpButton = new QPushButton(Resource::loadIconSet("up"),"",this,"cdUpButton");
cdUpButton ->setFixedSize( QSize( 20, 20 ) );
@@ -127,5 +127,5 @@ AdvancedFm::AdvancedFm( )
docButton = new QToolButton( this,"docsButton");
- docButton->setPixmap(Resource::loadPixmap("DocsIcon"));
+ docButton->setPixmap(Resource::loadPixmap("DocsIcon"));
// docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton");
docButton->setFixedSize( QSize( 20, 20 ) );
@@ -135,5 +135,5 @@ AdvancedFm::AdvancedFm( )
homeButton = new QToolButton( this,"homeButton");
- homeButton->setPixmap(Resource::loadPixmap("home"));
+ homeButton->setPixmap(Resource::loadPixmap("home"));
// homeButton = new QPushButton( Resource::loadIconSet("home"),"",this,"homeButton");
homeButton->setFixedSize( QSize( 20, 20 ) );
@@ -1186,6 +1186,16 @@ 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) ) {
QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile);
@@ -1203,6 +1213,16 @@ 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) ) {
QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile);
@@ -1214,5 +1234,5 @@ void AdvancedFm::copy()
TabWidget->setCurrentPage(0);
}
-}
+ }
}
@@ -1221,117 +1241,244 @@ void AdvancedFm::copyAs()
QStringList curFileList = getPath();
if( curFileList.count() > 0) {
- QString curFile;
- InputDialog *fileDlg;
- fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0);
+ QString curFile;
+ InputDialog *fileDlg;
+ fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0);
- if (TabWidget->currentPageIndex() == 0) {
- for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
- QString destFile;
- curFile = currentDir.canonicalPath()+"/"+(*it);
+ if (TabWidget->currentPageIndex() == 0) {
+ for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
+ QString destFile;
+ curFile = currentDir.canonicalPath()+"/"+(*it);
// 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 = currentRemoteDir.canonicalPath()+"/"+(*it);
+ fileDlg->setInputText((const QString &) destFile );
+ fileDlg->exec();
+ if( fileDlg->result() == 1 ) {
+ QString filename = fileDlg->LineEdit1->text();
+ destFile = currentRemoteDir.canonicalPath()+"/"+(*it);
- QFile f(destFile);
- if( f.exists())
- f.remove();
- if(!copyFile(destFile, curFile) ) {
- QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile);
- qWarning("nothin doing");
+ 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");
+ }
}
}
+ populateRemoteView();
+ TabWidget->setCurrentPage(1);
+ } else {
+ if (TabWidget->currentPageIndex() == 0) {
+ for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
+
+ curFile = currentDir.canonicalPath()+"/"+(*it);
+ QString destFile;
+ fileDlg->setInputText((const QString &) destFile);
+ fileDlg->exec();
+ if( fileDlg->result() == 1 ) {
+ QString filename = fileDlg->LineEdit1->text();
+ destFile = currentDir.canonicalPath()+"/"+(*it);
+
+ 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");
+ }
+
+ }
+ }
+ populateLocalView();
+ TabWidget->setCurrentPage(0);
+ }
}
+ }
+
+}
+
+void AdvancedFm::copySameDir() {
+ QStringList curFileList = getPath();
+ if( curFileList.count() > 0) {
+ QString curFile;
+ InputDialog *fileDlg;
- populateRemoteView();
- TabWidget->setCurrentPage(1);
- } else {
if (TabWidget->currentPageIndex() == 0) {
for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
-
- curFile = currentDir.canonicalPath()+"/"+(*it);
QString destFile;
- fileDlg->setInputText((const 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()+"/"+(*it);
+ QString filename = fileDlg->LineEdit1->text();
+ destFile = currentDir.canonicalPath()+"/"+filename;
QFile f(destFile);
- if( f.exists())
- f.remove();
+ 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");
+ 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);
}
- populateLocalView();
- TabWidget->setCurrentPage(0);
}
- }
-}
-}
+ }
+}
+
void AdvancedFm::move() {
QStringList curFileList = getPath();
if( curFileList.count() > 0) {
- QString curFile;
+ QString curFile;
// qDebug(curFile);
- QString destFile;
+ QString destFile;
- if (TabWidget->currentPageIndex() == 0) {
- for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
- QString destFile = currentRemoteDir.canonicalPath();
+ if (TabWidget->currentPageIndex() == 0) {
+ for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
+ QString destFile = currentRemoteDir.canonicalPath();
if(destFile.right(1).find("/",0,TRUE) == -1)
destFile+="/";
destFile +=(*it);
- curFile = currentDir.canonicalPath();
- qDebug("Destination file is "+destFile);
- if(curFile.right(1).find("/",0,TRUE) == -1)
- curFile +="/";
- curFile+=(*it);
+ curFile = currentDir.canonicalPath();
+ qDebug("Destination file is "+destFile);
+ if(curFile.right(1).find("/",0,TRUE) == -1)
+ curFile +="/";
+ curFile+=(*it);
- QFile f(destFile);
- if( f.exists())
- f.remove();
- if(!copyFile( destFile, curFile) ) {
- QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile));
- return;
+ 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(tr("Note"),tr("Could not move\n"+curFile));
+ return;
+ }
+ QFile::remove(curFile);
+ }
}
- QFile::remove(curFile);
- }
- TabWidget->setCurrentPage(1);
- } else {
- for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
- QString destFile = currentRemoteDir.canonicalPath();
+ TabWidget->setCurrentPage(1);
+ } else {
+ for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
+ QString destFile = currentRemoteDir.canonicalPath();
if(destFile.right(1).find("/",0,TRUE) == -1)
destFile+="/";
destFile +=(*it);
- qDebug("Destination file is "+destFile);
- curFile = currentDir.canonicalPath();
- if(curFile.right(1).find("/",0,TRUE) == -1)
- curFile +="/";
- curFile+=(*it);
+ qDebug("Destination file is "+destFile);
+ curFile = currentDir.canonicalPath();
+ if(curFile.right(1).find("/",0,TRUE) == -1)
+ curFile +="/";
+ curFile+=(*it);
- QFile f(destFile);
- if( f.exists())
- f.remove();
- if(!copyFile(destFile, curFile) ) {
- QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile));
- return;
+ 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(tr("Note"),tr("Could not move\n"+curFile));
+ return;
+ }
+ }
+ QFile::remove(curFile);
+ TabWidget->setCurrentPage(0);
+ }
}
- QFile::remove(curFile);
- TabWidget->setCurrentPage(0);
+ populateRemoteView();
+ populateLocalView();
}
- }
- populateRemoteView();
- populateLocalView();
}
- }
bool AdvancedFm::copyFile( const QString & dest, const QString & src )
@@ -1756,4 +1903,5 @@ void AdvancedFm::showFileMenu() {
m->insertItem( tr( "Copy" ), this, SLOT( copy() ));
m->insertItem( tr( "Copy As" ), this, SLOT( copyAs() ));
+ m->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() ));
m->insertItem( tr( "Move" ), this, SLOT( move() ));
m->insertSeparator();
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
@@ -125,4 +125,5 @@ protected slots:
void copy();
void copyAs();
+ void copySameDir();
void currentPathComboActivated(const QString &);
void fillCombo(const QString &);