summaryrefslogtreecommitdiff
authorzecke <zecke>2002-04-01 01:48:02 (UTC)
committer zecke <zecke>2002-04-01 01:48:02 (UTC)
commit9a68bd2411e65eb6c51aead50a5b0b670174458d (patch) (unidiff)
tree05ab085d430edc2e821ea890da600774abc30f01
parent84850cd8811fc29aa39ecd2452884bf48ea27e92 (diff)
downloadopie-9a68bd2411e65eb6c51aead50a5b0b670174458d.zip
opie-9a68bd2411e65eb6c51aead50a5b0b670174458d.tar.gz
opie-9a68bd2411e65eb6c51aead50a5b0b670174458d.tar.bz2
Almost done ||
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/ofileselector.cc23
-rw-r--r--libopie/ofileselector.h4
2 files changed, 25 insertions, 2 deletions
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc
index 14f035e..fbe69ed 100644
--- a/libopie/ofileselector.cc
+++ b/libopie/ofileselector.cc
@@ -622,438 +622,459 @@ void OFileSelector::slotViewCheck(const QString &view ){
622 delete m_View; 622 delete m_View;
623 m_View = 0; 623 m_View = 0;
624 624
625 delete m_boxToolbar; 625 delete m_boxToolbar;
626 delete m_homeButton; 626 delete m_homeButton;
627 delete m_docButton; 627 delete m_docButton;
628 delete m_location; 628 delete m_location;
629 delete m_up; 629 delete m_up;
630 delete m_pseudo; 630 delete m_pseudo;
631 delete m_pseudoLayout; 631 delete m_pseudoLayout;
632 m_boxToolbar = 0; 632 m_boxToolbar = 0;
633 m_homeButton = 0; 633 m_homeButton = 0;
634 m_docButton = 0; 634 m_docButton = 0;
635 m_location = 0; 635 m_location = 0;
636 m_up = 0; 636 m_up = 0;
637 m_pseudo = 0; 637 m_pseudo = 0;
638 m_pseudoLayout = 0; 638 m_pseudoLayout = 0;
639 639
640 m_selector = EXTENDED; 640 m_selector = EXTENDED;
641 // create the ListView or IconView 641 // create the ListView or IconView
642 initializeListView(); 642 initializeListView();
643 643
644 reparse(); 644 reparse();
645 }else if(view == QString::fromLatin1("All Files") ) { 645 }else if(view == QString::fromLatin1("All Files") ) {
646 // remove from the stack 646 // remove from the stack
647 delete m_select; 647 delete m_select;
648 m_select = 0; 648 m_select = 0;
649 delete m_View; 649 delete m_View;
650 m_View = 0; 650 m_View = 0;
651 delete m_boxToolbar; 651 delete m_boxToolbar;
652 delete m_homeButton; 652 delete m_homeButton;
653 delete m_docButton; 653 delete m_docButton;
654 delete m_location; 654 delete m_location;
655 delete m_up; 655 delete m_up;
656 delete m_pseudo; 656 delete m_pseudo;
657 delete m_pseudoLayout; 657 delete m_pseudoLayout;
658 m_boxToolbar = 0; 658 m_boxToolbar = 0;
659 m_homeButton = 0; 659 m_homeButton = 0;
660 m_docButton = 0; 660 m_docButton = 0;
661 m_location = 0; 661 m_location = 0;
662 m_up = 0; 662 m_up = 0;
663 m_pseudo = 0; 663 m_pseudo = 0;
664 m_pseudoLayout = 0; 664 m_pseudoLayout = 0;
665 665
666 m_selector = EXTENDED_ALL; 666 m_selector = EXTENDED_ALL;
667 initializeListView(); 667 initializeListView();
668 reparse(); 668 reparse();
669 }; 669 };
670}; 670};
671 671
672 672
673void OFileSelector::updateMimes() // lets check which mode is active 673void OFileSelector::updateMimes() // lets check which mode is active
674 // check the current dir for items then 674 // check the current dir for items then
675{ 675{
676 m_mimetypes.clear(); 676 m_mimetypes.clear();
677 m_mimetypes.append("All" ); 677 m_mimetypes.append("All" );
678 if( m_selector == NORMAL ){ 678 if( m_selector == NORMAL ){
679 DocLnkSet set; 679 DocLnkSet set;
680 Global::findDocuments(&set, QString::null ); 680 Global::findDocuments(&set, QString::null );
681 QListIterator<DocLnk> dit( set.children() ); 681 QListIterator<DocLnk> dit( set.children() );
682 for ( ; dit.current(); ++dit ) { 682 for ( ; dit.current(); ++dit ) {
683 if( !m_mimetypes.contains((*dit)->type() ) ) 683 if( !m_mimetypes.contains((*dit)->type() ) )
684 m_mimetypes.append( (*dit)->type() ); 684 m_mimetypes.append( (*dit)->type() );
685 } 685 }
686 }else{ 686 }else{
687 // should be allreday updatet 687 // should be allreday updatet
688 ; 688 ;
689 } 689 }
690}; 690};
691void OFileSelector::initializeListView() 691void OFileSelector::initializeListView()
692{ 692{
693 // just to make sure but clean it up better FIXME 693 // just to make sure but clean it up better FIXME
694 delete m_View; 694 delete m_View;
695 m_View = 0; 695 m_View = 0;
696 delete m_boxToolbar; 696 delete m_boxToolbar;
697 delete m_homeButton; 697 delete m_homeButton;
698 delete m_docButton; 698 delete m_docButton;
699 delete m_location; 699 delete m_location;
700 delete m_up; 700 delete m_up;
701 delete m_pseudo; 701 delete m_pseudo;
702 delete m_pseudoLayout; 702 delete m_pseudoLayout;
703 m_boxToolbar = 0; 703 m_boxToolbar = 0;
704 m_homeButton = 0; 704 m_homeButton = 0;
705 m_docButton = 0; 705 m_docButton = 0;
706 m_location = 0; 706 m_location = 0;
707 m_up = 0; 707 m_up = 0;
708 m_pseudo = 0; 708 m_pseudo = 0;
709 m_pseudoLayout = 0; 709 m_pseudoLayout = 0;
710 // time for the toolbar 710 // time for the toolbar
711 m_pseudo = new QWidget(m_stack, "Pseudo Widget"); 711 m_pseudo = new QWidget(m_stack, "Pseudo Widget");
712 m_pseudoLayout = new QVBoxLayout(m_pseudo ); 712 m_pseudoLayout = new QVBoxLayout(m_pseudo );
713 if(m_shTool ){ 713 if(m_shTool ){
714 m_boxToolbar = new QHBoxLayout( ); 714 m_boxToolbar = new QHBoxLayout( );
715 m_boxToolbar->setAutoAdd( true ); 715 m_boxToolbar->setAutoAdd( true );
716 m_location = new QComboBox(m_pseudo ); 716 m_location = new QComboBox(m_pseudo );
717 717
718 m_up = new QPushButton(Resource::loadIconSet("up"),"", m_pseudo,"cdUpButton"); 718 m_up = new QPushButton(Resource::loadIconSet("up"),"", m_pseudo,"cdUpButton");
719 m_up->setMinimumSize( QSize( 20, 20 ) ); 719 m_up->setMinimumSize( QSize( 20, 20 ) );
720 m_up->setMaximumSize( QSize( 20, 20 ) ); 720 m_up->setMaximumSize( QSize( 20, 20 ) );
721 connect(m_up ,SIGNAL(clicked()),this,SLOT(cdUP() ) ); 721 connect(m_up ,SIGNAL(clicked()),this,SLOT(cdUP() ) );
722 m_up->setFlat(TRUE); 722 m_up->setFlat(TRUE);
723 723
724 m_homeButton = new QPushButton(Resource::loadIconSet("home") , "", m_pseudo); 724 m_homeButton = new QPushButton(Resource::loadIconSet("home") , "", m_pseudo);
725 m_homeButton->setMinimumSize( QSize( 20, 20 ) ); 725 m_homeButton->setMinimumSize( QSize( 20, 20 ) );
726 m_homeButton->setMaximumSize( QSize( 20, 20 ) ); 726 m_homeButton->setMaximumSize( QSize( 20, 20 ) );
727 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotHome() ) ); 727 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotHome() ) );
728 m_homeButton->setFlat(TRUE); 728 m_homeButton->setFlat(TRUE);
729 729
730 m_docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"", m_pseudo,"docsButton"); 730 m_docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"", m_pseudo,"docsButton");
731 m_docButton->setMinimumSize( QSize( 20, 20 ) ); 731 m_docButton->setMinimumSize( QSize( 20, 20 ) );
732 m_docButton->setMaximumSize( QSize( 20, 20 ) ); 732 m_docButton->setMaximumSize( QSize( 20, 20 ) );
733 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotDoc() ) ); 733 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotDoc() ) );
734 m_docButton->setFlat(TRUE); 734 m_docButton->setFlat(TRUE);
735 735
736 m_boxToolbar->addWidget(m_location ); 736 m_boxToolbar->addWidget(m_location );
737 m_boxToolbar->addWidget(m_up ); 737 m_boxToolbar->addWidget(m_up );
738 m_boxToolbar->addWidget(m_homeButton ); 738 m_boxToolbar->addWidget(m_homeButton );
739 m_boxToolbar->addWidget(m_docButton ); 739 m_boxToolbar->addWidget(m_docButton );
740 m_pseudoLayout->addLayout(m_boxToolbar ); 740 m_pseudoLayout->addLayout(m_boxToolbar );
741 // lets fill the combobox 741 // lets fill the combobox
742 StorageInfo storage; 742 StorageInfo storage;
743 const QList<FileSystem> &fs = storage.fileSystems(); 743 const QList<FileSystem> &fs = storage.fileSystems();
744 QListIterator<FileSystem> it ( fs ); 744 QListIterator<FileSystem> it ( fs );
745 for( ; it.current(); ++it ){ 745 for( ; it.current(); ++it ){
746 const QString disk = (*it)->name(); 746 const QString disk = (*it)->name();
747 const QString path = (*it)->path(); 747 const QString path = (*it)->path();
748 m_location->insertItem(path+ "<-"+disk ); 748 m_location->insertItem(path+ "<-"+disk );
749 } 749 }
750 int count = m_location->count();
751 m_location->insertItem(m_currentDir );
752 m_location->setCurrentItem( count );
750 }; 753 };
751 m_View = new QListView(m_pseudo, "Extended view" ); 754 m_View = new QListView(m_pseudo, "Extended view" );
752 m_stack->addWidget( m_pseudo, EXTENDED ); 755 m_stack->addWidget( m_pseudo, EXTENDED );
753 m_stack->raiseWidget( EXTENDED ); 756 m_stack->raiseWidget( EXTENDED );
754 m_pseudoLayout->addWidget(m_View ); 757 m_pseudoLayout->addWidget(m_View );
755 QPEApplication::setStylusOperation( m_View->viewport(),QPEApplication::RightOnHold); 758 QPEApplication::setStylusOperation( m_View->viewport(),QPEApplication::RightOnHold);
756 // set up the stuff 759 // set up the stuff
757 // Pixmap Name Date Size mime 760 // Pixmap Name Date Size mime
758 //(m_View->header() )->hide(); 761 //(m_View->header() )->hide();
759 //m_View->setRootIsDecorated(false); 762 //m_View->setRootIsDecorated(false);
760 m_View->addColumn(" "); 763 m_View->addColumn(" ");
761 m_View->addColumn(tr("Name") ); 764 m_View->addColumn(tr("Name") );
762 m_View->addColumn(tr("Size") ); 765 m_View->addColumn(tr("Size") );
763 m_View->addColumn(tr("Date"), 60 ); 766 m_View->addColumn(tr("Date"), 60 );
764 m_View->addColumn(tr("Mime Type") ); 767 m_View->addColumn(tr("Mime Type") );
765 QHeader *header = m_View->header(); 768 QHeader *header = m_View->header();
766 header->hide(); 769 header->hide();
767 m_View->setSorting(1 ); 770 m_View->setSorting(1 );
768 // connect now 771 // connect now
769 connect(m_View, SIGNAL(selectionChanged() ), this, SLOT(slotSelectionChanged() ) ); 772 connect(m_View, SIGNAL(selectionChanged() ), this, SLOT(slotSelectionChanged() ) );
770 connect(m_View, SIGNAL(currentChanged(QListViewItem *) ), this, SLOT(slotCurrentChanged(QListViewItem * ) ) ); 773 connect(m_View, SIGNAL(currentChanged(QListViewItem *) ), this, SLOT(slotCurrentChanged(QListViewItem * ) ) );
771 connect(m_View, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint &, int) ), 774 connect(m_View, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint &, int) ),
772 this, SLOT(slotClicked( int, QListViewItem *, const QPoint &, int) ) ); 775 this, SLOT(slotClicked( int, QListViewItem *, const QPoint &, int) ) );
773 connect(m_View, SIGNAL(mouseButtonPressed(int, QListViewItem *, const QPoint &, int )), 776 connect(m_View, SIGNAL(mouseButtonPressed(int, QListViewItem *, const QPoint &, int )),
774 this, SLOT(slotRightButton(int, QListViewItem *, const QPoint &, int ) ) ); 777 this, SLOT(slotRightButton(int, QListViewItem *, const QPoint &, int ) ) );
775 778
776 779
777}; 780};
778/* If a item is locked depends on the mode 781/* If a item is locked depends on the mode
779 if we're in OPEN !isReadable is locked 782 if we're in OPEN !isReadable is locked
780 if we're in SAVE !isWriteable is locked 783 if we're in SAVE !isWriteable is locked
781 784
782 785
783 */ 786 */
784 787
785 788
786void OFileSelector::addFile(const QString &mime, QFileInfo *info, bool symlink ){ 789void OFileSelector::addFile(const QString &mime, QFileInfo *info, bool symlink ){
787 qWarning("Add Files" ); 790 qWarning("Add Files" );
788 if( !m_files ){ 791 if( !m_files ){
789 qWarning("not mfiles" ); 792 qWarning("not mfiles" );
790 return; 793 return;
791 } 794 }
792 795
793 MimeType type( info->filePath() ); 796 MimeType type( info->filePath() );
794 QString name; 797 QString name;
795 QString dir; 798 QString dir;
796 bool locked= false; 799 bool locked= false;
797 if(mime == "All" ){ 800 if(mime == "All" ){
798 ; 801 ;
799 }else if( type.id() != mime ) { 802 }else if( type.id() != mime ) {
800 return; 803 return;
801 } 804 }
802 QPixmap pix = type.pixmap(); 805 QPixmap pix = type.pixmap();
803 if(pix.isNull() ) 806 if(pix.isNull() )
804 pix = Resource::loadPixmap( "UnknownDocument-14" ); 807 pix = Resource::loadPixmap( "UnknownDocument-14" );
805 dir = info->dirPath( true ); 808 dir = info->dirPath( true );
806 if( symlink ) { // check if the readLink is readable 809 if( symlink ) { // check if the readLink is readable
807 // do it right later 810 // do it right later
808 name = info->fileName() + " -> " + info->dirPath() + "/" + info->readLink(); 811 name = info->fileName() + " -> " + info->dirPath() + "/" + info->readLink();
809 }else{ // keep track of the icons 812 }else{ // keep track of the icons
810 name = info->fileName(); 813 name = info->fileName();
811 if( m_mode == OPEN ){ 814 if( m_mode == OPEN ){
812 if( !info->isReadable() ){ 815 if( !info->isReadable() ){
813 locked = true; 816 locked = true;
814 pix = Resource::loadPixmap("locked" ); 817 pix = Resource::loadPixmap("locked" );
815 } 818 }
816 }else if( m_mode == SAVE ){ 819 }else if( m_mode == SAVE ){
817 if( !info->isWritable() ){ 820 if( !info->isWritable() ){
818 locked = true; 821 locked = true;
819 pix = Resource::loadPixmap("locked" ); 822 pix = Resource::loadPixmap("locked" );
820 } 823 }
821 } 824 }
822 } 825 }
823 new OFileSelectorItem( m_View, pix, name, 826 new OFileSelectorItem( m_View, pix, name,
824 info->lastModified().toString(), 827 info->lastModified().toString(),
825 QString::number( info->size() ), 828 QString::number( info->size() ),
826 dir, locked ); 829 dir, locked );
827} 830}
828void OFileSelector::addDir(const QString &mime, QFileInfo *info, bool symlink ) 831void OFileSelector::addDir(const QString &mime, QFileInfo *info, bool symlink )
829{ 832{
830 if(!m_dir ) 833 if(!m_dir )
831 return; 834 return;
832 //if( showDirs ) 835 //if( showDirs )
833 { 836 {
834 bool locked=false; 837 bool locked=false;
835 QString name; 838 QString name;
836 QPixmap pix; 839 QPixmap pix;
837 if( ( m_mode == OPEN && !info->isReadable() ) || ( m_mode == SAVE && !info->isWritable() ) ){ 840 if( ( m_mode == OPEN && !info->isReadable() ) || ( m_mode == SAVE && !info->isWritable() ) ){
838 locked = true; 841 locked = true;
839 if( symlink ){ 842 if( symlink ){
840 pix = (*m_pixmaps)["symlinkedlocked"]; 843 pix = (*m_pixmaps)["symlinkedlocked"];
841 }else{ 844 }else{
842 pix = Resource::loadPixmap("lockedfolder" ); 845 pix = Resource::loadPixmap("lockedfolder" );
843 } 846 }
844 }else{ 847 }else{
845 if( symlink ){ 848 if( symlink ){
846 pix = (*m_pixmaps)["dirsymlink" ]; 849 pix = (*m_pixmaps)["dirsymlink" ];
847 }else{ 850 }else{
848 pix = Resource::loadPixmap("folder" ); 851 pix = Resource::loadPixmap("folder" );
849 } 852 }
850 } 853 }
851 if( symlink){ 854 if( symlink){
852 name = info->fileName()+ "->"+ info->dirPath(true) +"/" +info->readLink(); 855 name = info->fileName()+ "->"+ info->dirPath(true) +"/" +info->readLink();
853 856
854 }else{ 857 }else{
855 //if(info->isReadable() ) 858 //if(info->isReadable() )
856 name = info->fileName(); 859 name = info->fileName();
857 } 860 }
858 861
859 new OFileSelectorItem(m_View, pix, 862 new OFileSelectorItem(m_View, pix,
860 name, info->lastModified().toString(), 863 name, info->lastModified().toString(),
861 QString::number(info->size() ),info->dirPath(true), locked, true ); 864 QString::number(info->size() ),info->dirPath(true), locked, true );
862 865
863 } 866 }
864} 867}
865void OFileSelector::setShowDirs(bool dir ) 868void OFileSelector::setShowDirs(bool dir )
866{ 869{
867 m_dir = dir; 870 m_dir = dir;
868 reparse(); 871 reparse();
869} 872}
870 873
871void OFileSelector::slotFileSelected(const QString &string ) 874void OFileSelector::slotFileSelected(const QString &string )
872{ 875{
873 if(m_shLne ) 876 if(m_shLne )
874 m_edit->setText( string ); 877 m_edit->setText( string );
875 878
876 emit fileSelected( string ); 879 emit fileSelected( string );
877 // do AppLnk stuff 880 // do AppLnk stuff
878} 881}
879void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk ) 882void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk )
880{ 883{
881 slotFileSelected(lnk.name() ); 884 slotFileSelected(lnk.name() );
882 emit fileSelected( lnk ); 885 emit fileSelected( lnk );
883} 886}
884void OFileSelector::slotSelectionChanged() // get the current items 887void OFileSelector::slotSelectionChanged() // get the current items
885 // fixme 888 // fixme
886{ 889{
887 qWarning("selection changed" ); 890 qWarning("selection changed" );
888} 891}
889void OFileSelector::slotCurrentChanged(QListViewItem *item ) 892void OFileSelector::slotCurrentChanged(QListViewItem *item )
890{ 893{
891 qWarning("current changed" ); 894 qWarning("current changed" );
892 if( item == 0 ) 895 if( item == 0 )
893 return; 896 return;
894 897
895 if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){ 898 if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){
896 OFileSelectorItem *sel = (OFileSelectorItem*)item; 899 OFileSelectorItem *sel = (OFileSelectorItem*)item;
897 if(!sel->isDir() ){ 900 if(!sel->isDir() ){
898 qWarning("is not dir" ); 901 qWarning("is not dir" );
899 if(m_shLne ){ 902 if(m_shLne ){
900 m_edit->setText(sel->text(1) ); 903 m_edit->setText(sel->text(1) );
901 qWarning("setTexy" ); 904 qWarning("setTexy" );
902 } 905 }
903 } 906 }
904 }else { 907 }else {
905 qWarning("mode not extended" ); 908 qWarning("mode not extended" );
906 } 909 }
907} 910}
908// either select or change dir 911// either select or change dir
909void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint &point, int ) 912void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint &point, int )
910{ 913{
911 if( item == 0 ) 914 if( item == 0 )
912 return; 915 return;
913 916
914 if( button != Qt::LeftButton ) 917 if( button != Qt::LeftButton )
915 return; 918 return;
916 919
917 qWarning("clicked" ); 920 qWarning("clicked" );
918 if(m_selector == EXTENDED || m_selector == EXTENDED_ALL ){ 921 if(m_selector == EXTENDED || m_selector == EXTENDED_ALL ){
919 qWarning("inside" ); 922 qWarning("inside" );
920 OFileSelectorItem *sel = (OFileSelectorItem*)item; 923 OFileSelectorItem *sel = (OFileSelectorItem*)item;
921 if(!sel->isLocked() ){ // not locked either changedir or open 924 if(!sel->isLocked() ){ // not locked either changedir or open
922 QStringList str = QStringList::split("->", sel->text(1) ); 925 QStringList str = QStringList::split("->", sel->text(1) );
923 if(sel->isDir() ){ 926 if(sel->isDir() ){
924 cd( sel->directory() + "/" + str[0] ); 927 cd( sel->directory() + "/" + str[0] );
925 }else{ 928 }else{
926 qWarning("file" ); 929 qWarning("file" );
927 if(m_shLne ) 930 if(m_shLne )
928 m_edit->setText(str[0] ); 931 m_edit->setText(str[0] );
929 emit fileSelected(str[0] ); 932 emit fileSelected(str[0] );
930 // emit DocLnk need to do it 933 // emit DocLnk need to do it
931 } 934 }
932 }else{ 935 }else{
933 qWarning( "locked" ); 936 qWarning( "locked" );
934 } 937 }
935 }; 938 };
936} 939}
937void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoint &, int ) 940void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoint &, int )
938{ 941{
939 if (item == 0 ) 942 if (item == 0 )
940 return; 943 return;
941 944
942 if( button != Qt::RightButton ) 945 if( button != Qt::RightButton )
943 return; 946 return;
944 qWarning("right button" ); 947 qWarning("right button" );
945 slotContextMenu(item); 948 slotContextMenu(item);
946} 949}
947void OFileSelector::slotContextMenu(QListViewItem *item) 950void OFileSelector::slotContextMenu(QListViewItem *item)
948{ 951{
949 qWarning("context menu" ); 952 qWarning("context menu" );
950 if( item ==0 || !m_showPopup ) 953 if( item ==0 || !m_showPopup )
951 return; 954 return;
952 955
953 if( m_custom !=0){ 956 if( m_custom !=0){
954 m_custom->exec(); 957 m_custom->exec();
955 }else{ 958 }else{
956 QPopupMenu menu; 959 QPopupMenu menu;
957 QAction up; 960 QAction up;
958 up.setText("cd up"); 961 up.setText("cd up");
959 up.addTo( &menu ); 962 up.addTo( &menu );
960 connect(&up, SIGNAL(activated() ), 963 connect(&up, SIGNAL(activated() ),
961 this, SLOT(cdUP() ) ); 964 this, SLOT(cdUP() ) );
962 965
963 QAction act; 966 QAction act;
964 OFileSelectorItem *sel = (OFileSelectorItem*)item; 967 OFileSelectorItem *sel = (OFileSelectorItem*)item;
965 if(sel->isDir() ){ 968 if(sel->isDir() ){
966 act.setText( tr("Change Directory") ); 969 act.setText( tr("Change Directory") );
967 act.addTo(&menu ); 970 act.addTo(&menu );
968 connect(&act, SIGNAL(activated() ), 971 connect(&act, SIGNAL(activated() ),
969 this, SLOT(slotChangedDir() ) ); 972 this, SLOT(slotChangedDir() ) );
970 }else{ 973 }else{
971 act.setText( tr("Open file" ) ); 974 act.setText( tr("Open file" ) );
972 act.addTo( &menu ); 975 act.addTo( &menu );
973 connect(&act, SIGNAL(activated() ), 976 connect(&act, SIGNAL(activated() ),
974 this, SLOT(slotOpen() ) ); 977 this, SLOT(slotOpen() ) );
975 } 978 }
976 QAction rescan; 979 QAction rescan;
977 rescan.setText( tr("Rescan") ); 980 rescan.setText( tr("Rescan") );
978 rescan.addTo( &menu ); 981 rescan.addTo( &menu );
979 connect(&rescan, SIGNAL(activated() ), 982 connect(&rescan, SIGNAL(activated() ),
980 this, SLOT(slotRescan() ) ); 983 this, SLOT(slotRescan() ) );
981 984
982 QAction rename; 985 QAction rename;
983 rename.setText( tr("Rename") ); 986 rename.setText( tr("Rename") );
984 rename.addTo( &menu ); 987 rename.addTo( &menu );
985 connect(&rename, SIGNAL(activated() ), 988 connect(&rename, SIGNAL(activated() ),
986 this, SLOT(slotRename() ) ); 989 this, SLOT(slotRename() ) );
987 990
988 menu.insertSeparator(); 991 menu.insertSeparator();
989 QAction delItem; 992 QAction delItem;
990 delItem.setText( tr("Delete") ); 993 delItem.setText( tr("Delete") );
991 delItem.addTo(&menu ); 994 delItem.addTo(&menu );
992 connect(&delItem, SIGNAL(activated() ), 995 connect(&delItem, SIGNAL(activated() ),
993 this, SLOT(slotDelete() ) ); 996 this, SLOT(slotDelete() ) );
994 997
995 menu.exec(QCursor::pos() ); 998 menu.exec(QCursor::pos() );
996 } 999 }
997} 1000}
998bool OFileSelector::cd(const QString &str ) 1001bool OFileSelector::cd(const QString &str )
999{ 1002{
1000 qWarning(" dir %s", str.latin1() ); 1003 qWarning(" dir %s", str.latin1() );
1001 QDir dir( str); 1004 QDir dir( str);
1002 if(dir.exists() ){ 1005 if(dir.exists() ){
1003 m_currentDir = str; 1006 m_currentDir = str;
1004 reparse(); 1007 reparse();
1008 if(m_shTool ){
1009 int count = m_location->count();
1010 m_location->insertItem(str );
1011 m_location->setCurrentItem( count );
1012 }
1005 return true; 1013 return true;
1006 } 1014 }
1007 return false; 1015 return false;
1008} 1016}
1009 1017
1010void OFileSelector::slotChangedDir() 1018void OFileSelector::slotChangedDir()
1011{ 1019{
1012 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); 1020 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem();
1013 if(sel->isDir() ){ 1021 if(sel->isDir() ){
1014 QStringList str = QStringList::split("->", sel->text(1) ); 1022 QStringList str = QStringList::split("->", sel->text(1) );
1015 cd( sel->directory() + "/" + str[0] ); 1023 cd( sel->directory() + "/" + str[0] );
1016 } 1024 }
1017} 1025}
1018void OFileSelector::slotOpen() 1026void OFileSelector::slotOpen()
1019{ 1027{
1020 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); 1028 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem();
1021 if(!sel->isDir() ){ 1029 if(!sel->isDir() ){
1022 QStringList str = QStringList::split("->", sel->text(1) ); 1030 QStringList str = QStringList::split("->", sel->text(1) );
1023 slotFileSelected( str[0] ); 1031 slotFileSelected( str[0] );
1024 } 1032 }
1025} 1033}
1026void OFileSelector::slotRescan() 1034void OFileSelector::slotRescan()
1027{ 1035{
1028 reparse(); 1036 reparse();
1029} 1037}
1030void OFileSelector::slotRename() 1038void OFileSelector::slotRename()
1031{ 1039{
1032 // rename inline 1040 // rename inline
1033} 1041}
1034void OFileSelector::slotDelete() 1042void OFileSelector::slotDelete()
1035{ 1043{
1036 qWarning("delete slot" ); 1044 qWarning("delete slot" );
1037 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); 1045 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem();
1038 QStringList list = QStringList::split("->", sel->text(1) ); 1046 QStringList list = QStringList::split("->", sel->text(1) );
1039 if( sel->isDir() ){ 1047 if( sel->isDir() ){
1040 QString str = QString::fromLatin1("rm -rf ") + list[0]; 1048 QString str = QString::fromLatin1("rm -rf ") + list[0];
1041 ::system(str.utf8().data() ); 1049 ::system(str.utf8().data() );
1042 }else{ 1050 }else{
1043 QFile::remove( list[0] ); 1051 QFile::remove( list[0] );
1044 } 1052 }
1045 m_View->takeItem( sel ); 1053 m_View->takeItem( sel );
1046 delete sel; 1054 delete sel;
1047} 1055}
1048 1056
1049void OFileSelector::cdUP() 1057void OFileSelector::cdUP()
1050{ 1058{
1051 QDir dir( m_currentDir ); 1059 QDir dir( m_currentDir );
1052 dir.cdUp(); 1060 dir.cdUp();
1053 if(dir.exists() ){ 1061 if(dir.exists() ){
1054 m_currentDir = dir.absPath(); 1062 m_currentDir = dir.absPath();
1055 reparse(); 1063 reparse();
1064 int count = m_location->count();
1065 m_location->insertItem(m_currentDir );
1066 m_location->setCurrentItem( count );
1056 } 1067 }
1057} 1068}
1069void OFileSelector::slotHome()
1070{
1071 cd(QDir::homeDirPath() );
1072}
1073void OFileSelector::slotDoc()
1074{
1075 cd(QDir::homeDirPath() + "/Documents" );
1076}
1077void OFileSelector::slotNavigate()
1078{
1058 1079
1059 1080}
diff --git a/libopie/ofileselector.h b/libopie/ofileselector.h
index b91c0ea..bf3cb48 100644
--- a/libopie/ofileselector.h
+++ b/libopie/ofileselector.h
@@ -142,134 +142,136 @@ class OFileSelector : public QWidget {
142 void setShowDirs(bool ); 142 void setShowDirs(bool );
143 143
144 const QListView* listView() { return m_View; }; 144 const QListView* listView() { return m_View; };
145 145
146 bool isCaseSensetive()const { return m_case; } 146 bool isCaseSensetive()const { return m_case; }
147 void setCaseSensetive(bool caSe ); 147 void setCaseSensetive(bool caSe );
148 148
149 bool showFiles()const { return m_files; }; 149 bool showFiles()const { return m_files; };
150 void setShowFiles(bool ); 150 void setShowFiles(bool );
151 bool cd(const QString &path ); 151 bool cd(const QString &path );
152 152
153 153
154 int mode()const { return m_mode; }; 154 int mode()const { return m_mode; };
155 int selector()const { return m_selector; }; 155 int selector()const { return m_selector; };
156 void setSelector( int ); 156 void setSelector( int );
157 157
158 bool showPopup()const { return m_showPopup; }; 158 bool showPopup()const { return m_showPopup; };
159 void setShowPopup( bool pop ) { m_showPopup = pop; }; 159 void setShowPopup( bool pop ) { m_showPopup = pop; };
160 void setPopupMenu( QPopupMenu * ); 160 void setPopupMenu( QPopupMenu * );
161 161
162 void updateLay(); 162 void updateLay();
163 163
164 void reparse(); // re reads the dir 164 void reparse(); // re reads the dir
165 165
166 QString selectedName( )const; 166 QString selectedName( )const;
167 QStringList selectedNames()const; 167 QStringList selectedNames()const;
168 168
169 QString selectedPath() const; 169 QString selectedPath() const;
170 QStringList selectedPaths() const; 170 QStringList selectedPaths() const;
171 171
172 QString directory()const; 172 QString directory()const;
173 int fileCount(); 173 int fileCount();
174 174
175 /* the user needs to delete it */ 175 /* the user needs to delete it */
176 DocLnk selectedDocument()const; 176 DocLnk selectedDocument()const;
177 /* the user needs to delete it */ 177 /* the user needs to delete it */
178 QValueList<DocLnk> selectedDocuments()const; 178 QValueList<DocLnk> selectedDocuments()const;
179 179
180 signals: 180 signals:
181 void fileSelected( const DocLnk & ); 181 void fileSelected( const DocLnk & );
182 void fileSelected( const QString & ); 182 void fileSelected( const QString & );
183 void closeMe(); 183 void closeMe();
184 void ok(); 184 void ok();
185 void cancel(); 185 void cancel();
186 186
187 protected slots: 187 protected slots:
188 void slotOk(); 188 void slotOk();
189 void slotCancel(); 189 void slotCancel();
190 void slotViewCheck(const QString & ); 190 void slotViewCheck(const QString & );
191 void slotMimeCheck(const QString & ); 191 void slotMimeCheck(const QString & );
192 protected: 192 protected:
193 void init(); 193 void init();
194 void updateMimes(); 194 void updateMimes();
195 195
196 protected: 196 protected:
197 197
198 private: 198 private:
199 int m_mode, m_selector; 199 int m_mode, m_selector;
200 QComboBox *m_location, *m_mimeCheck, *m_viewCheck; 200 QComboBox *m_location, *m_mimeCheck, *m_viewCheck;
201 QPushButton *m_homeButton, *m_docButton, *m_hideButton, *m_ok, *m_cancel; 201 QPushButton *m_homeButton, *m_docButton, *m_hideButton, *m_ok, *m_cancel;
202 QPushButton *m_reread, *m_up; 202 QPushButton *m_reread, *m_up;
203 QListView *m_View; 203 QListView *m_View;
204 QCheckBox *m_checkPerm; 204 QCheckBox *m_checkPerm;
205 QWidget *m_pseudo; 205 QWidget *m_pseudo;
206 QVBoxLayout *m_pseudoLayout; 206 QVBoxLayout *m_pseudoLayout;
207 207
208 QString m_currentDir; 208 QString m_currentDir;
209 QString m_name; 209 QString m_name;
210 QStringList m_mimetypes; 210 QStringList m_mimetypes;
211 211
212 FileSelector *m_select; 212 FileSelector *m_select;
213 QWidgetStack *m_stack; 213 QWidgetStack *m_stack;
214 QVBoxLayout *m_lay; 214 QVBoxLayout *m_lay;
215 QGridLayout *m_Oselector; 215 QGridLayout *m_Oselector;
216 216
217 QHBoxLayout *m_boxToolbar; 217 QHBoxLayout *m_boxToolbar;
218 QHBoxLayout *m_boxOk; 218 QHBoxLayout *m_boxOk;
219 QHBoxLayout *m_boxName; 219 QHBoxLayout *m_boxName;
220 QHBoxLayout *m_boxView; 220 QHBoxLayout *m_boxView;
221 221
222 QPopupMenu *m_custom; 222 QPopupMenu *m_custom;
223 223
224 QLineEdit *m_edit; 224 QLineEdit *m_edit;
225 QLabel *m_fnLabel; 225 QLabel *m_fnLabel;
226 bool m_shTool:1; 226 bool m_shTool:1;
227 bool m_shPerm:1; 227 bool m_shPerm:1;
228 bool m_shLne:1; 228 bool m_shLne:1;
229 bool m_shChooser:1; 229 bool m_shChooser:1;
230 bool m_shYesNo:1; 230 bool m_shYesNo:1;
231 bool m_boCheckPerm:1; 231 bool m_boCheckPerm:1;
232 bool m_autoMime:1; 232 bool m_autoMime:1;
233 bool m_case:1; 233 bool m_case:1;
234 bool m_dir:1; 234 bool m_dir:1;
235 bool m_files:1; 235 bool m_files:1;
236 bool m_showPopup:1; 236 bool m_showPopup:1;
237 237
238 // implementation todo 238 // implementation todo
239 virtual void addFile(const QString &mime, QFileInfo *info, bool symlink = FALSE ); 239 virtual void addFile(const QString &mime, QFileInfo *info, bool symlink = FALSE );
240 virtual void addDir( const QString &mime, QFileInfo *info , bool symlink = FALSE ); 240 virtual void addDir( const QString &mime, QFileInfo *info , bool symlink = FALSE );
241 virtual void addSymlink(const QString &, QFileInfo *, bool = FALSE ){}; 241 virtual void addSymlink(const QString &, QFileInfo *, bool = FALSE ){};
242 void delItems(); 242 void delItems();
243 void initializeName(); 243 void initializeName();
244 void initializeYes(); 244 void initializeYes();
245 void initializeChooser(); 245 void initializeChooser();
246 void initializeListView(); 246 void initializeListView();
247 void initPics(); 247 void initPics();
248 bool compliesMime(const QString &path, const QString &mime); 248 bool compliesMime(const QString &path, const QString &mime);
249 249
250 class OFileSelectorPrivate; 250 class OFileSelectorPrivate;
251 OFileSelectorPrivate *d; 251 OFileSelectorPrivate *d;
252 static QMap<QString,QPixmap> *m_pixmaps; 252 static QMap<QString,QPixmap> *m_pixmaps;
253 253
254private slots: 254private slots:
255 void slotFileSelected(const QString & ); // not really meant to be a slot 255 void slotFileSelected(const QString & ); // not really meant to be a slot
256 void slotFileBridgeSelected( const DocLnk & ); 256 void slotFileBridgeSelected( const DocLnk & );
257 virtual void slotSelectionChanged(); 257 virtual void slotSelectionChanged();
258 virtual void slotCurrentChanged(QListViewItem* ); 258 virtual void slotCurrentChanged(QListViewItem* );
259 virtual void slotClicked( int, QListViewItem *item, const QPoint &, int); 259 virtual void slotClicked( int, QListViewItem *item, const QPoint &, int);
260 virtual void slotRightButton(int, QListViewItem *, const QPoint &, int ); 260 virtual void slotRightButton(int, QListViewItem *, const QPoint &, int );
261 virtual void slotContextMenu( QListViewItem *item); 261 virtual void slotContextMenu( QListViewItem *item);
262 // listview crap see above 262 // listview crap see above
263 // PopupMenu crap 263 // PopupMenu crap
264 virtual void slotChangedDir(); 264 virtual void slotChangedDir();
265 virtual void slotOpen(); 265 virtual void slotOpen();
266 virtual void slotRescan(); 266 virtual void slotRescan();
267 virtual void slotRename(); 267 virtual void slotRename();
268 virtual void slotDelete(); 268 virtual void slotDelete();
269 virtual void cdUP(); 269 virtual void cdUP();
270 270 virtual void slotHome();
271 virtual void slotDoc();
272 virtual void slotNavigate( );
271}; 273};
272 274
273 275
274#endif 276#endif
275 277