summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/unsupported/filebrowser/filebrowser.cpp37
-rw-r--r--noncore/unsupported/filebrowser/filebrowser.h6
2 files changed, 38 insertions, 5 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
@@ -176,6 +176,8 @@ FileView::FileView( const QString & dir, QWidget * parent,
addColumn( "Size" );
addColumn( "Type" );
+ showingHidden=FALSE;
+
setMultiSelection( TRUE );
header()->hide();
@@ -206,6 +208,9 @@ void FileView::resizeEvent( QResizeEvent *e )
void FileView::updateDir()
{
+ setCaption( "Boogie on boogieboy");
+ //qDebug("Caption should be "+currentDir);
+
generateDir( currentDir );
}
@@ -228,9 +233,13 @@ 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();
QFileInfoListIterator it( *list );
@@ -245,7 +254,6 @@ void FileView::generateDir( const QString & dir )
(void) new FileItem( (QListView *) this, *fi );
++it;
}
-
emit dirChanged();
}
@@ -655,11 +663,12 @@ void FileView::showFileMenu()
m->insertItem( Resource::loadPixmap("cut"),
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() ) );
m->insertItem( tr( "Deselect all" ), this, SLOT( deselectAll() ) );
@@ -711,6 +720,10 @@ void FileBrowser::init(const QString & dir)
sortMenu->insertItem( tr( "by Type "), this, SLOT( sortType() ) );
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 );
@@ -747,6 +760,7 @@ void FileBrowser::init(const QString & dir)
connect( pasteAction, SIGNAL( activated() ), fileView, SLOT( paste() ) );
pasteAction->addTo( toolBar );
+// dirLabel = new QLabel(this, "DirLabel");
connect( fileView, SIGNAL( dirChanged() ), SLOT( updateDirMenu() ) );
updateDirMenu();
@@ -764,6 +778,10 @@ void FileBrowser::pcmciaMessage( const QCString &msg, const QByteArray &)
}
}
+void FileBrowser::changeCaption(const QString & dir) {
+ setCaption( dir);
+}
+
void FileBrowser::dirSelected( int id )
{
int i = 0, j;
@@ -854,6 +872,17 @@ void FileBrowser::updateSorting()
sortType();
}
+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;
QStringList fl;
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
@@ -26,7 +26,7 @@
#include <qaction.h>
#include <qtimer.h>
#include <qstringlist.h>
-
+class QLabel;
class InlineEdit;
class FileItem : public QListViewItem
@@ -58,6 +58,7 @@ public:
void setDir( const QString & dir );
QString cd(){ return currentDir; }
QStringList history() const { return dirHistory; }
+ bool showingHidden;
public slots:
void updateDir();
@@ -114,6 +115,8 @@ public:
const char * name = 0, WFlags f = 0 );
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);
QString fileToCopy;
@@ -136,6 +139,7 @@ private slots:
void updateDirMenu();
void dirSelected( int id );
+ void showHidden();
};
#endif