summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/filebrowser/filebrowser.cpp39
-rw-r--r--noncore/unsupported/filebrowser/filebrowser.h6
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
@@ -173,12 +173,14 @@ FileView::FileView( const QString & dir, QWidget * parent,
{
addColumn( "Name" );
addColumn( "Date" );
addColumn( "Size" );
addColumn( "Type" );
+ showingHidden=FALSE;
+
setMultiSelection( TRUE );
header()->hide();
setColumnWidthMode( 0, Manual );
setColumnWidthMode( 3, Manual );
@@ -203,12 +205,15 @@ void FileView::resizeEvent( QResizeEvent *e )
setColumnWidth( 3, 0 );
QListView::resizeEvent( e );
}
void FileView::updateDir()
{
+ setCaption( "Boogie on boogieboy");
+ //qDebug("Caption should be "+currentDir);
+
generateDir( currentDir );
}
void FileView::setDir( const QString & dir )
{
if ( dir.startsWith( "/dev" ) ) {
@@ -225,30 +230,33 @@ void FileView::generateDir( const QString & dir )
QDir d( dir );
if( d.exists() && !d.isReadable() ) return;
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 );
QFileInfo *fi;
clear();
while( (fi = it.current()) ){
- if( (fi->fileName() == ".") || (fi->fileName() == "..") ){
+ if( (fi->fileName() == ".") || (fi->fileName() == "..") ){
++it;
continue;
}
(void) new FileItem( (QListView *) this, *fi );
++it;
}
-
emit dirChanged();
}
void FileView::rename()
{
itemToRename = (FileItem *) currentItem();
@@ -652,17 +660,18 @@ void FileView::showFileMenu()
}
m->insertItem( tr( "Rename" ), this, SLOT( rename() ) );
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() ) );
m->popup( QCursor::pos() );
}
@@ -708,12 +717,16 @@ void FileBrowser::init(const QString & dir)
sortMenu->insertItem( tr( "by Name "), this, SLOT( sortName() ) );
sortMenu->insertItem( tr( "by Size "), this, SLOT( sortSize() ) );
sortMenu->insertItem( tr( "by Date "), this, SLOT( sortDate() ) );
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 );
toolBar = new QPEToolBar( this );
lastAction = new QAction( tr("Previous dir"), Resource::loadIconSet( "back" ),
@@ -744,12 +757,13 @@ void FileBrowser::init(const QString & dir)
pasteAction = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ),
QString::null, 0, this, 0 );
connect( pasteAction, SIGNAL( activated() ), fileView, SLOT( paste() ) );
pasteAction->addTo( toolBar );
+// dirLabel = new QLabel(this, "DirLabel");
connect( fileView, SIGNAL( dirChanged() ), SLOT( updateDirMenu() ) );
updateDirMenu();
QCopChannel* pcmciaChannel = new QCopChannel( "QPE/Card", this );
connect( pcmciaChannel, SIGNAL(received(const QCString &, const QByteArray &)),
@@ -761,12 +775,16 @@ void FileBrowser::pcmciaMessage( const QCString &msg, const QByteArray &)
if ( msg == "mtabChanged()" ) {
// ## Only really needed if current dir is on a card
fileView->updateDir();
}
}
+void FileBrowser::changeCaption(const QString & dir) {
+ setCaption( dir);
+}
+
void FileBrowser::dirSelected( int id )
{
int i = 0, j;
QString dir;
// Bulid target dir from menu
@@ -851,12 +869,23 @@ void FileBrowser::updateSorting()
else if ( sortMenu->isItemChecked( sortMenu->idAt( 2 ) ) )
sortDate();
else
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;
QString cmd;
int err;
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
@@ -23,13 +23,13 @@
#include <qlistview.h>
#include <qmainwindow.h>
#include <qfileinfo.h>
#include <qaction.h>
#include <qtimer.h>
#include <qstringlist.h>
-
+class QLabel;
class InlineEdit;
class FileItem : public QListViewItem
{
public:
FileItem( QListView * parent, const QFileInfo & fi );
@@ -55,12 +55,13 @@ class FileView : public QListView
public:
FileView( const QString & dir, QWidget * parent = 0,
const char * name = 0 );
void setDir( const QString & dir );
QString cd(){ return currentDir; }
QStringList history() const { return dirHistory; }
+ bool showingHidden;
public slots:
void updateDir();
void parentDir();
void lastDir();
@@ -111,12 +112,14 @@ class FileBrowser : public QMainWindow
public:
FileBrowser( QWidget * parent = 0,
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;
QPopupMenu * dirMenu, * sortMenu;
FileView * fileView;
QAction * pasteAction;
@@ -133,9 +136,10 @@ private slots:
void sortSize();
void sortType();
void updateSorting();
void updateDirMenu();
void dirSelected( int id );
+ void showHidden();
};
#endif