summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/fileBrowser.cpp35
-rw-r--r--core/apps/textedit/fileBrowser.h3
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
@@ -153,4 +153,5 @@ fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags
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();
@@ -162,8 +163,4 @@ fileBrowser::~fileBrowser()
162} 163}
163 164
164void fileBrowser::setMimeType(const QString &type) {
165 mimeType = type;
166}
167
168void fileBrowser::setFileView( int selection ) 165void fileBrowser::setFileView( int selection )
169{ 166{
@@ -180,5 +177,4 @@ void fileBrowser::populateList()
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;
@@ -387,5 +383,5 @@ void fileBrowser::showListMenu(QListViewItem *item) {
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();
@@ -482,5 +478,27 @@ 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 & ) ) );
@@ -492,5 +510,4 @@ void fileBrowser::showType(const QString &t) {
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);
@@ -502,4 +519,5 @@ void fileBrowser::showType(const QString &t) {
502 519
503QStringList fileBrowser::getMimeTypes() { 520QStringList fileBrowser::getMimeTypes() {
521
504 QStringList r; 522 QStringList r;
505 AppLnkSet apps( QPEApplication::qpeDir() + "apps" ); 523 AppLnkSet apps( QPEApplication::qpeDir() + "apps" );
@@ -513,4 +531,5 @@ QStringList fileBrowser::getMimeTypes() {
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) {
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
@@ -59,5 +59,4 @@ public:
59public slots: 59public slots:
60 void setFileView( int ); 60 void setFileView( int );
61 void setMimeType(const QString &);
62 61
63private: 62private:
@@ -68,5 +67,5 @@ private:
68 QString filterStr, mimeType; 67 QString filterStr, mimeType;
69 QDir currentDir; 68 QDir currentDir;
70 QStringList dirPathStringList; 69 QStringList dirPathStringList, mimetypes;
71 QListViewItem * item; 70 QListViewItem * item;
72 QComboBox *dirPathCombo; 71 QComboBox *dirPathCombo;