-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 7cd8644..b224deb 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp @@ -275,97 +275,98 @@ void AdvancedFm::tabChanged(QWidget *w) void AdvancedFm::populateLocalView() { QPixmap pm; Local_View->clear(); currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); currentDir.setMatchAllDirs(TRUE); currentDir.setNameFilter(filterStr); QString fileL, fileS, fileDate; // qDebug(currentDir.canonicalPath()); // struct stat buf; // mode_t mode; QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); setCaption("AdvancedFm :: "+fs); bool isDir=FALSE; const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); QFileInfoListIterator it(*list); QFileInfo *fi; while ( (fi=it.current()) ) { if (fi->isSymLink() ) { QString symLink=fi->readLink(); // qDebug("Symlink detected "+symLink); QFileInfo sym( symLink); fileS.sprintf( "%10li", sym.size() ); fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); fileDate = sym.lastModified().toString(); } else { fileS.sprintf( "%10li", fi->size() ); fileL.sprintf( "%s",fi->fileName().data() ); fileDate= fi->lastModified().toString(); if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) { fileL+="/"; isDir=TRUE; // qDebug( fileL); } } QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); if(fileL !="./" && fi->exists()) { item= new QListViewItem( Local_View, fileL, fileS , fileDate); if(isDir || fileL.find("/",0,TRUE) != -1) { if( !QDir( fi->filePath() ).isReadable()) //is directory pm = Resource::loadPixmap( "lockedfolder" ); else pm= Resource::loadPixmap( "folder" ); // item->setPixmap( 0,pm ); } else if( (fileInfo.permission( QFileInfo::ExeUser) | fileInfo.permission( QFileInfo::ExeGroup) - | fileInfo.permission( QFileInfo::ExeOther)) & fs.find("vfat",0,TRUE) == -1) { + | fileInfo.permission( QFileInfo::ExeOther)) + | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { pm = Resource::loadPixmap( "exec"); // else { //is exec // pm = Resource::loadPixmap( "exec"); // } // // item->setPixmap( 0,pm); } else if( !fi->isReadable() ) { pm = Resource::loadPixmap( "locked" ); // item->setPixmap( 0,pm); } else { //everything else goes by mimetype MimeType mt(fi->filePath()); pm=mt.pixmap(); //sets the correct pixmap for mimetype if(pm.isNull()) pm = Resource::loadPixmap( "UnknownDocument-14" ); // item->setPixmap( 0,pm); } item->setPixmap( 0,pm); if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { // overlay link image pm= Resource::loadPixmap( "folder" ); QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); QPainter painter( &pm ); painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); pm.setMask( pm.createHeuristicMask( FALSE ) ); item->setPixmap( 0, pm); } } isDir=FALSE; ++it; } if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { struct stat buf; // struct stat st; dev_t devT; // mode_t mode; DIR *dir; // int fd = 0; struct dirent *mydirent; // int i = 1; if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) while ((mydirent = readdir(dir)) != NULL) { lstat( mydirent->d_name, &buf); qDebug(mydirent->d_name); // mode = buf.st_mode; fileL.sprintf("%s", mydirent->d_name); // fileS.sprintf("%d, %d", ); //this isn't correct devT = buf.st_dev; fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); @@ -397,97 +398,98 @@ void AdvancedFm::populateRemoteView() // QFileInfo fi(localFile); // } // } QPixmap pm; Remote_View->clear(); currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); currentRemoteDir.setMatchAllDirs(TRUE); currentRemoteDir.setNameFilter(filterStr); QString fileL, fileS, fileDate; QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); setCaption("AdvancedFm :: "+fs); bool isDir=FALSE; const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); QFileInfoListIterator it(*list); QFileInfo *fi; while ( (fi=it.current()) ) { if (fi->isSymLink() ){ QString symLink=fi->readLink(); // qDebug("Symlink detected "+symLink); QFileInfo sym( symLink); fileS.sprintf( "%10li", sym.size() ); fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); fileDate = sym.lastModified().toString(); } else { // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); fileS.sprintf( "%10li", fi->size() ); fileL.sprintf( "%s",fi->fileName().data() ); fileDate= fi->lastModified().toString(); if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { fileL+="/"; isDir=TRUE; // qDebug( fileL); } } QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); if(fileL !="./" && fi->exists()) { item= new QListViewItem( Remote_View, fileL, fileS, fileDate); QPixmap pm; if(isDir || fileL.find("/",0,TRUE) != -1) { if( !QDir( fi->filePath() ).isReadable()) pm = Resource::loadPixmap( "lockedfolder" ); else pm= Resource::loadPixmap( "folder" ); // item->setPixmap( 0,pm ); } else if( (fileInfo.permission( QFileInfo::ExeUser) | fileInfo.permission( QFileInfo::ExeGroup) - | fileInfo.permission( QFileInfo::ExeOther)) & fs.find("vfat",0,TRUE) == -1) { + | fileInfo.permission( QFileInfo::ExeOther)) + | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { ///// } else if(fileInfo.isExecutable()){ //is exec <<<< BROKEN!! pm = Resource::loadPixmap( "exec"); // item->setPixmap( 0,pm); } else if( !fi->isReadable() ) { pm = Resource::loadPixmap( "locked" ); // item->setPixmap( 0,pm); } else { MimeType mt(fi->filePath()); pm=mt.pixmap(); //sets the correct pixmap for mimetype if(pm.isNull()) pm = Resource::loadPixmap( "UnknownDocument-14" ); // item->setPixmap( 0,pm); } if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { // overlay link image pm= Resource::loadPixmap( "folder" ); QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); QPainter painter( &pm ); painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); pm.setMask( pm.createHeuristicMask( FALSE ) ); // item->setPixmap( 0, pm); } item->setPixmap( 0, pm); } isDir=FALSE; ++it; } if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { struct stat buf; // struct stat st; // mode_t mode; DIR *dir; // int fd = 0; struct dirent *mydirent; // int i = 1; if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) while ((mydirent = readdir(dir)) != NULL) { lstat( mydirent->d_name, &buf); qDebug(mydirent->d_name); // mode = buf.st_mode; fileL.sprintf("%s", mydirent->d_name); // fileS.sprintf("%d, %d", ); //this isn't correct fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); fileDate.sprintf("%s", ctime( &buf.st_mtime)); if( fileL.find(".") == -1 ){ item= new QListViewItem( Remote_View, fileL, fileS, fileDate); pm = Resource::loadPixmap( "UnknownDocument-14" ); |