Diffstat (limited to 'libopie/ofileselector/ofileselector.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie/ofileselector/ofileselector.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libopie/ofileselector/ofileselector.cpp b/libopie/ofileselector/ofileselector.cpp index 9ce07dd..c6e923f 100644 --- a/libopie/ofileselector/ofileselector.cpp +++ b/libopie/ofileselector/ofileselector.cpp | |||
@@ -464,48 +464,50 @@ void OFileSelector::init() | |||
464 | QString mime; | 464 | QString mime; |
465 | if (!m_autoMime) { | 465 | if (!m_autoMime) { |
466 | if (!m_mimetypes.isEmpty() ) { | 466 | if (!m_mimetypes.isEmpty() ) { |
467 | QMap<QString, QStringList>::Iterator it; | 467 | QMap<QString, QStringList>::Iterator it; |
468 | it = m_mimetypes.begin(); // cause we're in the init | 468 | it = m_mimetypes.begin(); // cause we're in the init |
469 | mime = it.data().join(";"); | 469 | mime = it.data().join(";"); |
470 | } | 470 | } |
471 | } | 471 | } |
472 | initializeOldSelector(); | 472 | initializeOldSelector(); |
473 | }else{ | 473 | }else{ |
474 | initializeView(); | 474 | initializeView(); |
475 | } | 475 | } |
476 | 476 | ||
477 | if( m_shLne ) // the LineEdit with the current FileName | 477 | if( m_shLne ) // the LineEdit with the current FileName |
478 | initializeName(); | 478 | initializeName(); |
479 | 479 | ||
480 | if( m_shPerm ) // the Permission QCheckBox | 480 | if( m_shPerm ) // the Permission QCheckBox |
481 | initializePerm(); | 481 | initializePerm(); |
482 | 482 | ||
483 | if( m_shYesNo ) // the Yes No button row | 483 | if( m_shYesNo ) // the Yes No button row |
484 | initializeYes( ); | 484 | initializeYes( ); |
485 | 485 | ||
486 | if (m_selector != Normal ) | 486 | if (m_selector != Normal ) |
487 | reparse(); | 487 | reparse(); |
488 | |||
489 | showMaximized(); | ||
488 | } | 490 | } |
489 | void OFileSelector::updateMimes() | 491 | void OFileSelector::updateMimes() |
490 | { | 492 | { |
491 | if( m_autoMime ){ | 493 | if( m_autoMime ){ |
492 | m_mimetypes.clear(); | 494 | m_mimetypes.clear(); |
493 | m_mimetypes.insert( tr("All"), QString::null ); | 495 | m_mimetypes.insert( tr("All"), QString::null ); |
494 | if( m_selector == Normal ){ | 496 | if( m_selector == Normal ){ |
495 | DocLnkSet set; | 497 | DocLnkSet set; |
496 | Global::findDocuments(&set, QString::null ); | 498 | Global::findDocuments(&set, QString::null ); |
497 | QListIterator<DocLnk> dit( set.children() ); | 499 | QListIterator<DocLnk> dit( set.children() ); |
498 | for( ; dit.current(); ++dit ){ | 500 | for( ; dit.current(); ++dit ){ |
499 | if( !m_mimetypes.contains( (*dit)->type() ) ) | 501 | if( !m_mimetypes.contains( (*dit)->type() ) ) |
500 | m_mimetypes.insert( (*dit)->type(), (*dit)->type() ); | 502 | m_mimetypes.insert( (*dit)->type(), (*dit)->type() ); |
501 | } | 503 | } |
502 | }// else done in reparse | 504 | }// else done in reparse |
503 | } | 505 | } |
504 | } | 506 | } |
505 | void OFileSelector::initVars() | 507 | void OFileSelector::initVars() |
506 | { | 508 | { |
507 | if( m_mimetypes.isEmpty() ) | 509 | if( m_mimetypes.isEmpty() ) |
508 | m_autoMime = true; | 510 | m_autoMime = true; |
509 | else | 511 | else |
510 | m_autoMime = false; | 512 | m_autoMime = false; |
511 | 513 | ||
@@ -630,49 +632,49 @@ void OFileSelector::initializeChooser() | |||
630 | 632 | ||
631 | 633 | ||
632 | updateMimeCheck(); | 634 | updateMimeCheck(); |
633 | fillList(); | 635 | fillList(); |
634 | 636 | ||
635 | connect( m_viewCheck, SIGNAL( activated(const QString & ) ), | 637 | connect( m_viewCheck, SIGNAL( activated(const QString & ) ), |
636 | this, SLOT( slotViewCheck(const QString & ) ) ); | 638 | this, SLOT( slotViewCheck(const QString & ) ) ); |
637 | connect( m_mimeCheck, SIGNAL( activated(const QString & ) ), | 639 | connect( m_mimeCheck, SIGNAL( activated(const QString & ) ), |
638 | this, SLOT( slotMimeCheck( const QString & ) ) ); | 640 | this, SLOT( slotMimeCheck( const QString & ) ) ); |
639 | } | 641 | } |
640 | } | 642 | } |
641 | /* generate the buttons for the toolbar */ | 643 | /* generate the buttons for the toolbar */ |
642 | void OFileSelector::initToolbar() { | 644 | void OFileSelector::initToolbar() { |
643 | m_mainView = new OFileSelectorMain( this ); | 645 | m_mainView = new OFileSelectorMain( this ); |
644 | 646 | ||
645 | /* now generate the tool bar */ | 647 | /* now generate the tool bar */ |
646 | qWarning( "toolbar" ); | 648 | qWarning( "toolbar" ); |
647 | m_pseudo = new QWidget( m_mainView, "Pseudo Widget" ); | 649 | m_pseudo = new QWidget( m_mainView, "Pseudo Widget" ); |
648 | m_pseudoLayout = new QVBoxLayout( m_pseudo ); | 650 | m_pseudoLayout = new QVBoxLayout( m_pseudo ); |
649 | 651 | ||
650 | m_boxToolbar = new QHBox( m_pseudo ); | 652 | m_boxToolbar = new QHBox( m_pseudo ); |
651 | m_boxToolbar->setSpacing( 0 ); | 653 | m_boxToolbar->setSpacing( 0 ); |
652 | 654 | ||
653 | // tool bar members now | 655 | // tool bar members now |
654 | m_location = new QComboBox( m_boxToolbar ); | 656 | m_location = new QComboBox( m_boxToolbar ); |
655 | m_location->setEditable( TRUE ); | 657 | m_location->setEditable( TRUE ); |
656 | m_location->setDuplicatesEnabled( FALSE ); | 658 | m_location->setDuplicatesEnabled( FALSE ); |
657 | connect( m_location, SIGNAL(activated(const QString& ) ), | 659 | connect( m_location, SIGNAL(activated(const QString& ) ), |
658 | this, SLOT(slotLocationActivated(const QString& )) ); | 660 | this, SLOT(slotLocationActivated(const QString& )) ); |
659 | connect( m_location->lineEdit(), SIGNAL(returnPressed() ) , | 661 | connect( m_location->lineEdit(), SIGNAL(returnPressed() ) , |
660 | this, SLOT(locationComboChanged() ) ); | 662 | this, SLOT(locationComboChanged() ) ); |
661 | 663 | ||
662 | // UP Button | 664 | // UP Button |
663 | m_up = new QPushButton( Resource::loadIconSet("up"), QString::null, | 665 | m_up = new QPushButton( Resource::loadIconSet("up"), QString::null, |
664 | m_boxToolbar, "cdUpButton" ); | 666 | m_boxToolbar, "cdUpButton" ); |
665 | m_up->setFixedSize( QSize(20, 20 ) ); | 667 | m_up->setFixedSize( QSize(20, 20 ) ); |
666 | connect( m_up, SIGNAL( clicked() ), this, SLOT(cdUP() ) ); | 668 | connect( m_up, SIGNAL( clicked() ), this, SLOT(cdUP() ) ); |
667 | m_up->setFlat( TRUE ); | 669 | m_up->setFlat( TRUE ); |
668 | 670 | ||
669 | // Home Button | 671 | // Home Button |
670 | m_homeButton = new QPushButton(Resource::loadIconSet("home"), | 672 | m_homeButton = new QPushButton(Resource::loadIconSet("home"), |
671 | QString::null, m_boxToolbar ); | 673 | QString::null, m_boxToolbar ); |
672 | m_homeButton->setFixedSize( QSize(20, 20 ) ); | 674 | m_homeButton->setFixedSize( QSize(20, 20 ) ); |
673 | connect(m_homeButton, SIGNAL(clicked() ), this, SLOT(slotHome() ) ); | 675 | connect(m_homeButton, SIGNAL(clicked() ), this, SLOT(slotHome() ) ); |
674 | m_homeButton->setFlat( TRUE ); | 676 | m_homeButton->setFlat( TRUE ); |
675 | 677 | ||
676 | // Documents Button | 678 | // Documents Button |
677 | m_docButton = new QPushButton( Resource::loadIconSet("DocsIcon"), | 679 | m_docButton = new QPushButton( Resource::loadIconSet("DocsIcon"), |
678 | QString::null, m_boxToolbar, | 680 | QString::null, m_boxToolbar, |
@@ -953,51 +955,51 @@ void OFileSelector::setView( const QString& lis ) { | |||
953 | delete m_select; | 955 | delete m_select; |
954 | m_lister =0l; | 956 | m_lister =0l; |
955 | m_fileView = 0l; | 957 | m_fileView = 0l; |
956 | m_select = 0l; | 958 | m_select = 0l; |
957 | if ( lis.startsWith("All") ) { | 959 | if ( lis.startsWith("All") ) { |
958 | m_selector = ExtendedAll; | 960 | m_selector = ExtendedAll; |
959 | list = lis.mid(4 ).stripWhiteSpace(); | 961 | list = lis.mid(4 ).stripWhiteSpace(); |
960 | } else{ | 962 | } else{ |
961 | list = lis; | 963 | list = lis; |
962 | m_selector = Extended; | 964 | m_selector = Extended; |
963 | } | 965 | } |
964 | setLister(m_listerName); | 966 | setLister(m_listerName); |
965 | m_fileView = factory()->view( list, this, m_mainView ); | 967 | m_fileView = factory()->view( list, this, m_mainView ); |
966 | m_mainView->setWidget( m_fileView->widget() ); | 968 | m_mainView->setWidget( m_fileView->widget() ); |
967 | reparse(); | 969 | reparse(); |
968 | } | 970 | } |
969 | } | 971 | } |
970 | /* | 972 | /* |
971 | * the factory | 973 | * the factory |
972 | */ | 974 | */ |
973 | void OFileSelector::initFactory() { | 975 | void OFileSelector::initFactory() { |
974 | m_fileFactory = new OFileFactory(); | 976 | m_fileFactory = new OFileFactory(); |
975 | m_fileFactory->addLister(tr("Files"), newLocalLister ); | 977 | m_fileFactory->addLister(tr("Files"), newLocalLister ); |
976 | m_fileFactory->addView(tr("List View"), newFileListView ); | 978 | m_fileFactory->addView(tr("List View"), newFileListView ); |
977 | /* the factory is just a dummy */ | 979 | m_fileFactory->addView(tr("Documents"), newFileIconView ); |
978 | m_fileFactory->addView(tr("Documents"), newFileListView ); | ||
979 | } | 980 | } |
981 | |||
980 | void OFileSelector::fillList() { | 982 | void OFileSelector::fillList() { |
981 | qWarning("fill list"); | 983 | qWarning("fill list"); |
982 | if (!m_viewCheck ) | 984 | if (!m_viewCheck ) |
983 | return; | 985 | return; |
984 | 986 | ||
985 | m_viewCheck->clear(); | 987 | m_viewCheck->clear(); |
986 | QStringList list = factory()->views(); | 988 | QStringList list = factory()->views(); |
987 | qWarning("views: " + list.join(";") ); | 989 | qWarning("views: " + list.join(";") ); |
988 | for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { | 990 | for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { |
989 | qWarning( (*it) ); | 991 | qWarning( (*it) ); |
990 | if ( (*it) == tr("Documents") ) { | 992 | if ( (*it) == tr("Documents") ) { |
991 | m_viewCheck->insertItem( (*it) ); | 993 | m_viewCheck->insertItem( (*it) ); |
992 | }else{ | 994 | }else{ |
993 | m_viewCheck->insertItem( (*it) ); | 995 | m_viewCheck->insertItem( (*it) ); |
994 | m_viewCheck->insertItem( tr("All ") + (*it) ); | 996 | m_viewCheck->insertItem( tr("All ") + (*it) ); |
995 | } | 997 | } |
996 | } | 998 | } |
997 | } | 999 | } |
998 | OFileFactory* OFileSelector::factory() { | 1000 | OFileFactory* OFileSelector::factory() { |
999 | return m_fileFactory; | 1001 | return m_fileFactory; |
1000 | } | 1002 | } |
1001 | 1003 | ||
1002 | 1004 | ||
1003 | OFileView* OFileSelector::currentView() { | 1005 | OFileView* OFileSelector::currentView() { |