author | sandman <sandman> | 2002-10-10 16:18:17 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-10-10 16:18:17 (UTC) |
commit | aa38f642a07810515dcc18ea38bf520e26d7f88e (patch) (unidiff) | |
tree | f9bd4346cc043e63663474f0818eac11f8b37706 | |
parent | c82a7868e0e2f8dc3e3d2b42629fc8d8efef05c7 (diff) | |
download | opie-aa38f642a07810515dcc18ea38bf520e26d7f88e.zip opie-aa38f642a07810515dcc18ea38bf520e26d7f88e.tar.gz opie-aa38f642a07810515dcc18ea38bf520e26d7f88e.tar.bz2 |
fileSelected ( DocLnk & ); was not emitted
(opening files in qpdf works now)
-rw-r--r-- | libopie/ofileselector.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc index b3aacd6..9534667 100644 --- a/libopie/ofileselector.cc +++ b/libopie/ofileselector.cc | |||
@@ -655,646 +655,646 @@ void OFileSelector::initVars() | |||
655 | 655 | ||
656 | // pointers | 656 | // pointers |
657 | m_location = 0; | 657 | m_location = 0; |
658 | m_mimeCheck = 0; | 658 | m_mimeCheck = 0; |
659 | m_viewCheck = 0; | 659 | m_viewCheck = 0; |
660 | m_homeButton = 0; | 660 | m_homeButton = 0; |
661 | m_docButton = 0; | 661 | m_docButton = 0; |
662 | m_hideButton = 0; | 662 | m_hideButton = 0; |
663 | m_ok = 0; | 663 | m_ok = 0; |
664 | m_cancel = 0; | 664 | m_cancel = 0; |
665 | m_reread = 0; | 665 | m_reread = 0; |
666 | m_up = 0; | 666 | m_up = 0; |
667 | m_View = 0; | 667 | m_View = 0; |
668 | m_checkPerm = 0; | 668 | m_checkPerm = 0; |
669 | m_pseudo = 0; | 669 | m_pseudo = 0; |
670 | m_pseudoLayout = 0; | 670 | m_pseudoLayout = 0; |
671 | m_select = 0; | 671 | m_select = 0; |
672 | m_stack = 0; | 672 | m_stack = 0; |
673 | m_lay = 0; | 673 | m_lay = 0; |
674 | m_Oselector = 0; | 674 | m_Oselector = 0; |
675 | m_boxToolbar = 0; | 675 | m_boxToolbar = 0; |
676 | m_boxOk = 0; | 676 | m_boxOk = 0; |
677 | m_boxName = 0; | 677 | m_boxName = 0; |
678 | m_boxView = 0; | 678 | m_boxView = 0; |
679 | m_custom = 0; | 679 | m_custom = 0; |
680 | m_edit = 0; | 680 | m_edit = 0; |
681 | m_fnLabel = 0; | 681 | m_fnLabel = 0; |
682 | m_new = 0; | 682 | m_new = 0; |
683 | m_close = 0; | 683 | m_close = 0; |
684 | } | 684 | } |
685 | void OFileSelector::addFile(const QString &mime, QFileInfo *info, bool symlink) | 685 | void OFileSelector::addFile(const QString &mime, QFileInfo *info, bool symlink) |
686 | { | 686 | { |
687 | if(!m_files) | 687 | if(!m_files) |
688 | return; | 688 | return; |
689 | // if( !compliesMime(info->absFilePath(), mime ) ) | 689 | // if( !compliesMime(info->absFilePath(), mime ) ) |
690 | // return; | 690 | // return; |
691 | MimeType type( info->absFilePath() ); | 691 | MimeType type( info->absFilePath() ); |
692 | if (!compliesMime( type.id() ) ) | 692 | if (!compliesMime( type.id() ) ) |
693 | return; | 693 | return; |
694 | 694 | ||
695 | QPixmap pix = type.pixmap(); | 695 | QPixmap pix = type.pixmap(); |
696 | QString dir; | 696 | QString dir; |
697 | QString name; | 697 | QString name; |
698 | bool locked; | 698 | bool locked; |
699 | if( pix.isNull() ) | 699 | if( pix.isNull() ) |
700 | pix = Resource::loadPixmap( "UnknownDocument-14"); | 700 | pix = Resource::loadPixmap( "UnknownDocument-14"); |
701 | dir = info->dirPath( true ); | 701 | dir = info->dirPath( true ); |
702 | if( symlink ) | 702 | if( symlink ) |
703 | name = info->fileName() + " -> " +info->dirPath() + "/" + info->readLink(); | 703 | name = info->fileName() + " -> " +info->dirPath() + "/" + info->readLink(); |
704 | else { | 704 | else { |
705 | name = info->fileName(); | 705 | name = info->fileName(); |
706 | if( ( m_mode == OPEN && !info->isReadable() )|| | 706 | if( ( m_mode == OPEN && !info->isReadable() )|| |
707 | ( m_mode == SAVE && !info->isWritable() ) ){ | 707 | ( m_mode == SAVE && !info->isWritable() ) ){ |
708 | 708 | ||
709 | locked = true; pix = Resource::loadPixmap("locked"); | 709 | locked = true; pix = Resource::loadPixmap("locked"); |
710 | } | 710 | } |
711 | } | 711 | } |
712 | new OFileSelectorItem( m_View, pix, name, | 712 | new OFileSelectorItem( m_View, pix, name, |
713 | info->lastModified().toString(), | 713 | info->lastModified().toString(), |
714 | QString::number( info->size() ), | 714 | QString::number( info->size() ), |
715 | dir, locked ); | 715 | dir, locked ); |
716 | } | 716 | } |
717 | void OFileSelector::addDir(const QString &mime, QFileInfo *info, bool symlink ) | 717 | void OFileSelector::addDir(const QString &mime, QFileInfo *info, bool symlink ) |
718 | { | 718 | { |
719 | if(!m_dir) | 719 | if(!m_dir) |
720 | return; | 720 | return; |
721 | if( m_selector == EXTENDED_ALL || m_selector == EXTENDED ){ | 721 | if( m_selector == EXTENDED_ALL || m_selector == EXTENDED ){ |
722 | bool locked = false; | 722 | bool locked = false; |
723 | QString name; | 723 | QString name; |
724 | QPixmap pix; | 724 | QPixmap pix; |
725 | if( ( m_mode == OPEN && !info->isReadable() ) || ( m_mode == SAVE && !info->isWritable() ) ){ | 725 | if( ( m_mode == OPEN && !info->isReadable() ) || ( m_mode == SAVE && !info->isWritable() ) ){ |
726 | locked = true; | 726 | locked = true; |
727 | if( symlink ) | 727 | if( symlink ) |
728 | pix = (*m_pixmaps)["symlinkedlocked"]; | 728 | pix = (*m_pixmaps)["symlinkedlocked"]; |
729 | else | 729 | else |
730 | pix = Resource::loadPixmap("lockedfolder"); | 730 | pix = Resource::loadPixmap("lockedfolder"); |
731 | }else { // readable | 731 | }else { // readable |
732 | pix = symlink ? (*m_pixmaps)["dirsymlink"] : Resource::loadPixmap("folder") ; | 732 | pix = symlink ? (*m_pixmaps)["dirsymlink"] : Resource::loadPixmap("folder") ; |
733 | } | 733 | } |
734 | name = symlink ? info->fileName() + "->" + info->dirPath(true) + "/" +info->readLink() : info->fileName() ; | 734 | name = symlink ? info->fileName() + "->" + info->dirPath(true) + "/" +info->readLink() : info->fileName() ; |
735 | new OFileSelectorItem( m_View, pix, name, | 735 | new OFileSelectorItem( m_View, pix, name, |
736 | info->lastModified().toString(), | 736 | info->lastModified().toString(), |
737 | QString::number( info->size() ), | 737 | QString::number( info->size() ), |
738 | info->dirPath( true ), locked, | 738 | info->dirPath( true ), locked, |
739 | true ); | 739 | true ); |
740 | 740 | ||
741 | }// else CUSTOM View | 741 | }// else CUSTOM View |
742 | } | 742 | } |
743 | void OFileSelector::delItems() | 743 | void OFileSelector::delItems() |
744 | { | 744 | { |
745 | 745 | ||
746 | } | 746 | } |
747 | void OFileSelector::initializeName() | 747 | void OFileSelector::initializeName() |
748 | { | 748 | { |
749 | /** Name Layout Line | 749 | /** Name Layout Line |
750 | * This is the Layout line arranged in | 750 | * This is the Layout line arranged in |
751 | * horizontal way each components | 751 | * horizontal way each components |
752 | * are next to each other | 752 | * are next to each other |
753 | * but we will only do this if | 753 | * but we will only do this if |
754 | * we didn't initialize a while ago. | 754 | * we didn't initialize a while ago. |
755 | */ | 755 | */ |
756 | if( m_boxName == 0 ){ | 756 | if( m_boxName == 0 ){ |
757 | m_boxName = new QHBox( this ); // remove this this? or use a QHBox | 757 | m_boxName = new QHBox( this ); // remove this this? or use a QHBox |
758 | m_fnLabel = new QLabel( m_boxName ); | 758 | m_fnLabel = new QLabel( m_boxName ); |
759 | m_fnLabel->setText( tr("Name:") ); | 759 | m_fnLabel->setText( tr("Name:") ); |
760 | m_edit = new QLineEdit( m_boxName ); | 760 | m_edit = new QLineEdit( m_boxName ); |
761 | m_edit->setText( m_name ); | 761 | m_edit->setText( m_name ); |
762 | //m_boxName->addWidget( m_fnLabel ); | 762 | //m_boxName->addWidget( m_fnLabel ); |
763 | m_boxName->setMargin( 5 ); | 763 | m_boxName->setMargin( 5 ); |
764 | m_boxName->setSpacing( 8 ); | 764 | m_boxName->setSpacing( 8 ); |
765 | //m_boxName->setStretchFactor(m_edit, 100 ); // 100 is stretch factor | 765 | //m_boxName->setStretchFactor(m_edit, 100 ); // 100 is stretch factor |
766 | 766 | ||
767 | m_lay->addWidget( m_boxName, 0 ); // add it to the topLevel layout | 767 | m_lay->addWidget( m_boxName, 0 ); // add it to the topLevel layout |
768 | }// else we already initialized | 768 | }// else we already initialized |
769 | // maybe show the components? | 769 | // maybe show the components? |
770 | // | 770 | // |
771 | } | 771 | } |
772 | void OFileSelector::initializeYes() | 772 | void OFileSelector::initializeYes() |
773 | { | 773 | { |
774 | /** The Save Cancel bar | 774 | /** The Save Cancel bar |
775 | * | 775 | * |
776 | */ | 776 | */ |
777 | if( m_boxOk == 0 ){ | 777 | if( m_boxOk == 0 ){ |
778 | m_boxOk = new QHBox( this ); | 778 | m_boxOk = new QHBox( this ); |
779 | m_ok = new QPushButton( tr("&Save"),m_boxOk , "save" ); | 779 | m_ok = new QPushButton( tr("&Save"),m_boxOk , "save" ); |
780 | m_cancel = new QPushButton( tr("C&ancel"), m_boxOk, "cancel" ); | 780 | m_cancel = new QPushButton( tr("C&ancel"), m_boxOk, "cancel" ); |
781 | 781 | ||
782 | //m_boxOk->addWidget( m_ok ); | 782 | //m_boxOk->addWidget( m_ok ); |
783 | //m_boxOk->addWidget( m_cancel ); | 783 | //m_boxOk->addWidget( m_cancel ); |
784 | m_boxOk->setMargin( 5 ); | 784 | m_boxOk->setMargin( 5 ); |
785 | m_boxOk->setSpacing( 10 ); | 785 | m_boxOk->setSpacing( 10 ); |
786 | m_lay->addWidget( m_boxOk, 0 ); | 786 | m_lay->addWidget( m_boxOk, 0 ); |
787 | 787 | ||
788 | connect( m_ok, SIGNAL( clicked() ), | 788 | connect( m_ok, SIGNAL( clicked() ), |
789 | this, SLOT(slotOk() ) ); | 789 | this, SLOT(slotOk() ) ); |
790 | connect( m_cancel, SIGNAL( clicked() ), | 790 | connect( m_cancel, SIGNAL( clicked() ), |
791 | this, SLOT( slotCancel() ) ); | 791 | this, SLOT( slotCancel() ) ); |
792 | } | 792 | } |
793 | } | 793 | } |
794 | /* | 794 | /* |
795 | * OK m_mimeCheck is a QComboBox we now want to fill | 795 | * OK m_mimeCheck is a QComboBox we now want to fill |
796 | * out that combobox | 796 | * out that combobox |
797 | * if automime we need to update the mimetypes | 797 | * if automime we need to update the mimetypes |
798 | */ | 798 | */ |
799 | void OFileSelector::updateMimeCheck() { | 799 | void OFileSelector::updateMimeCheck() { |
800 | m_mimeCheck->clear(); | 800 | m_mimeCheck->clear(); |
801 | if (m_autoMime ) { | 801 | if (m_autoMime ) { |
802 | //m_mimeCheck->insertItem( tr("All") ); | 802 | //m_mimeCheck->insertItem( tr("All") ); |
803 | updateMimes(); | 803 | updateMimes(); |
804 | } | 804 | } |
805 | 805 | ||
806 | QMap<QString, QStringList>::Iterator it; | 806 | QMap<QString, QStringList>::Iterator it; |
807 | for (it = m_mimetypes.begin(); it != m_mimetypes.end(); ++it ) { | 807 | for (it = m_mimetypes.begin(); it != m_mimetypes.end(); ++it ) { |
808 | m_mimeCheck->insertItem( it.key() ); | 808 | m_mimeCheck->insertItem( it.key() ); |
809 | } | 809 | } |
810 | } | 810 | } |
811 | 811 | ||
812 | void OFileSelector::initializeChooser() | 812 | void OFileSelector::initializeChooser() |
813 | { | 813 | { |
814 | if( m_boxView == 0 ){ | 814 | if( m_boxView == 0 ){ |
815 | m_boxView = new QHBox( this ); | 815 | m_boxView = new QHBox( this ); |
816 | m_viewCheck = new QComboBox( m_boxView, "view check"); | 816 | m_viewCheck = new QComboBox( m_boxView, "view check"); |
817 | m_mimeCheck = new QComboBox( m_boxView, "mime check"); | 817 | m_mimeCheck = new QComboBox( m_boxView, "mime check"); |
818 | m_boxView->setSpacing( 8 ); | 818 | m_boxView->setSpacing( 8 ); |
819 | m_lay->addWidget(m_boxView, 0 ); | 819 | m_lay->addWidget(m_boxView, 0 ); |
820 | 820 | ||
821 | m_viewCheck->insertItem( tr("Documents") ); | 821 | m_viewCheck->insertItem( tr("Documents") ); |
822 | m_viewCheck->insertItem( tr("Files") ); | 822 | m_viewCheck->insertItem( tr("Files") ); |
823 | m_viewCheck->insertItem( tr("All Files") ); | 823 | m_viewCheck->insertItem( tr("All Files") ); |
824 | updateMimeCheck(); | 824 | updateMimeCheck(); |
825 | 825 | ||
826 | connect( m_viewCheck, SIGNAL( activated(const QString & ) ), | 826 | connect( m_viewCheck, SIGNAL( activated(const QString & ) ), |
827 | this, SLOT( slotViewCheck(const QString & ) ) ); | 827 | this, SLOT( slotViewCheck(const QString & ) ) ); |
828 | connect( m_mimeCheck, SIGNAL( activated(const QString & ) ), | 828 | connect( m_mimeCheck, SIGNAL( activated(const QString & ) ), |
829 | this, SLOT( slotMimeCheck( const QString & ) ) ); | 829 | this, SLOT( slotMimeCheck( const QString & ) ) ); |
830 | } | 830 | } |
831 | } | 831 | } |
832 | void OFileSelector::initializeListView() | 832 | void OFileSelector::initializeListView() |
833 | { | 833 | { |
834 | qWarning("initializeListView"); | 834 | qWarning("initializeListView"); |
835 | if( m_pseudo == 0 ){ | 835 | if( m_pseudo == 0 ){ |
836 | qWarning("init"); | 836 | qWarning("init"); |
837 | m_pseudo = new QWidget( m_stack, "Pseudo Widget"); | 837 | m_pseudo = new QWidget( m_stack, "Pseudo Widget"); |
838 | m_pseudoLayout = new QVBoxLayout( m_pseudo ); | 838 | m_pseudoLayout = new QVBoxLayout( m_pseudo ); |
839 | // toolbar | 839 | // toolbar |
840 | m_boxToolbar = new QHBox( m_pseudo ); | 840 | m_boxToolbar = new QHBox( m_pseudo ); |
841 | m_boxToolbar->setSpacing(0 ); // next to each other please | 841 | m_boxToolbar->setSpacing(0 ); // next to each other please |
842 | 842 | ||
843 | // toolbar members | 843 | // toolbar members |
844 | { | 844 | { |
845 | // location QComboBox | 845 | // location QComboBox |
846 | m_location = new QComboBox( m_boxToolbar ); | 846 | m_location = new QComboBox( m_boxToolbar ); |
847 | m_location->setEditable( TRUE ); | 847 | m_location->setEditable( TRUE ); |
848 | m_location->setDuplicatesEnabled( FALSE ); | 848 | m_location->setDuplicatesEnabled( FALSE ); |
849 | connect( m_location, SIGNAL(activated(const QString &) ), | 849 | connect( m_location, SIGNAL(activated(const QString &) ), |
850 | this, SLOT( slotLocationActivated(const QString &) ) ); | 850 | this, SLOT( slotLocationActivated(const QString &) ) ); |
851 | connect( m_location->lineEdit(), SIGNAL(returnPressed() ), | 851 | connect( m_location->lineEdit(), SIGNAL(returnPressed() ), |
852 | this, SLOT(locationComboChanged() ) ); | 852 | this, SLOT(locationComboChanged() ) ); |
853 | // UP Button | 853 | // UP Button |
854 | m_up = new QPushButton(Resource::loadIconSet("up"),"", | 854 | m_up = new QPushButton(Resource::loadIconSet("up"),"", |
855 | m_boxToolbar,"cdUpButton"); | 855 | m_boxToolbar,"cdUpButton"); |
856 | m_up->setFixedSize( QSize( 20, 20 ) ); | 856 | m_up->setFixedSize( QSize( 20, 20 ) ); |
857 | connect(m_up ,SIGNAL(clicked()),this,SLOT(cdUP() ) ); | 857 | connect(m_up ,SIGNAL(clicked()),this,SLOT(cdUP() ) ); |
858 | m_up->setFlat(TRUE); | 858 | m_up->setFlat(TRUE); |
859 | 859 | ||
860 | // Home Button | 860 | // Home Button |
861 | m_homeButton = new QPushButton(Resource::loadIconSet("home") , | 861 | m_homeButton = new QPushButton(Resource::loadIconSet("home") , |
862 | "", m_boxToolbar); | 862 | "", m_boxToolbar); |
863 | m_homeButton->setFixedSize( QSize( 20, 20 ) ); | 863 | m_homeButton->setFixedSize( QSize( 20, 20 ) ); |
864 | connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotHome() ) ); | 864 | connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotHome() ) ); |
865 | m_homeButton->setFlat(TRUE); | 865 | m_homeButton->setFlat(TRUE); |
866 | // Documents Button | 866 | // Documents Button |
867 | m_docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"", | 867 | m_docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"", |
868 | m_boxToolbar,"docsButton"); | 868 | m_boxToolbar,"docsButton"); |
869 | m_docButton->setFixedSize( QSize( 20, 20 ) ); | 869 | m_docButton->setFixedSize( QSize( 20, 20 ) ); |
870 | connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotDoc() ) ); | 870 | connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotDoc() ) ); |
871 | m_docButton->setFlat(TRUE); | 871 | m_docButton->setFlat(TRUE); |
872 | 872 | ||
873 | // Close button | 873 | // Close button |
874 | m_close = new QPushButton( Resource::loadIconSet( "close"), "", | 874 | m_close = new QPushButton( Resource::loadIconSet( "close"), "", |
875 | m_boxToolbar ); | 875 | m_boxToolbar ); |
876 | connect( m_close, SIGNAL(clicked() ), this, SIGNAL(closeMe() ) ); | 876 | connect( m_close, SIGNAL(clicked() ), this, SIGNAL(closeMe() ) ); |
877 | m_close->setFixedSize( 20, 20 ); | 877 | m_close->setFixedSize( 20, 20 ); |
878 | 878 | ||
879 | m_boxToolbar->setFixedHeight( 20 ); | 879 | m_boxToolbar->setFixedHeight( 20 ); |
880 | m_pseudoLayout->addWidget(m_boxToolbar ); | 880 | m_pseudoLayout->addWidget(m_boxToolbar ); |
881 | 881 | ||
882 | // let;s fill the Location ComboBox | 882 | // let;s fill the Location ComboBox |
883 | StorageInfo storage; | 883 | StorageInfo storage; |
884 | const QList<FileSystem> &fs = storage.fileSystems(); | 884 | const QList<FileSystem> &fs = storage.fileSystems(); |
885 | QListIterator<FileSystem> it ( fs ); | 885 | QListIterator<FileSystem> it ( fs ); |
886 | for( ; it.current(); ++it ){ | 886 | for( ; it.current(); ++it ){ |
887 | const QString disk = (*it)->name(); | 887 | const QString disk = (*it)->name(); |
888 | const QString path = (*it)->path(); | 888 | const QString path = (*it)->path(); |
889 | m_location->insertItem(path+ "<-"+disk ); | 889 | m_location->insertItem(path+ "<-"+disk ); |
890 | } | 890 | } |
891 | int count = m_location->count(); | 891 | int count = m_location->count(); |
892 | m_location->insertItem( m_currentDir ); | 892 | m_location->insertItem( m_currentDir ); |
893 | m_location->setCurrentItem( count ); | 893 | m_location->setCurrentItem( count ); |
894 | // due to the New and Close button we can not simply hide m_boxToolBar to not show it | 894 | // due to the New and Close button we can not simply hide m_boxToolBar to not show it |
895 | if( !m_shTool ){ | 895 | if( !m_shTool ){ |
896 | m_location->hide( ); | 896 | m_location->hide( ); |
897 | m_up->hide( ); | 897 | m_up->hide( ); |
898 | m_homeButton->hide( ); | 898 | m_homeButton->hide( ); |
899 | m_docButton->hide( ); | 899 | m_docButton->hide( ); |
900 | } | 900 | } |
901 | if(!m_shClose ) | 901 | if(!m_shClose ) |
902 | m_close->hide(); | 902 | m_close->hide(); |
903 | //if(!m_shNew) | 903 | //if(!m_shNew) |
904 | //m_close->hide(); | 904 | //m_close->hide(); |
905 | 905 | ||
906 | } // off toolbar | 906 | } // off toolbar |
907 | // the Main ListView | 907 | // the Main ListView |
908 | // make a QWidgetStack first so Views can share the Toolbar | 908 | // make a QWidgetStack first so Views can share the Toolbar |
909 | m_View = new QListView( m_pseudo, "Extended view"); | 909 | m_View = new QListView( m_pseudo, "Extended view"); |
910 | QPEApplication::setStylusOperation( m_View->viewport(), | 910 | QPEApplication::setStylusOperation( m_View->viewport(), |
911 | QPEApplication::RightOnHold); | 911 | QPEApplication::RightOnHold); |
912 | m_View->addColumn(" " ); | 912 | m_View->addColumn(" " ); |
913 | m_View->addColumn(tr("Name"), 135 ); | 913 | m_View->addColumn(tr("Name"), 135 ); |
914 | m_View->addColumn(tr("Size"), -1 ); | 914 | m_View->addColumn(tr("Size"), -1 ); |
915 | m_View->addColumn(tr("Date"), 60 ); | 915 | m_View->addColumn(tr("Date"), 60 ); |
916 | m_View->addColumn(tr("Mime Type"), -1 ); | 916 | m_View->addColumn(tr("Mime Type"), -1 ); |
917 | QHeader *header = m_View->header(); | 917 | QHeader *header = m_View->header(); |
918 | header->hide(); | 918 | header->hide(); |
919 | m_View->setSorting( 1 ); | 919 | m_View->setSorting( 1 ); |
920 | m_View->setAllColumnsShowFocus( TRUE ); | 920 | m_View->setAllColumnsShowFocus( TRUE ); |
921 | 921 | ||
922 | connect(m_View, SIGNAL(selectionChanged() ), | 922 | connect(m_View, SIGNAL(selectionChanged() ), |
923 | this, SLOT(slotSelectionChanged() ) ); | 923 | this, SLOT(slotSelectionChanged() ) ); |
924 | 924 | ||
925 | connect(m_View, SIGNAL(currentChanged(QListViewItem *) ), | 925 | connect(m_View, SIGNAL(currentChanged(QListViewItem *) ), |
926 | this, SLOT(slotCurrentChanged(QListViewItem * ) ) ); | 926 | this, SLOT(slotCurrentChanged(QListViewItem * ) ) ); |
927 | 927 | ||
928 | connect(m_View, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint &, int) ), | 928 | connect(m_View, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint &, int) ), |
929 | this, SLOT(slotClicked( int, QListViewItem *, const QPoint &, int) ) ); | 929 | this, SLOT(slotClicked( int, QListViewItem *, const QPoint &, int) ) ); |
930 | 930 | ||
931 | connect(m_View, SIGNAL(mouseButtonPressed(int, QListViewItem *, const QPoint &, int )), | 931 | connect(m_View, SIGNAL(mouseButtonPressed(int, QListViewItem *, const QPoint &, int )), |
932 | this, SLOT(slotRightButton(int, QListViewItem *, const QPoint &, int ) ) ); | 932 | this, SLOT(slotRightButton(int, QListViewItem *, const QPoint &, int ) ) ); |
933 | 933 | ||
934 | m_pseudoLayout->addWidget( m_View, 288 ); | 934 | m_pseudoLayout->addWidget( m_View, 288 ); |
935 | m_stack->addWidget( m_pseudo, EXTENDED ); | 935 | m_stack->addWidget( m_pseudo, EXTENDED ); |
936 | } | 936 | } |
937 | } | 937 | } |
938 | void OFileSelector::initializePerm() | 938 | void OFileSelector::initializePerm() |
939 | { | 939 | { |
940 | if( m_checkPerm == 0 ){ | 940 | if( m_checkPerm == 0 ){ |
941 | m_checkPerm = new QCheckBox(tr("Ser Permission"), this, "perm"); | 941 | m_checkPerm = new QCheckBox(tr("Ser Permission"), this, "perm"); |
942 | m_checkPerm->setChecked( false ); | 942 | m_checkPerm->setChecked( false ); |
943 | m_lay->addWidget( m_checkPerm ); | 943 | m_lay->addWidget( m_checkPerm ); |
944 | 944 | ||
945 | } | 945 | } |
946 | } | 946 | } |
947 | void OFileSelector::initPics() | 947 | void OFileSelector::initPics() |
948 | { | 948 | { |
949 | m_pixmaps = new QMap<QString,QPixmap>; | 949 | m_pixmaps = new QMap<QString,QPixmap>; |
950 | QPixmap pm = Resource::loadPixmap( "folder" ); | 950 | QPixmap pm = Resource::loadPixmap( "folder" ); |
951 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 951 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
952 | QPainter painter( &pm ); | 952 | QPainter painter( &pm ); |
953 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 953 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
954 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 954 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
955 | m_pixmaps->insert("dirsymlink", pm ); | 955 | m_pixmaps->insert("dirsymlink", pm ); |
956 | 956 | ||
957 | QPixmap pm2 = Resource::loadPixmap( "lockedfolder" ); | 957 | QPixmap pm2 = Resource::loadPixmap( "lockedfolder" ); |
958 | QPainter pen(&pm2 ); | 958 | QPainter pen(&pm2 ); |
959 | pen.drawPixmap(pm2.width()-lnk.width(), pm2.height()-lnk.height(), lnk ); | 959 | pen.drawPixmap(pm2.width()-lnk.width(), pm2.height()-lnk.height(), lnk ); |
960 | pm2.setMask( pm2.createHeuristicMask( FALSE ) ); | 960 | pm2.setMask( pm2.createHeuristicMask( FALSE ) ); |
961 | m_pixmaps->insert("symlinkedlocked", pm2 ); | 961 | m_pixmaps->insert("symlinkedlocked", pm2 ); |
962 | } | 962 | } |
963 | // if a mime complies with the m_mimeCheck->currentItem | 963 | // if a mime complies with the m_mimeCheck->currentItem |
964 | bool OFileSelector::compliesMime( const QString &path, const QString &mime ) | 964 | bool OFileSelector::compliesMime( const QString &path, const QString &mime ) |
965 | { | 965 | { |
966 | if( mime == "All" ) | 966 | if( mime == "All" ) |
967 | return true; | 967 | return true; |
968 | MimeType type( path ); | 968 | MimeType type( path ); |
969 | if( type.id() == mime ) | 969 | if( type.id() == mime ) |
970 | return true; | 970 | return true; |
971 | return false; | 971 | return false; |
972 | } | 972 | } |
973 | /* check if the mimetype in mime | 973 | /* check if the mimetype in mime |
974 | * complies with the one which is current | 974 | * complies with the one which is current |
975 | */ | 975 | */ |
976 | /* | 976 | /* |
977 | * We've the mimetype of the file | 977 | * We've the mimetype of the file |
978 | * We need to get the stringlist of the current mimetype | 978 | * We need to get the stringlist of the current mimetype |
979 | * | 979 | * |
980 | * mime = image/jpeg | 980 | * mime = image/jpeg |
981 | * QStringList = 'image/*' | 981 | * QStringList = 'image/*' |
982 | * or QStringList = image/jpeg;image/png;application/x-ogg | 982 | * or QStringList = image/jpeg;image/png;application/x-ogg |
983 | * or QStringList = application/x-ogg;image/*; | 983 | * or QStringList = application/x-ogg;image/*; |
984 | * with all these mime filters it should get acceptes | 984 | * with all these mime filters it should get acceptes |
985 | * to do so we need to look if mime is contained inside | 985 | * to do so we need to look if mime is contained inside |
986 | * the stringlist | 986 | * the stringlist |
987 | * if it's contained return true | 987 | * if it's contained return true |
988 | * if not ( I'm no RegExp expert at all ) we'll look if a '/*' | 988 | * if not ( I'm no RegExp expert at all ) we'll look if a '/*' |
989 | * is contained in the mimefilter and then we will | 989 | * is contained in the mimefilter and then we will |
990 | * look if both are equal until the '/' | 990 | * look if both are equal until the '/' |
991 | */ | 991 | */ |
992 | bool OFileSelector::compliesMime( const QString& mime ) { | 992 | bool OFileSelector::compliesMime( const QString& mime ) { |
993 | qWarning("mimetype is %s", mime.latin1() ); | 993 | qWarning("mimetype is %s", mime.latin1() ); |
994 | QString currentText; | 994 | QString currentText; |
995 | if (m_shChooser ) | 995 | if (m_shChooser ) |
996 | currentText = m_mimeCheck->currentText(); | 996 | currentText = m_mimeCheck->currentText(); |
997 | 997 | ||
998 | qWarning("current text is %s", currentText.latin1() ); | 998 | qWarning("current text is %s", currentText.latin1() ); |
999 | QMap<QString, QStringList>::Iterator it; | 999 | QMap<QString, QStringList>::Iterator it; |
1000 | QStringList list; | 1000 | QStringList list; |
1001 | if ( currentText == tr("All") ) return true; | 1001 | if ( currentText == tr("All") ) return true; |
1002 | else if ( currentText.isEmpty() && !m_mimetypes.isEmpty() ) { | 1002 | else if ( currentText.isEmpty() && !m_mimetypes.isEmpty() ) { |
1003 | it = m_mimetypes.begin(); | 1003 | it = m_mimetypes.begin(); |
1004 | list = it.data(); | 1004 | list = it.data(); |
1005 | }else if ( currentText.isEmpty() ) return true; | 1005 | }else if ( currentText.isEmpty() ) return true; |
1006 | else{ | 1006 | else{ |
1007 | it = m_mimetypes.find(currentText ); | 1007 | it = m_mimetypes.find(currentText ); |
1008 | if ( it == m_mimetypes.end() ) qWarning("not there"), list << currentText; | 1008 | if ( it == m_mimetypes.end() ) qWarning("not there"), list << currentText; |
1009 | else qWarning("found"), list = it.data(); | 1009 | else qWarning("found"), list = it.data(); |
1010 | } | 1010 | } |
1011 | // dump it now | 1011 | // dump it now |
1012 | //for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { | 1012 | //for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { |
1013 | // qWarning( "%s", (*it).latin1() ); | 1013 | // qWarning( "%s", (*it).latin1() ); |
1014 | //} | 1014 | //} |
1015 | 1015 | ||
1016 | 1016 | ||
1017 | if ( list.contains(mime) ) return true; | 1017 | if ( list.contains(mime) ) return true; |
1018 | qWarning("list doesn't contain it "); | 1018 | qWarning("list doesn't contain it "); |
1019 | QStringList::Iterator it2; | 1019 | QStringList::Iterator it2; |
1020 | int pos; | 1020 | int pos; |
1021 | int pos2; | 1021 | int pos2; |
1022 | for ( it2 = list.begin(); it2 != list.end(); ++it2 ) { | 1022 | for ( it2 = list.begin(); it2 != list.end(); ++it2 ) { |
1023 | pos = (*it2).findRev("/*"); | 1023 | pos = (*it2).findRev("/*"); |
1024 | if ( pos >= 0 ) { | 1024 | if ( pos >= 0 ) { |
1025 | if ( mime.contains( (*it2).left(pos) ) ) return true; | 1025 | if ( mime.contains( (*it2).left(pos) ) ) return true; |
1026 | } | 1026 | } |
1027 | } | 1027 | } |
1028 | return false; | 1028 | return false; |
1029 | } | 1029 | } |
1030 | void OFileSelector::slotFileSelected( const QString &string ) | 1030 | void OFileSelector::slotFileSelected( const QString &string ) |
1031 | { | 1031 | { |
1032 | if( m_shLne ) | 1032 | if( m_shLne ) |
1033 | m_edit->setText( string ); | 1033 | m_edit->setText( string ); |
1034 | emit fileSelected( string ); | 1034 | emit fileSelected( string ); |
1035 | } | 1035 | } |
1036 | void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk ) | 1036 | void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk ) |
1037 | { | 1037 | { |
1038 | slotFileSelected( lnk.name() ); | 1038 | slotFileSelected( lnk.name() ); |
1039 | // emit fileSelected( lnk ); | 1039 | emit fileSelected( lnk ); |
1040 | } | 1040 | } |
1041 | void OFileSelector::slotSelectionChanged() | 1041 | void OFileSelector::slotSelectionChanged() |
1042 | { | 1042 | { |
1043 | 1043 | ||
1044 | } | 1044 | } |
1045 | void OFileSelector::slotCurrentChanged(QListViewItem* item ) | 1045 | void OFileSelector::slotCurrentChanged(QListViewItem* item ) |
1046 | { | 1046 | { |
1047 | if( item == 0 ) | 1047 | if( item == 0 ) |
1048 | return; | 1048 | return; |
1049 | if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ) { | 1049 | if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ) { |
1050 | OFileSelectorItem *sel = (OFileSelectorItem*) item; // start to use the C++ casts ;) | 1050 | OFileSelectorItem *sel = (OFileSelectorItem*) item; // start to use the C++ casts ;) |
1051 | qWarning("current changed"); | 1051 | qWarning("current changed"); |
1052 | if(!sel->isDir() ){ | 1052 | if(!sel->isDir() ){ |
1053 | if( m_shLne ) | 1053 | if( m_shLne ) |
1054 | m_edit->setText( sel->text(1) ); | 1054 | m_edit->setText( sel->text(1) ); |
1055 | 1055 | ||
1056 | if (m_mode == FILESELECTOR ) { | 1056 | if (m_mode == FILESELECTOR ) { |
1057 | QStringList str = QStringList::split("->", sel->text(1) ); | 1057 | QStringList str = QStringList::split("->", sel->text(1) ); |
1058 | QString path =sel->directory() + "/" + str[0].stripWhiteSpace(); | 1058 | QString path =sel->directory() + "/" + str[0].stripWhiteSpace(); |
1059 | emit fileSelected(path ); | 1059 | emit fileSelected(path ); |
1060 | DocLnk lnk( path ); | 1060 | DocLnk lnk( path ); |
1061 | emit fileSelected(lnk ); | 1061 | emit fileSelected(lnk ); |
1062 | } | 1062 | } |
1063 | } | 1063 | } |
1064 | } | 1064 | } |
1065 | } | 1065 | } |
1066 | void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint &, int) | 1066 | void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint &, int) |
1067 | { | 1067 | { |
1068 | if ( item == 0 ) | 1068 | if ( item == 0 ) |
1069 | return; | 1069 | return; |
1070 | 1070 | ||
1071 | if( button != Qt::LeftButton ) | 1071 | if( button != Qt::LeftButton ) |
1072 | return; | 1072 | return; |
1073 | 1073 | ||
1074 | switch( m_selector ){ | 1074 | switch( m_selector ){ |
1075 | default: | 1075 | default: |
1076 | break; | 1076 | break; |
1077 | case EXTENDED: // fall through | 1077 | case EXTENDED: // fall through |
1078 | case EXTENDED_ALL:{ | 1078 | case EXTENDED_ALL:{ |
1079 | OFileSelectorItem *sel = (OFileSelectorItem*)item; | 1079 | OFileSelectorItem *sel = (OFileSelectorItem*)item; |
1080 | if(!sel->isLocked() ){ | 1080 | if(!sel->isLocked() ){ |
1081 | QStringList str = QStringList::split("->", sel->text(1) ); | 1081 | QStringList str = QStringList::split("->", sel->text(1) ); |
1082 | if( sel->isDir() ){ | 1082 | if( sel->isDir() ){ |
1083 | cd( sel->directory() + "/" + str[0].stripWhiteSpace() ); | 1083 | cd( sel->directory() + "/" + str[0].stripWhiteSpace() ); |
1084 | // if MODE Dir m_shLne set the Text | 1084 | // if MODE Dir m_shLne set the Text |
1085 | }else{ | 1085 | }else{ |
1086 | if( m_shLne ) | 1086 | if( m_shLne ) |
1087 | m_edit->setText( str[0].stripWhiteSpace() ); | 1087 | m_edit->setText( str[0].stripWhiteSpace() ); |
1088 | qWarning("selected here in slot clicked"); | 1088 | qWarning("selected here in slot clicked"); |
1089 | emit fileSelected( sel->directory() + "/" + str[0].stripWhiteSpace() ); | 1089 | emit fileSelected( sel->directory() + "/" + str[0].stripWhiteSpace() ); |
1090 | DocLnk lnk( sel->directory() + "/" + str[0].stripWhiteSpace() ); | 1090 | DocLnk lnk( sel->directory() + "/" + str[0].stripWhiteSpace() ); |
1091 | qWarning("file selected"); | 1091 | qWarning("file selected"); |
1092 | emit fileSelected( lnk ); | 1092 | emit fileSelected( lnk ); |
1093 | } | 1093 | } |
1094 | } | 1094 | } |
1095 | break; | 1095 | break; |
1096 | } | 1096 | } |
1097 | } | 1097 | } |
1098 | } | 1098 | } |
1099 | void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoint &, int ) | 1099 | void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoint &, int ) |
1100 | { | 1100 | { |
1101 | if( item == 0 ) | 1101 | if( item == 0 ) |
1102 | return; | 1102 | return; |
1103 | 1103 | ||
1104 | if( button != Qt::RightButton ) | 1104 | if( button != Qt::RightButton ) |
1105 | return; | 1105 | return; |
1106 | slotContextMenu( item ); | 1106 | slotContextMenu( item ); |
1107 | } | 1107 | } |
1108 | void OFileSelector::slotContextMenu( QListViewItem *item) | 1108 | void OFileSelector::slotContextMenu( QListViewItem *item) |
1109 | { | 1109 | { |
1110 | 1110 | ||
1111 | } | 1111 | } |
1112 | void OFileSelector::slotChangedDir() | 1112 | void OFileSelector::slotChangedDir() |
1113 | { | 1113 | { |
1114 | OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); | 1114 | OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); |
1115 | if(sel->isDir() ){ | 1115 | if(sel->isDir() ){ |
1116 | QStringList str = QStringList::split("->", sel->text(1) ); | 1116 | QStringList str = QStringList::split("->", sel->text(1) ); |
1117 | cd( sel->directory() + "/" + str[0].stripWhiteSpace() ); | 1117 | cd( sel->directory() + "/" + str[0].stripWhiteSpace() ); |
1118 | } | 1118 | } |
1119 | } | 1119 | } |
1120 | void OFileSelector::slotOpen() | 1120 | void OFileSelector::slotOpen() |
1121 | { | 1121 | { |
1122 | OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); | 1122 | OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); |
1123 | if(!sel->isDir() ){ | 1123 | if(!sel->isDir() ){ |
1124 | QStringList str = QStringList::split("->", sel->text(1) ); | 1124 | QStringList str = QStringList::split("->", sel->text(1) ); |
1125 | slotFileSelected( sel->directory() +"/" +str[0].stripWhiteSpace() ); | 1125 | slotFileSelected( sel->directory() +"/" +str[0].stripWhiteSpace() ); |
1126 | qWarning("slot open"); | 1126 | qWarning("slot open"); |
1127 | // DocLnk lnk( sel->directory() + "/" + str[0].stripWhiteSpace() ); | 1127 | // DocLnk lnk( sel->directory() + "/" + str[0].stripWhiteSpace() ); |
1128 | //emit fileSelected( lnk ); | 1128 | //emit fileSelected( lnk ); |
1129 | } | 1129 | } |
1130 | } | 1130 | } |
1131 | void OFileSelector::slotRescan() | 1131 | void OFileSelector::slotRescan() |
1132 | { | 1132 | { |
1133 | 1133 | ||
1134 | } | 1134 | } |
1135 | void OFileSelector::slotRename() | 1135 | void OFileSelector::slotRename() |
1136 | { | 1136 | { |
1137 | reparse(); | 1137 | reparse(); |
1138 | } | 1138 | } |
1139 | void OFileSelector::slotDelete() | 1139 | void OFileSelector::slotDelete() |
1140 | { | 1140 | { |
1141 | OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); | 1141 | OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); |
1142 | QStringList list = QStringList::split("->", sel->text(1) ); | 1142 | QStringList list = QStringList::split("->", sel->text(1) ); |
1143 | if( sel->isDir() ){ | 1143 | if( sel->isDir() ){ |
1144 | QString str = QString::fromLatin1("rm -rf ") + sel->directory() +"/" + list[0]; //better safe than sorry | 1144 | QString str = QString::fromLatin1("rm -rf ") + sel->directory() +"/" + list[0]; //better safe than sorry |
1145 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+list[0], | 1145 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+list[0], |
1146 | tr("Yes"),tr("No"),0,1,1) ) { | 1146 | tr("Yes"),tr("No"),0,1,1) ) { |
1147 | case 0: | 1147 | case 0: |
1148 | ::system(str.utf8().data() ); | 1148 | ::system(str.utf8().data() ); |
1149 | break; | 1149 | break; |
1150 | } | 1150 | } |
1151 | } else { | 1151 | } else { |
1152 | QFile::remove( list[0] ); | 1152 | QFile::remove( list[0] ); |
1153 | } | 1153 | } |
1154 | m_View->takeItem( sel ); | 1154 | m_View->takeItem( sel ); |
1155 | delete sel; | 1155 | delete sel; |
1156 | } | 1156 | } |
1157 | void OFileSelector::cdUP() | 1157 | void OFileSelector::cdUP() |
1158 | { | 1158 | { |
1159 | QDir dir( m_currentDir ); | 1159 | QDir dir( m_currentDir ); |
1160 | dir.cdUp(); | 1160 | dir.cdUp(); |
1161 | if(dir.exists() ){ | 1161 | if(dir.exists() ){ |
1162 | m_currentDir = dir.absPath(); | 1162 | m_currentDir = dir.absPath(); |
1163 | reparse(); | 1163 | reparse(); |
1164 | int count = m_location->count(); | 1164 | int count = m_location->count(); |
1165 | slotInsertLocationPath( m_currentDir, count); | 1165 | slotInsertLocationPath( m_currentDir, count); |
1166 | m_location->setCurrentItem( indexByString( m_location, m_currentDir)); | 1166 | m_location->setCurrentItem( indexByString( m_location, m_currentDir)); |
1167 | //this wont work in all instances | 1167 | //this wont work in all instances |
1168 | // FIXME | 1168 | // FIXME |
1169 | } | 1169 | } |
1170 | } | 1170 | } |
1171 | void OFileSelector::slotHome() | 1171 | void OFileSelector::slotHome() |
1172 | { | 1172 | { |
1173 | cd(QDir::homeDirPath() ); | 1173 | cd(QDir::homeDirPath() ); |
1174 | } | 1174 | } |
1175 | void OFileSelector::slotDoc() | 1175 | void OFileSelector::slotDoc() |
1176 | { | 1176 | { |
1177 | cd(QPEApplication::documentDir() ); | 1177 | cd(QPEApplication::documentDir() ); |
1178 | } | 1178 | } |
1179 | void OFileSelector::slotNavigate( ) | 1179 | void OFileSelector::slotNavigate( ) |
1180 | { | 1180 | { |
1181 | 1181 | ||
1182 | } | 1182 | } |
1183 | // fill the View with life | 1183 | // fill the View with life |
1184 | void OFileSelector::reparse() | 1184 | void OFileSelector::reparse() |
1185 | { | 1185 | { |
1186 | if( m_selector == NORMAL ) | 1186 | if( m_selector == NORMAL ) |
1187 | return; | 1187 | return; |
1188 | if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ) | 1188 | if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ) |
1189 | m_View->clear(); | 1189 | m_View->clear(); |
1190 | else // custom view | 1190 | else // custom view |
1191 | ; // currentView()->clear(); | 1191 | ; // currentView()->clear(); |
1192 | if( m_shChooser) | 1192 | if( m_shChooser) |
1193 | qWarning("reparse %s", m_mimeCheck->currentText().latin1() ); | 1193 | qWarning("reparse %s", m_mimeCheck->currentText().latin1() ); |
1194 | 1194 | ||
1195 | QString currentMimeType; | 1195 | QString currentMimeType; |
1196 | // let's update the mimetype | 1196 | // let's update the mimetype |
1197 | if( m_autoMime ){ | 1197 | if( m_autoMime ){ |
1198 | m_mimetypes.clear(); | 1198 | m_mimetypes.clear(); |
1199 | // ok we can change mimetype so we need to be able to give a selection | 1199 | // ok we can change mimetype so we need to be able to give a selection |
1200 | if( m_shChooser ) { | 1200 | if( m_shChooser ) { |
1201 | currentMimeType = m_mimeCheck->currentText(); | 1201 | currentMimeType = m_mimeCheck->currentText(); |
1202 | m_mimeCheck->clear(); | 1202 | m_mimeCheck->clear(); |
1203 | 1203 | ||
1204 | // let's find possible mimetypes | 1204 | // let's find possible mimetypes |
1205 | QDir dir( m_currentDir ); | 1205 | QDir dir( m_currentDir ); |
1206 | dir.setFilter( QDir::Files | QDir::Readable ); | 1206 | dir.setFilter( QDir::Files | QDir::Readable ); |
1207 | dir.setSorting( QDir::Size ); | 1207 | dir.setSorting( QDir::Size ); |
1208 | const QFileInfoList *list = dir.entryInfoList(); | 1208 | const QFileInfoList *list = dir.entryInfoList(); |
1209 | QFileInfoListIterator it( *list ); | 1209 | QFileInfoListIterator it( *list ); |
1210 | QFileInfo *fi; | 1210 | QFileInfo *fi; |
1211 | while( (fi=it.current() ) ) { | 1211 | while( (fi=it.current() ) ) { |
1212 | if( fi->extension() == QString::fromLatin1("desktop") ){ | 1212 | if( fi->extension() == QString::fromLatin1("desktop") ){ |
1213 | ++it; | 1213 | ++it; |
1214 | continue; | 1214 | continue; |
1215 | } | 1215 | } |
1216 | MimeType type( fi->absFilePath() ); | 1216 | MimeType type( fi->absFilePath() ); |
1217 | if( !m_mimetypes.contains( type.id() ) ){ | 1217 | if( !m_mimetypes.contains( type.id() ) ){ |
1218 | //qWarning("Type %s", type.id().latin1() ); | 1218 | //qWarning("Type %s", type.id().latin1() ); |
1219 | m_mimetypes.insert( type.id(), type.id() ); | 1219 | m_mimetypes.insert( type.id(), type.id() ); |
1220 | } | 1220 | } |
1221 | 1221 | ||
1222 | ++it; | 1222 | ++it; |
1223 | } | 1223 | } |
1224 | // add them to the chooser | 1224 | // add them to the chooser |
1225 | updateMimeCheck(); | 1225 | updateMimeCheck(); |
1226 | m_mimeCheck->setCurrentItem( indexByString( m_mimeCheck, currentMimeType ) ); | 1226 | m_mimeCheck->setCurrentItem( indexByString( m_mimeCheck, currentMimeType ) ); |
1227 | currentMimeType = m_mimeCheck->currentText(); | 1227 | currentMimeType = m_mimeCheck->currentText(); |
1228 | } | 1228 | } |
1229 | }else { // no autoMime | 1229 | }else { // no autoMime |
1230 | // let the mimetype be set from out side the m_mimeCheck FEATURE | 1230 | // let the mimetype be set from out side the m_mimeCheck FEATURE |
1231 | 1231 | ||
1232 | if( m_shChooser ){ | 1232 | if( m_shChooser ){ |
1233 | currentMimeType = m_mimeCheck->currentText(); | 1233 | currentMimeType = m_mimeCheck->currentText(); |
1234 | // updateMimeCheck(); | 1234 | // updateMimeCheck(); |
1235 | } | 1235 | } |
1236 | } | 1236 | } |
1237 | // now we got our mimetypes we can add the files | 1237 | // now we got our mimetypes we can add the files |
1238 | 1238 | ||
1239 | QDir dir( m_currentDir ); | 1239 | QDir dir( m_currentDir ); |
1240 | 1240 | ||
1241 | int sort; | 1241 | int sort; |
1242 | if ( m_case ) | 1242 | if ( m_case ) |
1243 | sort = (QDir::IgnoreCase | QDir::Name | QDir::DirsFirst | QDir::Reversed); | 1243 | sort = (QDir::IgnoreCase | QDir::Name | QDir::DirsFirst | QDir::Reversed); |
1244 | else | 1244 | else |
1245 | sort = (QDir::Name | QDir::DirsFirst | QDir::Reversed); | 1245 | sort = (QDir::Name | QDir::DirsFirst | QDir::Reversed); |
1246 | dir.setSorting( sort ); | 1246 | dir.setSorting( sort ); |
1247 | 1247 | ||
1248 | int filter; | 1248 | int filter; |
1249 | if( m_selector == EXTENDED_ALL /*|| m_selector ==CUSTOM_ALL */ ){ | 1249 | if( m_selector == EXTENDED_ALL /*|| m_selector ==CUSTOM_ALL */ ){ |
1250 | filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; | 1250 | filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; |
1251 | }else | 1251 | }else |
1252 | filter = QDir::Files | QDir::Dirs | QDir::All; | 1252 | filter = QDir::Files | QDir::Dirs | QDir::All; |
1253 | dir.setFilter( filter ); | 1253 | dir.setFilter( filter ); |
1254 | 1254 | ||
1255 | // now go through all files | 1255 | // now go through all files |
1256 | const QFileInfoList *list = dir.entryInfoList(); | 1256 | const QFileInfoList *list = dir.entryInfoList(); |
1257 | QFileInfoListIterator it( *list ); | 1257 | QFileInfoListIterator it( *list ); |
1258 | QFileInfo *fi; | 1258 | QFileInfo *fi; |
1259 | while( (fi=it.current() ) ){ | 1259 | while( (fi=it.current() ) ){ |
1260 | //qWarning("True and only" ); | 1260 | //qWarning("True and only" ); |
1261 | if( fi->fileName() == QString::fromLatin1("..") || fi->fileName() == QString::fromLatin1(".") ){ | 1261 | if( fi->fileName() == QString::fromLatin1("..") || fi->fileName() == QString::fromLatin1(".") ){ |
1262 | //qWarning(".. or ." ); | 1262 | //qWarning(".. or ." ); |
1263 | ++it; | 1263 | ++it; |
1264 | continue; | 1264 | continue; |
1265 | } | 1265 | } |
1266 | if( fi->isSymLink() ){ | 1266 | if( fi->isSymLink() ){ |
1267 | QString file = fi->dirPath( true ) + "/" + fi->readLink(); | 1267 | QString file = fi->dirPath( true ) + "/" + fi->readLink(); |
1268 | for( int i = 0; i<=4; i++) { // 5 tries to prevent dos | 1268 | for( int i = 0; i<=4; i++) { // 5 tries to prevent dos |
1269 | QFileInfo info( file ); | 1269 | QFileInfo info( file ); |
1270 | if( !info.exists() ){ | 1270 | if( !info.exists() ){ |
1271 | addSymlink( currentMimeType, fi, TRUE ); | 1271 | addSymlink( currentMimeType, fi, TRUE ); |
1272 | break; | 1272 | break; |
1273 | }else if( info.isDir() ){ | 1273 | }else if( info.isDir() ){ |
1274 | addDir( currentMimeType, fi, TRUE ); | 1274 | addDir( currentMimeType, fi, TRUE ); |
1275 | break; | 1275 | break; |
1276 | }else if( info.isFile() ){ | 1276 | }else if( info.isFile() ){ |
1277 | addFile( currentMimeType, fi, TRUE ); | 1277 | addFile( currentMimeType, fi, TRUE ); |
1278 | break; | 1278 | break; |
1279 | }else if( info.isSymLink() ){ | 1279 | }else if( info.isSymLink() ){ |
1280 | file = info.dirPath(true ) + "/" + info.readLink() ; | 1280 | file = info.dirPath(true ) + "/" + info.readLink() ; |
1281 | break; | 1281 | break; |
1282 | }else if( i == 4){ | 1282 | }else if( i == 4){ |
1283 | addSymlink( currentMimeType, fi ); | 1283 | addSymlink( currentMimeType, fi ); |
1284 | } | 1284 | } |
1285 | } // off for loop | 1285 | } // off for loop |
1286 | }else if( fi->isDir() ){ | 1286 | }else if( fi->isDir() ){ |
1287 | addDir( currentMimeType, fi ); | 1287 | addDir( currentMimeType, fi ); |
1288 | }else if( fi->isFile() ){ | 1288 | }else if( fi->isFile() ){ |
1289 | addFile( currentMimeType, fi ); | 1289 | addFile( currentMimeType, fi ); |
1290 | } | 1290 | } |
1291 | //qWarning( "%s", fi->fileName().latin1() ); | 1291 | //qWarning( "%s", fi->fileName().latin1() ); |
1292 | ++it; | 1292 | ++it; |
1293 | } // of while loop | 1293 | } // of while loop |
1294 | m_View->sort(); | 1294 | m_View->sort(); |
1295 | if( m_shTool ){ | 1295 | if( m_shTool ){ |
1296 | m_location->insertItem( m_currentDir ); | 1296 | m_location->insertItem( m_currentDir ); |
1297 | 1297 | ||
1298 | } | 1298 | } |
1299 | // reenable painting and updates | 1299 | // reenable painting and updates |
1300 | } | 1300 | } |