author | llornkcor <llornkcor> | 2002-08-04 23:16:00 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-08-04 23:16:00 (UTC) |
commit | 400870188f123415355589ce4fb533614ecdf2ac (patch) (side-by-side diff) | |
tree | 6dc7b0f747c3c48de6b730154c1167186226ec4a | |
parent | 57bd412cf973805fbe69ecfa8f168ad2e28311a9 (diff) | |
download | opie-400870188f123415355589ce4fb533614ecdf2ac.zip opie-400870188f123415355589ce4fb533614ecdf2ac.tar.gz opie-400870188f123415355589ce4fb533614ecdf2ac.tar.bz2 |
fix several severe file handling bugs
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 120 |
1 files changed, 67 insertions, 53 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 818a281..b169a79 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp @@ -1005,2 +1005,3 @@ QStringList AdvancedFm::getPath() { strList << it.current()->text(0); + qDebug(it.current()->text(0)); } @@ -1014,2 +1015,3 @@ QStringList AdvancedFm::getPath() { strList << it.current()->text(0); + qDebug(it.current()->text(0)); } @@ -1101,2 +1103,3 @@ void AdvancedFm::copy() { + qApp->processEvents(); QStringList curFileList = getPath(); @@ -1108,3 +1111,7 @@ void AdvancedFm::copy() QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it); + qDebug("Destination file is "+destFile); + curFile = currentDir.canonicalPath()+"/"+(*it); + qDebug("CurrentFile file is " + curFile); + QFile f(destFile); @@ -1134,3 +1141,5 @@ void AdvancedFm::copy() QString destFile = currentDir.canonicalPath()+"/"+(*it); + qDebug("Destination file is "+destFile); curFile = currentRemoteDir.canonicalPath()+"/"+(*it); + qDebug("CurrentFile file is " + curFile); @@ -1158,2 +1167,3 @@ void AdvancedFm::copy() } + } @@ -1161,11 +1171,10 @@ void AdvancedFm::copy() -void AdvancedFm::copyAs() -{ +void AdvancedFm::copyAs() { + qApp->processEvents(); + QStringList curFileList = getPath(); - if( curFileList.count() > 0) { QString curFile; InputDialog *fileDlg; - fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); - if (TabWidget->currentPageIndex() == 0) { + qDebug("tab 1"); for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { @@ -1173,7 +1182,10 @@ 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()+"/"+(*it); + destFile = currentRemoteDir.canonicalPath()+"/"+filename; @@ -1197,2 +1209,4 @@ void AdvancedFm::copyAs() } + delete fileDlg; + } @@ -1200,7 +1214,9 @@ void AdvancedFm::copyAs() TabWidget->setCurrentPage(1); + } else { - if (TabWidget->currentPageIndex() == 0) { for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { - curFile = currentDir.canonicalPath()+"/"+(*it); + curFile = currentRemoteDir.canonicalPath()+"/"+(*it); + fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); + QString destFile; @@ -1208,5 +1224,6 @@ void AdvancedFm::copyAs() fileDlg->exec(); + if( fileDlg->result() == 1 ) { QString filename = fileDlg->LineEdit1->text(); - destFile = currentDir.canonicalPath()+"/"+(*it); + destFile = currentDir.canonicalPath()+"/"+filename; @@ -1231,2 +1248,4 @@ void AdvancedFm::copyAs() } + delete fileDlg; + } @@ -1236,9 +1255,6 @@ void AdvancedFm::copyAs() } - } - -} void AdvancedFm::copySameDir() { + qApp->processEvents(); QStringList curFileList = getPath(); - if( curFileList.count() > 0) { QString curFile; @@ -1247,5 +1263,8 @@ void AdvancedFm::copySameDir() { 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); @@ -1253,3 +1272,5 @@ void AdvancedFm::copySameDir() { fileDlg->exec(); + if( fileDlg->result() == 1 ) { + QString filename = fileDlg->LineEdit1->text(); @@ -1280,6 +1301,5 @@ void AdvancedFm::copySameDir() { } - populateRemoteView(); - TabWidget->setCurrentPage(1); + populateLocalView(); + } else { - if (TabWidget->currentPageIndex() == 0) { for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { @@ -1287,2 +1307,3 @@ void AdvancedFm::copySameDir() { curFile = currentRemoteDir.canonicalPath()+"/"+(*it); + fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); @@ -1293,3 +1314,4 @@ void AdvancedFm::copySameDir() { QString filename = fileDlg->LineEdit1->text(); - destFile = currentDir.canonicalPath()+"/"+filename; + + destFile = currentRemoteDir.canonicalPath()+"/"+filename; @@ -1316,8 +1338,4 @@ void AdvancedFm::copySameDir() { } - populateLocalView(); - TabWidget->setCurrentPage(0); - } - } + populateRemoteView(); } - } @@ -1325,2 +1343,3 @@ void AdvancedFm::copySameDir() { void AdvancedFm::move() { + qApp->processEvents(); @@ -1329,3 +1348,2 @@ void AdvancedFm::move() { QString curFile; - // qDebug(curFile); QString destFile; @@ -1333,4 +1351,7 @@ void AdvancedFm::move() { 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) @@ -1339,19 +1360,13 @@ void AdvancedFm::move() { curFile = currentDir.canonicalPath(); + qDebug("Destination file is "+destFile); + if(curFile.right(1).find("/",0,TRUE) == -1) curFile +="/"; + curFile+=(*it); + qDebug("CurrentFile file is " + curFile); - QFile f(destFile); + QFile f( curFile); 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) ) { @@ -1359,3 +1374,3 @@ void AdvancedFm::move() { return; - } + } else QFile::remove(curFile); @@ -1363,11 +1378,20 @@ void AdvancedFm::move() { } + TabWidget->setCurrentPage(1); - } else { + + } else { //view 2 + for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { - QString destFile = currentRemoteDir.canonicalPath(); + + QString destFile = currentDir.canonicalPath(); + if(destFile.right(1).find("/",0,TRUE) == -1) destFile+="/"; + destFile +=(*it); + qDebug("Destination file is "+destFile); - curFile = currentDir.canonicalPath(); + + curFile = currentRemoteDir.canonicalPath(); + if(curFile.right(1).find("/",0,TRUE) == -1) @@ -1375,15 +1399,6 @@ void AdvancedFm::move() { curFile+=(*it); + qDebug("CurrentFile file is " + curFile); - QFile f(destFile); + QFile f( curFile); 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) ) { @@ -1391,5 +1406,5 @@ void AdvancedFm::move() { return; - } - } + } else QFile::remove(curFile); + } TabWidget->setCurrentPage(0); @@ -1402,4 +1417,3 @@ void AdvancedFm::move() { -bool AdvancedFm::copyFile( const QString & dest, const QString & src ) -{ +bool AdvancedFm::copyFile( const QString & dest, const QString & src ) { char bf[ 50000 ]; |