-rw-r--r-- | libopie/ofileselector.cc | 89 |
1 files changed, 49 insertions, 40 deletions
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc index ce66f51..3a11032 100644 --- a/libopie/ofileselector.cc +++ b/libopie/ofileselector.cc | |||
@@ -67,5 +67,4 @@ namespace { | |||
67 | int index= -1; | 67 | int index= -1; |
68 | for(int i= 0; i < box->count(); i++ ){ | 68 | for(int i= 0; i < box->count(); i++ ){ |
69 | qWarning("str T%sT boxT%sT", str.latin1(), box->text(i).latin1() ); | ||
70 | if( str == box->text(i ) ){ | 69 | if( str == box->text(i ) ){ |
71 | index= i; | 70 | index= i; |
@@ -87,9 +86,10 @@ OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString | |||
87 | m_currentDir = dirName; | 86 | m_currentDir = dirName; |
88 | m_name = fileName; | 87 | m_name = fileName; |
89 | requestedMimeTypesList = m_mimetypes = mimetypes; | 88 | m_mimetypes = mimetypes; |
90 | 89 | ||
91 | // if( mimetypes.isEmpty() ) | 90 | if( mimetypes.isEmpty() ) |
92 | // m_autoMime = true; | 91 | m_autoMime = true; |
93 | 92 | ||
93 | qWarning("OFileSelector mimetypes %s", mimetypes.join(" ").latin1() ); | ||
94 | m_mode = mode; | 94 | m_mode = mode; |
95 | m_shTool = true; | 95 | m_shTool = true; |
@@ -98,4 +98,5 @@ OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString | |||
98 | m_shChooser = true; | 98 | m_shChooser = true; |
99 | m_shYesNo = true; | 99 | m_shYesNo = true; |
100 | |||
100 | // for FILESELECTOR only view is interesting | 101 | // for FILESELECTOR only view is interesting |
101 | m_location = 0; | 102 | m_location = 0; |
@@ -190,15 +191,19 @@ void OFileSelector::init() | |||
190 | // qDebug("init"); | 191 | // qDebug("init"); |
191 | m_stack = new QWidgetStack(this, "wstack" ); | 192 | m_stack = new QWidgetStack(this, "wstack" ); |
193 | if( m_selector == NORMAL ){ | ||
192 | QString currMime; | 194 | QString currMime; |
193 | if( m_mimeCheck != 0 ) | 195 | if( m_mimeCheck != 0 ) |
194 | currMime = m_mimeCheck->currentText(); | 196 | currMime = m_mimeCheck->currentText(); |
195 | updateMimes(); | 197 | updateMimes(); |
196 | m_select = new FileSelector( currMime == "All" ? QString::null : currMime , m_stack, "fileselector", FALSE, FALSE ); | 198 | m_select = new FileSelector( currMime == "All" ? QString::null : currMime , |
199 | m_stack, "fileselector", FALSE, FALSE ); | ||
197 | m_stack->addWidget(m_select, NORMAL ); | 200 | m_stack->addWidget(m_select, NORMAL ); |
198 | m_lay->addWidget(m_stack ); | 201 | m_lay->addWidget(m_stack ); |
199 | m_stack->raiseWidget(NORMAL ); | 202 | m_stack->raiseWidget(NORMAL ); |
200 | connect(m_select, SIGNAL(fileSelected( const DocLnk &) ), this, SLOT(slotFileBridgeSelected(const DocLnk &) ) ); | 203 | connect(m_select, SIGNAL(fileSelected( const DocLnk &) ), |
204 | this, SLOT(slotFileBridgeSelected(const DocLnk &) ) ); | ||
201 | m_pseudoLayout = 0l; | 205 | m_pseudoLayout = 0l; |
202 | if( m_selector != NORMAL ) { | 206 | |
207 | } else { | ||
203 | initializeListView(); | 208 | initializeListView(); |
204 | } | 209 | } |
@@ -216,6 +221,6 @@ void OFileSelector::init() | |||
216 | initializeYes(); | 221 | initializeYes(); |
217 | 222 | ||
218 | m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, requestedMimeTypesList.first()) ); | 223 | // m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, requestedMimeTypesList.first()) ); |
219 | reparse(); | 224 | // reparse(); |
220 | 225 | ||
221 | } | 226 | } |
@@ -444,5 +449,8 @@ void OFileSelector::reparse() | |||
444 | // set it to the current mimetype | 449 | // set it to the current mimetype |
445 | m_mimeCheck->setCurrentItem( indexByString( m_mimeCheck, currMime ) ); | 450 | m_mimeCheck->setCurrentItem( indexByString( m_mimeCheck, currMime ) ); |
446 | }; | 451 | }else{ |
452 | m_mimeCheck->clear(); | ||
453 | m_mimeCheck->insertItem( m_mimetypes.join(";") ); | ||
454 | } | ||
447 | 455 | ||
448 | QDir dir( m_currentDir ); | 456 | QDir dir( m_currentDir ); |
@@ -579,10 +587,10 @@ void OFileSelector::initializeChooser() | |||
579 | m_viewCheck->insertItem(tr("All Files") ); | 587 | m_viewCheck->insertItem(tr("All Files") ); |
580 | 588 | ||
581 | // if(!m_autoMime ) | 589 | if(!m_autoMime ) |
582 | // m_mimeCheck->insertItem(m_mimetypes.join("," ) ); | 590 | m_mimeCheck->insertItem(m_mimetypes.join("," ) ); |
583 | // else{ // check | 591 | else{ // check |
584 | updateMimes(); | 592 | updateMimes(); |
585 | m_mimeCheck->insertStringList( m_mimetypes ); | 593 | m_mimeCheck->insertStringList( m_mimetypes ); |
586 | // } | 594 | } |
587 | 595 | ||
588 | connect( m_viewCheck, SIGNAL(activated(const QString &) ), | 596 | connect( m_viewCheck, SIGNAL(activated(const QString &) ), |
@@ -670,18 +678,20 @@ void OFileSelector::updateMimes() // lets check which mode is active | |||
670 | // check the current dir for items then | 678 | // check the current dir for items then |
671 | { | 679 | { |
672 | m_mimetypes.clear(); | 680 | if( m_autoMime ){ |
673 | m_mimetypes.append("All" ); | 681 | m_mimetypes.clear(); |
674 | // if( m_selector == NORMAL ){ | 682 | m_mimetypes.append("All" ); |
675 | DocLnkSet set; | 683 | if( m_selector == NORMAL ){ |
676 | Global::findDocuments(&set, QString::null ); | 684 | DocLnkSet set; |
677 | QListIterator<DocLnk> dit( set.children() ); | 685 | Global::findDocuments(&set, QString::null ); |
678 | for ( ; dit.current(); ++dit ) { | 686 | QListIterator<DocLnk> dit( set.children() ); |
679 | if( !m_mimetypes.contains((*dit)->type() ) ) | 687 | for ( ; dit.current(); ++dit ) { |
680 | m_mimetypes.append( (*dit)->type() ); | 688 | if( !m_mimetypes.contains((*dit)->type() ) ) |
681 | } | 689 | m_mimetypes.append( (*dit)->type() ); |
682 | // }else{ | 690 | } |
683 | // should be allreday updatet | 691 | }else{ |
684 | // ; | 692 | // should be allreday updatet |
685 | // } | 693 | ; |
694 | } | ||
695 | } | ||
686 | } | 696 | } |
687 | 697 | ||
@@ -693,14 +703,13 @@ void OFileSelector::initializeListView() | |||
693 | 703 | ||
694 | // just to make sure but clean it up better FIXME | 704 | // just to make sure but clean it up better FIXME |
695 | // if( m_View) delete m_View; | 705 | delete m_View; |
696 | // m_View = 0; | 706 | m_View = 0; |
697 | // if(m_boxToolbar) delete m_boxToolbar; | 707 | delete m_boxToolbar; |
698 | // if(m_homeButton) delete m_homeButton; | 708 | delete m_homeButton; |
699 | // if(m_docButton) delete m_docButton; | 709 | delete m_docButton; |
700 | // if( m_location) delete m_location; | 710 | delete m_location; |
701 | // if(m_up) delete m_up; | 711 | delete m_up; |
702 | //delete m_pseudo; | 712 | delete m_pseudo; |
703 | //if(m_pseudoLayout!=0 ) // why did you overload malloc | 713 | |
704 | //delete m_pseudoLayout; | ||
705 | m_boxToolbar = 0; | 714 | m_boxToolbar = 0; |
706 | m_homeButton = 0; | 715 | m_homeButton = 0; |