-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 @@ -68,3 +68,2 @@ namespace { for(int i= 0; i < box->count(); i++ ){ - qWarning("str T%sT boxT%sT", str.latin1(), box->text(i).latin1() ); if( str == box->text(i ) ){ @@ -88,7 +87,8 @@ OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString m_name = fileName; - requestedMimeTypesList = m_mimetypes = mimetypes; + m_mimetypes = mimetypes; -// if( mimetypes.isEmpty() ) -// m_autoMime = true; + if( mimetypes.isEmpty() ) + m_autoMime = true; + qWarning("OFileSelector mimetypes %s", mimetypes.join(" ").latin1() ); m_mode = mode; @@ -99,2 +99,3 @@ OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString m_shYesNo = true; + // for FILESELECTOR only view is interesting @@ -191,2 +192,3 @@ void OFileSelector::init() m_stack = new QWidgetStack(this, "wstack" ); + if( m_selector == NORMAL ){ QString currMime; @@ -195,3 +197,4 @@ void OFileSelector::init() updateMimes(); - m_select = new FileSelector( currMime == "All" ? QString::null : currMime , m_stack, "fileselector", FALSE, FALSE ); + m_select = new FileSelector( currMime == "All" ? QString::null : currMime , + m_stack, "fileselector", FALSE, FALSE ); m_stack->addWidget(m_select, NORMAL ); @@ -199,5 +202,7 @@ void OFileSelector::init() m_stack->raiseWidget(NORMAL ); - connect(m_select, SIGNAL(fileSelected( const DocLnk &) ), this, SLOT(slotFileBridgeSelected(const DocLnk &) ) ); + connect(m_select, SIGNAL(fileSelected( const DocLnk &) ), + this, SLOT(slotFileBridgeSelected(const DocLnk &) ) ); m_pseudoLayout = 0l; - if( m_selector != NORMAL ) { + + } else { initializeListView(); @@ -217,4 +222,4 @@ void OFileSelector::init() - m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, requestedMimeTypesList.first()) ); - reparse(); + // m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, requestedMimeTypesList.first()) ); + // reparse(); @@ -445,3 +450,6 @@ void OFileSelector::reparse() m_mimeCheck->setCurrentItem( indexByString( m_mimeCheck, currMime ) ); - }; + }else{ + m_mimeCheck->clear(); + m_mimeCheck->insertItem( m_mimetypes.join(";") ); + } @@ -580,8 +588,8 @@ void OFileSelector::initializeChooser() -// if(!m_autoMime ) -// m_mimeCheck->insertItem(m_mimetypes.join("," ) ); -// else{ // check - updateMimes(); - m_mimeCheck->insertStringList( m_mimetypes ); -// } + if(!m_autoMime ) + m_mimeCheck->insertItem(m_mimetypes.join("," ) ); + else{ // check + updateMimes(); + m_mimeCheck->insertStringList( m_mimetypes ); + } @@ -671,16 +679,18 @@ void OFileSelector::updateMimes() // lets check which mode is active { - m_mimetypes.clear(); - m_mimetypes.append("All" ); -// if( m_selector == NORMAL ){ - DocLnkSet set; - Global::findDocuments(&set, QString::null ); - QListIterator<DocLnk> dit( set.children() ); - for ( ; dit.current(); ++dit ) { - if( !m_mimetypes.contains((*dit)->type() ) ) - m_mimetypes.append( (*dit)->type() ); - } -// }else{ - // should be allreday updatet - // ; - // } + if( m_autoMime ){ + m_mimetypes.clear(); + m_mimetypes.append("All" ); + if( m_selector == NORMAL ){ + DocLnkSet set; + Global::findDocuments(&set, QString::null ); + QListIterator<DocLnk> dit( set.children() ); + for ( ; dit.current(); ++dit ) { + if( !m_mimetypes.contains((*dit)->type() ) ) + m_mimetypes.append( (*dit)->type() ); + } + }else{ + // should be allreday updatet + ; + } + } } @@ -694,12 +704,11 @@ void OFileSelector::initializeListView() // just to make sure but clean it up better FIXME - // if( m_View) delete m_View; -// m_View = 0; -// if(m_boxToolbar) delete m_boxToolbar; -// if(m_homeButton) delete m_homeButton; -// if(m_docButton) delete m_docButton; -// if( m_location) delete m_location; -// if(m_up) delete m_up; - //delete m_pseudo; - //if(m_pseudoLayout!=0 ) // why did you overload malloc - //delete m_pseudoLayout; + delete m_View; + m_View = 0; + delete m_boxToolbar; + delete m_homeButton; + delete m_docButton; + delete m_location; + delete m_up; + delete m_pseudo; + m_boxToolbar = 0; |