summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-05-02 03:35:28 (UTC)
committer llornkcor <llornkcor>2002-05-02 03:35:28 (UTC)
commita52fd4b1995e34963888397587aa2592ea858da6 (patch) (unidiff)
tree6f8461a8ff72a96078bac6e3a644d33a8b25873a
parentdd8d5784a9ef93b0d4ed7b6d1751942a904ab7cb (diff)
downloadopie-a52fd4b1995e34963888397587aa2592ea858da6.zip
opie-a52fd4b1995e34963888397587aa2592ea858da6.tar.gz
opie-a52fd4b1995e34963888397587aa2592ea858da6.tar.bz2
I hate vfat.. I really do, or maybe I hate the way the kernel deals with it
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index b224deb..f4ca349 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -225,321 +225,322 @@ AdvancedFm::AdvancedFm( )
225 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 7); 225 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 7);
226 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 226 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
227 227
228 connect( currentPathCombo, SIGNAL( activated( const QString & ) ), 228 connect( currentPathCombo, SIGNAL( activated( const QString & ) ),
229 this, SLOT( currentPathComboActivated( const QString & ) ) ); 229 this, SLOT( currentPathComboActivated( const QString & ) ) );
230 230
231 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), 231 connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()),
232 this,SLOT(currentPathComboChanged())); 232 this,SLOT(currentPathComboChanged()));
233 233
234 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 234 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
235 235
236 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 7); 236 layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 7);
237 237
238 filterStr="*"; 238 filterStr="*";
239 b=FALSE; 239 b=FALSE;
240 populateLocalView(); 240 populateLocalView();
241 populateRemoteView(); 241 populateRemoteView();
242} 242}
243 243
244AdvancedFm::~AdvancedFm() 244AdvancedFm::~AdvancedFm()
245{ 245{
246} 246}
247 247
248void AdvancedFm::cleanUp() 248void AdvancedFm::cleanUp()
249{ 249{
250 QString sfile=QDir::homeDirPath(); 250 QString sfile=QDir::homeDirPath();
251 if(sfile.right(1) != "/") 251 if(sfile.right(1) != "/")
252 sfile+="/._temp"; 252 sfile+="/._temp";
253 else 253 else
254 sfile+="._temp"; 254 sfile+="._temp";
255 QFile file( sfile); 255 QFile file( sfile);
256 if(file.exists()) 256 if(file.exists())
257 file.remove(); 257 file.remove();
258} 258}
259 259
260void AdvancedFm::tabChanged(QWidget *w) 260void AdvancedFm::tabChanged(QWidget *w)
261{ 261{
262 if (TabWidget->currentPageIndex() == 0) { 262 if (TabWidget->currentPageIndex() == 0) {
263 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 263 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
264 viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); 264 viewMenu->setItemChecked(viewMenu->idAt(0),TRUE);
265 viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); 265 viewMenu->setItemChecked(viewMenu->idAt(1),FALSE);
266 } 266 }
267 if (TabWidget->currentPageIndex() == 1) { 267 if (TabWidget->currentPageIndex() == 1) {
268 currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath()); 268 currentPathCombo->lineEdit()->setText( currentRemoteDir.canonicalPath());
269 viewMenu->setItemChecked(viewMenu->idAt(1),TRUE); 269 viewMenu->setItemChecked(viewMenu->idAt(1),TRUE);
270 viewMenu->setItemChecked(viewMenu->idAt(0),FALSE); 270 viewMenu->setItemChecked(viewMenu->idAt(0),FALSE);
271 } 271 }
272} 272}
273 273
274 274
275void AdvancedFm::populateLocalView() 275void 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", fi->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 ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
322 pm = Resource::loadPixmap( "exec");
321 } else if( (fileInfo.permission( QFileInfo::ExeUser) 323 } else if( (fileInfo.permission( QFileInfo::ExeUser)
322 | fileInfo.permission( QFileInfo::ExeGroup) 324 | fileInfo.permission( QFileInfo::ExeGroup)
323 | fileInfo.permission( QFileInfo::ExeOther)) 325 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) {
324 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 326 pm = Resource::loadPixmap( "exec");
325 pm = Resource::loadPixmap( "exec");
326// else { //is exec 327// else { //is exec
327// pm = Resource::loadPixmap( "exec"); 328// pm = Resource::loadPixmap( "exec");
328// } 329// }
329// // item->setPixmap( 0,pm); 330// // item->setPixmap( 0,pm);
330 } else if( !fi->isReadable() ) { 331 } else if( !fi->isReadable() ) {
331 pm = Resource::loadPixmap( "locked" ); 332 pm = Resource::loadPixmap( "locked" );
332// item->setPixmap( 0,pm); 333// item->setPixmap( 0,pm);
333 } else { //everything else goes by mimetype 334 } else { //everything else goes by mimetype
334 MimeType mt(fi->filePath()); 335 MimeType mt(fi->filePath());
335 pm=mt.pixmap(); //sets the correct pixmap for mimetype 336 pm=mt.pixmap(); //sets the correct pixmap for mimetype
336 if(pm.isNull()) 337 if(pm.isNull())
337 pm = Resource::loadPixmap( "UnknownDocument-14" ); 338 pm = Resource::loadPixmap( "UnknownDocument-14" );
338// item->setPixmap( 0,pm); 339// item->setPixmap( 0,pm);
339 } 340 }
340 item->setPixmap( 0,pm); 341 item->setPixmap( 0,pm);
341 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { 342 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) {
342 // overlay link image 343 // overlay link image
343 pm= Resource::loadPixmap( "folder" ); 344 pm= Resource::loadPixmap( "folder" );
344 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 345 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
345 QPainter painter( &pm ); 346 QPainter painter( &pm );
346 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 347 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
347 pm.setMask( pm.createHeuristicMask( FALSE ) ); 348 pm.setMask( pm.createHeuristicMask( FALSE ) );
348 item->setPixmap( 0, pm); 349 item->setPixmap( 0, pm);
349 } 350 }
350 } 351 }
351 isDir=FALSE; 352 isDir=FALSE;
352 ++it; 353 ++it;
353 } 354 }
354 355
355 if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) { 356 if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) {
356 struct stat buf; 357 struct stat buf;
357// struct stat st; 358// struct stat st;
358 dev_t devT; 359 dev_t devT;
359// mode_t mode; 360// mode_t mode;
360 DIR *dir; 361 DIR *dir;
361// int fd = 0; 362// int fd = 0;
362 struct dirent *mydirent; 363 struct dirent *mydirent;
363// int i = 1; 364// int i = 1;
364 if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) 365 if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL)
365 while ((mydirent = readdir(dir)) != NULL) { 366 while ((mydirent = readdir(dir)) != NULL) {
366 lstat( mydirent->d_name, &buf); 367 lstat( mydirent->d_name, &buf);
367 qDebug(mydirent->d_name); 368 qDebug(mydirent->d_name);
368// mode = buf.st_mode; 369// mode = buf.st_mode;
369 fileL.sprintf("%s", mydirent->d_name); 370 fileL.sprintf("%s", mydirent->d_name);
370// fileS.sprintf("%d, %d", ); //this isn't correct 371// fileS.sprintf("%d, %d", ); //this isn't correct
371 devT = buf.st_dev; 372 devT = buf.st_dev;
372 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); 373 fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF);
373// fileS.sprintf("%d,%d", devT, devT); 374// fileS.sprintf("%d,%d", devT, devT);
374 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 375 fileDate.sprintf("%s", ctime( &buf.st_mtime));
375 if( fileL.find(".") == -1 ){ 376 if( fileL.find(".") == -1 ){
376 item= new QListViewItem( Local_View, fileL, fileS, fileDate); 377 item= new QListViewItem( Local_View, fileL, fileS, fileDate);
377 pm = Resource::loadPixmap( "UnknownDocument-14" ); 378 pm = Resource::loadPixmap( "UnknownDocument-14" );
378 item->setPixmap( 0,pm); 379 item->setPixmap( 0,pm);
379 } 380 }
380 } 381 }
381 382
382 closedir(dir); 383 closedir(dir);
383 } 384 }
384 385
385 Local_View->setSorting( 3,FALSE); 386 Local_View->setSorting( 3,FALSE);
386 fillCombo( (const QString &) currentDir.canonicalPath()); 387 fillCombo( (const QString &) currentDir.canonicalPath());
387} 388}
388 389
389 390
390void AdvancedFm::populateRemoteView() 391void AdvancedFm::populateRemoteView()
391{ 392{
392// QList<QListViewItem> * getSelectedItems( QListView * Local_View ); 393// QList<QListViewItem> * getSelectedItems( QListView * Local_View );
393// QListViewItemIterator it( Remote_View ); 394// QListViewItemIterator it( Remote_View );
394// for ( ; it.current(); ++it ) { 395// for ( ; it.current(); ++it ) {
395// if ( it.current()->isSelected() ) { 396// if ( it.current()->isSelected() ) {
396// QString strItem = it.current()->text(0); 397// QString strItem = it.current()->text(0);
397// QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem; 398// QString localFile = currentRemoteDir.canonicalPath()+"/"+strItem;
398// QFileInfo fi(localFile); 399// QFileInfo fi(localFile);
399// } 400// }
400// } 401// }
401 QPixmap pm; 402 QPixmap pm;
402 Remote_View->clear(); 403 Remote_View->clear();
403 currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 404 currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
404 currentRemoteDir.setMatchAllDirs(TRUE); 405 currentRemoteDir.setMatchAllDirs(TRUE);
405 currentRemoteDir.setNameFilter(filterStr); 406 currentRemoteDir.setNameFilter(filterStr);
406 QString fileL, fileS, fileDate; 407 QString fileL, fileS, fileDate;
407 408
408 QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); 409 QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath());
409 setCaption("AdvancedFm :: "+fs); 410 setCaption("AdvancedFm :: "+fs);
410 bool isDir=FALSE; 411 bool isDir=FALSE;
411 const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); 412 const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
412 QFileInfoListIterator it(*list); 413 QFileInfoListIterator it(*list);
413 QFileInfo *fi; 414 QFileInfo *fi;
414 while ( (fi=it.current()) ) { 415 while ( (fi=it.current()) ) {
415 if (fi->isSymLink() ){ 416 if (fi->isSymLink() ){
416 QString symLink=fi->readLink(); 417 QString symLink=fi->readLink();
417// qDebug("Symlink detected "+symLink); 418// qDebug("Symlink detected "+symLink);
418 QFileInfo sym( symLink); 419 QFileInfo sym( symLink);
419 fileS.sprintf( "%10li", sym.size() ); 420 fileS.sprintf( "%10li", sym.size() );
420 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); 421 fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() );
421 fileDate = sym.lastModified().toString(); 422 fileDate = sym.lastModified().toString();
422 } else { 423 } else {
423// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); 424// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL);
424 fileS.sprintf( "%10li", fi->size() ); 425 fileS.sprintf( "%10li", fi->size() );
425 fileL.sprintf( "%s",fi->fileName().data() ); 426 fileL.sprintf( "%s",fi->fileName().data() );
426 fileDate= fi->lastModified().toString(); 427 fileDate= fi->lastModified().toString();
427 if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) { 428 if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) {
428 fileL+="/"; 429 fileL+="/";
429 isDir=TRUE; 430 isDir=TRUE;
430// qDebug( fileL); 431// qDebug( fileL);
431 } 432 }
432 } 433 }
433 QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); 434 QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+fileL);
434 if(fileL !="./" && fi->exists()) { 435 if(fileL !="./" && fi->exists()) {
435 item= new QListViewItem( Remote_View, fileL, fileS, fileDate); 436 item= new QListViewItem( Remote_View, fileL, fileS, fileDate);
436 QPixmap pm; 437 QPixmap pm;
437 438
438 if(isDir || fileL.find("/",0,TRUE) != -1) { 439 if(isDir || fileL.find("/",0,TRUE) != -1) {
439 if( !QDir( fi->filePath() ).isReadable()) 440 if( !QDir( fi->filePath() ).isReadable())
440 pm = Resource::loadPixmap( "lockedfolder" ); 441 pm = Resource::loadPixmap( "lockedfolder" );
441 else 442 else
442 pm= Resource::loadPixmap( "folder" ); 443 pm= Resource::loadPixmap( "folder" );
443// item->setPixmap( 0,pm ); 444// item->setPixmap( 0,pm );
445 } else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
446 pm = Resource::loadPixmap( "exec");
444 } else if( (fileInfo.permission( QFileInfo::ExeUser) 447 } else if( (fileInfo.permission( QFileInfo::ExeUser)
445 | fileInfo.permission( QFileInfo::ExeGroup) 448 | fileInfo.permission( QFileInfo::ExeGroup)
446 | fileInfo.permission( QFileInfo::ExeOther)) 449 | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) {
447 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 450 pm = Resource::loadPixmap( "exec");
448///// } else if(fileInfo.isExecutable()){ //is exec <<<< BROKEN!!
449 pm = Resource::loadPixmap( "exec");
450// item->setPixmap( 0,pm); 451// item->setPixmap( 0,pm);
451 } else if( !fi->isReadable() ) { 452 } else if( !fi->isReadable() ) {
452 pm = Resource::loadPixmap( "locked" ); 453 pm = Resource::loadPixmap( "locked" );
453// item->setPixmap( 0,pm); 454// item->setPixmap( 0,pm);
454 } else { 455 } else {
455 MimeType mt(fi->filePath()); 456 MimeType mt(fi->filePath());
456 pm=mt.pixmap(); //sets the correct pixmap for mimetype 457 pm=mt.pixmap(); //sets the correct pixmap for mimetype
457 if(pm.isNull()) 458 if(pm.isNull())
458 pm = Resource::loadPixmap( "UnknownDocument-14" ); 459 pm = Resource::loadPixmap( "UnknownDocument-14" );
459// item->setPixmap( 0,pm); 460// item->setPixmap( 0,pm);
460 } 461 }
461 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) { 462 if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) {
462 // overlay link image 463 // overlay link image
463 pm= Resource::loadPixmap( "folder" ); 464 pm= Resource::loadPixmap( "folder" );
464 QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); 465 QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
465 QPainter painter( &pm ); 466 QPainter painter( &pm );
466 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 467 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
467 pm.setMask( pm.createHeuristicMask( FALSE ) ); 468 pm.setMask( pm.createHeuristicMask( FALSE ) );
468// item->setPixmap( 0, pm); 469// item->setPixmap( 0, pm);
469 } 470 }
470 item->setPixmap( 0, pm); 471 item->setPixmap( 0, pm);
471 } 472 }
472 isDir=FALSE; 473 isDir=FALSE;
473 ++it; 474 ++it;
474 } 475 }
475 476
476 if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) { 477 if(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) {
477 struct stat buf; 478 struct stat buf;
478// struct stat st; 479// struct stat st;
479// mode_t mode; 480// mode_t mode;
480 DIR *dir; 481 DIR *dir;
481// int fd = 0; 482// int fd = 0;
482 struct dirent *mydirent; 483 struct dirent *mydirent;
483// int i = 1; 484// int i = 1;
484 if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) 485 if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL)
485 while ((mydirent = readdir(dir)) != NULL) { 486 while ((mydirent = readdir(dir)) != NULL) {
486 lstat( mydirent->d_name, &buf); 487 lstat( mydirent->d_name, &buf);
487 qDebug(mydirent->d_name); 488 qDebug(mydirent->d_name);
488// mode = buf.st_mode; 489// mode = buf.st_mode;
489 fileL.sprintf("%s", mydirent->d_name); 490 fileL.sprintf("%s", mydirent->d_name);
490// fileS.sprintf("%d, %d", ); //this isn't correct 491// fileS.sprintf("%d, %d", ); //this isn't correct
491 fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); 492 fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF);
492 fileDate.sprintf("%s", ctime( &buf.st_mtime)); 493 fileDate.sprintf("%s", ctime( &buf.st_mtime));
493 if( fileL.find(".") == -1 ){ 494 if( fileL.find(".") == -1 ){
494 item= new QListViewItem( Remote_View, fileL, fileS, fileDate); 495 item= new QListViewItem( Remote_View, fileL, fileS, fileDate);
495 pm = Resource::loadPixmap( "UnknownDocument-14" ); 496 pm = Resource::loadPixmap( "UnknownDocument-14" );
496 item->setPixmap( 0,pm); 497 item->setPixmap( 0,pm);
497 } 498 }
498 } 499 }
499 500
500 closedir(dir); 501 closedir(dir);
501 } 502 }
502 503
503 Remote_View->setSorting( 3,FALSE); 504 Remote_View->setSorting( 3,FALSE);
504 fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); 505 fillCombo( (const QString &) currentRemoteDir.canonicalPath() );
505} 506}
506 507
507void AdvancedFm::localListClicked(QListViewItem *selectedItem) 508void AdvancedFm::localListClicked(QListViewItem *selectedItem)
508{ 509{
509 if(selectedItem) { 510 if(selectedItem) {
510 QString strItem=selectedItem->text(0); 511 QString strItem=selectedItem->text(0);
511 QString strSize=selectedItem->text(1); 512 QString strSize=selectedItem->text(1);
512 strSize=strSize.stripWhiteSpace(); 513 strSize=strSize.stripWhiteSpace();
513 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 514 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
514 // is symlink 515 // is symlink
515 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 516 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
516 if(QDir(strItem2).exists() ) { 517 if(QDir(strItem2).exists() ) {
517 currentDir.cd(strItem2, TRUE); 518 currentDir.cd(strItem2, TRUE);
518 populateLocalView(); 519 populateLocalView();
519 } 520 }
520 } else { // not a symlink 521 } else { // not a symlink
521 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 522 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
522 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { 523 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) {
523 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 524 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
524 currentDir.cd(strItem,FALSE); 525 currentDir.cd(strItem,FALSE);
525 populateLocalView(); 526 populateLocalView();
526 } else { 527 } else {
527 currentDir.cdUp(); 528 currentDir.cdUp();
528 populateLocalView(); 529 populateLocalView();
529 } 530 }
530 if(QDir(strItem).exists()){ 531 if(QDir(strItem).exists()){
531 currentDir.cd(strItem, TRUE); 532 currentDir.cd(strItem, TRUE);
532 populateLocalView(); 533 populateLocalView();
533 } 534 }
534 } else { 535 } else {
535 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 536 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
536 if( QFile::exists(strItem ) ) { 537 if( QFile::exists(strItem ) ) {
537// qDebug("upload "+strItem); 538// qDebug("upload "+strItem);
538 } 539 }
539 } //end not symlink 540 } //end not symlink
540 chdir(strItem.latin1()); 541 chdir(strItem.latin1());
541 } 542 }
542 } 543 }
543} 544}
544 545
545void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) 546void AdvancedFm::remoteListClicked(QListViewItem *selectedItem)