author | llornkcor <llornkcor> | 2002-05-01 23:22:28 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-05-01 23:22:28 (UTC) |
commit | 21ddb4ef8f53ac003836535708736b91fd2c9f57 (patch) (unidiff) | |
tree | 116dd5b31b95b457c7331000be5d5f2a9624a8ee /noncore/apps/advancedfm/advancedfm.cpp | |
parent | a3397118d3c384655bedb40210db96ca34adc0c9 (diff) | |
download | opie-21ddb4ef8f53ac003836535708736b91fd2c9f57.zip opie-21ddb4ef8f53ac003836535708736b91fd2c9f57.tar.gz opie-21ddb4ef8f53ac003836535708736b91fd2c9f57.tar.bz2 |
fixed symlink showing linked file instead of name of symlink.
Diffstat (limited to 'noncore/apps/advancedfm/advancedfm.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index a9ba3c2..a378170 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -274,49 +274,49 @@ void AdvancedFm::tabChanged(QWidget *w) | |||
274 | 274 | ||
275 | void AdvancedFm::populateLocalView() | 275 | void AdvancedFm::populateLocalView() |
276 | { | 276 | { |
277 | QPixmap pm; | 277 | QPixmap pm; |
278 | Local_View->clear(); | 278 | Local_View->clear(); |
279 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 279 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
280 | currentDir.setMatchAllDirs(TRUE); | 280 | currentDir.setMatchAllDirs(TRUE); |
281 | currentDir.setNameFilter(filterStr); | 281 | currentDir.setNameFilter(filterStr); |
282 | QString fileL, fileS, fileDate; | 282 | QString fileL, fileS, fileDate; |
283 | // qDebug(currentDir.canonicalPath()); | 283 | // qDebug(currentDir.canonicalPath()); |
284 | // struct stat buf; | 284 | // struct stat buf; |
285 | // mode_t mode; | 285 | // mode_t mode; |
286 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | 286 | QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); |
287 | setCaption("AdvancedFm :: "+fs); | 287 | setCaption("AdvancedFm :: "+fs); |
288 | bool isDir=FALSE; | 288 | bool isDir=FALSE; |
289 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 289 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
290 | QFileInfoListIterator it(*list); | 290 | QFileInfoListIterator it(*list); |
291 | QFileInfo *fi; | 291 | QFileInfo *fi; |
292 | while ( (fi=it.current()) ) { | 292 | while ( (fi=it.current()) ) { |
293 | if (fi->isSymLink() ) { | 293 | if (fi->isSymLink() ) { |
294 | QString symLink=fi->readLink(); | 294 | QString symLink=fi->readLink(); |
295 | // qDebug("Symlink detected "+symLink); | 295 | // qDebug("Symlink detected "+symLink); |
296 | QFileInfo sym( symLink); | 296 | QFileInfo sym( symLink); |
297 | fileS.sprintf( "%10li", sym.size() ); | 297 | fileS.sprintf( "%10li", sym.size() ); |
298 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); | 298 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); |
299 | fileDate = sym.lastModified().toString(); | 299 | fileDate = sym.lastModified().toString(); |
300 | } else { | 300 | } else { |
301 | fileS.sprintf( "%10li", fi->size() ); | 301 | fileS.sprintf( "%10li", fi->size() ); |
302 | fileL.sprintf( "%s",fi->fileName().data() ); | 302 | fileL.sprintf( "%s",fi->fileName().data() ); |
303 | fileDate= fi->lastModified().toString(); | 303 | fileDate= fi->lastModified().toString(); |
304 | if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 304 | if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
305 | fileL+="/"; | 305 | fileL+="/"; |
306 | isDir=TRUE; | 306 | isDir=TRUE; |
307 | // qDebug( fileL); | 307 | // qDebug( fileL); |
308 | } | 308 | } |
309 | } | 309 | } |
310 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); | 310 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); |
311 | if(fileL !="./" && fi->exists()) { | 311 | if(fileL !="./" && fi->exists()) { |
312 | item= new QListViewItem( Local_View, fileL, fileS , fileDate); | 312 | item= new QListViewItem( Local_View, fileL, fileS , fileDate); |
313 | 313 | ||
314 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 314 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
315 | 315 | ||
316 | if( !QDir( fi->filePath() ).isReadable()) //is directory | 316 | if( !QDir( fi->filePath() ).isReadable()) //is directory |
317 | pm = Resource::loadPixmap( "lockedfolder" ); | 317 | pm = Resource::loadPixmap( "lockedfolder" ); |
318 | else | 318 | else |
319 | pm= Resource::loadPixmap( "folder" ); | 319 | pm= Resource::loadPixmap( "folder" ); |
320 | // item->setPixmap( 0,pm ); | 320 | // item->setPixmap( 0,pm ); |
321 | } else if( (fileInfo.permission( QFileInfo::ExeUser) | 321 | } else if( (fileInfo.permission( QFileInfo::ExeUser) |
322 | | fileInfo.permission( QFileInfo::ExeGroup) | 322 | | fileInfo.permission( QFileInfo::ExeGroup) |
@@ -395,76 +395,75 @@ void AdvancedFm::populateRemoteView() | |||
395 | // QString strItem = it.current()->text(0); | 395 | // QString strItem = it.current()->text(0); |
396 | // QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem; | 396 | // QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem; |
397 | // QFileInfo fi(localFile); | 397 | // QFileInfo fi(localFile); |
398 | // } | 398 | // } |
399 | // } | 399 | // } |
400 | QPixmap pm; | 400 | QPixmap pm; |
401 | Remote_View->clear(); | 401 | Remote_View->clear(); |
402 | currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 402 | currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
403 | currentRemoteDir.setMatchAllDirs(TRUE); | 403 | currentRemoteDir.setMatchAllDirs(TRUE); |
404 | currentRemoteDir.setNameFilter(filterStr); | 404 | currentRemoteDir.setNameFilter(filterStr); |
405 | QString fileL, fileS, fileDate; | 405 | QString fileL, fileS, fileDate; |
406 | 406 | ||
407 | QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); | 407 | QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); |
408 | setCaption("AdvancedFm :: "+fs); | 408 | setCaption("AdvancedFm :: "+fs); |
409 | bool isDir=FALSE; | 409 | bool isDir=FALSE; |
410 | const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 410 | const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
411 | QFileInfoListIterator it(*list); | 411 | QFileInfoListIterator it(*list); |
412 | QFileInfo *fi; | 412 | QFileInfo *fi; |
413 | while ( (fi=it.current()) ) { | 413 | while ( (fi=it.current()) ) { |
414 | if (fi->isSymLink() ){ | 414 | if (fi->isSymLink() ){ |
415 | QString symLink=fi->readLink(); | 415 | QString symLink=fi->readLink(); |
416 | // qDebug("Symlink detected "+symLink); | 416 | // qDebug("Symlink detected "+symLink); |
417 | QFileInfo sym( symLink); | 417 | QFileInfo sym( symLink); |
418 | fileS.sprintf( "%10li", sym.size() ); | 418 | fileS.sprintf( "%10li", sym.size() ); |
419 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); | 419 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); |
420 | fileDate = sym.lastModified().toString(); | 420 | fileDate = sym.lastModified().toString(); |
421 | } else { | 421 | } else { |
422 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 422 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
423 | fileS.sprintf( "%10li", fi->size() ); | 423 | fileS.sprintf( "%10li", fi->size() ); |
424 | fileL.sprintf( "%s",fi->fileName().data() ); | 424 | fileL.sprintf( "%s",fi->fileName().data() ); |
425 | fileDate= fi->lastModified().toString(); | 425 | fileDate= fi->lastModified().toString(); |
426 | if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { | 426 | if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { |
427 | fileL+="/"; | 427 | fileL+="/"; |
428 | isDir=TRUE; | 428 | isDir=TRUE; |
429 | // qDebug( fileL); | 429 | // qDebug( fileL); |
430 | } | 430 | } |
431 | } | 431 | } |
432 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); | 432 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); |
433 | if(fileL !="./" && fi->exists()) { | 433 | if(fileL !="./" && fi->exists()) { |
434 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); | 434 | item= new QListViewItem( Remote_View, fileL, fileS, fileDate); |
435 | QPixmap pm; | 435 | QPixmap pm; |
436 | 436 | ||
437 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 437 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
438 | if( !QDir( fi->filePath() ).isReadable()) | 438 | if( !QDir( fi->filePath() ).isReadable()) |
439 | pm = Resource::loadPixmap( "lockedfolder" ); | 439 | pm = Resource::loadPixmap( "lockedfolder" ); |
440 | else | 440 | else |
441 | pm= Resource::loadPixmap( "folder" ); | 441 | pm= Resource::loadPixmap( "folder" ); |
442 | // item->setPixmap( 0,pm ); | 442 | // item->setPixmap( 0,pm ); |
443 | } else if( (fileInfo.permission( QFileInfo::ExeUser) | 443 | } else if( (fileInfo.permission( QFileInfo::ExeUser) |
444 | | fileInfo.permission( QFileInfo::ExeGroup) | 444 | | fileInfo.permission( QFileInfo::ExeGroup) |
445 | | fileInfo.permission( QFileInfo::ExeOther)) & fs.find("vfat",0,TRUE) == -1) { | 445 | | fileInfo.permission( QFileInfo::ExeOther)) & fs.find("vfat",0,TRUE) == -1) { |
446 | pm = Resource::loadPixmap( "exec"); | ||
447 | ///// } else if(fileInfo.isExecutable()){ //is exec <<<< BROKEN!! | 446 | ///// } else if(fileInfo.isExecutable()){ //is exec <<<< BROKEN!! |
448 | pm = Resource::loadPixmap( "exec"); | 447 | pm = Resource::loadPixmap( "exec"); |
449 | // item->setPixmap( 0,pm); | 448 | // item->setPixmap( 0,pm); |
450 | } else if( !fi->isReadable() ) { | 449 | } else if( !fi->isReadable() ) { |
451 | pm = Resource::loadPixmap( "locked" ); | 450 | pm = Resource::loadPixmap( "locked" ); |
452 | // item->setPixmap( 0,pm); | 451 | // item->setPixmap( 0,pm); |
453 | } else { | 452 | } else { |
454 | MimeType mt(fi->filePath()); | 453 | MimeType mt(fi->filePath()); |
455 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 454 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
456 | if(pm.isNull()) | 455 | if(pm.isNull()) |
457 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 456 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
458 | // item->setPixmap( 0,pm); | 457 | // item->setPixmap( 0,pm); |
459 | } | 458 | } |
460 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { | 459 | if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { |
461 | // overlay link image | 460 | // overlay link image |
462 | pm= Resource::loadPixmap( "folder" ); | 461 | pm= Resource::loadPixmap( "folder" ); |
463 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 462 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
464 | QPainter painter( &pm ); | 463 | QPainter painter( &pm ); |
465 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 464 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
466 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 465 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
467 | // item->setPixmap( 0, pm); | 466 | // item->setPixmap( 0, pm); |
468 | } | 467 | } |
469 | item->setPixmap( 0, pm); | 468 | item->setPixmap( 0, pm); |
470 | } | 469 | } |
@@ -1326,52 +1325,52 @@ void AdvancedFm::move() { | |||
1326 | if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){ | 1325 | if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){ |
1327 | success = FALSE; | 1326 | success = FALSE; |
1328 | break; | 1327 | break; |
1329 | } | 1328 | } |
1330 | } | 1329 | } |
1331 | if( success && (bytesRead > 0) ){ | 1330 | if( success && (bytesRead > 0) ){ |
1332 | d.writeBlock( bf, bytesRead ); | 1331 | d.writeBlock( bf, bytesRead ); |
1333 | } | 1332 | } |
1334 | } else { | 1333 | } else { |
1335 | success = FALSE; | 1334 | success = FALSE; |
1336 | } | 1335 | } |
1337 | 1336 | ||
1338 | // Set file permissions | 1337 | // Set file permissions |
1339 | if( stat( (const char *) src, &status ) == 0 ){ | 1338 | if( stat( (const char *) src, &status ) == 0 ){ |
1340 | chmod( (const char *) dest, status.st_mode ); | 1339 | chmod( (const char *) dest, status.st_mode ); |
1341 | } | 1340 | } |
1342 | 1341 | ||
1343 | return success; | 1342 | return success; |
1344 | } | 1343 | } |
1345 | 1344 | ||
1346 | void AdvancedFm::runCommand() { | 1345 | void AdvancedFm::runCommand() { |
1347 | QString curFile; | 1346 | QString curFile; |
1348 | if (TabWidget->currentPageIndex() == 0) { | 1347 | if (TabWidget->currentPageIndex() == 0) { |
1349 | if( Local_View->currentItem()) | 1348 | if( Local_View->currentItem()) |
1350 | curFile = currentDir.canonicalPath() + Local_View->currentItem()->text(0); | 1349 | curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); |
1351 | } else { | 1350 | } else { |
1352 | if(Remote_View->currentItem()) | 1351 | if(Remote_View->currentItem()) |
1353 | curFile = currentRemoteDir.canonicalPath() + Remote_View->currentItem()->text(0); | 1352 | curFile = currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0); |
1354 | } | 1353 | } |
1355 | 1354 | ||
1356 | InputDialog *fileDlg; | 1355 | InputDialog *fileDlg; |
1357 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); | 1356 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); |
1358 | fileDlg->setInputText(curFile); | 1357 | fileDlg->setInputText(curFile); |
1359 | fileDlg->exec(); | 1358 | fileDlg->exec(); |
1360 | QString command; | 1359 | QString command; |
1361 | if( fileDlg->result() == 1 ) { | 1360 | if( fileDlg->result() == 1 ) { |
1362 | command = fileDlg->LineEdit1->text(); | 1361 | command = fileDlg->LineEdit1->text(); |
1363 | 1362 | ||
1364 | // int err=0; | 1363 | // int err=0; |
1365 | Output *outDlg; | 1364 | Output *outDlg; |
1366 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); | 1365 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); |
1367 | outDlg->showMaximized(); | 1366 | outDlg->showMaximized(); |
1368 | outDlg->show(); | 1367 | outDlg->show(); |
1369 | qApp->processEvents(); | 1368 | qApp->processEvents(); |
1370 | FILE *fp; | 1369 | FILE *fp; |
1371 | char line[130]; | 1370 | char line[130]; |
1372 | sleep(1); | 1371 | sleep(1); |
1373 | // if(command.find("2>",0,TRUE) != -1) | 1372 | // if(command.find("2>",0,TRUE) != -1) |
1374 | command +=" 2>&1"; | 1373 | command +=" 2>&1"; |
1375 | fp = popen( (const char *) command, "r"); | 1374 | fp = popen( (const char *) command, "r"); |
1376 | if ( !fp ) { | 1375 | if ( !fp ) { |
1377 | qDebug("Could not execute '" + command + "'! err=%d", fp); | 1376 | qDebug("Could not execute '" + command + "'! err=%d", fp); |