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
@@ -65,9 +65,8 @@ namespace {
int indexByString( const QComboBox *box, const QString &str ){
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;
break;
}
@@ -85,19 +84,21 @@ OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString
resize(wid->width(),wid->height());
m_selector = selector;
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;
m_shPerm = true;
m_shLne = true;
m_shChooser = true;
m_shYesNo = true;
+
// for FILESELECTOR only view is interesting
m_location = 0;
m_homeButton = 0;
m_docButton = 0;
@@ -188,19 +189,23 @@ void OFileSelector::delItems()
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();
}
if(m_shLne ){
initializeName();
@@ -214,10 +219,10 @@ void OFileSelector::init()
initializeChooser();
if(m_shYesNo )
initializeYes();
- m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, requestedMimeTypesList.first()) );
- reparse();
+ // m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, requestedMimeTypesList.first()) );
+ // reparse();
}
void OFileSelector::setYesCancelVisible( bool show )
@@ -442,9 +447,12 @@ void OFileSelector::reparse()
m_mimetypes.prepend("All" );
m_mimeCheck->insertStringList(m_mimetypes );
// 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 );
//dir.setFilter(-1 );
int sort = QDir::Name | QDir::DirsFirst | QDir::Reversed;
@@ -577,14 +585,14 @@ void OFileSelector::initializeChooser()
m_viewCheck->insertItem(tr("Documents") );
m_viewCheck->insertItem(tr("Files") );
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 &) ),
this, SLOT(slotViewCheck(const QString & ) ) );
@@ -668,22 +676,24 @@ void OFileSelector::slotViewCheck(const QString &view ){
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
+ ;
+ }
+ }
}
void OFileSelector::initializeListView()
{
@@ -691,18 +701,17 @@ void OFileSelector::initializeListView()
// in the initial initialization, you are deleting objects here
// that aren't even existing yet.
// 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;
m_docButton = 0;
m_location = 0;