-rw-r--r-- | core/apps/textedit/fileBrowser.cpp | 6 | ||||
-rw-r--r-- | core/apps/textedit/fileSaver.cpp | 3 |
2 files changed, 4 insertions, 5 deletions
diff --git a/core/apps/textedit/fileBrowser.cpp b/core/apps/textedit/fileBrowser.cpp index 3e3cc3a..b029e5b 100644 --- a/core/apps/textedit/fileBrowser.cpp +++ b/core/apps/textedit/fileBrowser.cpp @@ -50,74 +50,74 @@ fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags ListView->setColumnAlignment(1,QListView::AlignRight); // ListView->setMultiSelection(true); // ListView->setSelectionMode(QListView::Extended); ListView->setAllColumnsShowFocus( TRUE ); ListView->setGeometry( QRect( 10, 35, 220, 240 ) ); // signals and slots connections connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) ); connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); currentDir.setPath(QDir::currentDirPath()); populateList(); move(0,15); } fileBrowser::~fileBrowser() { } void fileBrowser::populateList() { ListView->clear(); //qDebug(currentDir.canonicalPath()); - currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden ); + currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); currentDir.setMatchAllDirs(TRUE); currentDir.setNameFilter(filterStr); // currentDir.setNameFilter("*.txt;*.etx"); QString fileL, fileS; - const QFileInfoList *list = currentDir.entryInfoList(QDir::All /*, QDir::SortByMask*/); + const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); QFileInfoListIterator it(*list); QFileInfo *fi; while ( (fi=it.current()) ) { 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() ); } else { // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); fileS.sprintf( "%10li", fi->size() ); fileL.sprintf( "%s",fi->fileName().data() ); if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { fileL+="/"; -// qDebug(currentDir.canonicalPath()+fileL); +// qDebug( fileL); } } item= new QListViewItem( ListView,fileL,fileS ); ++it; } ListView->setSorting( 2, FALSE); dirLabel->setText(currentDir.canonicalPath()); } void fileBrowser::upDir() { // qDebug(currentDir.canonicalPath()); } void fileBrowser::listDoubleClicked(QListViewItem *selectedItem) { } // you may want to switch these 2 functions. I like single clicks void fileBrowser::listClicked(QListViewItem *selectedItem) { QString strItem=selectedItem->text(0); QString strSize=selectedItem->text(1); // qDebug("strItem is "+strItem); diff --git a/core/apps/textedit/fileSaver.cpp b/core/apps/textedit/fileSaver.cpp index de594aa..f3be914 100644 --- a/core/apps/textedit/fileSaver.cpp +++ b/core/apps/textedit/fileSaver.cpp @@ -61,59 +61,58 @@ fileSaver::fileSaver( QWidget* parent, const char* name, bool modal, WFlags fl fileEdit= new QLineEdit(this); fileEdit->setGeometry( QRect( 10, 162, 205, 17)); fileEdit->setText( tmpFileName); filePermCheck = new QCheckBox( this, "SetFilePerms" ); filePermCheck->setText("set file permissions"); filePermCheck->setGeometry(10, 178, 150,17); // signals and slots connections connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) ); connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); // tmpFileName=fi.FilePath(); // qDebug( tmpFileName); currentDir.setPath( QDir::currentDirPath() ); populateList(); move(0,15); } fileSaver::~fileSaver() { } - void fileSaver::populateList() { ListView->clear(); currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden ); currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); currentDir.setMatchAllDirs(TRUE); currentDir.setNameFilter("*"); QString fileL, fileS; - const QFileInfoList *list = currentDir.entryInfoList(QDir::All /*, QDir::SortByMask*/); + const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); QFileInfoListIterator it(*list); QFileInfo *fi; while ( (fi=it.current()) ) { 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() ); } else { // // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); fileS.sprintf( "%10li", fi->size() ); fileL.sprintf( "%s",fi->fileName().data() ); if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { fileL+="/"; // qDebug(currentDir.canonicalPath()+fileL); } } item= new QListViewItem( ListView,fileL,fileS ); ++it; } ListView->setSorting( 2, FALSE); |