author | llornkcor <llornkcor> | 2002-03-25 05:32:47 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-03-25 05:32:47 (UTC) |
commit | 7c0676ba302dc1cfa4348423544ea2d66417c1bd (patch) (unidiff) | |
tree | 4ca7e3471ff88bab34ec476f1ed22528030c96ee /core | |
parent | 2dc3d45e57eb3265fe77e868c76d92fa27f627af (diff) | |
download | opie-7c0676ba302dc1cfa4348423544ea2d66417c1bd.zip opie-7c0676ba302dc1cfa4348423544ea2d66417c1bd.tar.gz opie-7c0676ba302dc1cfa4348423544ea2d66417c1bd.tar.bz2 |
more mime
-rw-r--r-- | core/apps/textedit/fileBrowser.cpp | 35 | ||||
-rw-r--r-- | core/apps/textedit/fileBrowser.h | 3 |
2 files changed, 28 insertions, 10 deletions
diff --git a/core/apps/textedit/fileBrowser.cpp b/core/apps/textedit/fileBrowser.cpp index 7a3a703..8c942a1 100644 --- a/core/apps/textedit/fileBrowser.cpp +++ b/core/apps/textedit/fileBrowser.cpp | |||
@@ -154,2 +154,3 @@ fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags | |||
154 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden */| QDir::All); | 154 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden */| QDir::All); |
155 | currentDir.setNameFilter(filterStr); | ||
155 | 156 | ||
@@ -163,6 +164,2 @@ fileBrowser::~fileBrowser() | |||
163 | 164 | ||
164 | void fileBrowser::setMimeType(const QString &type) { | ||
165 | mimeType = type; | ||
166 | } | ||
167 | |||
168 | void fileBrowser::setFileView( int selection ) | 165 | void fileBrowser::setFileView( int selection ) |
@@ -181,3 +178,2 @@ void fileBrowser::populateList() | |||
181 | 178 | ||
182 | currentDir.setNameFilter(filterStr); | ||
183 | // currentDir.setNameFilter("*.txt;*.etx"); | 179 | // currentDir.setNameFilter("*.txt;*.etx"); |
@@ -388,3 +384,3 @@ void fileBrowser::showListMenu(QListViewItem *item) { | |||
388 | m.insertItem( tr( "Make Directory" ), this, SLOT( makDir() )); | 384 | m.insertItem( tr( "Make Directory" ), this, SLOT( makDir() )); |
389 | m.insertItem( tr( "Rescan" ), this, SLOT( populateList()() )); | 385 | m.insertItem( tr( "Rescan" ), this, SLOT( populateList() )); |
390 | m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 386 | m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
@@ -483,3 +479,25 @@ void fileBrowser::showType(const QString &t) { | |||
483 | qDebug(t); | 479 | qDebug(t); |
484 | mimeType = t+"/*"; | 480 | if(t.find("All",0,TRUE) != -1) { |
481 | filterStr = "*"; | ||
482 | } else { | ||
483 | QStringList list = mimetypes.grep( t,TRUE); | ||
484 | QString ext; | ||
485 | for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { | ||
486 | mimeType =(*it); | ||
487 | MimeType mt( mimeType); | ||
488 | qDebug("mime "+mimeType); | ||
489 | // qDebug("description "+mt.description()); | ||
490 | // qDebug( "id "+mt.id()); | ||
491 | qDebug("extension "+mt.extension()); | ||
492 | if( mt.extension().isEmpty()) | ||
493 | filterStr = "*"; | ||
494 | else | ||
495 | filterStr = "*."+ mt.extension()+" "; | ||
496 | // printf( "%s \n", (*it).latin1() ); | ||
497 | } | ||
498 | } | ||
499 | currentDir.setNameFilter(filterStr); | ||
500 | |||
501 | populateList(); | ||
502 | update(); | ||
485 | // if(fileSelector) { | 503 | // if(fileSelector) { |
@@ -493,3 +511,2 @@ void fileBrowser::showType(const QString &t) { | |||
493 | // fileSelector->reread(); | 511 | // fileSelector->reread(); |
494 | repaint(); | ||
495 | // if ( t == tr("All") ) { | 512 | // if ( t == tr("All") ) { |
@@ -503,2 +520,3 @@ void fileBrowser::showType(const QString &t) { | |||
503 | QStringList fileBrowser::getMimeTypes() { | 520 | QStringList fileBrowser::getMimeTypes() { |
521 | |||
504 | QStringList r; | 522 | QStringList r; |
@@ -514,2 +532,3 @@ QStringList fileBrowser::getMimeTypes() { | |||
514 | QString temp = *f; | 532 | QString temp = *f; |
533 | mimetypes << temp; | ||
515 | int sl = temp.find('/'); | 534 | int sl = temp.find('/'); |
diff --git a/core/apps/textedit/fileBrowser.h b/core/apps/textedit/fileBrowser.h index 1138d80..339483f 100644 --- a/core/apps/textedit/fileBrowser.h +++ b/core/apps/textedit/fileBrowser.h | |||
@@ -60,3 +60,2 @@ public slots: | |||
60 | void setFileView( int ); | 60 | void setFileView( int ); |
61 | void setMimeType(const QString &); | ||
62 | 61 | ||
@@ -69,3 +68,3 @@ private: | |||
69 | QDir currentDir; | 68 | QDir currentDir; |
70 | QStringList dirPathStringList; | 69 | QStringList dirPathStringList, mimetypes; |
71 | QListViewItem * item; | 70 | QListViewItem * item; |