summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/filebrowser/filebrowser.cpp102
1 files changed, 51 insertions, 51 deletions
diff --git a/noncore/unsupported/filebrowser/filebrowser.cpp b/noncore/unsupported/filebrowser/filebrowser.cpp
index d9e2afa..1bb7984 100644
--- a/noncore/unsupported/filebrowser/filebrowser.cpp
+++ b/noncore/unsupported/filebrowser/filebrowser.cpp
@@ -59,16 +59,16 @@ FileItem::FileItem( QListView * parent, const QFileInfo & fi )
setText( 0, fi.fileName() );
setText( 1, sizeString( fi.size() ) + " " );
setText( 2, QString().sprintf("%4d-%02d-%02d",d.year(), d.month(), d.day() ) );
MimeType mt(fi.filePath());
- if ( fi.isSymLink() )
- setText( 3, "symlink" );
+ if ( fi.isSymLink() )
+ setText( 3, "symlink" );
else if( fi.isDir() )
- setText( 3, "directory" );
+ setText( 3, "directory" );
else if( isLib() )
setText( 3, "library" );
else
setText( 3, mt.description() );
QPixmap pm;
@@ -84,16 +84,16 @@ FileItem::FileItem( QListView * parent, const QFileInfo & fi )
pm = Resource::loadPixmap( "library" );
else
pm = mt.pixmap();
if ( pm.isNull() )
pm = Resource::loadPixmap("UnknownDocument-14");
if( fi.isSymLink() ){
- // overlay link image
- QPixmap lnk = Resource::loadPixmap( "filebrowser/symlink" );
- QPainter painter( &pm );
- painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
+ // overlay link image
+ QPixmap lnk = Resource::loadPixmap( "filebrowser/symlink" );
+ QPainter painter( &pm );
+ painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
pm.setMask( pm.createHeuristicMask( FALSE ) );
}
setPixmap(0,pm);
}
QString FileItem::sizeString( unsigned int s )
@@ -172,25 +172,25 @@ bool FileItem::rename( const QString & name )
}
//
// FileView
//
FileView::FileView( const QString & dir, QWidget * parent,
- const char * name,
- bool hidden, bool symlinks )
+ const char * name,
+ bool hidden, bool symlinks )
: QListView( parent, name ),
menuTimer( this ),
le( NULL ),
itemToRename( NULL ),
showHidden( hidden ),
showSymlinks( symlinks),
- menuKeepsOpen( FALSE )
+ menuKeepsOpen( FALSE )
{
addColumn( "Name" );
- addColumn( "Date" );
addColumn( "Size" );
+ addColumn( "Date" );
addColumn( "Type" );
setMultiSelection( TRUE );
//header()->hide();
setColumnWidthMode( 0, Manual );
@@ -233,16 +233,16 @@ void FileView::setDir( const QString & dir )
dirHistory += currentDir;
generateDir( dir );
}
void FileView::generateDir( const QString & dir )
{
- if(menuKeepsOpen){
- cancelMenuTimer();
+ if(menuKeepsOpen){
+ cancelMenuTimer();
}
- QDir d( dir );
+ QDir d( dir );
if( d.exists() && !d.isReadable() ) return;
currentDir = d.canonicalPath();
if( !showHidden)
@@ -260,16 +260,16 @@ void FileView::generateDir( const QString & dir )
clear();
while( (fi = it.current()) ){
if( (fi->fileName() == ".") || (fi->fileName() == "..") ){
++it;
continue;
}
- if(!showSymlinks && fi->isSymLink()){
- ++it;
- continue;
- }
+ if(!showSymlinks && fi->isSymLink()){
+ ++it;
+ continue;
+ }
(void) new FileItem( (QListView *) this, *fi );
++it;
}
emit dirChanged();
}
@@ -586,17 +586,17 @@ void FileView::itemClicked( QListViewItem * i)
setDir( t->getFilePath() );
}
}
void FileView::itemDblClicked( QListViewItem * i)
{
- if(menuKeepsOpen){
- cancelMenuTimer();
- }
+ if(menuKeepsOpen){
+ cancelMenuTimer();
+ }
- FileItem * t = (FileItem *) i;
+ FileItem * t = (FileItem *) i;
if(t == NULL) return;
if(t->launch() == -1){
QMessageBox::warning( this, tr( "Launch Application" ),
tr( "Launch failed!" ), tr( "Ok" ) );
}
@@ -622,16 +622,16 @@ void FileView::contentsMousePressEvent( QMouseEvent * e )
menuTimer.start( 750, TRUE );
}
void FileView::contentsMouseReleaseEvent( QMouseEvent * e )
{
QListView::contentsMouseReleaseEvent( e );
- if(!menuKeepsOpen){
- menuTimer.stop();
- }
-
+ if(!menuKeepsOpen){
+ menuTimer.stop();
+ }
+
}
void FileView::cancelMenuTimer()
{
if( menuTimer.isActive() )
menuTimer.stop();
@@ -701,23 +701,23 @@ void FileView::showFileMenu()
//
// FileBrowser
//
void FileView::setShowHidden(bool hidden)
{
- showHidden=hidden;
+ showHidden=hidden;
}
void FileView::setShowSymlinks(bool symlinks)
{
- showSymlinks=symlinks;
+ showSymlinks=symlinks;
}
void FileView::setMenuKeepsOpen(bool keepOpen)
{
- menuKeepsOpen=keepOpen;
+ menuKeepsOpen=keepOpen;
}
FileBrowser::FileBrowser( QWidget * parent,
const char * name, WFlags f ) :
QMainWindow( parent, name, f )
{
@@ -733,25 +733,25 @@ FileBrowser::FileBrowser( const QString & dir, QWidget * parent,
void FileBrowser::init(const QString & dir)
{
setCaption( tr("File Manager") );
setIcon( Resource::loadPixmap( "filebrowser_icon" ) );
- Config cfg("Filebrowser");
- cfg.setGroup("View");
- bool showHidden=(cfg.readEntry("Hidden","FALSE") == "TRUE");
- bool showSymlinks=(cfg.readEntry("Symlinks","FALSE") == "TRUE");
+ Config cfg("Filebrowser");
+ cfg.setGroup("View");
+ bool showHidden=(cfg.readEntry("Hidden","FALSE") == "TRUE");
+ bool showSymlinks=(cfg.readEntry("Symlinks","FALSE") == "TRUE");
- cfg.setGroup("Menu");
- bool menuKeepsOpen=(cfg.readEntry("KeepOpen", "FALSE") == "TRUE");
-
+ cfg.setGroup("Menu");
+ bool menuKeepsOpen=(cfg.readEntry("KeepOpen", "FALSE") == "TRUE");
+
fileView = new FileView( dir, this, 0, showHidden, showSymlinks );
fileView->setAllColumnsShowFocus( TRUE );
- fileView->setMenuKeepsOpen(menuKeepsOpen);
-
+ fileView->setMenuKeepsOpen(menuKeepsOpen);
+
setCentralWidget( fileView );
setToolBarsMovable( FALSE );
QPEToolBar* toolBar = new QPEToolBar( this );
toolBar->setHorizontalStretchable( TRUE );
@@ -770,18 +770,18 @@ void FileBrowser::init(const QString & dir)
sortMenu->insertItem( tr( "Ascending" ), this, SLOT( updateSorting() ) );
sortMenu->setItemChecked( sortMenu->idAt( 5 ), TRUE );
sortMenu->setItemChecked( sortMenu->idAt( 0 ), TRUE );
viewMenu = new QPopupMenu( this);
- viewMenu->insertItem( tr( "Hidden"), this, SLOT( updateShowHidden() ) );
- viewMenu->insertItem( tr( "Symlinks"), this, SLOT( updateShowSymlinks() ) );
+ viewMenu->insertItem( tr( "Hidden"), this, SLOT( updateShowHidden() ) );
+ viewMenu->insertItem( tr( "Symlinks"), this, SLOT( updateShowSymlinks() ) );
viewMenu->setItemChecked( viewMenu->idAt( 0 ), showHidden );
viewMenu->setItemChecked( viewMenu->idAt( 1 ), showSymlinks );
- menuBar->insertItem( tr("View"), viewMenu );
+ menuBar->insertItem( tr("View"), viewMenu );
toolBar = new QPEToolBar( this );
lastAction = new QAction( tr("Previous dir"), Resource::loadIconSet( "back" ),
QString::null, 0, this, 0 );
connect( lastAction, SIGNAL( activated() ), fileView, SLOT( lastDir() ) );
@@ -953,31 +953,31 @@ void FileView::chPerm() {
updateDir();
}
}
void FileBrowser::updateShowHidden()
{
- bool valShowHidden=viewMenu->isItemChecked( viewMenu->idAt( 0 ) );
- valShowHidden=!valShowHidden;
- viewMenu->setItemChecked( viewMenu->idAt( 0 ), valShowHidden );
- fileView->setShowHidden(valShowHidden);
+ bool valShowHidden=viewMenu->isItemChecked( viewMenu->idAt( 0 ) );
+ valShowHidden=!valShowHidden;
+ viewMenu->setItemChecked( viewMenu->idAt( 0 ), valShowHidden );
+ fileView->setShowHidden(valShowHidden);
Config cfg("Filebrowser");
cfg.setGroup("View");
cfg.writeEntry("Hidden",valShowHidden?"TRUE":"FALSE");
- fileView->updateDir();
+ fileView->updateDir();
}
void FileBrowser::updateShowSymlinks()
{
- bool valShowSymlinks=viewMenu->isItemChecked( viewMenu->idAt( 1 ) );
- valShowSymlinks=!valShowSymlinks;
- viewMenu->setItemChecked( viewMenu->idAt( 1 ), valShowSymlinks );
- fileView->setShowSymlinks(valShowSymlinks);
+ bool valShowSymlinks=viewMenu->isItemChecked( viewMenu->idAt( 1 ) );
+ valShowSymlinks=!valShowSymlinks;
+ viewMenu->setItemChecked( viewMenu->idAt( 1 ), valShowSymlinks );
+ fileView->setShowSymlinks(valShowSymlinks);
Config cfg("Filebrowser");
cfg.setGroup("View");
cfg.writeEntry("Symlinks",valShowSymlinks?"TRUE":"FALSE");
- fileView->updateDir();
+ fileView->updateDir();
}