summaryrefslogtreecommitdiff
path: root/noncore/apps/advancedfm/advancedfm.cpp
Unidiff
Diffstat (limited to 'noncore/apps/advancedfm/advancedfm.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp71
1 files changed, 28 insertions, 43 deletions
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()
121 const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 121 const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
122 QFileInfoListIterator it(*list); 122 QFileInfoListIterator it(*list);
123 QFileInfo *fi; 123 QFileInfo *fi;
124 while ( (fi=it.current()) ) 124 while ( (fi=it.current()) ) {
125 { 125 if (fi->isSymLink() ) {
126 if (fi->isSymLink() )
127 {
128 QString symLink=fi->readLink(); 126 QString symLink=fi->readLink();
129 QFileInfo sym( symLink); 127 QFileInfo sym( symLink);
130 fileS.sprintf( "%10i", sym.size() ); 128 fileS.sprintf( "%10i", sym.size() );
131 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.filePath().data() ); 129 fileL = fi->fileName() +" -> " + sym.filePath().data();
132 fileDate = sym.lastModified().toString(); 130 fileDate = sym.lastModified().toString();
133 } 131 } else {
134 else
135 {
136 fileS.sprintf( "%10i", fi->size() ); 132 fileS.sprintf( "%10i", fi->size() );
137 fileL.sprintf( "%s",fi->fileName().data() ); 133 fileL = fi->fileName();
138 fileDate= fi->lastModified().toString(); 134 fileDate= fi->lastModified().toString();
139 if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) 135 if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) {
140 {
141 fileL+="/"; 136 fileL+="/";
142 isDir=TRUE; 137 isDir=TRUE;
143 } 138 }
144 } 139 }
145
146 QFileInfo fileInfo( path + "/" + fileL); 140 QFileInfo fileInfo( path + "/" + fileL);
147 141
148 if(fileL !="./" && fi->exists()) 142 if(fileL !="./" && fi->exists()) {
149 { 143 item = new QListViewItem( thisView, fileL, fileS , fileDate);
150 item= new QListViewItem( thisView, fileL, fileS , fileDate);
151 144
152 if(isDir || fileL.find("/",0,TRUE) != -1) 145 if(isDir || fileL.find("/",0,TRUE) != -1) {
153 {
154 146
155 if( !QDir( fi->filePath() ).isReadable()) //is directory 147 if( !QDir( fi->filePath() ).isReadable()) //is directory
156 pm = Resource::loadPixmap( "lockedfolder" ); 148 pm = Resource::loadPixmap( "lockedfolder" );
157 else 149 else
158 pm= Resource::loadPixmap( "folder" ); 150 pm= Resource::loadPixmap( "folder" );
159 } 151 }
160 else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) 152 else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
161 { 153 pm = Resource::loadPixmap( "exec");
162 pm = Resource::loadPixmap( "exec");
163 } 154 }
164 else if( (fileInfo.permission( QFileInfo::ExeUser) 155 else if( (fileInfo.permission( QFileInfo::ExeUser)
165 | fileInfo.permission( QFileInfo::ExeGroup) 156 | fileInfo.permission( QFileInfo::ExeGroup)
166 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) 157 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) {
167 {
168 pm = Resource::loadPixmap( "exec"); 158 pm = Resource::loadPixmap( "exec");
169 } 159 }
170 else if( !fi->isReadable() ) 160 else if( !fi->isReadable() ) {
171 {
172 pm = Resource::loadPixmap( "locked" ); 161 pm = Resource::loadPixmap( "locked" );
173 } 162 }
174 else { //everything else goes by mimetype 163 else { //everything else goes by mimetype
@@ -178,14 +167,14 @@ void AdvancedFm::populateView()
178 pm = unknownXpm; 167 pm = unknownXpm;
179 } 168 }
180 } 169 }
181 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) 170 if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) {
182 { 171 // qDebug(" overlay link image");
183 // overlay link image 172 pm= Resource::loadPixmap( "advancedfm/symlink" );
184 pm= Resource::loadPixmap( "folder" ); 173 // pm= Resource::loadPixmap( "folder" );
185 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 174// QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
186 QPainter painter( &pm ); 175// QPainter painter( &pm );
187 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 176// painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
188 pm.setMask( pm.createHeuristicMask( FALSE ) ); 177// pm.setMask( pm.createHeuristicMask( FALSE ) );
189 } 178 }
190 item->setPixmap( 0,pm); 179 item->setPixmap( 0,pm);
191 180
@@ -194,24 +183,21 @@ void AdvancedFm::populateView()
194 ++it; 183 ++it;
195 } 184 }
196 185
197 if( path.find("dev",0,TRUE) != -1) 186 if( path.find("dev",0,TRUE) != -1) {
198 {
199 struct stat buf; 187 struct stat buf;
200 dev_t devT; 188 dev_t devT;
201 DIR *dir; 189 DIR *dir;
202 struct dirent *mydirent; 190 struct dirent *mydirent;
203 191
204 if((dir = opendir( path.latin1())) != NULL) 192 if((dir = opendir( path.latin1())) != NULL)
205 while ((mydirent = readdir(dir)) != NULL) 193 while ((mydirent = readdir(dir)) != NULL) {
206 {
207 lstat( mydirent->d_name, &buf); 194 lstat( mydirent->d_name, &buf);
208// qDebug(mydirent->d_name); 195// qDebug(mydirent->d_name);
209 fileL.sprintf("%s", mydirent->d_name); 196 fileL.sprintf("%s", mydirent->d_name);
210 devT = buf.st_dev; 197 devT = buf.st_dev;
211 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); 198 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF);
212 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 199 fileDate.sprintf("%s", ctime( &buf.st_mtime));
213 if( fileL.find(".") == -1 ) 200 if( fileL.find(".") == -1 ) {
214 {
215 item= new QListViewItem( thisView, fileL, fileS, fileDate); 201 item= new QListViewItem( thisView, fileL, fileS, fileDate);
216 pm = unknownXpm; 202 pm = unknownXpm;
217 item->setPixmap( 0,pm); 203 item->setPixmap( 0,pm);
@@ -680,16 +666,15 @@ void AdvancedFm::addToDocs()
680 QStringList strListPaths = getPath(); 666 QStringList strListPaths = getPath();
681 QDir *thisDir = CurrentDir(); 667 QDir *thisDir = CurrentDir();
682 668
683 if( strListPaths.count() > 0) 669 if( strListPaths.count() > 0) {
684 {
685 QString curFile; 670 QString curFile;
686 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) 671 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) {
687 {
688 curFile = thisDir->canonicalPath()+"/"+(*it); 672 curFile = thisDir->canonicalPath()+"/"+(*it);
689// qDebug(curFile); 673// qDebug(curFile);
674 QFileInfo fi(curFile);
690 DocLnk f; 675 DocLnk f;
691// curFile.replace(QRegExp("\\..*"),""); 676// curFile.replace(QRegExp("\\..*"),"");
692 f.setName((*it)); 677 f.setName(fi.baseName() );
693 f.setFile( curFile); 678 f.setFile( curFile);
694 f.writeLink(); 679 f.writeLink();
695 } 680 }