summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2004-09-25 06:21:43 (UTC)
committer llornkcor <llornkcor>2004-09-25 06:21:43 (UTC)
commit448e2835ff7b84162022b62f8570935739a167bb (patch) (unidiff)
tree57cbbc4e2a6a87119df7240a346b256314e99910
parentc47a2d0e8ec283737f7c43474be4cf8070cde046 (diff)
downloadopie-448e2835ff7b84162022b62f8570935739a167bb.zip
opie-448e2835ff7b84162022b62f8570935739a167bb.tar.gz
opie-448e2835ff7b84162022b62f8570935739a167bb.tar.bz2
change message
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index 6f017b4..ec7a08a 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -104,389 +104,390 @@ void AdvancedFm::populateView() {
104 104
105 thisView->clear(); 105 thisView->clear();
106 thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 106 thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
107 thisDir->setMatchAllDirs(TRUE); 107 thisDir->setMatchAllDirs(TRUE);
108 thisDir->setNameFilter(filterStr); 108 thisDir->setNameFilter(filterStr);
109 QString fileL, fileS, fileDate; 109 QString fileL, fileS, fileDate;
110 QString fs= getFileSystemType((const QString &) path); 110 QString fs= getFileSystemType((const QString &) path);
111 setCaption(tr("AdvancedFm :: ")+fs+" :: " 111 setCaption(tr("AdvancedFm :: ")+fs+" :: "
112 +checkDiskSpace((const QString &) path)+ tr(" kB free") ); 112 +checkDiskSpace((const QString &) path)+ tr(" kB free") );
113 bool isDir=FALSE; 113 bool isDir=FALSE;
114 const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 114 const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
115 QFileInfoListIterator it(*list); 115 QFileInfoListIterator it(*list);
116 QFileInfo *fi; 116 QFileInfo *fi;
117 while ( (fi=it.current()) ) { 117 while ( (fi=it.current()) ) {
118 if (fi->isSymLink() ) { 118 if (fi->isSymLink() ) {
119 QString symLink=fi->readLink(); 119 QString symLink=fi->readLink();
120 QFileInfo sym( symLink); 120 QFileInfo sym( symLink);
121 fileS.sprintf( "%10i", sym.size() ); 121 fileS.sprintf( "%10i", sym.size() );
122 fileL = fi->fileName() +" -> " + sym.filePath().data(); 122 fileL = fi->fileName() +" -> " + sym.filePath().data();
123 fileDate = sym.lastModified().toString(); 123 fileDate = sym.lastModified().toString();
124 } else { 124 } else {
125 fileS.sprintf( "%10i", fi->size() ); 125 fileS.sprintf( "%10i", fi->size() );
126 fileL = fi->fileName(); 126 fileL = fi->fileName();
127 fileDate= fi->lastModified().toString(); 127 fileDate= fi->lastModified().toString();
128 if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) { 128 if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) {
129// if(fileL == "..") 129// if(fileL == "..")
130 fileL += "/"; 130 fileL += "/";
131 isDir=TRUE; 131 isDir=TRUE;
132 } 132 }
133 } 133 }
134 QFileInfo fileInfo( path + "/" + fileL); 134 QFileInfo fileInfo( path + "/" + fileL);
135 135
136 if(fileL !="./" && fi->exists()) { 136 if(fileL !="./" && fi->exists()) {
137 item = new QListViewItem( thisView, fileL, fileS , fileDate); 137 item = new QListViewItem( thisView, fileL, fileS , fileDate);
138 138
139 if(isDir || fileL.find("/",0,TRUE) != -1) { 139 if(isDir || fileL.find("/",0,TRUE) != -1) {
140 140
141 if( !QDir( fi->filePath() ).isReadable()) //is directory 141 if( !QDir( fi->filePath() ).isReadable()) //is directory
142 pm = Resource::loadPixmap( "lockedfolder" ); 142 pm = Resource::loadPixmap( "lockedfolder" );
143 else 143 else
144 pm= Resource::loadPixmap( "folder" ); 144 pm= Resource::loadPixmap( "folder" );
145 } 145 }
146 else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 146 else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
147 pm = Resource::loadPixmap( "exec"); 147 pm = Resource::loadPixmap( "exec");
148 } 148 }
149 else if( (fileInfo.permission( QFileInfo::ExeUser) 149 else if( (fileInfo.permission( QFileInfo::ExeUser)
150 | fileInfo.permission( QFileInfo::ExeGroup) 150 | fileInfo.permission( QFileInfo::ExeGroup)
151 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) { 151 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) {
152 pm = Resource::loadPixmap( "exec"); 152 pm = Resource::loadPixmap( "exec");
153 } 153 }
154 else if( !fi->isReadable() ) { 154 else if( !fi->isReadable() ) {
155 pm = Resource::loadPixmap( "locked" ); 155 pm = Resource::loadPixmap( "locked" );
156 } 156 }
157 else { //everything else goes by mimetype 157 else { //everything else goes by mimetype
158 MimeType mt(fi->filePath()); 158 MimeType mt(fi->filePath());
159 pm=mt.pixmap(); //sets the correct pixmap for mimetype 159 pm=mt.pixmap(); //sets the correct pixmap for mimetype
160 if(pm.isNull()) { 160 if(pm.isNull()) {
161 pm = unknownXpm; 161 pm = unknownXpm;
162 } 162 }
163 } 163 }
164 if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) { 164 if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) {
165 // odebug << " overlay link image" << oendl; 165 // odebug << " overlay link image" << oendl;
166 pm= Resource::loadPixmap( "advancedfm/symlink" ); 166 pm= Resource::loadPixmap( "advancedfm/symlink" );
167 // pm= Resource::loadPixmap( "folder" ); 167 // pm= Resource::loadPixmap( "folder" );
168// QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 168// QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
169// QPainter painter( &pm ); 169// QPainter painter( &pm );
170// painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 170// painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
171// pm.setMask( pm.createHeuristicMask( FALSE ) ); 171// pm.setMask( pm.createHeuristicMask( FALSE ) );
172 } 172 }
173 item->setPixmap( 0,pm); 173 item->setPixmap( 0,pm);
174 174
175 } 175 }
176 isDir=FALSE; 176 isDir=FALSE;
177 ++it; 177 ++it;
178 } 178 }
179 179
180 if( path.find("dev",0,TRUE) != -1) { 180 if( path.find("dev",0,TRUE) != -1) {
181 struct stat buf; 181 struct stat buf;
182 dev_t devT; 182 dev_t devT;
183 DIR *dir; 183 DIR *dir;
184 struct dirent *mydirent; 184 struct dirent *mydirent;
185 185
186 if((dir = opendir( path.latin1())) != NULL) 186 if((dir = opendir( path.latin1())) != NULL)
187 while ((mydirent = readdir(dir)) != NULL) { 187 while ((mydirent = readdir(dir)) != NULL) {
188 lstat( mydirent->d_name, &buf); 188 lstat( mydirent->d_name, &buf);
189// odebug << mydirent->d_name << oendl; 189// odebug << mydirent->d_name << oendl;
190 fileL.sprintf("%s", mydirent->d_name); 190 fileL.sprintf("%s", mydirent->d_name);
191 devT = buf.st_dev; 191 devT = buf.st_dev;
192 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); 192 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF);
193 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 193 fileDate.sprintf("%s", ctime( &buf.st_mtime));
194 if( fileL.find(".") == -1 ) { 194 if( fileL.find(".") == -1 ) {
195 item= new QListViewItem( thisView, fileL, fileS, fileDate); 195 item= new QListViewItem( thisView, fileL, fileS, fileDate);
196 pm = unknownXpm; 196 pm = unknownXpm;
197 item->setPixmap( 0,pm); 197 item->setPixmap( 0,pm);
198 } 198 }
199 } 199 }
200 200
201 closedir(dir); 201 closedir(dir);
202 } 202 }
203 203
204 thisView->setSorting( 3,FALSE); 204 thisView->setSorting( 3,FALSE);
205 fillCombo( (const QString &) path ); 205 fillCombo( (const QString &) path );
206} 206}
207 207
208void AdvancedFm::rePopulate() { 208void AdvancedFm::rePopulate() {
209 // qDebug("repopulate views"); 209 // qDebug("repopulate views");
210 populateView(); 210 populateView();
211 setOtherTabCurrent(); 211 setOtherTabCurrent();
212 populateView(); 212 populateView();
213 213
214// int tmpTab = whichTab; 214// int tmpTab = whichTab;
215// // odebug << "" << tmpTab << "" << oendl; 215// // odebug << "" << tmpTab << "" << oendl;
216 216
217// for(int i =1; i < 3; i++) { 217// for(int i =1; i < 3; i++) {
218// TabWidget->setCurrentWidget(i - 1); 218// TabWidget->setCurrentWidget(i - 1);
219// populateView(); 219// populateView();
220// } 220// }
221// TabWidget->setCurrentWidget( tmpTab - 1); 221// TabWidget->setCurrentWidget( tmpTab - 1);
222} 222}
223 223
224void AdvancedFm::ListClicked(QListViewItem *selectedItem) { 224void AdvancedFm::ListClicked(QListViewItem *selectedItem) {
225 // if ( TabWidget->currentWidget() == tab) 225 // if ( TabWidget->currentWidget() == tab)
226 // qDebug("XXXXXXXXXXXXXXXXXXXXXXXX ListClicked local"); 226 // qDebug("XXXXXXXXXXXXXXXXXXXXXXXX ListClicked local");
227 // else 227 // else
228 // qDebug("XXXXXXXXXXXXXXXXXXXXXXXX ListClicked remote"); 228 // qDebug("XXXXXXXXXXXXXXXXXXXXXXXX ListClicked remote");
229 229
230 230
231 if(selectedItem) { 231 if(selectedItem) {
232 QString strItem=selectedItem->text(0); 232 QString strItem=selectedItem->text(0);
233// owarn << strItem << oendl; 233// owarn << strItem << oendl;
234 QString strSize=selectedItem->text(1); 234 QString strSize=selectedItem->text(1);
235 strSize=strSize.stripWhiteSpace(); 235 strSize=strSize.stripWhiteSpace();
236 bool isDirectory = false; 236 bool isDirectory = false;
237 QString strItem2; 237 QString strItem2;
238 238
239 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink 239 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink
240 strItem2 = dealWithSymName((const QString&)strItem); 240 strItem2 = dealWithSymName((const QString&)strItem);
241 if(QDir(strItem2).exists() ) 241 if(QDir(strItem2).exists() )
242 strItem = strItem2; 242 strItem = strItem2;
243 } 243 }
244 244
245 if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 245 if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
246 246
247 if(QDir(strItem).exists()) 247 if(QDir(strItem).exists())
248 isDirectory = true; 248 isDirectory = true;
249 } 249 }
250 250
251 if( isDirectory ) { 251 if( isDirectory ) {
252 CurrentDir()->cd( strItem, TRUE); 252 CurrentDir()->cd( strItem, TRUE);
253 populateView(); 253 populateView();
254 CurrentView()->ensureItemVisible( CurrentView()->firstChild()); 254 CurrentView()->ensureItemVisible( CurrentView()->firstChild());
255 } 255 }
256 chdir( strItem.latin1()); 256 chdir( strItem.latin1());
257 } 257 }
258} 258}
259 259
260void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) { 260void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) {
261 Q_UNUSED(item); 261 Q_UNUSED(item);
262 switch (mouse) { 262 switch (mouse) {
263 case 1: 263 case 1:
264 { 264 {
265 if(renameBox != 0 ) { 265 if(renameBox != 0 ) {
266 cancelRename(); 266 cancelRename();
267 } 267 }
268 } 268 }
269 break; 269 break;
270// case 2: 270// case 2:
271// menuTimer.start( 50, TRUE ); 271// menuTimer.start( 50, TRUE );
272// break; 272// break;
273 }; 273 };
274} 274}
275 275
276 276
277void AdvancedFm::refreshCurrentTab() { 277void AdvancedFm::refreshCurrentTab() {
278 populateView(); 278 populateView();
279 // if ( TabWidget->currentWidget() == tab) { 279 // if ( TabWidget->currentWidget() == tab) {
280 280
281} 281}
282 282
283void AdvancedFm::switchToLocalTab() { 283void AdvancedFm::switchToLocalTab() {
284 TabWidget->setCurrentWidget(0); 284 TabWidget->setCurrentWidget(0);
285 // Local_View->setFocus(); 285 // Local_View->setFocus();
286 whichTab = 1; 286 whichTab = 1;
287} 287}
288 288
289void AdvancedFm::switchToRemoteTab() { 289void AdvancedFm::switchToRemoteTab() {
290 TabWidget->setCurrentWidget(1); 290 TabWidget->setCurrentWidget(1);
291 // Remote_View->setFocus(); 291 // Remote_View->setFocus();
292 whichTab = 2; 292 whichTab = 2;
293} 293}
294 294
295void AdvancedFm::currentPathComboChanged() { 295void AdvancedFm::currentPathComboChanged() {
296 if(QDir( currentPathCombo->lineEdit()->text()).exists()) { 296 QString pDir = currentPathCombo->lineEdit()->text();
297 CurrentDir()->setPath( currentPathCombo->lineEdit()->text() ); 297 if(QDir(pDir).exists()) {
298 CurrentDir()->setPath(pDir );
298 populateView(); 299 populateView();
299 } else { 300 } else {
300 QMessageBox::message(tr("Note"),tr("<p>That directory does not exist</p>")); 301 QMessageBox::message(tr("Note"),tr("<p>%1 does not exist</p>").arg(pDir));
301 } 302 }
302} 303}
303 304
304void AdvancedFm::fillCombo(const QString &currentPath) { 305void AdvancedFm::fillCombo(const QString &currentPath) {
305 306
306 if ( TabWidget->currentWidget() == tab) { 307 if ( TabWidget->currentWidget() == tab) {
307// if ( whichTab == 1) { 308// if ( whichTab == 1) {
308 currentPathCombo->lineEdit()->setText( currentPath); 309 currentPathCombo->lineEdit()->setText( currentPath);
309 if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { 310 if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) {
310 currentPathCombo->clear(); 311 currentPathCombo->clear();
311 localDirPathStringList.prepend( currentPath ); 312 localDirPathStringList.prepend( currentPath );
312 currentPathCombo->insertStringList( localDirPathStringList,-1); 313 currentPathCombo->insertStringList( localDirPathStringList,-1);
313 } 314 }
314 } else { 315 } else {
315 currentPathCombo->lineEdit()->setText( currentPath); 316 currentPathCombo->lineEdit()->setText( currentPath);
316 if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { 317 if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) {
317 currentPathCombo->clear(); 318 currentPathCombo->clear();
318 remoteDirPathStringList.prepend( currentPath ); 319 remoteDirPathStringList.prepend( currentPath );
319 currentPathCombo->insertStringList( remoteDirPathStringList,-1); 320 currentPathCombo->insertStringList( remoteDirPathStringList,-1);
320 } 321 }
321 } 322 }
322} 323}
323 324
324QStringList AdvancedFm::getPath() { 325QStringList AdvancedFm::getPath() {
325 QStringList strList; 326 QStringList strList;
326 QListView *thisView=CurrentView(); 327 QListView *thisView=CurrentView();
327 QList<QListViewItem> * getSelectedItems( QListView * thisView ); 328 QList<QListViewItem> * getSelectedItems( QListView * thisView );
328 QListViewItemIterator it( thisView ); 329 QListViewItemIterator it( thisView );
329 for ( ; it.current(); ++it ) { 330 for ( ; it.current(); ++it ) {
330 if ( it.current()->isSelected() ) { 331 if ( it.current()->isSelected() ) {
331 strList << it.current()->text(0); 332 strList << it.current()->text(0);
332// odebug << it.current()->text(0) << oendl; 333// odebug << it.current()->text(0) << oendl;
333 } 334 }
334 } 335 }
335 return strList; 336 return strList;
336} 337}
337 338
338void AdvancedFm::changeTo(const QString dir) { 339void AdvancedFm::changeTo(const QString dir) {
339 chdir( dir.latin1()); 340 chdir( dir.latin1());
340 CurrentDir()->cd(dir, TRUE); 341 CurrentDir()->cd(dir, TRUE);
341 populateView(); 342 populateView();
342 update(); 343 update();
343} 344}
344 345
345void AdvancedFm::homeButtonPushed() { 346void AdvancedFm::homeButtonPushed() {
346 changeTo(QDir::homeDirPath()); 347 changeTo(QDir::homeDirPath());
347} 348}
348 349
349void AdvancedFm::docButtonPushed() { 350void AdvancedFm::docButtonPushed() {
350 changeTo(QPEApplication::documentDir()); 351 changeTo(QPEApplication::documentDir());
351} 352}
352 353
353void AdvancedFm::SDButtonPushed() { 354void AdvancedFm::SDButtonPushed() {
354 changeTo("/mnt/card");// this can change so fix 355 changeTo("/mnt/card");// this can change so fix
355} 356}
356 357
357void AdvancedFm::CFButtonPushed() { 358void AdvancedFm::CFButtonPushed() {
358 if(zaurusDevice) 359 if(zaurusDevice)
359 changeTo("/mnt/cf"); //zaurus 360 changeTo("/mnt/cf"); //zaurus
360 else 361 else
361 changeTo("/mnt/hda"); //ipaq 362 changeTo("/mnt/hda"); //ipaq
362} 363}
363 364
364void AdvancedFm::QPEButtonPushed() { 365void AdvancedFm::QPEButtonPushed() {
365 changeTo(QPEApplication::qpeDir()); 366 changeTo(QPEApplication::qpeDir());
366} 367}
367 368
368void AdvancedFm::doAbout() { 369void AdvancedFm::doAbout() {
369 QMessageBox::message("AdvancedFm",tr("<P>Advanced FileManager is copyright 2002-2003 by L.J.Potter<llornkcor@handhelds.org> and is licensed by the GPL</P>")); 370 QMessageBox::message("AdvancedFm",tr("<P>Advanced FileManager is copyright 2002-2003 by L.J.Potter<llornkcor@handhelds.org> and is licensed by the GPL</P>"));
370} 371}
371 372
372void AdvancedFm::keyPressEvent( QKeyEvent *e) { 373void AdvancedFm::keyPressEvent( QKeyEvent *e) {
373 Q_UNUSED(e); 374 Q_UNUSED(e);
374} 375}
375 376
376void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { 377void AdvancedFm::keyReleaseEvent( QKeyEvent *e) {
377// if( CurrentView()->hasFocus() ) 378// if( CurrentView()->hasFocus() )
378// e->ignore(); 379// e->ignore();
379 if( currentPathCombo->lineEdit()->hasFocus()) { 380 if( currentPathCombo->lineEdit()->hasFocus()) {
380 // qDebug("shout!"); 381 // qDebug("shout!");
381 } 382 }
382 383
383 else if( e->key() == Key_Left ) 384 else if( e->key() == Key_Left )
384 upDir(); 385 upDir();
385 else if( e->key() == Key_Return || e->key() == Key_Enter) 386 else if( e->key() == Key_Return || e->key() == Key_Enter)
386 navigateToSelected(); 387 navigateToSelected();
387 else if( e->key() == Key_Tab) 388 else if( e->key() == Key_Tab)
388 setOtherTabCurrent(); 389 setOtherTabCurrent();
389 else if( e->key() == Key_Delete ) 390 else if( e->key() == Key_Delete )
390 del(); 391 del();
391 else if( e->key() == Key_A) 392 else if( e->key() == Key_A)
392 copyAs(); 393 copyAs();
393 else if( e->key() == Key_C) 394 else if( e->key() == Key_C)
394 copy(); 395 copy();
395 else if( e->key() == Key_E) 396 else if( e->key() == Key_E)
396 runThis(); 397 runThis();
397 else if( e->key() == Key_G) 398 else if( e->key() == Key_G)
398 currentPathCombo->lineEdit()->setFocus(); 399 currentPathCombo->lineEdit()->setFocus();
399 else if( e->key() == Key_H ) 400 else if( e->key() == Key_H )
400 showHidden(); 401 showHidden();
401 else if( e->key() == Key_I) 402 else if( e->key() == Key_I)
402 fileStatus(); 403 fileStatus();
403 else if( e->key() == Key_M) 404 else if( e->key() == Key_M)
404 move(); 405 move();
405 else if( e->key() == Key_N ) 406 else if( e->key() == Key_N )
406 mkDir(); 407 mkDir();
407 else if( e->key() == Key_P) 408 else if( e->key() == Key_P)
408 filePerms(); 409 filePerms();
409 else if( e->key() == Key_R ) 410 else if( e->key() == Key_R )
410 rn(); 411 rn();
411 else if( e->key() == Key_U ) 412 else if( e->key() == Key_U )
412 upDir(); 413 upDir();
413 else if( e->key() == Key_1) 414 else if( e->key() == Key_1)
414 switchToLocalTab(); 415 switchToLocalTab();
415 else if( e->key() == Key_2) 416 else if( e->key() == Key_2)
416 switchToRemoteTab(); 417 switchToRemoteTab();
417 else if( e->key() == Key_3) 418 else if( e->key() == Key_3)
418 CFButtonPushed(); 419 CFButtonPushed();
419 else if( e->key() == Key_4) 420 else if( e->key() == Key_4)
420 SDButtonPushed(); 421 SDButtonPushed();
421 else if( e->key() == Key_5 ) 422 else if( e->key() == Key_5 )
422 homeButtonPushed(); 423 homeButtonPushed();
423 else if( e->key() == Key_6 ) 424 else if( e->key() == Key_6 )
424 docButtonPushed(); 425 docButtonPushed();
425 else 426 else
426 e->accept(); 427 e->accept();
427} 428}
428 429
429 430
430void AdvancedFm::parsetab(const QString &fileName) { 431void AdvancedFm::parsetab(const QString &fileName) {
431 432
432 fileSystemTypeList.clear(); 433 fileSystemTypeList.clear();
433 fsList.clear(); 434 fsList.clear();
434 struct mntent *me; 435 struct mntent *me;
435 FILE *mntfp = setmntent( fileName.latin1(), "r" ); 436 FILE *mntfp = setmntent( fileName.latin1(), "r" );
436 if ( mntfp ) { 437 if ( mntfp ) {
437 while ( (me = getmntent( mntfp )) != 0 ) { 438 while ( (me = getmntent( mntfp )) != 0 ) {
438 QString deviceName = me->mnt_fsname; 439 QString deviceName = me->mnt_fsname;
439 QString filesystemType = me->mnt_type; 440 QString filesystemType = me->mnt_type;
440 QString mountDir = me->mnt_dir; 441 QString mountDir = me->mnt_dir;
441 if(deviceName != "none") { 442 if(deviceName != "none") {
442 if( fsList.contains(filesystemType) == 0 443 if( fsList.contains(filesystemType) == 0
443 & filesystemType.find("proc",0,TRUE) == -1 444 & filesystemType.find("proc",0,TRUE) == -1
444 & filesystemType.find("cramfs",0,TRUE) == -1 445 & filesystemType.find("cramfs",0,TRUE) == -1
445 & filesystemType.find("auto",0,TRUE) == -1) 446 & filesystemType.find("auto",0,TRUE) == -1)
446 fsList << filesystemType; 447 fsList << filesystemType;
447 fileSystemTypeList << mountDir+"::"+filesystemType; 448 fileSystemTypeList << mountDir+"::"+filesystemType;
448 } 449 }
449 } 450 }
450 } 451 }
451 endmntent( mntfp ); 452 endmntent( mntfp );
452} 453}
453 454
454QString AdvancedFm::getFileSystemType(const QString &currentText) { 455QString AdvancedFm::getFileSystemType(const QString &currentText) {
455 parsetab("/etc/mtab"); //why did TT forget filesystem type? 456 parsetab("/etc/mtab"); //why did TT forget filesystem type?
456 QString current = currentText;//.right( currentText.length()-1); 457 QString current = currentText;//.right( currentText.length()-1);
457 QString baseFs; 458 QString baseFs;
458 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { 459 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) {
459 QString temp = (*it); 460 QString temp = (*it);
460 QString path = temp.left(temp.find("::",0,TRUE) ); 461 QString path = temp.left(temp.find("::",0,TRUE) );
461 path = path.right( path.length()-1); 462 path = path.right( path.length()-1);
462 if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 463 if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
463 if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { 464 if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) {
464 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 465 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
465 } 466 }
466 } 467 }
467 return baseFs; 468 return baseFs;
468} 469}
469 470
470QString AdvancedFm::getDiskSpace( const QString &path) { 471QString AdvancedFm::getDiskSpace( const QString &path) {
471 struct statfs fss; 472 struct statfs fss;
472 if ( !statfs( path.latin1(), &fss ) ) { 473 if ( !statfs( path.latin1(), &fss ) ) {
473 int blkSize = fss.f_bsize; 474 int blkSize = fss.f_bsize;
474 // int totalBlks = fs.f_blocks; 475 // int totalBlks = fs.f_blocks;
475 int availBlks = fss.f_bavail; 476 int availBlks = fss.f_bavail;
476 477
477 long mult = blkSize / 1024; 478 long mult = blkSize / 1024;
478 long div = 1024 / blkSize; 479 long div = 1024 / blkSize;
479 if ( !mult ) mult = 1; 480 if ( !mult ) mult = 1;
480 if ( !div ) div = 1; 481 if ( !div ) div = 1;
481 482
482 return QString::number(availBlks * mult / div); 483 return QString::number(availBlks * mult / div);
483 } 484 }
484 return ""; 485 return "";
485} 486}
486 487
487 488
488void AdvancedFm::showFileMenu() { 489void AdvancedFm::showFileMenu() {
489 QString curApp; 490 QString curApp;
490 curApp = CurrentView()->currentItem()->text(0); 491 curApp = CurrentView()->currentItem()->text(0);
491 492
492 MimeType mt(curApp); 493 MimeType mt(curApp);