summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2004-07-18 15:07:08 (UTC)
committer mickeyl <mickeyl>2004-07-18 15:07:08 (UTC)
commit63c1d7b2cb5abfcfa518363caf9e9c24dbb906dc (patch) (unidiff)
treeed9c37e249a132229f5f90500478189c0fa69d1e
parent35625ac739a9e070ceff4714328a91bb00b1f8a9 (diff)
downloadopie-63c1d7b2cb5abfcfa518363caf9e9c24dbb906dc.zip
opie-63c1d7b2cb5abfcfa518363caf9e9c24dbb906dc.tar.gz
opie-63c1d7b2cb5abfcfa518363caf9e9c24dbb906dc.tar.bz2
no need to warn here. debug seems enough
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/fileselector/ofileselector.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/libopie2/opieui/fileselector/ofileselector.cpp b/libopie2/opieui/fileselector/ofileselector.cpp
index 1f6ca05..5528aed 100644
--- a/libopie2/opieui/fileselector/ofileselector.cpp
+++ b/libopie2/opieui/fileselector/ofileselector.cpp
@@ -454,221 +454,221 @@ void OFileViewFileListView::reread( bool all )
454 * It is a symlink we try to resolve it now but don't let us attack by DOS 454 * It is a symlink we try to resolve it now but don't let us attack by DOS
455 * 455 *
456 */ 456 */
457 if( fi->isSymLink() ) 457 if( fi->isSymLink() )
458 { 458 {
459 QString file = fi->dirPath( true ) + "/" + fi->readLink(); 459 QString file = fi->dirPath( true ) + "/" + fi->readLink();
460 for( int i = 0; i<=4; i++) 460 for( int i = 0; i<=4; i++)
461 { // 5 tries to prevent dos 461 { // 5 tries to prevent dos
462 QFileInfo info( file ); 462 QFileInfo info( file );
463 if( !info.exists() ) 463 if( !info.exists() )
464 { 464 {
465 addSymlink( fi, TRUE ); 465 addSymlink( fi, TRUE );
466 break; 466 break;
467 } 467 }
468 else if( info.isDir() ) 468 else if( info.isDir() )
469 { 469 {
470 addDir( fi, TRUE ); 470 addDir( fi, TRUE );
471 break; 471 break;
472 } 472 }
473 else if( info.isFile() ) 473 else if( info.isFile() )
474 { 474 {
475 addFile( fi, TRUE ); 475 addFile( fi, TRUE );
476 break; 476 break;
477 } 477 }
478 else if( info.isSymLink() ) 478 else if( info.isSymLink() )
479 { 479 {
480 file = info.dirPath(true ) + "/" + info.readLink() ; 480 file = info.dirPath(true ) + "/" + info.readLink() ;
481 break; 481 break;
482 } 482 }
483 else if( i == 4) 483 else if( i == 4)
484 { // couldn't resolve symlink add it as symlink 484 { // couldn't resolve symlink add it as symlink
485 addSymlink( fi ); 485 addSymlink( fi );
486 } 486 }
487 } // off for loop for symlink resolving 487 } // off for loop for symlink resolving
488 } 488 }
489 else if( fi->isDir() ) 489 else if( fi->isDir() )
490 addDir( fi ); 490 addDir( fi );
491 else if( fi->isFile() ) 491 else if( fi->isFile() )
492 addFile( fi ); 492 addFile( fi );
493 493
494 ++it; 494 ++it;
495 } // of while loop 495 } // of while loop
496 m_view->sort(); 496 m_view->sort();
497 497
498} 498}
499int OFileViewFileListView::fileCount()const 499int OFileViewFileListView::fileCount()const
500{ 500{
501 return m_view->childCount(); 501 return m_view->childCount();
502} 502}
503 503
504QString OFileViewFileListView::currentDir()const 504QString OFileViewFileListView::currentDir()const
505{ 505{
506 return m_currentDir; 506 return m_currentDir;
507} 507}
508 508
509OFileSelector* OFileViewFileListView::selector() 509OFileSelector* OFileViewFileListView::selector()
510{ 510{
511 return m_sel; 511 return m_sel;
512} 512}
513 513
514bool OFileViewFileListView::eventFilter (QObject *o, QEvent *e) 514bool OFileViewFileListView::eventFilter (QObject *o, QEvent *e)
515{ 515{
516 if ( e->type() == QEvent::KeyPress ) 516 if ( e->type() == QEvent::KeyPress )
517 { 517 {
518 QKeyEvent *k = (QKeyEvent *)e; 518 QKeyEvent *k = (QKeyEvent *)e;
519 if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) 519 if ( (k->key()==Key_Enter) || (k->key()==Key_Return))
520 { 520 {
521 slotClicked( Qt::LeftButton,m_view->currentItem(),QPoint(0,0),0); 521 slotClicked( Qt::LeftButton,m_view->currentItem(),QPoint(0,0),0);
522 return true; 522 return true;
523 } 523 }
524 } 524 }
525 return false; 525 return false;
526} 526}
527 527
528void OFileViewFileListView::connectSlots() 528void OFileViewFileListView::connectSlots()
529{ 529{
530 connect(m_view, SIGNAL(clicked(QListViewItem*) ), 530 connect(m_view, SIGNAL(clicked(QListViewItem*) ),
531 this, SLOT(slotCurrentChanged(QListViewItem*) ) ); 531 this, SLOT(slotCurrentChanged(QListViewItem*) ) );
532 connect(m_view, SIGNAL(mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ), 532 connect(m_view, SIGNAL(mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ),
533 this, SLOT(slotClicked(int,QListViewItem*,const QPoint&,int) ) ); 533 this, SLOT(slotClicked(int,QListViewItem*,const QPoint&,int) ) );
534} 534}
535 535
536void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) 536void OFileViewFileListView::slotCurrentChanged( QListViewItem* item)
537{ 537{
538 if (!item) 538 if (!item)
539 return; 539 return;
540#if 0 540#if 0
541 541
542 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); 542 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item);
543 543
544 if (!sel->isDir() ) 544 if (!sel->isDir() )
545 { 545 {
546 selector()->m_lneEdit->setText( sel->text(1) ); 546 selector()->m_lneEdit->setText( sel->text(1) );
547 // if in fileselector mode we will emit selected 547 // if in fileselector mode we will emit selected
548 if ( selector()->mode() == OFileSelector::FileSelector ) 548 if ( selector()->mode() == OFileSelector::FileSelector )
549 { 549 {
550 owarn << "slot Current Changed" << oendl; 550 odebug << "slot Current Changed" << oendl;
551 QStringList str = QStringList::split("->", sel->text(1) ); 551 QStringList str = QStringList::split("->", sel->text(1) );
552 QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); 552 QString path = sel->directory() + "/" + str[0].stripWhiteSpace();
553 emit selector()->fileSelected( path ); 553 emit selector()->fileSelected( path );
554 DocLnk lnk( path ); 554 DocLnk lnk( path );
555 emit selector()->fileSelected( lnk ); 555 emit selector()->fileSelected( lnk );
556 } 556 }
557 } 557 }
558#endif 558#endif
559} 559}
560 560
561void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int ) 561void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int )
562{ 562{
563 if (!item || ( button != Qt::LeftButton) ) 563 if (!item || ( button != Qt::LeftButton) )
564 return; 564 return;
565 565
566 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); 566 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item);
567 if (!sel->isLocked() ) 567 if (!sel->isLocked() )
568 { 568 {
569 QStringList str = QStringList::split("->", sel->text(1) ); 569 QStringList str = QStringList::split("->", sel->text(1) );
570 if (sel->isDir() ) 570 if (sel->isDir() )
571 { 571 {
572 m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace(); 572 m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace();
573 emit selector()->dirSelected( m_currentDir ); 573 emit selector()->dirSelected( m_currentDir );
574 reread( m_all ); 574 reread( m_all );
575 } 575 }
576 else 576 else
577 { // file 577 { // file
578 owarn << "slot Clicked" << oendl; 578 odebug << "slot Clicked" << oendl;
579 selector()->m_lneEdit->setText( str[0].stripWhiteSpace() ); 579 selector()->m_lneEdit->setText( str[0].stripWhiteSpace() );
580 QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); 580 QString path = sel->directory() + "/" + str[0].stripWhiteSpace();
581 emit selector()->fileSelected( path ); 581 emit selector()->fileSelected( path );
582 DocLnk lnk( path ); 582 DocLnk lnk( path );
583 emit selector()->fileSelected( lnk ); 583 emit selector()->fileSelected( lnk );
584 } 584 }
585 } // not locked 585 } // not locked
586} 586}
587 587
588void OFileViewFileListView::addFile( QFileInfo* info, bool symlink ) 588void OFileViewFileListView::addFile( QFileInfo* info, bool symlink )
589{ 589{
590 MimeType type( info->absFilePath() ); 590 MimeType type( info->absFilePath() );
591 if (!compliesMime( type.id() ) ) 591 if (!compliesMime( type.id() ) )
592 return; 592 return;
593 593
594 QPixmap pix = type.pixmap(); 594 QPixmap pix = type.pixmap();
595 QString dir, name; bool locked; 595 QString dir, name; bool locked;
596 if ( pix.isNull() ) 596 if ( pix.isNull() )
597 { 597 {
598 QWMatrix matrix; 598 QWMatrix matrix;
599 QPixmap pixer(Resource::loadPixmap("UnknownDocument") ); 599 QPixmap pixer(Resource::loadPixmap("UnknownDocument") );
600 matrix.scale( .4, .4 ); 600 matrix.scale( .4, .4 );
601 pix = pixer.xForm( matrix ); 601 pix = pixer.xForm( matrix );
602 } 602 }
603 dir = info->dirPath( true ); 603 dir = info->dirPath( true );
604 locked = false; 604 locked = false;
605 if ( symlink ) 605 if ( symlink )
606 name = info->fileName() + " -> " + info->dirPath() + "/" + info->readLink(); 606 name = info->fileName() + " -> " + info->dirPath() + "/" + info->readLink();
607 else 607 else
608 { 608 {
609 name = info->fileName(); 609 name = info->fileName();
610 if ( ( (selector()->mode() == OFileSelector::Open)&& !info->isReadable() ) || 610 if ( ( (selector()->mode() == OFileSelector::Open)&& !info->isReadable() ) ||
611 ( (selector()->mode() == OFileSelector::Save)&& !info->isWritable() ) ) 611 ( (selector()->mode() == OFileSelector::Save)&& !info->isWritable() ) )
612 { 612 {
613 locked = true; pix = Resource::loadPixmap("locked"); 613 locked = true; pix = Resource::loadPixmap("locked");
614 } 614 }
615 } 615 }
616 (void)new OFileSelectorItem( m_view, pix, name, 616 (void)new OFileSelectorItem( m_view, pix, name,
617 info->lastModified().toString(), QString::number( info->size() ), 617 info->lastModified().toString(), QString::number( info->size() ),
618 dir, locked ); 618 dir, locked );
619} 619}
620 620
621void OFileViewFileListView::addDir( QFileInfo* info, bool symlink ) 621void OFileViewFileListView::addDir( QFileInfo* info, bool symlink )
622{ 622{
623 bool locked = false; QString name; QPixmap pix; 623 bool locked = false; QString name; QPixmap pix;
624 624
625 if ( ( ( selector()->mode() == OFileSelector::Open ) && !info->isReadable() ) || 625 if ( ( ( selector()->mode() == OFileSelector::Open ) && !info->isReadable() ) ||
626 ( ( selector()->mode() == OFileSelector::Save ) && !info->isWritable() ) ) 626 ( ( selector()->mode() == OFileSelector::Save ) && !info->isWritable() ) )
627 { 627 {
628 locked = true; 628 locked = true;
629 if ( symlink ) 629 if ( symlink )
630 pix = Resource::loadPixmap( "opie/symlink" ); 630 pix = Resource::loadPixmap( "opie/symlink" );
631 else 631 else
632 pix = Resource::loadPixmap( "lockedfolder" ); 632 pix = Resource::loadPixmap( "lockedfolder" );
633 } 633 }
634 else 634 else
635 pix = symlink ? Resource::loadPixmap( "opie/symlink") : Resource::loadPixmap("folder"); 635 pix = symlink ? Resource::loadPixmap( "opie/symlink") : Resource::loadPixmap("folder");
636 636
637 name = symlink ? info->fileName() + " -> " + info->dirPath(true) + "/" + info->readLink() : 637 name = symlink ? info->fileName() + " -> " + info->dirPath(true) + "/" + info->readLink() :
638 info->fileName(); 638 info->fileName();
639 639
640 (void)new OFileSelectorItem( m_view, pix, name, 640 (void)new OFileSelectorItem( m_view, pix, name,
641 info->lastModified().toString(), 641 info->lastModified().toString(),
642 QString::number( info->size() ), 642 QString::number( info->size() ),
643 info->dirPath( true ), locked, true ); 643 info->dirPath( true ), locked, true );
644 644
645 645
646} 646}
647 647
648void OFileViewFileListView::addSymlink( QFileInfo* , bool ) 648void OFileViewFileListView::addSymlink( QFileInfo* , bool )
649{ 649{
650} 650}
651 651
652void OFileViewFileListView::cdUP() 652void OFileViewFileListView::cdUP()
653{ 653{
654 QDir dir( m_currentDir ); 654 QDir dir( m_currentDir );
655 dir.cdUp(); 655 dir.cdUp();
656 656
657 if (!dir.exists() ) 657 if (!dir.exists() )
658 m_currentDir = "/"; 658 m_currentDir = "/";
659 else 659 else
660 m_currentDir = dir.absPath(); 660 m_currentDir = dir.absPath();
661 661
662 emit selector()->dirSelected( m_currentDir ); 662 emit selector()->dirSelected( m_currentDir );
663 reread( m_all ); 663 reread( m_all );
664} 664}
665 665
666void OFileViewFileListView::cdHome() 666void OFileViewFileListView::cdHome()
667{ 667{
668 m_currentDir = QDir::homeDirPath(); 668 m_currentDir = QDir::homeDirPath();
669 emit selector()->dirSelected( m_currentDir ); 669 emit selector()->dirSelected( m_currentDir );
670 reread( m_all ); 670 reread( m_all );
671} 671}
672 672
673void OFileViewFileListView::cdDoc() 673void OFileViewFileListView::cdDoc()
674{ 674{