Diffstat (limited to 'core/apps/textedit/fileBrowser.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/apps/textedit/fileBrowser.cpp | 59 |
1 files changed, 34 insertions, 25 deletions
diff --git a/core/apps/textedit/fileBrowser.cpp b/core/apps/textedit/fileBrowser.cpp index f322513..fced326 100644 --- a/core/apps/textedit/fileBrowser.cpp +++ b/core/apps/textedit/fileBrowser.cpp @@ -8,13 +8,13 @@ ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ****************************************************************************/ -//#define QTOPIA_INTERNAL_MIMEEXT +#define QTOPIA_INTERNAL_MIMEEXT #include "fileBrowser.h" //#include "inputDialog.h" #include <qpe/config.h> #include <qpe/resource.h> #include <qpe/fileselector.h> @@ -47,30 +47,36 @@ static int get_unique_id() fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags fl , const QString mimeFilter ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "fileBrowser" ); setCaption(tr( name ) ); -// mimeType = mimeFilter; -// MimeType mt( mimeType); -// if( mt.extension().isEmpty()) -// QStringList filterList; -// filterList=QStringList::split(";",mimeFilter,FALSE); -// for ( QStringList::Iterator it = filterList.begin(); it != filterList.end(); ++it ) { -// printf( "%s \n", (*it).latin1() ); -// } - filterStr = mimeFilter.right(mimeFilter.length() - mimeFilter.find("/",0,TRUE) - 1);// "*"; +// getMimeTypes(); + + mimeType = mimeFilter; + MimeType mt( mimeType); + + if( mt.extension().isEmpty()) { + + QStringList filterList; + filterList=QStringList::split(";",mimeFilter,FALSE); + + for ( QStringList::Iterator it = filterList.begin(); it != filterList.end(); ++it ) { + printf( "%s \n", (*it).latin1() ); + } + + filterStr = mimeFilter.right(mimeFilter.length() - mimeFilter.find("/",0,TRUE) - 1);// "*"; - qDebug(filterStr); -// else -// filterStr = "*."+ mt.extension(); + qDebug(filterStr); + } else { + filterStr = "*."+ mt.extension(); // qDebug("description "+mt.description()); // qDebug( "id "+mt.id()); // qDebug("extension "+mt.extension()); - + } // channel = new QCopChannel( "QPE/fileDialog", this ); // connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), // this, SLOT(receive(const QCString&, const QByteArray&)) ); QGridLayout *layout = new QGridLayout( this ); layout->setSpacing( 4 ); @@ -231,13 +237,13 @@ void fileBrowser::populateList() item->setPixmap( 0,pm); } } if( fileL.find("->",0,TRUE) != -1) { // overlay link image pm= Resource::loadPixmap( "folder" ); - QPixmap lnk = Resource::loadPixmap( "symlink" ); + QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); QPainter painter( &pm ); painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); pm.setMask( pm.createHeuristicMask( FALSE ) ); item->setPixmap( 0, pm); } } @@ -489,29 +495,31 @@ void fileBrowser::updateMimeTypeMenu() { connect(typemb, SIGNAL(selected(const QString&)), this, SLOT(showType(const QString&))); } void fileBrowser::showType(const QString &t) { - qDebug(t); +// qDebug("Show type "+t); if(t.find("All",0,TRUE) != -1) { filterStr = "*"; } else { QStringList list = mimetypes.grep( t,TRUE); QString ext; for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { mimeType =(*it); - MimeType mt( mimeType); -// qDebug("mime "+mimeType); -// qDebug("description "+mt.description()); -// qDebug( "id "+mt.id()); -// qDebug("extension "+mt.extension()); -// if( mt.extension().isEmpty()) + MimeType mt(mimeType); + +// qDebug("mime "+mimeType); +// qDebug("description "+mt.description()); +// qDebug( "id "+mt.id()); +// qDebug("extension "+mt.extension()); + + if( mt.extension().isEmpty()) filterStr = "*"; -// else -// filterStr = "*."+ mt.extension()+" "; + else + filterStr = "*."+ mt.extension()+" "; // printf( "%s \n", (*it).latin1() ); } } currentDir.setNameFilter(filterStr); populateList(); @@ -543,16 +551,17 @@ QStringList fileBrowser::getMimeTypes() { AppLnk* l; l = it.current(); QStringList maj = l->mimeTypes(); QStringList::ConstIterator f; for ( f = maj.begin(); f != maj.end(); f++ ) { QString temp = *f; + qDebug("type "+temp); mimetypes << temp; int sl = temp.find('/'); if (sl >= 0) { - QString k = temp.left(sl); + QString k = temp;//.left(sl); if( r.grep(k,TRUE).isEmpty() ) { r << k; k+="\n"; file.writeBlock( k.latin1(), k.length()); } } |