author | llornkcor <llornkcor> | 2002-03-27 04:33:32 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-03-27 04:33:32 (UTC) |
commit | 7d6828df281631bce0aaa2aaa229b69b9329e03c (patch) (side-by-side diff) | |
tree | efd928de11a2d7d2ae33bbccf737fae7a51ff36d /core/apps | |
parent | 524ad1da733675debd5c248b54efc5d58e855485 (diff) | |
download | opie-7d6828df281631bce0aaa2aaa229b69b9329e03c.zip opie-7d6828df281631bce0aaa2aaa229b69b9329e03c.tar.gz opie-7d6828df281631bce0aaa2aaa229b69b9329e03c.tar.bz2 |
fixed something erother.. probably something todo with deleting or somesuch. probably broke something else in the process
-rw-r--r-- | core/apps/textedit/fileBrowser.cpp | 117 | ||||
-rw-r--r-- | core/apps/textedit/fileBrowser.h | 2 | ||||
-rw-r--r-- | core/apps/textedit/fileSaver.cpp | 45 |
3 files changed, 104 insertions, 60 deletions
diff --git a/core/apps/textedit/fileBrowser.cpp b/core/apps/textedit/fileBrowser.cpp index 8c942a1..8ea8067 100644 --- a/core/apps/textedit/fileBrowser.cpp +++ b/core/apps/textedit/fileBrowser.cpp @@ -123,3 +123,3 @@ fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags connect( ListView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), - this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); + this, SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); @@ -173,2 +173,3 @@ void fileBrowser::populateList() ListView->clear(); + QListViewItem * item; bool isDir=FALSE; @@ -184,54 +185,54 @@ void fileBrowser::populateList() while ( (fi=it.current()) ) { - - if (fi->isSymLink() ){ - QString symLink=fi->readLink(); + if (fi->isSymLink() ){ + QString symLink=fi->readLink(); // qDebug("Symlink detected "+symLink); - QFileInfo sym( symLink); - fileS.sprintf( "%10li", sym.size() ); - fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); - fileDate = sym.lastModified().toString(); - } else { + QFileInfo sym( symLink); + fileS.sprintf( "%10li", sym.size() ); + fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); + fileDate = sym.lastModified().toString(); + } else { // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); - fileS.sprintf( "%10li", fi->size() ); - fileL.sprintf( "%s",fi->fileName().data() ); - fileDate= fi->lastModified().toString(); - if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { - fileL+="/"; - isDir=TRUE; + fileS.sprintf( "%10li", fi->size() ); + fileL.sprintf( "%s",fi->fileName().data() ); + fileDate= fi->lastModified().toString(); + if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { + fileL+="/"; + isDir=TRUE; // qDebug( fileL); + } } - } - if(fileL !="./") { - item= new QListViewItem( ListView,fileL,fileS , fileDate); - QPixmap pm; + if(fileL !="./" && fi->exists()) { + 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" ); - else + 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" ); - 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); + 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( 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; + isDir=FALSE; + ++it; +// } } @@ -265,2 +266,3 @@ void fileBrowser::listClicked(QListViewItem *selectedItem) { + if(selectedItem) { QString strItem=selectedItem->text(0); @@ -304,2 +306,3 @@ void fileBrowser::listClicked(QListViewItem *selectedItem) } + } } @@ -380,12 +383,16 @@ void fileBrowser::showListMenu(QListViewItem *item) { QPopupMenu m;// = new QPopupMenu( Local_View ); - if( item->text(0).find("/",0,TRUE)) - m.insertItem( tr( "Change Directory" ), this, SLOT( doCd() )); - else - m.insertItem( tr( "Make Directory" ), this, SLOT( makDir() )); - m.insertItem( tr( "Rescan" ), this, SLOT( populateList() )); - m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); - m.insertSeparator(); - m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); + if(item) { + if( item->text(0).find("/",0,TRUE)) + m.insertItem( tr( "Change Directory" ), this, SLOT( doCd() )); + m.insertItem( tr( "Make Directory" ), this, SLOT( makDir() )); + m.insertItem( tr( "Rescan" ), this, SLOT( populateList() )); + m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); + m.insertSeparator(); + m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); + } else { + m.insertItem( tr( "Make Directory" ), this, SLOT( makDir() )); + m.insertItem( tr( "Rescan" ), this, SLOT( populateList() )); + + } m.exec( QCursor::pos() ); - } @@ -402,2 +409,3 @@ void fileBrowser::makDir() { QString filename = fileDlg->LineEdit1->text(); + qDebug("Make dir"); currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); @@ -438,3 +446,2 @@ void fileBrowser::localDelete() { }; - } else { diff --git a/core/apps/textedit/fileBrowser.h b/core/apps/textedit/fileBrowser.h index 339483f..e76c7df 100644 --- a/core/apps/textedit/fileBrowser.h +++ b/core/apps/textedit/fileBrowser.h @@ -69,3 +69,3 @@ private: QStringList dirPathStringList, mimetypes; - QListViewItem * item; +/* QListViewItem * item; */ QComboBox *dirPathCombo; diff --git a/core/apps/textedit/fileSaver.cpp b/core/apps/textedit/fileSaver.cpp index 07fb5ba..f2a5355 100644 --- a/core/apps/textedit/fileSaver.cpp +++ b/core/apps/textedit/fileSaver.cpp @@ -16,2 +16,3 @@ #include <qpe/resource.h> +#include <qpe/mimetype.h> @@ -49,2 +50,3 @@ fileSaver::fileSaver( QWidget* parent, const char* name, bool modal, WFlags fl connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) ); + docButton->setFlat(TRUE); @@ -59,6 +61,8 @@ fileSaver::fileSaver( QWidget* parent, const char* name, bool modal, WFlags fl ListView->addColumn( tr( "Name" ) ); - ListView->setColumnWidth(0,140); + ListView->setColumnWidth(0,120); ListView->setSorting( 2, FALSE); ListView->addColumn( tr( "Size" ) ); - ListView->setColumnWidth(1,59); + ListView->setColumnWidth(1,-1); + ListView->addColumn( "Date",-1); + ListView->setColumnWidthMode(0,QListView::Manual); @@ -99,2 +103,3 @@ void fileSaver::populateList() ListView->clear(); + bool isDir=FALSE; currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); @@ -103,3 +108,3 @@ void fileSaver::populateList() currentDir.setNameFilter("*"); - QString fileL, fileS; + QString fileL, fileS, fileDate; const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); @@ -122,2 +127,3 @@ void fileSaver::populateList() fileL+="/"; + isDir=TRUE; // qDebug(currentDir.canonicalPath()+fileL); @@ -125,3 +131,34 @@ void fileSaver::populateList() } - item= new QListViewItem( ListView,fileL,fileS ); + if(fileL !="./") { + 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" ); + 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; |