author | llornkcor <llornkcor> | 2002-03-20 00:50:29 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-03-20 00:50:29 (UTC) |
commit | 090ac02da739600c577ed6396e04ed0e121f7890 (patch) (side-by-side diff) | |
tree | b994655686701aa5482e98a455141eb1757cc952 | |
parent | 5f6144b48cac5cc058ee06461e865ce03cda00f1 (diff) | |
download | opie-090ac02da739600c577ed6396e04ed0e121f7890.zip opie-090ac02da739600c577ed6396e04ed0e121f7890.tar.gz opie-090ac02da739600c577ed6396e04ed0e121f7890.tar.bz2 |
added hidden file option.
-rw-r--r-- | noncore/unsupported/filebrowser/filebrowser.cpp | 39 | ||||
-rw-r--r-- | noncore/unsupported/filebrowser/filebrowser.h | 6 |
2 files changed, 39 insertions, 6 deletions
diff --git a/noncore/unsupported/filebrowser/filebrowser.cpp b/noncore/unsupported/filebrowser/filebrowser.cpp index 41e7634..d9aabfd 100644 --- a/noncore/unsupported/filebrowser/filebrowser.cpp +++ b/noncore/unsupported/filebrowser/filebrowser.cpp @@ -177,4 +177,6 @@ FileView::FileView( const QString & dir, QWidget * parent, addColumn( "Type" ); + showingHidden=FALSE; + setMultiSelection( TRUE ); header()->hide(); @@ -207,4 +209,7 @@ void FileView::resizeEvent( QResizeEvent *e ) void FileView::updateDir() { + setCaption( "Boogie on boogieboy"); + //qDebug("Caption should be "+currentDir); + generateDir( currentDir ); } @@ -229,7 +234,11 @@ void FileView::generateDir( const QString & dir ) currentDir = d.canonicalPath(); + if( !showingHidden) d.setFilter( QDir::Dirs | QDir::Files ); - d.setSorting( QDir::Name | QDir::DirsFirst | QDir::IgnoreCase | - QDir::Reversed ); + else + d.setFilter( QDir::Dirs | QDir::Files |QDir::Hidden | QDir::All); + + d.setSorting( QDir::Name | QDir::DirsFirst | QDir::IgnoreCase | QDir::Reversed ); + const QFileInfoList * list = d.entryInfoList(); @@ -239,5 +248,5 @@ void FileView::generateDir( const QString & dir ) clear(); while( (fi = it.current()) ){ - if( (fi->fileName() == ".") || (fi->fileName() == "..") ){ + if( (fi->fileName() == ".") || (fi->fileName() == "..") ){ ++it; continue; @@ -246,5 +255,4 @@ void FileView::generateDir( const QString & dir ) ++it; } - emit dirChanged(); } @@ -656,9 +664,10 @@ void FileView::showFileMenu() tr( "Cut" ), this, SLOT( cut() ) ); m->insertItem( Resource::loadPixmap("copy"), + tr( "Copy" ), this, SLOT( copy() ) ); m->insertItem( Resource::loadPixmap("paste"), tr( "Paste" ), this, SLOT( paste() ) ); m->insertItem( tr( "Change Permissions" ), this, SLOT( chPerm() ) ); - m->insertItem( tr( "Delete" ), this, SLOT( del() ) ); + m->insertItem(Resource::loadPixmap( "close" ), tr( "Delete" ), this, SLOT( del() ) ); m->insertSeparator(); m->insertItem( tr( "Select all" ), this, SLOT( selectAll() ) ); @@ -712,4 +721,8 @@ void FileBrowser::init(const QString & dir) sortMenu->insertSeparator(); sortMenu->insertItem( tr( "Ascending" ), this, SLOT( updateSorting() ) ); + sortMenu->insertSeparator(); + sortMenu->insertItem( tr( "Show Hidden "), this, SLOT( showHidden() ) ); + fileView->showingHidden=FALSE; + sortMenu->setItemChecked( sortMenu->idAt( 5 ), TRUE ); sortMenu->setItemChecked( sortMenu->idAt( 0 ), TRUE ); @@ -748,4 +761,5 @@ void FileBrowser::init(const QString & dir) pasteAction->addTo( toolBar ); +// dirLabel = new QLabel(this, "DirLabel"); connect( fileView, SIGNAL( dirChanged() ), SLOT( updateDirMenu() ) ); @@ -765,4 +779,8 @@ void FileBrowser::pcmciaMessage( const QCString &msg, const QByteArray &) } +void FileBrowser::changeCaption(const QString & dir) { + setCaption( dir); +} + void FileBrowser::dirSelected( int id ) { @@ -855,4 +873,15 @@ void FileBrowser::updateSorting() } +void FileBrowser::showHidden() { + if(! fileView->showingHidden) { + fileView->showingHidden=TRUE; + sortMenu->setItemChecked( sortMenu->idAt( 7),TRUE); + } else { + fileView->showingHidden=FALSE; + sortMenu->setItemChecked( sortMenu->idAt( 7),FALSE); + } + fileView->updateDir(); +} + void FileView::chPerm() { FileItem * i; diff --git a/noncore/unsupported/filebrowser/filebrowser.h b/noncore/unsupported/filebrowser/filebrowser.h index c214dbe..54856a0 100644 --- a/noncore/unsupported/filebrowser/filebrowser.h +++ b/noncore/unsupported/filebrowser/filebrowser.h @@ -27,5 +27,5 @@ #include <qtimer.h> #include <qstringlist.h> - +class QLabel; class InlineEdit; @@ -59,4 +59,5 @@ public: QString cd(){ return currentDir; } QStringList history() const { return dirHistory; } + bool showingHidden; public slots: @@ -115,4 +116,6 @@ public: FileBrowser( const QString & dir, QWidget * parent = 0, const char * name = 0, WFlags f = 0 ); +public slots: + void changeCaption(const QString &); private: void init(const QString & dir); @@ -137,4 +140,5 @@ private slots: void updateDirMenu(); void dirSelected( int id ); + void showHidden(); }; |