summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/fileBrowser.cpp53
1 files changed, 30 insertions, 23 deletions
diff --git a/core/apps/textedit/fileBrowser.cpp b/core/apps/textedit/fileBrowser.cpp
index acd50c2..ebb78d1 100644
--- a/core/apps/textedit/fileBrowser.cpp
+++ b/core/apps/textedit/fileBrowser.cpp
@@ -18,8 +18,9 @@
#include <qpe/resource.h>
#include <qpe/fileselector.h>
#include <qpe/qpeapplication.h>
#include <qpe/menubutton.h>
+#include <qpe/mimetype.h>
#include <qdict.h>
#include <qwidgetstack.h>
#include <qlistview.h>
@@ -117,9 +118,9 @@ fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags
connect( ListView, SIGNAL( clicked( QListViewItem*)), SLOT(listClicked(QListViewItem *)) );
FileStack->addWidget( ListView, get_unique_id() );
- mimeType="text/*";
+mimeType="text/*";
fileSelector = new FileSelector( mimeType, FileStack, "fileselector" , FALSE, FALSE); //buggy
// connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( showEditTools() ) );
// connect( fileSelector, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) );
connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( docOpen( const DocLnk & ) ) );
@@ -193,32 +194,38 @@ void fileBrowser::populateList()
// qDebug( fileL);
}
}
if(fileL !="./") {
- item= new QListViewItem( ListView,fileL,fileS , fileDate);
- QPixmap pm;
- pm= Resource::loadPixmap( "folder" );
+ item= new QListViewItem( ListView,fileL,fileS , fileDate);
+ QPixmap pm;
- if(isDir || fileL.find("/",0,TRUE) != -1) {
- if( !QDir( fi->filePath() ).isReadable())
- pm = Resource::loadPixmap( "lockedfolder" );
- item->setPixmap( 0,pm );
- } else {
- if( !fi->isReadable() )
- pm = Resource::loadPixmap( "locked" );
- else
- pm = Resource::loadPixmap( "fileopen" );
- item->setPixmap( 0,pm);
- }
- if( fileL.find("->",0,TRUE) != -1) {
- // overlay link image
- QPixmap lnk = Resource::loadPixmap( "symlink" );
- QPainter painter( &pm );
- painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
- pm.setMask( pm.createHeuristicMask( FALSE ) );
- item->setPixmap( 0, pm);
+ if(isDir || fileL.find("/",0,TRUE) != -1) {
+ if( !QDir( fi->filePath() ).isReadable())
+ pm = Resource::loadPixmap( "lockedfolder" );
+ else
+ pm= Resource::loadPixmap( "folder" );
+ item->setPixmap( 0,pm );
+ } else {
+ if( !fi->isReadable() )
+ pm = Resource::loadPixmap( "locked" );
+ else {
+ MimeType mt(fi->filePath());
+ pm=mt.pixmap();
+ if(pm.isNull())
+ pm = Resource::loadPixmap( "UnknownDocument-14" );
+ item->setPixmap( 0,pm);
+ }
+ }
+ if( fileL.find("->",0,TRUE) != -1) {
+ // overlay link image
+ pm= Resource::loadPixmap( "folder" );
+ QPixmap lnk = Resource::loadPixmap( "symlink" );
+ QPainter painter( &pm );
+ painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
+ pm.setMask( pm.createHeuristicMask( FALSE ) );
+ item->setPixmap( 0, pm);
+ }
}
- }
isDir=FALSE;
++it;
}
ListView->setSorting( 3, FALSE);