author | llornkcor <llornkcor> | 2002-04-28 21:59:34 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-04-28 21:59:34 (UTC) |
commit | 726d985ddb6a5c7eb25a48efdadb189eb38b9a2a (patch) (unidiff) | |
tree | e92814b56ee706ccb1d95a0c2e86294aa79ab2c2 | |
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 | 149 |
1 files changed, 76 insertions, 73 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 | |||
@@ -320,9 +320,9 @@ void AdvancedFm::populateLocalView() | |||
320 | item->setPixmap( 0,pm ); | 320 | item->setPixmap( 0,pm ); |
321 | } else { | 321 | } else { |
322 | if(fi->isExecutable()) { | 322 | // if(fi->isExecutable()) { |
323 | pm = Resource::loadPixmap( "exec"); | 323 | // pm = Resource::loadPixmap( "exec"); |
324 | item->setPixmap( 0,pm); | 324 | // item->setPixmap( 0,pm); |
325 | } | 325 | // } |
326 | else if( !fi->isReadable() ) { | 326 | if( !fi->isReadable() ) { |
327 | pm = Resource::loadPixmap( "locked" ); | 327 | pm = Resource::loadPixmap( "locked" ); |
328 | item->setPixmap( 0,pm); | 328 | item->setPixmap( 0,pm); |
@@ -436,9 +436,9 @@ void AdvancedFm::populateRemoteView() | |||
436 | item->setPixmap( 0,pm ); | 436 | item->setPixmap( 0,pm ); |
437 | } else { | 437 | } else { |
438 | if(fi->isExecutable()) { | 438 | // if(fi->isExecutable()) { |
439 | pm = Resource::loadPixmap( "exec"); | 439 | // pm = Resource::loadPixmap( "exec"); |
440 | item->setPixmap( 0,pm); | 440 | // item->setPixmap( 0,pm); |
441 | } | 441 | // } |
442 | else if( !fi->isReadable() ) { | 442 | if( !fi->isReadable() ) { |
443 | pm = Resource::loadPixmap( "locked" ); | 443 | pm = Resource::loadPixmap( "locked" ); |
444 | item->setPixmap( 0,pm); | 444 | item->setPixmap( 0,pm); |
@@ -717,8 +717,8 @@ void AdvancedFm::runThis() { | |||
717 | QString curFile = Local_View->currentItem()->text(0); | 717 | QString curFile = Local_View->currentItem()->text(0); |
718 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); | 718 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); |
719 | if(fileInfo.isExecutable()) { | 719 | // if(fileInfo.isExecutable()) { |
720 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 720 | // QCopEnvelope e("QPE/System", "execute(QString)" ); |
721 | e << curFile; | 721 | // e << curFile; |
722 | } else { | 722 | // } else { |
723 | curFile = currentDir.canonicalPath()+"/"+curFile; | 723 | curFile = currentDir.canonicalPath()+"/"+curFile; |
724 | DocLnk nf(curFile); | 724 | DocLnk nf(curFile); |
@@ -729,13 +729,13 @@ void AdvancedFm::runThis() { | |||
729 | nf.execute(); | 729 | nf.execute(); |
730 | } | 730 | } |
731 | } | 731 | // } |
732 | // MimeType mt( curFile); | 732 | // MimeType mt( curFile); |
733 | } else { | 733 | } else { |
734 | QString curFile = Remote_View->currentItem()->text(0); | 734 | QString curFile = Remote_View->currentItem()->text(0); |
735 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); | 735 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); |
736 | if(fileInfo.isExecutable()) { | 736 | // if(fileInfo.isExecutable()) { |
737 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 737 | // QCopEnvelope e("QPE/System", "execute(QString)" ); |
738 | e << curFile; | 738 | // e << curFile; |
739 | } else { | 739 | // } else { |
740 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 740 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; |
741 | DocLnk nf(curFile); | 741 | DocLnk nf(curFile); |
@@ -746,5 +746,5 @@ void AdvancedFm::runThis() { | |||
746 | nf.execute(); | 746 | nf.execute(); |
747 | } | 747 | } |
748 | } | 748 | // } |
749 | // MimeType mt( curFile); | 749 | // MimeType mt( curFile); |
750 | } | 750 | } |
@@ -1047,5 +1047,5 @@ QStringList AdvancedFm::getPath() { | |||
1047 | for ( ; it.current(); ++it ) { | 1047 | for ( ; it.current(); ++it ) { |
1048 | if ( it.current()->isSelected() ) { | 1048 | if ( it.current()->isSelected() ) { |
1049 | strList << currentDir.canonicalPath()+"/"+ it.current()->text(0); | 1049 | strList << it.current()->text(0); |
1050 | } | 1050 | } |
1051 | } | 1051 | } |
@@ -1140,17 +1140,21 @@ void AdvancedFm::copy() | |||
1140 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1140 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1141 | 1141 | ||
1142 | QString destFile = currentRemoteDir.canonicalPath(); | 1142 | QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1143 | if(destFile.right(1).find("/",0,TRUE) == -1) | 1143 | // if(destFile.right(1).find("/",0,TRUE) == -1) |
1144 | destFile+="/"; | 1144 | // destFile+="/"; |
1145 | destFile +=(*it); | 1145 | // destFile +=(*it); |
1146 | curFile = currentDir.canonicalPath(); | 1146 | |
1147 | if(curFile.right(1).find("/",0,TRUE) == -1) | 1147 | curFile = currentDir.canonicalPath()+"/"+(*it); |
1148 | curFile +="/"; | 1148 | // if(curFile.right(1).find("/",0,TRUE) == -1) |
1149 | curFile +=(*it); | 1149 | // curFile +="/"; |
1150 | // curFile +=(*it); | ||
1151 | |||
1150 | QFile f(destFile); | 1152 | QFile f(destFile); |
1151 | if( f.exists()) | 1153 | if( f.exists()) |
1152 | f.remove(); | 1154 | f.remove(); |
1153 | if(!copyFile(destFile, curFile) ) | 1155 | if(!copyFile(destFile, curFile) ) { |
1156 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); | ||
1154 | qWarning("nothin doing"); | 1157 | qWarning("nothin doing"); |
1158 | } | ||
1155 | } | 1159 | } |
1156 | populateRemoteView(); | 1160 | populateRemoteView(); |
@@ -1160,17 +1164,15 @@ void AdvancedFm::copy() | |||
1160 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1164 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1161 | 1165 | ||
1162 | QString destFile = currentDir.canonicalPath(); | 1166 | QString destFile = currentDir.canonicalPath()+"/"+(*it); |
1163 | if(destFile.right(1).find("/",0,TRUE) == -1) | 1167 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1164 | destFile+="/"; | 1168 | |
1165 | destFile +=(*it); | ||
1166 | curFile = currentRemoteDir.canonicalPath(); | ||
1167 | if(curFile.right(1).find("/",0,TRUE) == -1) | ||
1168 | curFile +="/"; | ||
1169 | curFile +=(*it); | ||
1170 | QFile f(destFile); | 1169 | QFile f(destFile); |
1171 | if( f.exists()) | 1170 | if( f.exists()) |
1172 | f.remove(); | 1171 | f.remove(); |
1173 | if(!copyFile(destFile, curFile) ) | 1172 | if(!copyFile(destFile, curFile) ) { |
1174 | qWarning("nothin doing"); | 1173 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); |
1174 | |||
1175 | qWarning("nothin doing"); | ||
1176 | } | ||
1175 | } | 1177 | } |
1176 | populateLocalView(); | 1178 | populateLocalView(); |
@@ -1189,8 +1191,5 @@ void AdvancedFm::copyAs() | |||
1189 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1191 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1190 | QString destFile; | 1192 | QString destFile; |
1191 | curFile = currentDir.canonicalPath(); | 1193 | curFile = currentDir.canonicalPath()+"/"+(*it); |
1192 | if(curFile.right(1).find("/",0,TRUE) == -1) | ||
1193 | curFile +="/"; | ||
1194 | curFile+=(*it); | ||
1195 | // InputDialog *fileDlg; | 1194 | // InputDialog *fileDlg; |
1196 | // fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); | 1195 | // fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); |
@@ -1199,14 +1198,13 @@ void AdvancedFm::copyAs() | |||
1199 | if( fileDlg->result() == 1 ) { | 1198 | if( fileDlg->result() == 1 ) { |
1200 | QString filename = fileDlg->LineEdit1->text(); | 1199 | QString filename = fileDlg->LineEdit1->text(); |
1201 | destFile = currentRemoteDir.canonicalPath(); | 1200 | destFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1202 | if(destFile.right(1).find("/",0,TRUE) == -1) | ||
1203 | destFile+="/"; | ||
1204 | destFile +=(*it); | ||
1205 | 1201 | ||
1206 | QFile f(destFile); | 1202 | QFile f(destFile); |
1207 | if( f.exists()) | 1203 | if( f.exists()) |
1208 | f.remove(); | 1204 | f.remove(); |
1209 | if(!copyFile(destFile, curFile) ) | 1205 | if(!copyFile(destFile, curFile) ) { |
1206 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); | ||
1210 | qWarning("nothin doing"); | 1207 | qWarning("nothin doing"); |
1208 | } | ||
1211 | } | 1209 | } |
1212 | } | 1210 | } |
@@ -1218,8 +1216,5 @@ void AdvancedFm::copyAs() | |||
1218 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1216 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1219 | 1217 | ||
1220 | curFile = currentDir.canonicalPath(); | 1218 | curFile = currentDir.canonicalPath()+"/"+(*it); |
1221 | if(curFile.right(1).find("/",0,TRUE) == -1) | ||
1222 | curFile +="/"; | ||
1223 | curFile+=(*it); | ||
1224 | QString destFile; | 1219 | QString destFile; |
1225 | fileDlg->setInputText((const QString &) destFile); | 1220 | fileDlg->setInputText((const QString &) destFile); |
@@ -1227,14 +1222,13 @@ void AdvancedFm::copyAs() | |||
1227 | if( fileDlg->result() == 1 ) { | 1222 | if( fileDlg->result() == 1 ) { |
1228 | QString filename = fileDlg->LineEdit1->text(); | 1223 | QString filename = fileDlg->LineEdit1->text(); |
1229 | destFile = currentDir.canonicalPath(); | 1224 | destFile = currentDir.canonicalPath()+"/"+(*it); |
1230 | if(destFile.right(1).find("/",0,TRUE) == -1) | ||
1231 | destFile+="/"; | ||
1232 | destFile +=(*it); | ||
1233 | 1225 | ||
1234 | QFile f(destFile); | 1226 | QFile f(destFile); |
1235 | if( f.exists()) | 1227 | if( f.exists()) |
1236 | f.remove(); | 1228 | f.remove(); |
1237 | if(!copyFile(destFile, curFile) ) | 1229 | if(!copyFile(destFile, curFile) ) { |
1238 | qWarning("nothin doing"); | 1230 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); |
1231 | qWarning("nothin doing"); | ||
1232 | } | ||
1239 | } | 1233 | } |
1240 | } | 1234 | } |
@@ -1535,20 +1529,29 @@ void AdvancedFm::keyReleaseEvent( QKeyEvent *e) | |||
1535 | void AdvancedFm::mkSym() { | 1529 | void AdvancedFm::mkSym() { |
1536 | QString cmd; | 1530 | QString cmd; |
1531 | QStringList curFileList = getPath(); | ||
1532 | |||
1537 | if (TabWidget->currentPageIndex() == 0) { | 1533 | if (TabWidget->currentPageIndex() == 0) { |
1538 | QString curFile = Local_View->currentItem()->text(0); | 1534 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1539 | if(curFile.right(1) == "/") curFile = curFile.left(curFile.length() - 1); | 1535 | |
1540 | QString destName = currentRemoteDir.canonicalPath()+"/"+curFile; | 1536 | QString destName = currentRemoteDir.canonicalPath()+"/"+(*it); |
1541 | curFile = currentDir.canonicalPath()+"/"+curFile; | 1537 | QString curFile = currentDir.canonicalPath()+"/"+(*it); |
1542 | cmd = "ln -s "+curFile+" "+destName; | 1538 | cmd = "ln -s "+curFile+" "+destName; |
1543 | system(cmd.latin1() ); | 1539 | qDebug(cmd); |
1544 | populateRemoteView(); | 1540 | system(cmd.latin1() ); |
1541 | } | ||
1542 | populateRemoteView(); | ||
1543 | TabWidget->setCurrentPage(1); | ||
1545 | } else { | 1544 | } else { |
1546 | QString curFile = Remote_View->currentItem()->text(0); | 1545 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1547 | if(curFile.right(1) == "/") curFile = curFile.left(curFile.length() - 1); | 1546 | |
1548 | QString destName = currentDir.canonicalPath()+"/"+curFile; | 1547 | QString destName = currentDir.canonicalPath()+"/"+(*it); |
1549 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 1548 | QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1550 | cmd = "ln -s "+curFile+" "+destName; | 1549 | |
1551 | system(cmd.latin1() ); | 1550 | cmd = "ln -s "+curFile+" "+destName; |
1552 | populateLocalView(); | 1551 | qDebug(cmd); |
1552 | system(cmd.latin1() ); | ||
1553 | } | ||
1554 | populateLocalView(); | ||
1555 | TabWidget->setCurrentPage(0); | ||
1553 | } | 1556 | } |
1554 | } | 1557 | } |