summaryrefslogtreecommitdiff
authorzecke <zecke>2002-04-12 13:24:38 (UTC)
committer zecke <zecke>2002-04-12 13:24:38 (UTC)
commite3443eef4d49c7e91369790c29dd3b15b5dba854 (patch) (unidiff)
treeb92f78798a247ecf3eec501c64f5f8c81dc043fe
parent3973cf42c778055ab81a9ee254eaf8829464f936 (diff)
downloadopie-e3443eef4d49c7e91369790c29dd3b15b5dba854.zip
opie-e3443eef4d49c7e91369790c29dd3b15b5dba854.tar.gz
opie-e3443eef4d49c7e91369790c29dd3b15b5dba854.tar.bz2
fix the crash
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/TODO1
-rw-r--r--libopie/ofileselector.cc10
2 files changed, 6 insertions, 5 deletions
diff --git a/libopie/TODO b/libopie/TODO
index a4e1ada..d49910c 100644
--- a/libopie/TODO
+++ b/libopie/TODO
@@ -1,19 +1,20 @@
1- xmltree done 1- xmltree done
2 2
3- tododb 3- tododb
4 - set Alarms 4 - set Alarms
5 - multiple categories 5 - multiple categories
6 - Attendees 6 - Attendees
7 7
8- OFileSelector 8- OFileSelector
9 - fix the weird view change bug delete m_pseudoLayout crash
9 - DocLnk when not in Document Mode ( and vice versa ) 10 - DocLnk when not in Document Mode ( and vice versa )
10 - MultipleDocuments 11 - MultipleDocuments
11 - TreeView have a own OFileSelectorItem for this 12 - TreeView have a own OFileSelectorItem for this
12 - IconView add a QIconView to the widgetstack 13 - IconView add a QIconView to the widgetstack
13 - Move OFileSelectorItem to it's own files 14 - Move OFileSelectorItem to it's own files
14 - add functions to access the member variables 15 - add functions to access the member variables
15 - debug 16 - debug
16 - new Dirs created inside the listview 17 - new Dirs created inside the listview
17 18
18- Clickable labels? 19- Clickable labels?
19 Harlekin you wanted them in the libs? \ No newline at end of file 20 Harlekin you wanted them in the libs? \ No newline at end of file
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc
index 7451c1b..968541a 100644
--- a/libopie/ofileselector.cc
+++ b/libopie/ofileselector.cc
@@ -407,466 +407,466 @@ void OFileSelector::reparse()
407 407
408 QString currMime =m_mimeCheck->currentText(); 408 QString currMime =m_mimeCheck->currentText();
409 // update the mimetype now 409 // update the mimetype now
410 if( m_autoMime ) { 410 if( m_autoMime ) {
411 QDir dir( m_currentDir ); 411 QDir dir( m_currentDir );
412 m_mimetypes.clear(); 412 m_mimetypes.clear();
413 m_mimeCheck->clear(); 413 m_mimeCheck->clear();
414 dir.setFilter( QDir::Files | QDir::Readable ); 414 dir.setFilter( QDir::Files | QDir::Readable );
415 dir.setSorting(QDir::Size ); 415 dir.setSorting(QDir::Size );
416 const QFileInfoList *list = dir.entryInfoList(); 416 const QFileInfoList *list = dir.entryInfoList();
417 QFileInfoListIterator it( *list ); 417 QFileInfoListIterator it( *list );
418 QFileInfo *fi; 418 QFileInfo *fi;
419 while( (fi=it.current()) ){ 419 while( (fi=it.current()) ){
420 if(fi->extension() == QString::fromLatin1("desktop") ){ 420 if(fi->extension() == QString::fromLatin1("desktop") ){
421 ++it; 421 ++it;
422 continue; 422 continue;
423 } 423 }
424 MimeType type(fi->filePath() ); 424 MimeType type(fi->filePath() );
425 if( !m_mimetypes.contains( type.id() ) ) 425 if( !m_mimetypes.contains( type.id() ) )
426 m_mimetypes.append( type.id() ); 426 m_mimetypes.append( type.id() );
427 427
428 ++it; 428 ++it;
429 } 429 }
430 m_mimetypes.prepend("All" ); 430 m_mimetypes.prepend("All" );
431 m_mimeCheck->insertStringList(m_mimetypes ); 431 m_mimeCheck->insertStringList(m_mimetypes );
432 // set it to the current mimetype 432 // set it to the current mimetype
433 m_mimeCheck->setCurrentItem( indexByString( m_mimeCheck, currMime ) ); 433 m_mimeCheck->setCurrentItem( indexByString( m_mimeCheck, currMime ) );
434 }; 434 };
435 QDir dir( m_currentDir ); 435 QDir dir( m_currentDir );
436 //dir.setFilter(-1 ); 436 //dir.setFilter(-1 );
437 int sort = QDir::Name | QDir::DirsFirst | QDir::Reversed; 437 int sort = QDir::Name | QDir::DirsFirst | QDir::Reversed;
438 if( m_case ) 438 if( m_case )
439 sort = QDir::IgnoreCase; 439 sort = QDir::IgnoreCase;
440 dir.setSorting( sort ); 440 dir.setSorting( sort );
441 441
442 int filter; 442 int filter;
443 /* if( m_dir && !m_files) 443 /* if( m_dir && !m_files)
444 filter |= QDir::Dirs; 444 filter |= QDir::Dirs;
445 else if( !m_dir && m_files ) 445 else if( !m_dir && m_files )
446 filter |= QDir::Files; 446 filter |= QDir::Files;
447 else 447 else
448 filter |= QDir::All; 448 filter |= QDir::All;
449 */ 449 */
450 if( m_selector == EXTENDED_ALL ) 450 if( m_selector == EXTENDED_ALL )
451 filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; 451 filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All;
452 else 452 else
453 filter = QDir::Files | QDir::Dirs | QDir::All; 453 filter = QDir::Files | QDir::Dirs | QDir::All;
454 dir.setFilter( filter ); 454 dir.setFilter( filter );
455 455
456 const QFileInfoList *list = dir.entryInfoList(); 456 const QFileInfoList *list = dir.entryInfoList();
457 QFileInfoListIterator it( *list ); 457 QFileInfoListIterator it( *list );
458 QFileInfo *fi; 458 QFileInfo *fi;
459 while( (fi=it.current()) ){ 459 while( (fi=it.current()) ){
460 if(fi->fileName() == ".." || fi->fileName() == "." ){ 460 if(fi->fileName() == ".." || fi->fileName() == "." ){
461 ++it; 461 ++it;
462 continue; 462 continue;
463 } 463 }
464 qWarning("Test: %s", fi->fileName().latin1() ); 464 qWarning("Test: %s", fi->fileName().latin1() );
465 if(fi->isSymLink() ){ 465 if(fi->isSymLink() ){
466 qWarning("Symlink %s", fi->fileName().latin1() ); 466 qWarning("Symlink %s", fi->fileName().latin1() );
467 QString file = fi->dirPath(true)+"/"+ fi->readLink(); 467 QString file = fi->dirPath(true)+"/"+ fi->readLink();
468 qWarning("File ->%s", file.latin1() ); 468 qWarning("File ->%s", file.latin1() );
469 for(int i=0; i<=4; i++ ){ // prepend from dos 469 for(int i=0; i<=4; i++ ){ // prepend from dos
470 QFileInfo info( file ); 470 QFileInfo info( file );
471 if( !info.exists() ){ 471 if( !info.exists() ){
472 qWarning("does not exist" ); 472 qWarning("does not exist" );
473 addSymlink(currMime, fi, TRUE ); 473 addSymlink(currMime, fi, TRUE );
474 break; 474 break;
475 }else if( info.isDir() ){ 475 }else if( info.isDir() ){
476 qWarning("isDir" ); 476 qWarning("isDir" );
477 addDir(currMime, fi, TRUE ); 477 addDir(currMime, fi, TRUE );
478 break; 478 break;
479 }else if( info.isFile() ){ 479 }else if( info.isFile() ){
480 qWarning("isFile" ); 480 qWarning("isFile" );
481 addFile(currMime, fi, TRUE ); 481 addFile(currMime, fi, TRUE );
482 break; 482 break;
483 }else if( info.isSymLink() ){ 483 }else if( info.isSymLink() ){
484 file = info.dirPath(true)+ "/"+ info.readLink(); 484 file = info.dirPath(true)+ "/"+ info.readLink();
485 qWarning("isSymlink again %s", file.latin1() ); 485 qWarning("isSymlink again %s", file.latin1() );
486 }else if( i == 4 ){ // just insert it and have the symlink symbol 486 }else if( i == 4 ){ // just insert it and have the symlink symbol
487 addSymlink(currMime, fi ); 487 addSymlink(currMime, fi );
488 qWarning("level too deep" ); 488 qWarning("level too deep" );
489 } 489 }
490 } 490 }
491 }else if( fi->isDir() ){ 491 }else if( fi->isDir() ){
492 addDir(currMime, fi ); 492 addDir(currMime, fi );
493 }else if( fi->isFile() ) { // file ? 493 }else if( fi->isFile() ) { // file ?
494 addFile(currMime, fi ); 494 addFile(currMime, fi );
495 } 495 }
496 ++it; 496 ++it;
497 } 497 }
498 m_View->sort(); 498 m_View->sort();
499} 499}
500QString OFileSelector::directory()const 500QString OFileSelector::directory()const
501{ 501{
502 return m_currentDir; 502 return m_currentDir;
503} 503}
504int OFileSelector::fileCount() 504int OFileSelector::fileCount()
505{ 505{
506 return 0; 506 return 0;
507} 507}
508void OFileSelector::slotOk( ) 508void OFileSelector::slotOk( )
509{ 509{
510 emit ok(); 510 emit ok();
511} 511}
512void OFileSelector::slotCancel( ) 512void OFileSelector::slotCancel( )
513{ 513{
514 emit cancel(); 514 emit cancel();
515} 515}
516 516
517void OFileSelector::initializeName() 517void OFileSelector::initializeName()
518{ 518{
519 m_boxName = new QHBoxLayout(this ); 519 m_boxName = new QHBoxLayout(this );
520 m_edit = new QLineEdit(this ); 520 m_edit = new QLineEdit(this );
521 m_fnLabel = new QLabel(this ); 521 m_fnLabel = new QLabel(this );
522 m_fnLabel->setText(tr("Name:") ); 522 m_fnLabel->setText(tr("Name:") );
523 m_boxName->addWidget(m_fnLabel ); 523 m_boxName->addWidget(m_fnLabel );
524 m_boxName->insertSpacing(1, 8 ); 524 m_boxName->insertSpacing(1, 8 );
525 m_boxName->addWidget(m_edit, 100 ); 525 m_boxName->addWidget(m_edit, 100 );
526 526
527 m_lay->addLayout(m_boxName); 527 m_lay->addLayout(m_boxName);
528} 528}
529void OFileSelector::initializeYes() 529void OFileSelector::initializeYes()
530{ 530{
531 m_ok = new QPushButton("&Save", this, "save" ); 531 m_ok = new QPushButton("&Save", this, "save" );
532 m_cancel = new QPushButton("C&ancel", this, "cancel" ); 532 m_cancel = new QPushButton("C&ancel", this, "cancel" );
533 m_boxOk = new QHBoxLayout(this ); 533 m_boxOk = new QHBoxLayout(this );
534 m_boxOk->addWidget( m_ok, Qt::AlignHCenter ); 534 m_boxOk->addWidget( m_ok, Qt::AlignHCenter );
535 m_boxOk->insertSpacing(1, 8 ); 535 m_boxOk->insertSpacing(1, 8 );
536 m_boxOk->addWidget( m_cancel, Qt::AlignHCenter); 536 m_boxOk->addWidget( m_cancel, Qt::AlignHCenter);
537 m_lay->addLayout(m_boxOk ); 537 m_lay->addLayout(m_boxOk );
538 connect(m_ok, SIGNAL(clicked() ), 538 connect(m_ok, SIGNAL(clicked() ),
539 this, SLOT(slotOk() ) ); 539 this, SLOT(slotOk() ) );
540 connect(m_cancel, SIGNAL(clicked() ), 540 connect(m_cancel, SIGNAL(clicked() ),
541 this, SLOT(slotCancel() ) ); 541 this, SLOT(slotCancel() ) );
542 542
543} 543}
544void OFileSelector::initializeChooser() 544void OFileSelector::initializeChooser()
545{ 545{
546 m_boxView = new QHBoxLayout(this ); 546 m_boxView = new QHBoxLayout(this );
547 547
548 m_mimeCheck = new QComboBox(this, "mime check"); 548 m_mimeCheck = new QComboBox(this, "mime check");
549 m_viewCheck = new QComboBox(this, "view check"); 549 m_viewCheck = new QComboBox(this, "view check");
550 m_boxView->addWidget(m_viewCheck, 0 ); 550 m_boxView->addWidget(m_viewCheck, 0 );
551 m_boxView->insertSpacing(1, 8 ); 551 m_boxView->insertSpacing(1, 8 );
552 m_boxView->addWidget(m_mimeCheck, 0 ); 552 m_boxView->addWidget(m_mimeCheck, 0 );
553 m_lay->addLayout(m_boxView ); 553 m_lay->addLayout(m_boxView );
554 554
555 m_viewCheck->insertItem(tr("Documents") ); 555 m_viewCheck->insertItem(tr("Documents") );
556 m_viewCheck->insertItem(tr("Files") ); 556 m_viewCheck->insertItem(tr("Files") );
557 m_viewCheck->insertItem(tr("All Files") ); 557 m_viewCheck->insertItem(tr("All Files") );
558 558
559 if(!m_autoMime ) 559 if(!m_autoMime )
560 m_mimeCheck->insertItem(m_mimetypes.join("," ) ); 560 m_mimeCheck->insertItem(m_mimetypes.join("," ) );
561 else{ // check 561 else{ // check
562 updateMimes(); 562 updateMimes();
563 m_mimeCheck->insertStringList( m_mimetypes ); 563 m_mimeCheck->insertStringList( m_mimetypes );
564 } 564 }
565 565
566 connect( m_viewCheck, SIGNAL(activated(const QString &) ), 566 connect( m_viewCheck, SIGNAL(activated(const QString &) ),
567 this, SLOT(slotViewCheck(const QString & ) ) ); 567 this, SLOT(slotViewCheck(const QString & ) ) );
568 568
569 connect( m_mimeCheck, SIGNAL(activated(const QString &) ), 569 connect( m_mimeCheck, SIGNAL(activated(const QString &) ),
570 this, SLOT(slotMimeCheck(const QString & ) ) ); 570 this, SLOT(slotMimeCheck(const QString & ) ) );
571} 571}
572void OFileSelector::slotMimeCheck(const QString &view ){ 572void OFileSelector::slotMimeCheck(const QString &view ){
573 if(m_selector == NORMAL ){ 573 if(m_selector == NORMAL ){
574 delete m_select; 574 delete m_select;
575 m_select = new FileSelector(view == "All" ? QString::null : view 575 m_select = new FileSelector(view == "All" ? QString::null : view
576 , m_stack, "fileselector", FALSE, FALSE ); 576 , m_stack, "fileselector", FALSE, FALSE );
577 m_stack->addWidget( m_select, NORMAL ); 577 m_stack->addWidget( m_select, NORMAL );
578 m_stack->raiseWidget( NORMAL ); 578 m_stack->raiseWidget( NORMAL );
579 }else{ 579 }else{
580 reparse(); 580 reparse();
581 } 581 }
582} 582}
583 583
584void OFileSelector::slotViewCheck(const QString &view ){ 584void OFileSelector::slotViewCheck(const QString &view ){
585 qWarning("changed: show %s", view.latin1() ); 585 qWarning("changed: show %s", view.latin1() );
586 // if the current view is the one 586 // if the current view is the one
587 QString currMime = m_mimeCheck->currentText(); 587 QString currMime = m_mimeCheck->currentText();
588 if( view == QString::fromLatin1("Documents") ){ 588 if( view == QString::fromLatin1("Documents") ){
589 // get the mimetype now 589 // get the mimetype now
590 // check if we're the current widget and return 590 // check if we're the current widget and return
591 if( m_View != 0) { // delete 0 shouldn't crash but it did :( 591 if( m_View != 0) { // delete 0 shouldn't crash but it did :(
592 delete m_View; 592 delete m_View;
593 delete m_boxToolbar; 593 delete m_boxToolbar;
594 delete m_homeButton; 594 delete m_homeButton;
595 delete m_docButton; 595 delete m_docButton;
596 delete m_location; 596 delete m_location;
597 delete m_up; 597 delete m_up;
598 delete m_pseudo; 598 delete m_pseudo;
599 if(m_pseudoLayout!=0 ) 599 //if(m_pseudoLayout!=0 )
600 delete m_pseudoLayout; 600 //delete m_pseudoLayout;
601 } 601 }
602 m_View = 0; 602 m_View = 0;
603 m_boxToolbar = 0; 603 m_boxToolbar = 0;
604 m_homeButton = 0; 604 m_homeButton = 0;
605 m_docButton = 0; 605 m_docButton = 0;
606 m_location = 0; 606 m_location = 0;
607 m_up = 0; 607 m_up = 0;
608 m_pseudo = 0; 608 m_pseudo = 0;
609 m_pseudoLayout = 0; 609 m_pseudoLayout = 0;
610 610
611 delete m_select; 611 delete m_select;
612 m_select = new FileSelector( currMime == "All" ? QString::null : currMime, 612 m_select = new FileSelector( currMime == "All" ? QString::null : currMime,
613 m_stack,"fileselector", FALSE, FALSE ); 613 m_stack,"fileselector", FALSE, FALSE );
614 m_stack->addWidget( m_select, NORMAL ); 614 m_stack->addWidget( m_select, NORMAL );
615 m_mimeCheck->clear(); 615 m_mimeCheck->clear();
616 m_selector = NORMAL; 616 m_selector = NORMAL;
617 updateMimes(); 617 updateMimes();
618 m_mimeCheck->insertStringList( m_mimetypes ); 618 m_mimeCheck->insertStringList( m_mimetypes );
619 m_stack->raiseWidget( NORMAL ); 619 m_stack->raiseWidget( NORMAL );
620 connect(m_select, SIGNAL(fileSelected( const DocLnk &) ), this, SLOT(slotFileBridgeSelected(const DocLnk &) ) ); 620 connect(m_select, SIGNAL(fileSelected( const DocLnk &) ), this, SLOT(slotFileBridgeSelected(const DocLnk &) ) );
621 621
622 }else if(view == QString::fromLatin1("Files") ){ 622 }else if(view == QString::fromLatin1("Files") ){
623 // remove from the stack 623 // remove from the stack
624 delete m_select; 624 delete m_select;
625 m_select = 0; 625 m_select = 0;
626 delete m_View; 626 delete m_View;
627 m_View = 0; 627 m_View = 0;
628 628
629 629
630 630
631 m_selector = EXTENDED; 631 m_selector = EXTENDED;
632 // create the ListView or IconView 632 // create the ListView or IconView
633 initializeListView(); 633 initializeListView();
634 634
635 reparse(); 635 reparse();
636 }else if(view == QString::fromLatin1("All Files") ) { 636 }else if(view == QString::fromLatin1("All Files") ) {
637 // remove from the stack 637 // remove from the stack
638 delete m_select; 638 delete m_select;
639 m_select = 0; 639 m_select = 0;
640 delete m_View; 640 delete m_View;
641 m_View = 0; 641 m_View = 0;
642 642
643 m_selector = EXTENDED_ALL; 643 m_selector = EXTENDED_ALL;
644 initializeListView(); 644 initializeListView();
645 reparse(); 645 reparse();
646 }; 646 };
647}; 647};
648 648
649 649
650void OFileSelector::updateMimes() // lets check which mode is active 650void OFileSelector::updateMimes() // lets check which mode is active
651 // check the current dir for items then 651 // check the current dir for items then
652{ 652{
653 m_mimetypes.clear(); 653 m_mimetypes.clear();
654 m_mimetypes.append("All" ); 654 m_mimetypes.append("All" );
655 if( m_selector == NORMAL ){ 655 if( m_selector == NORMAL ){
656 DocLnkSet set; 656 DocLnkSet set;
657 Global::findDocuments(&set, QString::null ); 657 Global::findDocuments(&set, QString::null );
658 QListIterator<DocLnk> dit( set.children() ); 658 QListIterator<DocLnk> dit( set.children() );
659 for ( ; dit.current(); ++dit ) { 659 for ( ; dit.current(); ++dit ) {
660 if( !m_mimetypes.contains((*dit)->type() ) ) 660 if( !m_mimetypes.contains((*dit)->type() ) )
661 m_mimetypes.append( (*dit)->type() ); 661 m_mimetypes.append( (*dit)->type() );
662 } 662 }
663 }else{ 663 }else{
664 // should be allreday updatet 664 // should be allreday updatet
665 ; 665 ;
666 } 666 }
667}; 667};
668void OFileSelector::initializeListView() 668void OFileSelector::initializeListView()
669{ 669{
670 // just to make sure but clean it up better FIXME 670 // just to make sure but clean it up better FIXME
671 delete m_View; 671 delete m_View;
672 m_View = 0; 672 m_View = 0;
673 delete m_boxToolbar; 673 delete m_boxToolbar;
674 delete m_homeButton; 674 delete m_homeButton;
675 delete m_docButton; 675 delete m_docButton;
676 delete m_location; 676 delete m_location;
677 delete m_up; 677 delete m_up;
678 delete m_pseudo; 678 //delete m_pseudo;
679 if(m_pseudoLayout!=0 ) // why did you overload malloc 679 //if(m_pseudoLayout!=0 ) // why did you overload malloc
680 delete m_pseudoLayout; 680 //delete m_pseudoLayout;
681 m_boxToolbar = 0; 681 m_boxToolbar = 0;
682 m_homeButton = 0; 682 m_homeButton = 0;
683 m_docButton = 0; 683 m_docButton = 0;
684 m_location = 0; 684 m_location = 0;
685 m_up = 0; 685 m_up = 0;
686 m_pseudo = 0; 686 m_pseudo = 0;
687 m_pseudoLayout = 0; 687 m_pseudoLayout = 0;
688 // time for the toolbar 688 // time for the toolbar
689 m_pseudo = new QWidget(m_stack, "Pseudo Widget"); 689 m_pseudo = new QWidget(m_stack, "Pseudo Widget");
690 m_pseudoLayout = new QVBoxLayout(m_pseudo ); 690 m_pseudoLayout = new QVBoxLayout(m_pseudo );
691 if(m_shTool ){ 691 if(m_shTool ){
692 m_boxToolbar = new QHBoxLayout( ); 692 m_boxToolbar = new QHBoxLayout( );
693 m_boxToolbar->setAutoAdd( true ); 693 m_boxToolbar->setAutoAdd( true );
694 m_location = new QComboBox(m_pseudo ); 694 m_location = new QComboBox(m_pseudo );
695 695
696 m_up = new QPushButton(Resource::loadIconSet("up"),"", m_pseudo,"cdUpButton"); 696 m_up = new QPushButton(Resource::loadIconSet("up"),"", m_pseudo,"cdUpButton");
697 m_up->setMinimumSize( QSize( 20, 20 ) ); 697 m_up->setMinimumSize( QSize( 20, 20 ) );
698 m_up->setMaximumSize( QSize( 20, 20 ) ); 698 m_up->setMaximumSize( QSize( 20, 20 ) );
699 connect(m_up ,SIGNAL(clicked()),this,SLOT(cdUP() ) ); 699 connect(m_up ,SIGNAL(clicked()),this,SLOT(cdUP() ) );
700 m_up->setFlat(TRUE); 700 m_up->setFlat(TRUE);
701 701
702 m_homeButton = new QPushButton(Resource::loadIconSet("home") , "", m_pseudo); 702 m_homeButton = new QPushButton(Resource::loadIconSet("home") , "", m_pseudo);
703 m_homeButton->setMinimumSize( QSize( 20, 20 ) ); 703 m_homeButton->setMinimumSize( QSize( 20, 20 ) );
704 m_homeButton->setMaximumSize( QSize( 20, 20 ) ); 704 m_homeButton->setMaximumSize( QSize( 20, 20 ) );
705 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotHome() ) ); 705 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotHome() ) );
706 m_homeButton->setFlat(TRUE); 706 m_homeButton->setFlat(TRUE);
707 707
708 m_docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"", m_pseudo,"docsButton"); 708 m_docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"", m_pseudo,"docsButton");
709 m_docButton->setMinimumSize( QSize( 20, 20 ) ); 709 m_docButton->setMinimumSize( QSize( 20, 20 ) );
710 m_docButton->setMaximumSize( QSize( 20, 20 ) ); 710 m_docButton->setMaximumSize( QSize( 20, 20 ) );
711 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotDoc() ) ); 711 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotDoc() ) );
712 m_docButton->setFlat(TRUE); 712 m_docButton->setFlat(TRUE);
713 713
714 m_boxToolbar->addWidget(m_location ); 714 m_boxToolbar->addWidget(m_location );
715 m_boxToolbar->addWidget(m_up ); 715 m_boxToolbar->addWidget(m_up );
716 m_boxToolbar->addWidget(m_homeButton ); 716 m_boxToolbar->addWidget(m_homeButton );
717 m_boxToolbar->addWidget(m_docButton ); 717 m_boxToolbar->addWidget(m_docButton );
718 m_pseudoLayout->addLayout(m_boxToolbar ); 718 m_pseudoLayout->addLayout(m_boxToolbar );
719 // lets fill the combobox 719 // lets fill the combobox
720 StorageInfo storage; 720 StorageInfo storage;
721 const QList<FileSystem> &fs = storage.fileSystems(); 721 const QList<FileSystem> &fs = storage.fileSystems();
722 QListIterator<FileSystem> it ( fs ); 722 QListIterator<FileSystem> it ( fs );
723 for( ; it.current(); ++it ){ 723 for( ; it.current(); ++it ){
724 const QString disk = (*it)->name(); 724 const QString disk = (*it)->name();
725 const QString path = (*it)->path(); 725 const QString path = (*it)->path();
726 m_location->insertItem(path+ "<-"+disk ); 726 m_location->insertItem(path+ "<-"+disk );
727 } 727 }
728 int count = m_location->count(); 728 int count = m_location->count();
729 m_location->insertItem(m_currentDir ); 729 m_location->insertItem(m_currentDir );
730 m_location->setCurrentItem( count ); 730 m_location->setCurrentItem( count );
731 }; 731 };
732 m_View = new QListView(m_pseudo, "Extended view" ); 732 m_View = new QListView(m_pseudo, "Extended view" );
733 m_stack->addWidget( m_pseudo, EXTENDED ); 733 m_stack->addWidget( m_pseudo, EXTENDED );
734 m_stack->raiseWidget( EXTENDED ); 734 m_stack->raiseWidget( EXTENDED );
735 m_pseudoLayout->addWidget(m_View ); 735 m_pseudoLayout->addWidget(m_View );
736 QPEApplication::setStylusOperation( m_View->viewport(),QPEApplication::RightOnHold); 736 QPEApplication::setStylusOperation( m_View->viewport(),QPEApplication::RightOnHold);
737 // set up the stuff 737 // set up the stuff
738 // Pixmap Name Date Size mime 738 // Pixmap Name Date Size mime
739 //(m_View->header() )->hide(); 739 //(m_View->header() )->hide();
740 //m_View->setRootIsDecorated(false); 740 //m_View->setRootIsDecorated(false);
741 m_View->addColumn(" "); 741 m_View->addColumn(" ");
742 m_View->addColumn(tr("Name") ); 742 m_View->addColumn(tr("Name") );
743 m_View->addColumn(tr("Size") ); 743 m_View->addColumn(tr("Size") );
744 m_View->addColumn(tr("Date"), 60 ); 744 m_View->addColumn(tr("Date"), 60 );
745 m_View->addColumn(tr("Mime Type") ); 745 m_View->addColumn(tr("Mime Type") );
746 QHeader *header = m_View->header(); 746 QHeader *header = m_View->header();
747 header->hide(); 747 header->hide();
748 m_View->setSorting(1 ); 748 m_View->setSorting(1 );
749 // connect now 749 // connect now
750 connect(m_View, SIGNAL(selectionChanged() ), this, SLOT(slotSelectionChanged() ) ); 750 connect(m_View, SIGNAL(selectionChanged() ), this, SLOT(slotSelectionChanged() ) );
751 connect(m_View, SIGNAL(currentChanged(QListViewItem *) ), this, SLOT(slotCurrentChanged(QListViewItem * ) ) ); 751 connect(m_View, SIGNAL(currentChanged(QListViewItem *) ), this, SLOT(slotCurrentChanged(QListViewItem * ) ) );
752 connect(m_View, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint &, int) ), 752 connect(m_View, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint &, int) ),
753 this, SLOT(slotClicked( int, QListViewItem *, const QPoint &, int) ) ); 753 this, SLOT(slotClicked( int, QListViewItem *, const QPoint &, int) ) );
754 connect(m_View, SIGNAL(mouseButtonPressed(int, QListViewItem *, const QPoint &, int )), 754 connect(m_View, SIGNAL(mouseButtonPressed(int, QListViewItem *, const QPoint &, int )),
755 this, SLOT(slotRightButton(int, QListViewItem *, const QPoint &, int ) ) ); 755 this, SLOT(slotRightButton(int, QListViewItem *, const QPoint &, int ) ) );
756 756
757 757
758}; 758};
759/* If a item is locked depends on the mode 759/* If a item is locked depends on the mode
760 if we're in OPEN !isReadable is locked 760 if we're in OPEN !isReadable is locked
761 if we're in SAVE !isWriteable is locked 761 if we're in SAVE !isWriteable is locked
762 762
763 763
764 */ 764 */
765 765
766 766
767void OFileSelector::addFile(const QString &mime, QFileInfo *info, bool symlink ){ 767void OFileSelector::addFile(const QString &mime, QFileInfo *info, bool symlink ){
768 qWarning("Add Files" ); 768 qWarning("Add Files" );
769 if( !m_files ){ 769 if( !m_files ){
770 qWarning("not mfiles" ); 770 qWarning("not mfiles" );
771 return; 771 return;
772 } 772 }
773 773
774 MimeType type( info->filePath() ); 774 MimeType type( info->filePath() );
775 QString name; 775 QString name;
776 QString dir; 776 QString dir;
777 bool locked= false; 777 bool locked= false;
778 if(mime == "All" ){ 778 if(mime == "All" ){
779 ; 779 ;
780 }else if( type.id() != mime ) { 780 }else if( type.id() != mime ) {
781 return; 781 return;
782 } 782 }
783 QPixmap pix = type.pixmap(); 783 QPixmap pix = type.pixmap();
784 if(pix.isNull() ) 784 if(pix.isNull() )
785 pix = Resource::loadPixmap( "UnknownDocument-14" ); 785 pix = Resource::loadPixmap( "UnknownDocument-14" );
786 dir = info->dirPath( true ); 786 dir = info->dirPath( true );
787 if( symlink ) { // check if the readLink is readable 787 if( symlink ) { // check if the readLink is readable
788 // do it right later 788 // do it right later
789 name = info->fileName() + " -> " + info->dirPath() + "/" + info->readLink(); 789 name = info->fileName() + " -> " + info->dirPath() + "/" + info->readLink();
790 }else{ // keep track of the icons 790 }else{ // keep track of the icons
791 name = info->fileName(); 791 name = info->fileName();
792 if( m_mode == OPEN ){ 792 if( m_mode == OPEN ){
793 if( !info->isReadable() ){ 793 if( !info->isReadable() ){
794 locked = true; 794 locked = true;
795 pix = Resource::loadPixmap("locked" ); 795 pix = Resource::loadPixmap("locked" );
796 } 796 }
797 }else if( m_mode == SAVE ){ 797 }else if( m_mode == SAVE ){
798 if( !info->isWritable() ){ 798 if( !info->isWritable() ){
799 locked = true; 799 locked = true;
800 pix = Resource::loadPixmap("locked" ); 800 pix = Resource::loadPixmap("locked" );
801 } 801 }
802 } 802 }
803 } 803 }
804 new OFileSelectorItem( m_View, pix, name, 804 new OFileSelectorItem( m_View, pix, name,
805 info->lastModified().toString(), 805 info->lastModified().toString(),
806 QString::number( info->size() ), 806 QString::number( info->size() ),
807 dir, locked ); 807 dir, locked );
808} 808}
809void OFileSelector::addDir(const QString &mime, QFileInfo *info, bool symlink ) 809void OFileSelector::addDir(const QString &mime, QFileInfo *info, bool symlink )
810{ 810{
811 if(!m_dir ) 811 if(!m_dir )
812 return; 812 return;
813 //if( showDirs ) 813 //if( showDirs )
814 { 814 {
815 bool locked=false; 815 bool locked=false;
816 QString name; 816 QString name;
817 QPixmap pix; 817 QPixmap pix;
818 if( ( m_mode == OPEN && !info->isReadable() ) || ( m_mode == SAVE && !info->isWritable() ) ){ 818 if( ( m_mode == OPEN && !info->isReadable() ) || ( m_mode == SAVE && !info->isWritable() ) ){
819 locked = true; 819 locked = true;
820 if( symlink ){ 820 if( symlink ){
821 pix = (*m_pixmaps)["symlinkedlocked"]; 821 pix = (*m_pixmaps)["symlinkedlocked"];
822 }else{ 822 }else{
823 pix = Resource::loadPixmap("lockedfolder" ); 823 pix = Resource::loadPixmap("lockedfolder" );
824 } 824 }
825 }else{ 825 }else{
826 if( symlink ){ 826 if( symlink ){
827 pix = (*m_pixmaps)["dirsymlink" ]; 827 pix = (*m_pixmaps)["dirsymlink" ];
828 }else{ 828 }else{
829 pix = Resource::loadPixmap("folder" ); 829 pix = Resource::loadPixmap("folder" );
830 } 830 }
831 } 831 }
832 if( symlink){ 832 if( symlink){
833 name = info->fileName()+ "->"+ info->dirPath(true) +"/" +info->readLink(); 833 name = info->fileName()+ "->"+ info->dirPath(true) +"/" +info->readLink();
834 834
835 }else{ 835 }else{
836 //if(info->isReadable() ) 836 //if(info->isReadable() )
837 name = info->fileName(); 837 name = info->fileName();
838 } 838 }
839 839
840 new OFileSelectorItem(m_View, pix, 840 new OFileSelectorItem(m_View, pix,
841 name, info->lastModified().toString(), 841 name, info->lastModified().toString(),
842 QString::number(info->size() ),info->dirPath(true), locked, true ); 842 QString::number(info->size() ),info->dirPath(true), locked, true );
843 843
844 } 844 }
845} 845}
846void OFileSelector::setShowDirs(bool dir ) 846void OFileSelector::setShowDirs(bool dir )
847{ 847{
848 m_dir = dir; 848 m_dir = dir;
849 reparse(); 849 reparse();
850} 850}
851 851
852void OFileSelector::slotFileSelected(const QString &string ) 852void OFileSelector::slotFileSelected(const QString &string )
853{ 853{
854 if(m_shLne ) 854 if(m_shLne )
855 m_edit->setText( string ); 855 m_edit->setText( string );
856 856
857 emit fileSelected( string ); 857 emit fileSelected( string );
858 // do AppLnk stuff 858 // do AppLnk stuff
859} 859}
860void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk ) 860void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk )
861{ 861{
862 slotFileSelected(lnk.name() ); 862 slotFileSelected(lnk.name() );
863 emit fileSelected( lnk ); 863 emit fileSelected( lnk );
864} 864}
865void OFileSelector::slotSelectionChanged() // get the current items 865void OFileSelector::slotSelectionChanged() // get the current items
866 // fixme 866 // fixme
867{ 867{
868 qWarning("selection changed" ); 868 qWarning("selection changed" );
869} 869}
870void OFileSelector::slotCurrentChanged(QListViewItem *item ) 870void OFileSelector::slotCurrentChanged(QListViewItem *item )
871{ 871{
872 qWarning("current changed" ); 872 qWarning("current changed" );