author | llornkcor <llornkcor> | 2002-03-20 00:50:29 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-03-20 00:50:29 (UTC) |
commit | 090ac02da739600c577ed6396e04ed0e121f7890 (patch) (unidiff) | |
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, | |||
177 | addColumn( "Type" ); | 177 | addColumn( "Type" ); |
178 | 178 | ||
179 | showingHidden=FALSE; | ||
180 | |||
179 | setMultiSelection( TRUE ); | 181 | setMultiSelection( TRUE ); |
180 | header()->hide(); | 182 | header()->hide(); |
@@ -207,4 +209,7 @@ void FileView::resizeEvent( QResizeEvent *e ) | |||
207 | void FileView::updateDir() | 209 | void FileView::updateDir() |
208 | { | 210 | { |
211 | setCaption( "Boogie on boogieboy"); | ||
212 | //qDebug("Caption should be "+currentDir); | ||
213 | |||
209 | generateDir( currentDir ); | 214 | generateDir( currentDir ); |
210 | } | 215 | } |
@@ -229,7 +234,11 @@ void FileView::generateDir( const QString & dir ) | |||
229 | currentDir = d.canonicalPath(); | 234 | currentDir = d.canonicalPath(); |
230 | 235 | ||
236 | if( !showingHidden) | ||
231 | d.setFilter( QDir::Dirs | QDir::Files ); | 237 | d.setFilter( QDir::Dirs | QDir::Files ); |
232 | d.setSorting( QDir::Name | QDir::DirsFirst | QDir::IgnoreCase | | 238 | else |
233 | QDir::Reversed ); | 239 | d.setFilter( QDir::Dirs | QDir::Files |QDir::Hidden | QDir::All); |
240 | |||
241 | d.setSorting( QDir::Name | QDir::DirsFirst | QDir::IgnoreCase | QDir::Reversed ); | ||
242 | |||
234 | 243 | ||
235 | const QFileInfoList * list = d.entryInfoList(); | 244 | const QFileInfoList * list = d.entryInfoList(); |
@@ -239,5 +248,5 @@ void FileView::generateDir( const QString & dir ) | |||
239 | clear(); | 248 | clear(); |
240 | while( (fi = it.current()) ){ | 249 | while( (fi = it.current()) ){ |
241 | if( (fi->fileName() == ".") || (fi->fileName() == "..") ){ | 250 | if( (fi->fileName() == ".") || (fi->fileName() == "..") ){ |
242 | ++it; | 251 | ++it; |
243 | continue; | 252 | continue; |
@@ -246,5 +255,4 @@ void FileView::generateDir( const QString & dir ) | |||
246 | ++it; | 255 | ++it; |
247 | } | 256 | } |
248 | |||
249 | emit dirChanged(); | 257 | emit dirChanged(); |
250 | } | 258 | } |
@@ -656,9 +664,10 @@ void FileView::showFileMenu() | |||
656 | tr( "Cut" ), this, SLOT( cut() ) ); | 664 | tr( "Cut" ), this, SLOT( cut() ) ); |
657 | m->insertItem( Resource::loadPixmap("copy"), | 665 | m->insertItem( Resource::loadPixmap("copy"), |
666 | |||
658 | tr( "Copy" ), this, SLOT( copy() ) ); | 667 | tr( "Copy" ), this, SLOT( copy() ) ); |
659 | m->insertItem( Resource::loadPixmap("paste"), | 668 | m->insertItem( Resource::loadPixmap("paste"), |
660 | tr( "Paste" ), this, SLOT( paste() ) ); | 669 | tr( "Paste" ), this, SLOT( paste() ) ); |
661 | m->insertItem( tr( "Change Permissions" ), this, SLOT( chPerm() ) ); | 670 | m->insertItem( tr( "Change Permissions" ), this, SLOT( chPerm() ) ); |
662 | m->insertItem( tr( "Delete" ), this, SLOT( del() ) ); | 671 | m->insertItem(Resource::loadPixmap( "close" ), tr( "Delete" ), this, SLOT( del() ) ); |
663 | m->insertSeparator(); | 672 | m->insertSeparator(); |
664 | m->insertItem( tr( "Select all" ), this, SLOT( selectAll() ) ); | 673 | m->insertItem( tr( "Select all" ), this, SLOT( selectAll() ) ); |
@@ -712,4 +721,8 @@ void FileBrowser::init(const QString & dir) | |||
712 | sortMenu->insertSeparator(); | 721 | sortMenu->insertSeparator(); |
713 | sortMenu->insertItem( tr( "Ascending" ), this, SLOT( updateSorting() ) ); | 722 | sortMenu->insertItem( tr( "Ascending" ), this, SLOT( updateSorting() ) ); |
723 | sortMenu->insertSeparator(); | ||
724 | sortMenu->insertItem( tr( "Show Hidden "), this, SLOT( showHidden() ) ); | ||
725 | fileView->showingHidden=FALSE; | ||
726 | |||
714 | sortMenu->setItemChecked( sortMenu->idAt( 5 ), TRUE ); | 727 | sortMenu->setItemChecked( sortMenu->idAt( 5 ), TRUE ); |
715 | sortMenu->setItemChecked( sortMenu->idAt( 0 ), TRUE ); | 728 | sortMenu->setItemChecked( sortMenu->idAt( 0 ), TRUE ); |
@@ -748,4 +761,5 @@ void FileBrowser::init(const QString & dir) | |||
748 | pasteAction->addTo( toolBar ); | 761 | pasteAction->addTo( toolBar ); |
749 | 762 | ||
763 | // dirLabel = new QLabel(this, "DirLabel"); | ||
750 | 764 | ||
751 | connect( fileView, SIGNAL( dirChanged() ), SLOT( updateDirMenu() ) ); | 765 | connect( fileView, SIGNAL( dirChanged() ), SLOT( updateDirMenu() ) ); |
@@ -765,4 +779,8 @@ void FileBrowser::pcmciaMessage( const QCString &msg, const QByteArray &) | |||
765 | } | 779 | } |
766 | 780 | ||
781 | void FileBrowser::changeCaption(const QString & dir) { | ||
782 | setCaption( dir); | ||
783 | } | ||
784 | |||
767 | void FileBrowser::dirSelected( int id ) | 785 | void FileBrowser::dirSelected( int id ) |
768 | { | 786 | { |
@@ -855,4 +873,15 @@ void FileBrowser::updateSorting() | |||
855 | } | 873 | } |
856 | 874 | ||
875 | void FileBrowser::showHidden() { | ||
876 | if(! fileView->showingHidden) { | ||
877 | fileView->showingHidden=TRUE; | ||
878 | sortMenu->setItemChecked( sortMenu->idAt( 7),TRUE); | ||
879 | } else { | ||
880 | fileView->showingHidden=FALSE; | ||
881 | sortMenu->setItemChecked( sortMenu->idAt( 7),FALSE); | ||
882 | } | ||
883 | fileView->updateDir(); | ||
884 | } | ||
885 | |||
857 | void FileView::chPerm() { | 886 | void FileView::chPerm() { |
858 | FileItem * i; | 887 | 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 @@ | |||
27 | #include <qtimer.h> | 27 | #include <qtimer.h> |
28 | #include <qstringlist.h> | 28 | #include <qstringlist.h> |
29 | 29 | class QLabel; | |
30 | class InlineEdit; | 30 | class InlineEdit; |
31 | 31 | ||
@@ -59,4 +59,5 @@ public: | |||
59 | QString cd(){ return currentDir; } | 59 | QString cd(){ return currentDir; } |
60 | QStringList history() const { return dirHistory; } | 60 | QStringList history() const { return dirHistory; } |
61 | bool showingHidden; | ||
61 | 62 | ||
62 | public slots: | 63 | public slots: |
@@ -115,4 +116,6 @@ public: | |||
115 | FileBrowser( const QString & dir, QWidget * parent = 0, | 116 | FileBrowser( const QString & dir, QWidget * parent = 0, |
116 | const char * name = 0, WFlags f = 0 ); | 117 | const char * name = 0, WFlags f = 0 ); |
118 | public slots: | ||
119 | void changeCaption(const QString &); | ||
117 | private: | 120 | private: |
118 | void init(const QString & dir); | 121 | void init(const QString & dir); |
@@ -137,4 +140,5 @@ private slots: | |||
137 | void updateDirMenu(); | 140 | void updateDirMenu(); |
138 | void dirSelected( int id ); | 141 | void dirSelected( int id ); |
142 | void showHidden(); | ||
139 | }; | 143 | }; |
140 | 144 | ||