From c72b7e02defdbcc1f2b6b4ff38f256486cfaeec7 Mon Sep 17 00:00:00 2001 From: llornkcor Date: Thu, 17 Jul 2003 13:14:32 +0000 Subject: some crazy characters fixing --- (limited to 'noncore/apps/advancedfm/advancedfm.cpp') diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 60558e7..77dca49 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp @@ -121,54 +121,43 @@ void AdvancedFm::populateView() const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); QFileInfoListIterator it(*list); QFileInfo *fi; - while ( (fi=it.current()) ) - { - if (fi->isSymLink() ) - { + while ( (fi=it.current()) ) { + if (fi->isSymLink() ) { QString symLink=fi->readLink(); QFileInfo sym( symLink); fileS.sprintf( "%10i", sym.size() ); - fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.filePath().data() ); + fileL = fi->fileName() +" -> " + sym.filePath().data(); fileDate = sym.lastModified().toString(); - } - else - { + } else { fileS.sprintf( "%10i", fi->size() ); - fileL.sprintf( "%s",fi->fileName().data() ); + fileL = fi->fileName(); fileDate= fi->lastModified().toString(); - if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) - { + if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) { fileL+="/"; isDir=TRUE; } } - QFileInfo fileInfo( path + "/" + fileL); - if(fileL !="./" && fi->exists()) - { - item= new QListViewItem( thisView, fileL, fileS , fileDate); + if(fileL !="./" && fi->exists()) { + item = new QListViewItem( thisView, fileL, fileS , fileDate); - if(isDir || fileL.find("/",0,TRUE) != -1) - { + if(isDir || fileL.find("/",0,TRUE) != -1) { if( !QDir( fi->filePath() ).isReadable()) //is directory pm = Resource::loadPixmap( "lockedfolder" ); else pm= Resource::loadPixmap( "folder" ); } - else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) - { - pm = Resource::loadPixmap( "exec"); + else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { + pm = Resource::loadPixmap( "exec"); } else if( (fileInfo.permission( QFileInfo::ExeUser) | fileInfo.permission( QFileInfo::ExeGroup) - | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) - { + | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { pm = Resource::loadPixmap( "exec"); } - else if( !fi->isReadable() ) - { + else if( !fi->isReadable() ) { pm = Resource::loadPixmap( "locked" ); } else { //everything else goes by mimetype @@ -178,14 +167,14 @@ void AdvancedFm::populateView() pm = unknownXpm; } } - 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 ) ); + if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) { + // qDebug(" overlay link image"); + pm= Resource::loadPixmap( "advancedfm/symlink" ); + // 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); @@ -194,24 +183,21 @@ void AdvancedFm::populateView() ++it; } - if( path.find("dev",0,TRUE) != -1) - { + if( path.find("dev",0,TRUE) != -1) { struct stat buf; dev_t devT; DIR *dir; struct dirent *mydirent; if((dir = opendir( path.latin1())) != NULL) - while ((mydirent = readdir(dir)) != NULL) - { + while ((mydirent = readdir(dir)) != NULL) { lstat( mydirent->d_name, &buf); // qDebug(mydirent->d_name); fileL.sprintf("%s", mydirent->d_name); devT = buf.st_dev; fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); fileDate.sprintf("%s", ctime( &buf.st_mtime)); - if( fileL.find(".") == -1 ) - { + if( fileL.find(".") == -1 ) { item= new QListViewItem( thisView, fileL, fileS, fileDate); pm = unknownXpm; item->setPixmap( 0,pm); @@ -680,16 +666,15 @@ void AdvancedFm::addToDocs() QStringList strListPaths = getPath(); QDir *thisDir = CurrentDir(); - if( strListPaths.count() > 0) - { + if( strListPaths.count() > 0) { QString curFile; - for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) - { + for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { curFile = thisDir->canonicalPath()+"/"+(*it); // qDebug(curFile); + QFileInfo fi(curFile); DocLnk f; // curFile.replace(QRegExp("\\..*"),""); - f.setName((*it)); + f.setName(fi.baseName() ); f.setFile( curFile); f.writeLink(); } -- cgit v0.9.0.2