author | llornkcor <llornkcor> | 2002-04-28 21:59:34 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-04-28 21:59:34 (UTC) |
commit | 726d985ddb6a5c7eb25a48efdadb189eb38b9a2a (patch) (side-by-side diff) | |
tree | e92814b56ee706ccb1d95a0c2e86294aa79ab2c2 /noncore/apps/advancedfm | |
parent | d9a38221ea876cae8ef8b015968e14af75e202bb (diff) | |
download | opie-726d985ddb6a5c7eb25a48efdadb189eb38b9a2a.zip opie-726d985ddb6a5c7eb25a48efdadb189eb38b9a2a.tar.gz opie-726d985ddb6a5c7eb25a48efdadb189eb38b9a2a.tar.bz2 |
fixed multi symlink handling
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 133 |
1 files changed, 68 insertions, 65 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index bd513c0..b5fcccf 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp @@ -321,7 +321,7 @@ void AdvancedFm::populateLocalView() } else { - if(fi->isExecutable()) { - pm = Resource::loadPixmap( "exec"); - item->setPixmap( 0,pm); - } - else if( !fi->isReadable() ) { +// if(fi->isExecutable()) { +// pm = Resource::loadPixmap( "exec"); +// item->setPixmap( 0,pm); +// } + if( !fi->isReadable() ) { pm = Resource::loadPixmap( "locked" ); @@ -437,7 +437,7 @@ void AdvancedFm::populateRemoteView() } else { - if(fi->isExecutable()) { - pm = Resource::loadPixmap( "exec"); - item->setPixmap( 0,pm); - } - else if( !fi->isReadable() ) { +// if(fi->isExecutable()) { +// pm = Resource::loadPixmap( "exec"); +// item->setPixmap( 0,pm); +// } + if( !fi->isReadable() ) { pm = Resource::loadPixmap( "locked" ); @@ -718,6 +718,6 @@ void AdvancedFm::runThis() { QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); - if(fileInfo.isExecutable()) { - QCopEnvelope e("QPE/System", "execute(QString)" ); - e << curFile; - } else { +// if(fileInfo.isExecutable()) { +// QCopEnvelope e("QPE/System", "execute(QString)" ); +// e << curFile; +// } else { curFile = currentDir.canonicalPath()+"/"+curFile; @@ -730,3 +730,3 @@ void AdvancedFm::runThis() { } - } +// } // MimeType mt( curFile); @@ -735,6 +735,6 @@ void AdvancedFm::runThis() { QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); - if(fileInfo.isExecutable()) { - QCopEnvelope e("QPE/System", "execute(QString)" ); - e << curFile; - } else { +// if(fileInfo.isExecutable()) { +// QCopEnvelope e("QPE/System", "execute(QString)" ); +// e << curFile; +// } else { curFile = currentRemoteDir.canonicalPath()+"/"+curFile; @@ -747,3 +747,3 @@ void AdvancedFm::runThis() { } - } +// } // MimeType mt( curFile); @@ -1048,3 +1048,3 @@ QStringList AdvancedFm::getPath() { if ( it.current()->isSelected() ) { - strList << currentDir.canonicalPath()+"/"+ it.current()->text(0); + strList << it.current()->text(0); } @@ -1141,10 +1141,12 @@ void AdvancedFm::copy() - QString destFile = currentRemoteDir.canonicalPath(); - if(destFile.right(1).find("/",0,TRUE) == -1) - destFile+="/"; - destFile +=(*it); - curFile = currentDir.canonicalPath(); - if(curFile.right(1).find("/",0,TRUE) == -1) - curFile +="/"; - curFile +=(*it); + QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it); +// if(destFile.right(1).find("/",0,TRUE) == -1) +// destFile+="/"; +// destFile +=(*it); + + curFile = currentDir.canonicalPath()+"/"+(*it); +// if(curFile.right(1).find("/",0,TRUE) == -1) +// curFile +="/"; +// curFile +=(*it); + QFile f(destFile); @@ -1152,5 +1154,7 @@ void AdvancedFm::copy() f.remove(); - if(!copyFile(destFile, curFile) ) + if(!copyFile(destFile, curFile) ) { + QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); qWarning("nothin doing"); } + } populateRemoteView(); @@ -1161,10 +1165,5 @@ void AdvancedFm::copy() - QString destFile = currentDir.canonicalPath(); - if(destFile.right(1).find("/",0,TRUE) == -1) - destFile+="/"; - destFile +=(*it); - curFile = currentRemoteDir.canonicalPath(); - if(curFile.right(1).find("/",0,TRUE) == -1) - curFile +="/"; - curFile +=(*it); + QString destFile = currentDir.canonicalPath()+"/"+(*it); + curFile = currentRemoteDir.canonicalPath()+"/"+(*it); + QFile f(destFile); @@ -1172,5 +1171,8 @@ void AdvancedFm::copy() f.remove(); - if(!copyFile(destFile, curFile) ) + if(!copyFile(destFile, curFile) ) { + QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); + qWarning("nothin doing"); } + } populateLocalView(); @@ -1190,6 +1192,3 @@ void AdvancedFm::copyAs() QString destFile; - curFile = currentDir.canonicalPath(); - if(curFile.right(1).find("/",0,TRUE) == -1) - curFile +="/"; - curFile+=(*it); + curFile = currentDir.canonicalPath()+"/"+(*it); // InputDialog *fileDlg; @@ -1200,6 +1199,3 @@ void AdvancedFm::copyAs() QString filename = fileDlg->LineEdit1->text(); - destFile = currentRemoteDir.canonicalPath(); - if(destFile.right(1).find("/",0,TRUE) == -1) - destFile+="/"; - destFile +=(*it); + destFile = currentRemoteDir.canonicalPath()+"/"+(*it); @@ -1208,3 +1204,4 @@ void AdvancedFm::copyAs() f.remove(); - if(!copyFile(destFile, curFile) ) + if(!copyFile(destFile, curFile) ) { + QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); qWarning("nothin doing"); @@ -1212,2 +1209,3 @@ void AdvancedFm::copyAs() } + } @@ -1219,6 +1217,3 @@ void AdvancedFm::copyAs() - curFile = currentDir.canonicalPath(); - if(curFile.right(1).find("/",0,TRUE) == -1) - curFile +="/"; - curFile+=(*it); + curFile = currentDir.canonicalPath()+"/"+(*it); QString destFile; @@ -1228,6 +1223,3 @@ void AdvancedFm::copyAs() QString filename = fileDlg->LineEdit1->text(); - destFile = currentDir.canonicalPath(); - if(destFile.right(1).find("/",0,TRUE) == -1) - destFile+="/"; - destFile +=(*it); + destFile = currentDir.canonicalPath()+"/"+(*it); @@ -1236,3 +1228,4 @@ void AdvancedFm::copyAs() f.remove(); - if(!copyFile(destFile, curFile) ) + if(!copyFile(destFile, curFile) ) { + QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); qWarning("nothin doing"); @@ -1240,2 +1233,3 @@ void AdvancedFm::copyAs() } + } populateLocalView(); @@ -1536,18 +1530,27 @@ void AdvancedFm::mkSym() { QString cmd; + QStringList curFileList = getPath(); + if (TabWidget->currentPageIndex() == 0) { - QString curFile = Local_View->currentItem()->text(0); - if(curFile.right(1) == "/") curFile = curFile.left(curFile.length() - 1); - QString destName = currentRemoteDir.canonicalPath()+"/"+curFile; - curFile = currentDir.canonicalPath()+"/"+curFile; + for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { + + QString destName = currentRemoteDir.canonicalPath()+"/"+(*it); + QString curFile = currentDir.canonicalPath()+"/"+(*it); cmd = "ln -s "+curFile+" "+destName; + qDebug(cmd); system(cmd.latin1() ); + } populateRemoteView(); + TabWidget->setCurrentPage(1); } else { - QString curFile = Remote_View->currentItem()->text(0); - if(curFile.right(1) == "/") curFile = curFile.left(curFile.length() - 1); - QString destName = currentDir.canonicalPath()+"/"+curFile; - curFile = currentRemoteDir.canonicalPath()+"/"+curFile; + for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { + + QString destName = currentDir.canonicalPath()+"/"+(*it); + QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); + cmd = "ln -s "+curFile+" "+destName; + qDebug(cmd); system(cmd.latin1() ); + } populateLocalView(); + TabWidget->setCurrentPage(0); } |