Diffstat (limited to 'core/apps/textedit/fileBrowser.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/apps/textedit/fileBrowser.cpp | 35 |
1 files changed, 27 insertions, 8 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 | |||
@@ -152,6 +152,7 @@ fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags | |||
152 | 152 | ||
153 | currentDir.setPath(QDir::currentDirPath()); | 153 | currentDir.setPath(QDir::currentDirPath()); |
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 | ||
156 | populateList(); | 157 | populateList(); |
157 | move(0,15); | 158 | move(0,15); |
@@ -161,10 +162,6 @@ fileBrowser::~fileBrowser() | |||
161 | { | 162 | { |
162 | } | 163 | } |
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 ) |
169 | { | 166 | { |
170 | SelectionCombo->setCurrentItem( selection ); | 167 | SelectionCombo->setCurrentItem( selection ); |
@@ -179,7 +176,6 @@ void fileBrowser::populateList() | |||
179 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 176 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
180 | currentDir.setMatchAllDirs(TRUE); | 177 | currentDir.setMatchAllDirs(TRUE); |
181 | 178 | ||
182 | currentDir.setNameFilter(filterStr); | ||
183 | // currentDir.setNameFilter("*.txt;*.etx"); | 179 | // currentDir.setNameFilter("*.txt;*.etx"); |
184 | QString fileL, fileS, fileDate; | 180 | QString fileL, fileS, fileDate; |
185 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 181 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
@@ -386,7 +382,7 @@ void fileBrowser::showListMenu(QListViewItem *item) { | |||
386 | m.insertItem( tr( "Change Directory" ), this, SLOT( doCd() )); | 382 | m.insertItem( tr( "Change Directory" ), this, SLOT( doCd() )); |
387 | else | 383 | else |
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() )); |
391 | m.insertSeparator(); | 387 | m.insertSeparator(); |
392 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 388 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
@@ -481,7 +477,29 @@ void fileBrowser::updateMimeTypeMenu() { | |||
481 | void fileBrowser::showType(const QString &t) { | 477 | void fileBrowser::showType(const QString &t) { |
482 | 478 | ||
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) { |
486 | // disconnect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( docOpen( const DocLnk & ) ) ); | 504 | // disconnect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( docOpen( const DocLnk & ) ) ); |
487 | // delete fileSelector; | 505 | // delete fileSelector; |
@@ -491,7 +509,6 @@ void fileBrowser::showType(const QString &t) { | |||
491 | // connect( fileSelector, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); | 509 | // connect( fileSelector, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); |
492 | // connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( docOpen( const DocLnk & ) ) ); | 510 | // connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( docOpen( const DocLnk & ) ) ); |
493 | // fileSelector->reread(); | 511 | // fileSelector->reread(); |
494 | repaint(); | ||
495 | // if ( t == tr("All") ) { | 512 | // if ( t == tr("All") ) { |
496 | // icons->setTypeFilter("",TRUE); | 513 | // icons->setTypeFilter("",TRUE); |
497 | // } else { | 514 | // } else { |
@@ -501,6 +518,7 @@ void fileBrowser::showType(const QString &t) { | |||
501 | } | 518 | } |
502 | 519 | ||
503 | QStringList fileBrowser::getMimeTypes() { | 520 | QStringList fileBrowser::getMimeTypes() { |
521 | |||
504 | QStringList r; | 522 | QStringList r; |
505 | AppLnkSet apps( QPEApplication::qpeDir() + "apps" ); | 523 | AppLnkSet apps( QPEApplication::qpeDir() + "apps" ); |
506 | QFile file( QPEApplication::qpeDir()+"etc/available.mime"); | 524 | QFile file( QPEApplication::qpeDir()+"etc/available.mime"); |
@@ -512,6 +530,7 @@ QStringList fileBrowser::getMimeTypes() { | |||
512 | QStringList::ConstIterator f; | 530 | QStringList::ConstIterator f; |
513 | for ( f = maj.begin(); f != maj.end(); f++ ) { | 531 | for ( f = maj.begin(); f != maj.end(); f++ ) { |
514 | QString temp = *f; | 532 | QString temp = *f; |
533 | mimetypes << temp; | ||
515 | int sl = temp.find('/'); | 534 | int sl = temp.find('/'); |
516 | if (sl >= 0) { | 535 | if (sl >= 0) { |
517 | QString k = temp.left(sl); | 536 | QString k = temp.left(sl); |