author | zecke <zecke> | 2002-06-26 19:15:17 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-06-26 19:15:17 (UTC) |
commit | 7b3b485aff7fc5f5cdef40a7d4989295d5c8ab4a (patch) (unidiff) | |
tree | 661027703c822da5a109247b9ce54862af38932c /libopie | |
parent | f6800ca0bed431aac90f09ec98e481fb424c7b31 (diff) | |
download | opie-7b3b485aff7fc5f5cdef40a7d4989295d5c8ab4a.zip opie-7b3b485aff7fc5f5cdef40a7d4989295d5c8ab4a.tar.gz opie-7b3b485aff7fc5f5cdef40a7d4989295d5c8ab4a.tar.bz2 |
done for now
-rw-r--r-- | libopie/ofileselector.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc index 74b308e..98290e0 100644 --- a/libopie/ofileselector.cc +++ b/libopie/ofileselector.cc | |||
@@ -511,142 +511,146 @@ void OFileSelector::slotMimeCheck(const QString &mime) | |||
511 | qWarning("Current Text %s", m_mimeCheck->currentText().latin1() ); | 511 | qWarning("Current Text %s", m_mimeCheck->currentText().latin1() ); |
512 | //m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) ); | 512 | //m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) ); |
513 | } | 513 | } |
514 | reparse(); | 514 | reparse(); |
515 | } | 515 | } |
516 | 516 | ||
517 | } | 517 | } |
518 | void OFileSelector::slotLocationActivated(const QString &file) | 518 | void OFileSelector::slotLocationActivated(const QString &file) |
519 | { | 519 | { |
520 | cd(file.left(file.find("<-",0,TRUE))); | 520 | cd(file.left(file.find("<-",0,TRUE))); |
521 | reparse(); | 521 | reparse(); |
522 | } | 522 | } |
523 | void OFileSelector::slotInsertLocationPath(const QString ¤tPath, int count) | 523 | void OFileSelector::slotInsertLocationPath(const QString ¤tPath, int count) |
524 | { | 524 | { |
525 | QStringList pathList; | 525 | QStringList pathList; |
526 | bool underDog = FALSE; | 526 | bool underDog = FALSE; |
527 | for(int i=0;i<count;i++) { | 527 | for(int i=0;i<count;i++) { |
528 | pathList << m_location->text(i); | 528 | pathList << m_location->text(i); |
529 | if( m_location->text(i) == currentPath) | 529 | if( m_location->text(i) == currentPath) |
530 | underDog = TRUE; | 530 | underDog = TRUE; |
531 | } | 531 | } |
532 | if( !underDog) { | 532 | if( !underDog) { |
533 | m_location->clear(); | 533 | m_location->clear(); |
534 | if( currentPath.left(2)=="//") | 534 | if( currentPath.left(2)=="//") |
535 | pathList.append( currentPath.right(currentPath.length()-1) ); | 535 | pathList.append( currentPath.right(currentPath.length()-1) ); |
536 | else | 536 | else |
537 | pathList.append( currentPath ); | 537 | pathList.append( currentPath ); |
538 | m_location->insertStringList( pathList,-1); | 538 | m_location->insertStringList( pathList,-1); |
539 | } | 539 | } |
540 | } | 540 | } |
541 | void OFileSelector::locationComboChanged() | 541 | void OFileSelector::locationComboChanged() |
542 | { | 542 | { |
543 | cd( m_location->lineEdit()->text()); | 543 | cd( m_location->lineEdit()->text()); |
544 | reparse(); | 544 | reparse(); |
545 | } | 545 | } |
546 | void OFileSelector::init() | 546 | void OFileSelector::init() |
547 | { | 547 | { |
548 | m_lay = new QVBoxLayout( this ); | 548 | m_lay = new QVBoxLayout( this ); |
549 | m_lay->setSpacing(0 ); | 549 | m_lay->setSpacing(0 ); |
550 | 550 | ||
551 | m_stack = new QWidgetStack( this ); | 551 | m_stack = new QWidgetStack( this ); |
552 | if( m_selector == NORMAL ){ | 552 | if( m_selector == NORMAL ){ |
553 | QString mime; | 553 | QString mime; |
554 | if (!m_autoMime) { | 554 | if (!m_autoMime) { |
555 | if (!m_mimetypes.isEmpty() ) { | 555 | if (!m_mimetypes.isEmpty() ) { |
556 | QMap<QString, QStringList>::Iterator it; | 556 | QMap<QString, QStringList>::Iterator it; |
557 | it = m_mimetypes.begin(); // cause we're in the init | 557 | it = m_mimetypes.begin(); // cause we're in the init |
558 | mime = it.data().join(";"); | 558 | mime = it.data().join(";"); |
559 | } | 559 | } |
560 | } | 560 | } |
561 | m_select = new FileSelector(mime, | 561 | m_select = new FileSelector(mime, |
562 | m_stack, "fileselector", | 562 | m_stack, "fileselector", |
563 | FALSE, FALSE); | 563 | FALSE, FALSE); |
564 | 564 | ||
565 | connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), | 565 | connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), |
566 | this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); | 566 | this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); |
567 | //connect to close me and other signals as well | 567 | //connect to close me and other signals as well |
568 | 568 | ||
569 | m_stack->addWidget( m_select, NORMAL ); | 569 | m_stack->addWidget( m_select, NORMAL ); |
570 | m_stack->raiseWidget( NORMAL ); | 570 | m_stack->raiseWidget( NORMAL ); |
571 | }else{ // we're in init so it will be EXTENDED or EXTENDED_ALL | 571 | }else{ // we're in init so it will be EXTENDED or EXTENDED_ALL |
572 | // and initializeListview will take care of those | 572 | // and initializeListview will take care of those |
573 | // toolbar get's generade in initializeListView | 573 | // toolbar get's generade in initializeListView |
574 | initializeListView( ); // will raise the widget as well | 574 | initializeListView( ); // will raise the widget as well |
575 | m_stack->raiseWidget( EXTENDED ); | ||
575 | } | 576 | } |
576 | m_lay->addWidget( m_stack, 100 ); // add to the layout 10 = stretch | 577 | m_lay->addWidget( m_stack, 100 ); // add to the layout 10 = stretch |
577 | 578 | ||
578 | if( m_shLne ) // the LineEdit with the current FileName | 579 | if( m_shLne ) // the LineEdit with the current FileName |
579 | initializeName(); | 580 | initializeName(); |
580 | 581 | ||
581 | if( m_shPerm ) // the Permission QCheckBox | 582 | if( m_shPerm ) // the Permission QCheckBox |
582 | initializePerm(); | 583 | initializePerm(); |
583 | 584 | ||
584 | if( m_shChooser ) // the Chooser for the view and Mimetypes | 585 | if( m_shChooser ) // the Chooser for the view and Mimetypes |
585 | initializeChooser(); | 586 | initializeChooser(); |
586 | 587 | ||
587 | if( m_shYesNo ) // the Yes No button row | 588 | if( m_shYesNo ) // the Yes No button row |
588 | initializeYes( ); | 589 | initializeYes( ); |
590 | |||
591 | if (m_selector != NORMAL ) | ||
592 | reparse(); | ||
589 | } | 593 | } |
590 | void OFileSelector::updateMimes() | 594 | void OFileSelector::updateMimes() |
591 | { | 595 | { |
592 | if( m_autoMime ){ | 596 | if( m_autoMime ){ |
593 | m_mimetypes.clear(); | 597 | m_mimetypes.clear(); |
594 | m_mimetypes.insert( tr("All"), QString::null ); | 598 | m_mimetypes.insert( tr("All"), QString::null ); |
595 | if( m_selector == NORMAL ){ | 599 | if( m_selector == NORMAL ){ |
596 | DocLnkSet set; | 600 | DocLnkSet set; |
597 | Global::findDocuments(&set, QString::null ); | 601 | Global::findDocuments(&set, QString::null ); |
598 | QListIterator<DocLnk> dit( set.children() ); | 602 | QListIterator<DocLnk> dit( set.children() ); |
599 | for( ; dit.current(); ++dit ){ | 603 | for( ; dit.current(); ++dit ){ |
600 | if( !m_mimetypes.contains( (*dit)->type() ) ) | 604 | if( !m_mimetypes.contains( (*dit)->type() ) ) |
601 | m_mimetypes.insert( (*dit)->type(), (*dit)->type() ); | 605 | m_mimetypes.insert( (*dit)->type(), (*dit)->type() ); |
602 | } | 606 | } |
603 | }// else done in reparse | 607 | }// else done in reparse |
604 | } | 608 | } |
605 | } | 609 | } |
606 | void OFileSelector::initVars() | 610 | void OFileSelector::initVars() |
607 | { | 611 | { |
608 | if( m_mimetypes.isEmpty() ) | 612 | if( m_mimetypes.isEmpty() ) |
609 | m_autoMime = true; | 613 | m_autoMime = true; |
610 | else | 614 | else |
611 | m_autoMime = false; | 615 | m_autoMime = false; |
612 | m_shClose = false; | 616 | m_shClose = false; |
613 | m_shNew = false; | 617 | m_shNew = false; |
614 | m_shTool = true; | 618 | m_shTool = true; |
615 | m_shPerm = false; | 619 | m_shPerm = false; |
616 | m_shLne = true; | 620 | m_shLne = true; |
617 | m_shChooser = true; | 621 | m_shChooser = true; |
618 | m_shYesNo = true; | 622 | m_shYesNo = true; |
619 | m_case = false; | 623 | m_case = false; |
620 | m_dir = true; | 624 | m_dir = true; |
621 | m_files = true; | 625 | m_files = true; |
622 | m_showPopup = false; | 626 | m_showPopup = false; |
623 | if(m_pixmaps == 0 ) // init the pixmaps | 627 | if(m_pixmaps == 0 ) // init the pixmaps |
624 | initPics(); | 628 | initPics(); |
625 | 629 | ||
626 | // pointers | 630 | // pointers |
627 | m_location = 0; | 631 | m_location = 0; |
628 | m_mimeCheck = 0; | 632 | m_mimeCheck = 0; |
629 | m_viewCheck = 0; | 633 | m_viewCheck = 0; |
630 | m_homeButton = 0; | 634 | m_homeButton = 0; |
631 | m_docButton = 0; | 635 | m_docButton = 0; |
632 | m_hideButton = 0; | 636 | m_hideButton = 0; |
633 | m_ok = 0; | 637 | m_ok = 0; |
634 | m_cancel = 0; | 638 | m_cancel = 0; |
635 | m_reread = 0; | 639 | m_reread = 0; |
636 | m_up = 0; | 640 | m_up = 0; |
637 | m_View = 0; | 641 | m_View = 0; |
638 | m_checkPerm = 0; | 642 | m_checkPerm = 0; |
639 | m_pseudo = 0; | 643 | m_pseudo = 0; |
640 | m_pseudoLayout = 0; | 644 | m_pseudoLayout = 0; |
641 | m_select = 0; | 645 | m_select = 0; |
642 | m_stack = 0; | 646 | m_stack = 0; |
643 | m_lay = 0; | 647 | m_lay = 0; |
644 | m_Oselector = 0; | 648 | m_Oselector = 0; |
645 | m_boxToolbar = 0; | 649 | m_boxToolbar = 0; |
646 | m_boxOk = 0; | 650 | m_boxOk = 0; |
647 | m_boxName = 0; | 651 | m_boxName = 0; |
648 | m_boxView = 0; | 652 | m_boxView = 0; |
649 | m_custom = 0; | 653 | m_custom = 0; |
650 | m_edit = 0; | 654 | m_edit = 0; |
651 | m_fnLabel = 0; | 655 | m_fnLabel = 0; |
652 | m_new = 0; | 656 | m_new = 0; |
@@ -740,129 +744,131 @@ void OFileSelector::initializeName() | |||
740 | // | 744 | // |
741 | } | 745 | } |
742 | void OFileSelector::initializeYes() | 746 | void OFileSelector::initializeYes() |
743 | { | 747 | { |
744 | /** The Save Cancel bar | 748 | /** The Save Cancel bar |
745 | * | 749 | * |
746 | */ | 750 | */ |
747 | if( m_boxOk == 0 ){ | 751 | if( m_boxOk == 0 ){ |
748 | m_boxOk = new QHBox( this ); | 752 | m_boxOk = new QHBox( this ); |
749 | m_ok = new QPushButton( tr("&Save"),m_boxOk , "save" ); | 753 | m_ok = new QPushButton( tr("&Save"),m_boxOk , "save" ); |
750 | m_cancel = new QPushButton( tr("C&ancel"), m_boxOk, "cancel" ); | 754 | m_cancel = new QPushButton( tr("C&ancel"), m_boxOk, "cancel" ); |
751 | 755 | ||
752 | //m_boxOk->addWidget( m_ok ); | 756 | //m_boxOk->addWidget( m_ok ); |
753 | //m_boxOk->addWidget( m_cancel ); | 757 | //m_boxOk->addWidget( m_cancel ); |
754 | m_boxOk->setMargin( 5 ); | 758 | m_boxOk->setMargin( 5 ); |
755 | m_boxOk->setSpacing( 10 ); | 759 | m_boxOk->setSpacing( 10 ); |
756 | m_lay->addWidget( m_boxOk, 0 ); | 760 | m_lay->addWidget( m_boxOk, 0 ); |
757 | 761 | ||
758 | connect( m_ok, SIGNAL( clicked() ), | 762 | connect( m_ok, SIGNAL( clicked() ), |
759 | this, SLOT(slotOk() ) ); | 763 | this, SLOT(slotOk() ) ); |
760 | connect( m_cancel, SIGNAL( clicked() ), | 764 | connect( m_cancel, SIGNAL( clicked() ), |
761 | this, SLOT( slotCancel() ) ); | 765 | this, SLOT( slotCancel() ) ); |
762 | } | 766 | } |
763 | } | 767 | } |
764 | /* | 768 | /* |
765 | * OK m_mimeCheck is a QComboBox we now want to fill | 769 | * OK m_mimeCheck is a QComboBox we now want to fill |
766 | * out that combobox | 770 | * out that combobox |
767 | * if automime we need to update the mimetypes | 771 | * if automime we need to update the mimetypes |
768 | */ | 772 | */ |
769 | void OFileSelector::updateMimeCheck() { | 773 | void OFileSelector::updateMimeCheck() { |
770 | m_mimeCheck->clear(); | 774 | m_mimeCheck->clear(); |
771 | if (m_autoMime ) { | 775 | if (m_autoMime ) { |
772 | //m_mimeCheck->insertItem( tr("All") ); | 776 | //m_mimeCheck->insertItem( tr("All") ); |
773 | updateMimes(); | 777 | updateMimes(); |
774 | } | 778 | } |
775 | 779 | ||
776 | QMap<QString, QStringList>::Iterator it; | 780 | QMap<QString, QStringList>::Iterator it; |
777 | for (it = m_mimetypes.begin(); it != m_mimetypes.end(); ++it ) { | 781 | for (it = m_mimetypes.begin(); it != m_mimetypes.end(); ++it ) { |
778 | m_mimeCheck->insertItem( it.key() ); | 782 | m_mimeCheck->insertItem( it.key() ); |
779 | } | 783 | } |
780 | } | 784 | } |
781 | 785 | ||
782 | void OFileSelector::initializeChooser() | 786 | void OFileSelector::initializeChooser() |
783 | { | 787 | { |
784 | if( m_boxView == 0 ){ | 788 | if( m_boxView == 0 ){ |
785 | m_boxView = new QHBox( this ); | 789 | m_boxView = new QHBox( this ); |
786 | m_viewCheck = new QComboBox( m_boxView, "view check"); | 790 | m_viewCheck = new QComboBox( m_boxView, "view check"); |
787 | m_mimeCheck = new QComboBox( m_boxView, "mime check"); | 791 | m_mimeCheck = new QComboBox( m_boxView, "mime check"); |
788 | m_boxView->setSpacing( 8 ); | 792 | m_boxView->setSpacing( 8 ); |
789 | m_lay->addWidget(m_boxView, 0 ); | 793 | m_lay->addWidget(m_boxView, 0 ); |
790 | 794 | ||
791 | m_viewCheck->insertItem( tr("Documents") ); | 795 | m_viewCheck->insertItem( tr("Documents") ); |
792 | m_viewCheck->insertItem( tr("Files") ); | 796 | m_viewCheck->insertItem( tr("Files") ); |
793 | m_viewCheck->insertItem( tr("All Files") ); | 797 | m_viewCheck->insertItem( tr("All Files") ); |
794 | updateMimeCheck(); | 798 | updateMimeCheck(); |
795 | 799 | ||
796 | connect( m_viewCheck, SIGNAL( activated(const QString & ) ), | 800 | connect( m_viewCheck, SIGNAL( activated(const QString & ) ), |
797 | this, SLOT( slotViewCheck(const QString & ) ) ); | 801 | this, SLOT( slotViewCheck(const QString & ) ) ); |
798 | connect( m_mimeCheck, SIGNAL( activated(const QString & ) ), | 802 | connect( m_mimeCheck, SIGNAL( activated(const QString & ) ), |
799 | this, SLOT( slotMimeCheck( const QString & ) ) ); | 803 | this, SLOT( slotMimeCheck( const QString & ) ) ); |
800 | } | 804 | } |
801 | } | 805 | } |
802 | void OFileSelector::initializeListView() | 806 | void OFileSelector::initializeListView() |
803 | { | 807 | { |
808 | qWarning("initializeListView"); | ||
804 | if( m_pseudo == 0 ){ | 809 | if( m_pseudo == 0 ){ |
810 | qWarning("init"); | ||
805 | m_pseudo = new QWidget( m_stack, "Pseudo Widget"); | 811 | m_pseudo = new QWidget( m_stack, "Pseudo Widget"); |
806 | m_pseudoLayout = new QVBoxLayout( m_pseudo ); | 812 | m_pseudoLayout = new QVBoxLayout( m_pseudo ); |
807 | // toolbar | 813 | // toolbar |
808 | m_boxToolbar = new QHBox( m_pseudo ); | 814 | m_boxToolbar = new QHBox( m_pseudo ); |
809 | m_boxToolbar->setSpacing(0 ); // next to each other please | 815 | m_boxToolbar->setSpacing(0 ); // next to each other please |
810 | 816 | ||
811 | // toolbar members | 817 | // toolbar members |
812 | { | 818 | { |
813 | // location QComboBox | 819 | // location QComboBox |
814 | m_location = new QComboBox( m_boxToolbar ); | 820 | m_location = new QComboBox( m_boxToolbar ); |
815 | m_location->setEditable( TRUE ); | 821 | m_location->setEditable( TRUE ); |
816 | m_location->setDuplicatesEnabled( FALSE ); | 822 | m_location->setDuplicatesEnabled( FALSE ); |
817 | connect( m_location, SIGNAL(activated(const QString &) ), | 823 | connect( m_location, SIGNAL(activated(const QString &) ), |
818 | this, SLOT( slotLocationActivated(const QString &) ) ); | 824 | this, SLOT( slotLocationActivated(const QString &) ) ); |
819 | connect( m_location->lineEdit(), SIGNAL(returnPressed() ), | 825 | connect( m_location->lineEdit(), SIGNAL(returnPressed() ), |
820 | this, SLOT(locationComboChanged() ) ); | 826 | this, SLOT(locationComboChanged() ) ); |
821 | // UP Button | 827 | // UP Button |
822 | m_up = new QPushButton(Resource::loadIconSet("up"),"", | 828 | m_up = new QPushButton(Resource::loadIconSet("up"),"", |
823 | m_boxToolbar,"cdUpButton"); | 829 | m_boxToolbar,"cdUpButton"); |
824 | m_up->setFixedSize( QSize( 20, 20 ) ); | 830 | m_up->setFixedSize( QSize( 20, 20 ) ); |
825 | connect(m_up ,SIGNAL(clicked()),this,SLOT(cdUP() ) ); | 831 | connect(m_up ,SIGNAL(clicked()),this,SLOT(cdUP() ) ); |
826 | m_up->setFlat(TRUE); | 832 | m_up->setFlat(TRUE); |
827 | 833 | ||
828 | // Home Button | 834 | // Home Button |
829 | m_homeButton = new QPushButton(Resource::loadIconSet("home") , | 835 | m_homeButton = new QPushButton(Resource::loadIconSet("home") , |
830 | "", m_boxToolbar); | 836 | "", m_boxToolbar); |
831 | m_homeButton->setFixedSize( QSize( 20, 20 ) ); | 837 | m_homeButton->setFixedSize( QSize( 20, 20 ) ); |
832 | connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotHome() ) ); | 838 | connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotHome() ) ); |
833 | m_homeButton->setFlat(TRUE); | 839 | m_homeButton->setFlat(TRUE); |
834 | // Documents Button | 840 | // Documents Button |
835 | m_docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"", | 841 | m_docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"", |
836 | m_boxToolbar,"docsButton"); | 842 | m_boxToolbar,"docsButton"); |
837 | m_docButton->setFixedSize( QSize( 20, 20 ) ); | 843 | m_docButton->setFixedSize( QSize( 20, 20 ) ); |
838 | connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotDoc() ) ); | 844 | connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotDoc() ) ); |
839 | m_docButton->setFlat(TRUE); | 845 | m_docButton->setFlat(TRUE); |
840 | 846 | ||
841 | // Close button | 847 | // Close button |
842 | m_close = new QPushButton( Resource::loadIconSet( "close"), "", | 848 | m_close = new QPushButton( Resource::loadIconSet( "close"), "", |
843 | m_boxToolbar ); | 849 | m_boxToolbar ); |
844 | connect( m_close, SIGNAL(clicked() ), this, SIGNAL(closeMe() ) ); | 850 | connect( m_close, SIGNAL(clicked() ), this, SIGNAL(closeMe() ) ); |
845 | m_close->setFixedSize( 20, 20 ); | 851 | m_close->setFixedSize( 20, 20 ); |
846 | 852 | ||
847 | m_boxToolbar->setFixedHeight( 20 ); | 853 | m_boxToolbar->setFixedHeight( 20 ); |
848 | m_pseudoLayout->addWidget(m_boxToolbar ); | 854 | m_pseudoLayout->addWidget(m_boxToolbar ); |
849 | 855 | ||
850 | // let;s fill the Location ComboBox | 856 | // let;s fill the Location ComboBox |
851 | StorageInfo storage; | 857 | StorageInfo storage; |
852 | const QList<FileSystem> &fs = storage.fileSystems(); | 858 | const QList<FileSystem> &fs = storage.fileSystems(); |
853 | QListIterator<FileSystem> it ( fs ); | 859 | QListIterator<FileSystem> it ( fs ); |
854 | for( ; it.current(); ++it ){ | 860 | for( ; it.current(); ++it ){ |
855 | const QString disk = (*it)->name(); | 861 | const QString disk = (*it)->name(); |
856 | const QString path = (*it)->path(); | 862 | const QString path = (*it)->path(); |
857 | m_location->insertItem(path+ "<-"+disk ); | 863 | m_location->insertItem(path+ "<-"+disk ); |
858 | } | 864 | } |
859 | int count = m_location->count(); | 865 | int count = m_location->count(); |
860 | m_location->insertItem( m_currentDir ); | 866 | m_location->insertItem( m_currentDir ); |
861 | m_location->setCurrentItem( count ); | 867 | m_location->setCurrentItem( count ); |
862 | // due to the New and Close button we can not simply hide m_boxToolBar to not show it | 868 | // due to the New and Close button we can not simply hide m_boxToolBar to not show it |
863 | if( !m_shTool ){ | 869 | if( !m_shTool ){ |
864 | m_location->hide( ); | 870 | m_location->hide( ); |
865 | m_up->hide( ); | 871 | m_up->hide( ); |
866 | m_homeButton->hide( ); | 872 | m_homeButton->hide( ); |
867 | m_docButton->hide( ); | 873 | m_docButton->hide( ); |
868 | } | 874 | } |