summaryrefslogtreecommitdiff
path: root/core
authorllornkcor <llornkcor>2002-03-25 05:32:47 (UTC)
committer llornkcor <llornkcor>2002-03-25 05:32:47 (UTC)
commit7c0676ba302dc1cfa4348423544ea2d66417c1bd (patch) (unidiff)
tree4ca7e3471ff88bab34ec476f1ed22528030c96ee /core
parent2dc3d45e57eb3265fe77e868c76d92fa27f627af (diff)
downloadopie-7c0676ba302dc1cfa4348423544ea2d66417c1bd.zip
opie-7c0676ba302dc1cfa4348423544ea2d66417c1bd.tar.gz
opie-7c0676ba302dc1cfa4348423544ea2d66417c1bd.tar.bz2
more mime
Diffstat (limited to 'core') (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
@@ -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
164void fileBrowser::setMimeType(const QString &type) {
165 mimeType = type;
166}
167
168void fileBrowser::setFileView( int selection ) 165void 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() {
481void fileBrowser::showType(const QString &t) { 477void 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
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" );
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);
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
@@ -58,7 +58,6 @@ public:
58 QComboBox *SelectionCombo; 58 QComboBox *SelectionCombo;
59public slots: 59public slots:
60 void setFileView( int ); 60 void setFileView( int );
61 void setMimeType(const QString &);
62 61
63private: 62private:
64// QDict<void> mimes; 63// QDict<void> mimes;
@@ -67,7 +66,7 @@ private:
67 QLabel *dirLabel; 66 QLabel *dirLabel;
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;
73 MenuButton *typemb; 72 MenuButton *typemb;