summaryrefslogtreecommitdiff
authorzecke <zecke>2002-04-27 22:09:26 (UTC)
committer zecke <zecke>2002-04-27 22:09:26 (UTC)
commit7d741c93b423a3ab721071971b2c345d2d8548e2 (patch) (side-by-side diff)
treec6ae4fc904ccd5f3ab08fb2876f9666358544f4f
parent69e271e44d23befc74a96a98708ddb6ec754a4b6 (diff)
downloadopie-7d741c93b423a3ab721071971b2c345d2d8548e2.zip
opie-7d741c93b423a3ab721071971b2c345d2d8548e2.tar.gz
opie-7d741c93b423a3ab721071971b2c345d2d8548e2.tar.bz2
Fix automime and mime tested with textedit
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/ofileselector.cc89
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 {
int index= -1;
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 ) ){
index= i;
@@ -87,9 +86,10 @@ OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString
m_currentDir = dirName;
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;
m_shTool = true;
@@ -98,4 +98,5 @@ OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString
m_shChooser = true;
m_shYesNo = true;
+
// for FILESELECTOR only view is interesting
m_location = 0;
@@ -190,15 +191,19 @@ void OFileSelector::init()
// qDebug("init");
m_stack = new QWidgetStack(this, "wstack" );
+ if( m_selector == NORMAL ){
QString currMime;
if( m_mimeCheck != 0 )
currMime = m_mimeCheck->currentText();
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 );
m_lay->addWidget(m_stack );
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();
}
@@ -216,6 +221,6 @@ void OFileSelector::init()
initializeYes();
- m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, requestedMimeTypesList.first()) );
- reparse();
+ // m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, requestedMimeTypesList.first()) );
+ // reparse();
}
@@ -444,5 +449,8 @@ void OFileSelector::reparse()
// set it to the current mimetype
m_mimeCheck->setCurrentItem( indexByString( m_mimeCheck, currMime ) );
- };
+ }else{
+ m_mimeCheck->clear();
+ m_mimeCheck->insertItem( m_mimetypes.join(";") );
+ }
QDir dir( m_currentDir );
@@ -579,10 +587,10 @@ void OFileSelector::initializeChooser()
m_viewCheck->insertItem(tr("All Files") );
-// 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 );
+ }
connect( m_viewCheck, SIGNAL(activated(const QString &) ),
@@ -670,18 +678,20 @@ void OFileSelector::updateMimes() // lets check which mode is active
// check the current dir for items then
{
- 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
+ ;
+ }
+ }
}
@@ -693,14 +703,13 @@ 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;
m_homeButton = 0;