author | llornkcor <llornkcor> | 2003-03-26 02:07:38 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-03-26 02:07:38 (UTC) |
commit | 445c957aeddcea7ee0b83657e00987103a6d35b0 (patch) (side-by-side diff) | |
tree | 4efbff1b8896295e532d1c10dd33e4ab177f014c | |
parent | a76176911328349414203edda3785ac8925c0648 (diff) | |
download | opie-445c957aeddcea7ee0b83657e00987103a6d35b0.zip opie-445c957aeddcea7ee0b83657e00987103a6d35b0.tar.gz opie-445c957aeddcea7ee0b83657e00987103a6d35b0.tar.bz2 |
change to UnknownDocument icon and scale
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 943 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 2 |
2 files changed, 477 insertions, 468 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index bb7f346..1a5e131 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp @@ -33,2 +33,3 @@ +#include <qwmatrix.h> #include <qregexp.h> @@ -71,10 +72,15 @@ AdvancedFm::AdvancedFm( ) - : QMainWindow( ) { - init(); - renameBox = 0; + : QMainWindow( ) { + init(); + renameBox = 0; - initConnections(); - whichTab=1; - rePopulate(); - currentPathCombo->setFocus(); + QWMatrix matrix; + QPixmap pix(Resource::loadPixmap( "UnknownDocument" )); + matrix.scale( .4, .4); + unknownXpm = pix.xForm(matrix); + + initConnections(); + whichTab=1; + rePopulate(); + currentPathCombo->setFocus(); } @@ -99,20 +105,20 @@ void AdvancedFm::tabChanged(QWidget *w) { - if( w == tab) - whichTab = 1; - else - whichTab = 2; + if( w == tab) + whichTab = 1; + else + whichTab = 2; -// qDebug("tab changed %d", whichTab ); +// qDebug("tab changed %d", whichTab ); QString path = CurrentDir()->canonicalPath(); - currentPathCombo->lineEdit()->setText( path ); + currentPathCombo->lineEdit()->setText( path ); - viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); - viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); + viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); + viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); - QString fs= getFileSystemType( (const QString &) path); + QString fs= getFileSystemType( (const QString &) path); - setCaption("AdvancedFm :: "+fs+" :: " - +checkDiskSpace( (const QString &) path )+ " kB free" ); - chdir( path.latin1()); + setCaption("AdvancedFm :: "+fs+" :: " + +checkDiskSpace( (const QString &) path )+ " kB free" ); + chdir( path.latin1()); } @@ -123,5 +129,5 @@ void AdvancedFm::populateView() QPixmap pm; - QListView *thisView = CurrentView(); - QDir *thisDir = CurrentDir(); - QString path = thisDir->canonicalPath(); + QListView *thisView = CurrentView(); + QDir *thisDir = CurrentDir(); + QString path = thisDir->canonicalPath(); @@ -140,99 +146,100 @@ void AdvancedFm::populateView() while ( (fi=it.current()) ) - { - if (fi->isSymLink() ) - { - QString symLink=fi->readLink(); - QFileInfo sym( symLink); - fileS.sprintf( "%10i", sym.size() ); - fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.filePath().data() ); - fileDate = sym.lastModified().toString(); - } - else - { - fileS.sprintf( "%10i", fi->size() ); - fileL.sprintf( "%s",fi->fileName().data() ); - fileDate= fi->lastModified().toString(); - if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) - { - fileL+="/"; - isDir=TRUE; - } - } - - QFileInfo fileInfo( path + "/" + fileL); - - if(fileL !="./" && fi->exists()) - { - item= new QListViewItem( thisView, fileL, fileS , fileDate); - - if(isDir || fileL.find("/",0,TRUE) != -1) - { - - if( !QDir( fi->filePath() ).isReadable()) //is directory - pm = Resource::loadPixmap( "lockedfolder" ); - else - pm= Resource::loadPixmap( "folder" ); - } - else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) - { - pm = Resource::loadPixmap( "exec"); - } - else if( (fileInfo.permission( QFileInfo::ExeUser) - | fileInfo.permission( QFileInfo::ExeGroup) - | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) - { - pm = Resource::loadPixmap( "exec"); - } - else if( !fi->isReadable() ) - { - pm = Resource::loadPixmap( "locked" ); - } - else { //everything else goes by mimetype - MimeType mt(fi->filePath()); - pm=mt.pixmap(); //sets the correct pixmap for mimetype - if(pm.isNull()) - pm = Resource::loadPixmap( "UnknownDocument-14" ); - } - item->setPixmap( 0,pm); - if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) - { - // overlay link image - pm= Resource::loadPixmap( "folder" ); - QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); - QPainter painter( &pm ); - painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); - pm.setMask( pm.createHeuristicMask( FALSE ) ); - item->setPixmap( 0, pm); - } - } - isDir=FALSE; - ++it; - } + { + if (fi->isSymLink() ) + { + QString symLink=fi->readLink(); + QFileInfo sym( symLink); + fileS.sprintf( "%10i", sym.size() ); + fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.filePath().data() ); + fileDate = sym.lastModified().toString(); + } + else + { + fileS.sprintf( "%10i", fi->size() ); + fileL.sprintf( "%s",fi->fileName().data() ); + fileDate= fi->lastModified().toString(); + if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) + { + fileL+="/"; + isDir=TRUE; + } + } + + QFileInfo fileInfo( path + "/" + fileL); + + if(fileL !="./" && fi->exists()) + { + item= new QListViewItem( thisView, fileL, fileS , fileDate); + + if(isDir || fileL.find("/",0,TRUE) != -1) + { + + if( !QDir( fi->filePath() ).isReadable()) //is directory + pm = Resource::loadPixmap( "lockedfolder" ); + else + pm= Resource::loadPixmap( "folder" ); + } + else if ( fs == "vfat" && fileInfo.filePath().contains("/bin") ) + { + pm = Resource::loadPixmap( "exec"); + } + else if( (fileInfo.permission( QFileInfo::ExeUser) + | fileInfo.permission( QFileInfo::ExeGroup) + | fileInfo.permission( QFileInfo::ExeOther)) && fs != "vfat" ) + { + pm = Resource::loadPixmap( "exec"); + } + else if( !fi->isReadable() ) + { + pm = Resource::loadPixmap( "locked" ); + } + else { //everything else goes by mimetype + MimeType mt(fi->filePath()); + pm=mt.pixmap(); //sets the correct pixmap for mimetype + if(pm.isNull()) { + pm = unknownXpm; + } + } + if( fi->isSymLink() && fileL.find("->",0,TRUE) != -1) + { + // overlay link image + pm= Resource::loadPixmap( "folder" ); + QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); + QPainter painter( &pm ); + painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); + pm.setMask( pm.createHeuristicMask( FALSE ) ); + } + item->setPixmap( 0,pm); + + } + isDir=FALSE; + ++it; + } if( path.find("dev",0,TRUE) != -1) - { - struct stat buf; - dev_t devT; - DIR *dir; - struct dirent *mydirent; - - if((dir = opendir( path.latin1())) != NULL) - while ((mydirent = readdir(dir)) != NULL) - { - lstat( mydirent->d_name, &buf); + { + struct stat buf; + dev_t devT; + DIR *dir; + struct dirent *mydirent; + + if((dir = opendir( path.latin1())) != NULL) + while ((mydirent = readdir(dir)) != NULL) + { + lstat( mydirent->d_name, &buf); // qDebug(mydirent->d_name); - fileL.sprintf("%s", mydirent->d_name); - devT = buf.st_dev; - fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); - fileDate.sprintf("%s", ctime( &buf.st_mtime)); - if( fileL.find(".") == -1 ) - { - item= new QListViewItem( thisView, fileL, fileS, fileDate); - pm = Resource::loadPixmap( "UnknownDocument-14" ); - item->setPixmap( 0,pm); - } - } - - closedir(dir); - } + fileL.sprintf("%s", mydirent->d_name); + devT = buf.st_dev; + fileS.sprintf("%d, %d", (int) ( devT >>8) &0xFF, (int)devT &0xFF); + fileDate.sprintf("%s", ctime( &buf.st_mtime)); + if( fileL.find(".") == -1 ) + { + item= new QListViewItem( thisView, fileL, fileS, fileDate); + pm = unknownXpm; + item->setPixmap( 0,pm); + } + } + + closedir(dir); + } @@ -244,11 +251,11 @@ void AdvancedFm::rePopulate() { - int tmpTab = whichTab; - qDebug("%d", tmpTab); + int tmpTab = whichTab; + qDebug("%d", tmpTab); - for(int i =1; i < 3; i++) - { - TabWidget->setCurrentTab(i - 1); - populateView(); - } - TabWidget->setCurrentTab( tmpTab - 1); + for(int i =1; i < 3; i++) + { + TabWidget->setCurrentTab(i - 1); + populateView(); + } + TabWidget->setCurrentTab( tmpTab - 1); } @@ -258,31 +265,31 @@ void AdvancedFm::ListClicked(QListViewItem *selectedItem) if(selectedItem) - { - QString strItem=selectedItem->text(0); - QString strSize=selectedItem->text(1); - strSize=strSize.stripWhiteSpace(); - bool isDirectory = false; - QString strItem2; - - if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 )//if symlink - { - strItem2 = dealWithSymName((const QString&)strItem); - if(QDir(strItem2).exists() ) - strItem = strItem2; - } - - if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) - { - - if(QDir(strItem).exists()) - isDirectory = true; - } - - if( isDirectory ) - { - CurrentDir()->cd( strItem, TRUE); - populateView(); - CurrentView()->ensureItemVisible( CurrentView()->firstChild()); - } - chdir( strItem.latin1()); - } + { + QString strItem=selectedItem->text(0); + QString strSize=selectedItem->text(1); + strSize=strSize.stripWhiteSpace(); + bool isDirectory = false; + QString strItem2; + + if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 )//if symlink + { + strItem2 = dealWithSymName((const QString&)strItem); + if(QDir(strItem2).exists() ) + strItem = strItem2; + } + + if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) + { + + if(QDir(strItem).exists()) + isDirectory = true; + } + + if( isDirectory ) + { + CurrentDir()->cd( strItem, TRUE); + populateView(); + CurrentView()->ensureItemVisible( CurrentView()->firstChild()); + } + chdir( strItem.latin1()); + } } @@ -293,8 +300,8 @@ void AdvancedFm::ListPressed( int mouse, QListViewItem *, const QPoint& , int ) { - if(renameBox != 0 ) - { + if(renameBox != 0 ) + { cancelRename(); - } + } } - break; + break; case 2: @@ -329,11 +336,11 @@ void AdvancedFm::currentPathComboChanged() { - if(QDir( currentPathCombo->lineEdit()->text()).exists()) - { - CurrentDir()->setPath( currentPathCombo->lineEdit()->text() ); - populateView(); - } - else - { - QMessageBox::message(tr("Note"),tr("That directory does not exist")); - } + if(QDir( currentPathCombo->lineEdit()->text()).exists()) + { + CurrentDir()->setPath( currentPathCombo->lineEdit()->text() ); + populateView(); + } + else + { + QMessageBox::message(tr("Note"),tr("That directory does not exist")); + } } @@ -344,21 +351,21 @@ void AdvancedFm::fillCombo(const QString ¤tPath) if ( whichTab == 1) - { - currentPathCombo->lineEdit()->setText( currentPath); - if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) - { - currentPathCombo->clear(); - localDirPathStringList.prepend( currentPath ); - currentPathCombo->insertStringList( localDirPathStringList,-1); - } - } - else - { - currentPathCombo->lineEdit()->setText( currentPath); - if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) - { - currentPathCombo->clear(); - remoteDirPathStringList.prepend( currentPath ); - currentPathCombo->insertStringList( remoteDirPathStringList,-1); - } - } + { + currentPathCombo->lineEdit()->setText( currentPath); + if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) + { + currentPathCombo->clear(); + localDirPathStringList.prepend( currentPath ); + currentPathCombo->insertStringList( localDirPathStringList,-1); + } + } + else + { + currentPathCombo->lineEdit()->setText( currentPath); + if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) + { + currentPathCombo->clear(); + remoteDirPathStringList.prepend( currentPath ); + currentPathCombo->insertStringList( remoteDirPathStringList,-1); + } + } } @@ -376,14 +383,14 @@ QStringList AdvancedFm::getPath() QStringList strList; - QListView *thisView=CurrentView(); - QList<QListViewItem> * getSelectedItems( QListView * thisView ); - QListViewItemIterator it( thisView ); - for ( ; it.current(); ++it ) - { - if ( it.current()->isSelected() ) - { - strList << it.current()->text(0); + QListView *thisView=CurrentView(); + QList<QListViewItem> * getSelectedItems( QListView * thisView ); + QListViewItemIterator it( thisView ); + for ( ; it.current(); ++it ) + { + if ( it.current()->isSelected() ) + { + strList << it.current()->text(0); // qDebug(it.current()->text(0)); - } - } - return strList; + } + } + return strList; } @@ -394,4 +401,4 @@ void AdvancedFm::homeButtonPushed() chdir( current.latin1() ); - CurrentDir()->cd( current, TRUE); - populateView(); + CurrentDir()->cd( current, TRUE); + populateView(); update(); @@ -403,4 +410,4 @@ void AdvancedFm::docButtonPushed() chdir( current.latin1() ); - CurrentDir()->cd( current, TRUE); - populateView(); + CurrentDir()->cd( current, TRUE); + populateView(); update(); @@ -410,6 +417,6 @@ void AdvancedFm::SDButtonPushed() { - QString current = "/mnt/card";// this can change so fix + QString current = "/mnt/card";// this can change so fix chdir( current.latin1() ); - CurrentDir()->cd( current, TRUE); - populateView(); + CurrentDir()->cd( current, TRUE); + populateView(); update(); @@ -419,11 +426,11 @@ void AdvancedFm::CFButtonPushed() { - QString current; - if(zaurusDevice) - current= "/mnt/cf"; //zaurus - else - current = "/mnt/hda"; //ipaq - chdir( current.latin1() ); - CurrentDir()->cd( current, TRUE); - populateView(); - update(); + QString current; + if(zaurusDevice) + current= "/mnt/cf"; //zaurus + else + current = "/mnt/hda"; //ipaq + chdir( current.latin1() ); + CurrentDir()->cd( current, TRUE); + populateView(); + update(); } @@ -434,5 +441,5 @@ void AdvancedFm::doAbout() QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n" - "is copyright 2002-2003 by\n" - "L.J.Potter<llornkcor@handhelds.org>\n" - "and is licensed by the GPL")); + "is copyright 2002-2003 by\n" + "L.J.Potter<llornkcor@handhelds.org>\n" + "and is licensed by the GPL")); } @@ -444,18 +451,18 @@ void AdvancedFm::keyPressEvent( QKeyEvent *e) { - switch ( e->key() ) { - case Key_Delete: - del(); - break; - case Key_A: - copyAs(); - break; - case Key_C: - copy(); - break; - case Key_E: - runThis(); - break; + switch ( e->key() ) { + case Key_Delete: + del(); + break; + case Key_A: + copyAs(); + break; + case Key_C: + copy(); + break; + case Key_E: + runThis(); + break; case Key_G: { - currentPathCombo->lineEdit()->setFocus(); + currentPathCombo->lineEdit()->setFocus(); } @@ -463,51 +470,51 @@ void AdvancedFm::keyPressEvent( QKeyEvent *e) - case Key_H: - showHidden(); - break; - case Key_I: - fileStatus(); - break; - case Key_M: - move(); - break; - case Key_N: - mkDir(); - break; - case Key_P: - filePerms(); - break; - case Key_R: - rn(); - break; - case Key_U: - upDir(); - break; - case Key_1: - switchToLocalTab(); - break; - case Key_2: - switchToRemoteTab(); - break; - case Key_3: - CFButtonPushed(); - break; - case Key_4: - SDButtonPushed(); - break; - case Key_5: - homeButtonPushed(); - break; - case Key_6: - docButtonPushed(); - break; - case Key_7: - break; - case Key_8: - break; - case Key_9: - break; - case Key_0: - break; - }; - e->accept(); + case Key_H: + showHidden(); + break; + case Key_I: + fileStatus(); + break; + case Key_M: + move(); + break; + case Key_N: + mkDir(); + break; + case Key_P: + filePerms(); + break; + case Key_R: + rn(); + break; + case Key_U: + upDir(); + break; + case Key_1: + switchToLocalTab(); + break; + case Key_2: + switchToRemoteTab(); + break; + case Key_3: + CFButtonPushed(); + break; + case Key_4: + SDButtonPushed(); + break; + case Key_5: + homeButtonPushed(); + break; + case Key_6: + docButtonPushed(); + break; + case Key_7: + break; + case Key_8: + break; + case Key_9: + break; + case Key_0: + break; + }; + e->accept(); } @@ -517,4 +524,4 @@ void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { - if( CurrentView()->hasFocus() ) - e->ignore(); + if( CurrentView()->hasFocus() ) + e->ignore(); } @@ -539,5 +546,5 @@ void AdvancedFm::parsetab(const QString &fileName) if ( mntfp ) - { + { while ( (me = getmntent( mntfp )) != 0 ) - { + { QString deviceName = me->mnt_fsname; @@ -546,3 +553,3 @@ void AdvancedFm::parsetab(const QString &fileName) if(deviceName != "none") - { + { if( fsList.contains(filesystemType) == 0 @@ -578,16 +585,16 @@ QString AdvancedFm::getDiskSpace( const QString &path) { - struct statfs fss; - if ( !statfs( path.latin1(), &fss ) ) { - int blkSize = fss.f_bsize; - // int totalBlks = fs.f_blocks; - int availBlks = fss.f_bavail; + struct statfs fss; + if ( !statfs( path.latin1(), &fss ) ) { + int blkSize = fss.f_bsize; + // int totalBlks = fs.f_blocks; + int availBlks = fss.f_bavail; - long mult = blkSize / 1024; - long div = 1024 / blkSize; - if ( !mult ) mult = 1; - if ( !div ) div = 1; + long mult = blkSize / 1024; + long div = 1024 / blkSize; + if ( !mult ) mult = 1; + if ( !div ) div = 1; - return QString::number(availBlks * mult / div); - } - return ""; + return QString::number(availBlks * mult / div); + } + return ""; } @@ -597,67 +604,67 @@ void AdvancedFm::showFileMenu() { - QString curApp; - curApp = CurrentView()->currentItem()->text(0); + QString curApp; + curApp = CurrentView()->currentItem()->text(0); - MimeType mt( curApp ); - const AppLnk* app = mt.application(); - QFile fi(curApp); - QPopupMenu *m = new QPopupMenu(0); - QPopupMenu *n = new QPopupMenu(0); - // QPopupMenu *o = new QPopupMenu(0); - m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); + MimeType mt( curApp ); + const AppLnk* app = mt.application(); + QFile fi(curApp); + QPopupMenu *m = new QPopupMenu(0); + QPopupMenu *n = new QPopupMenu(0); + // QPopupMenu *o = new QPopupMenu(0); + m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); - if ( QFileInfo(fi).isDir() ) - { - m->insertSeparator(); - m->insertItem( tr( "Change Directory" ), this, SLOT( doDirChange() )); - } - else - { + if ( QFileInfo(fi).isDir() ) + { + m->insertSeparator(); + m->insertItem( tr( "Change Directory" ), this, SLOT( doDirChange() )); + } + else + { - if ( app ) - m->insertItem( app->pixmap(), tr( "Open in " - + app->name() ), this, SLOT( runThis() ) ); - else if( QFileInfo(fi).isExecutable() ) //damn opie doesnt like this - m->insertItem( tr( "Execute" ), this, SLOT( runThis() ) ); - m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) ); - } + if ( app ) + m->insertItem( app->pixmap(), tr( "Open in " + + app->name() ), this, SLOT( runThis() ) ); + else if( QFileInfo(fi).isExecutable() ) //damn opie doesnt like this + m->insertItem( tr( "Execute" ), this, SLOT( runThis() ) ); + m->insertItem( Resource::loadPixmap( "txt" ), tr( "Open as text" ),this, SLOT( runText() ) ); + } - m->insertItem(tr("Actions"),n); - n->insertItem( tr( "Make Directory" ), this, SLOT( makeDir() )); + m->insertItem(tr("Actions"),n); + n->insertItem( tr( "Make Directory" ), this, SLOT( makeDir() )); - n->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); + n->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); - n->insertSeparator(); - n->insertItem( tr( "Rename" ), this, SLOT( renameIt() )); + n->insertSeparator(); + n->insertItem( tr( "Rename" ), this, SLOT( renameIt() )); - n->insertItem( tr( "Copy" ), this, SLOT( copy() )); - n->insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); - n->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() )); - n->insertItem( tr( "Move" ), this, SLOT( move() )); + n->insertItem( tr( "Copy" ), this, SLOT( copy() )); + n->insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); + n->insertItem( tr( "Copy Same Dir" ), this, SLOT( copySameDir() )); + n->insertItem( tr( "Move" ), this, SLOT( move() )); - n->insertSeparator(); - n->insertItem( tr( "Delete" ), this, SLOT( doDelete() )); - m->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); + n->insertSeparator(); + n->insertItem( tr( "Delete" ), this, SLOT( doDelete() )); + m->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); - m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); - m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); + m->insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); + m->insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); - m->insertSeparator(); - m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); + m->insertSeparator(); + m->insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); #if defined(QT_QWS_OPIE) - m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); + m->insertItem( tr( "Properties" ), this, SLOT( doProperties() )); #endif - m->setCheckable(TRUE); - if (!b) - m->setItemChecked(m->idAt(0),TRUE); - else - m->setItemChecked(m->idAt(0),FALSE); + m->setCheckable(TRUE); + if (!b) + m->setItemChecked(m->idAt(0),TRUE); + else + m->setItemChecked(m->idAt(0),FALSE); - if(Ir::supported()) - m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); - m->setFocus(); - m->exec( QPoint( 4,QCursor::pos().y()) ); + if(Ir::supported()) + m->insertItem( tr( "Beam File" ), this, SLOT( doBeam() )); + m->setFocus(); + m->exec( QPoint( 4,QCursor::pos().y()) ); - if(m) delete m; + if(m) delete m; } @@ -676,3 +683,3 @@ QString AdvancedFm::checkDiskSpace(const QString &path) if ( !statfs( path.latin1(), &fss ) ) - { + { int blkSize = fss.f_bsize; @@ -694,19 +701,19 @@ void AdvancedFm::addToDocs() { - QStringList strListPaths = getPath(); - QDir *thisDir = CurrentDir(); + QStringList strListPaths = getPath(); + QDir *thisDir = CurrentDir(); - if( strListPaths.count() > 0) - { - QString curFile; - for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) - { - curFile = thisDir->canonicalPath()+"/"+(*it); + if( strListPaths.count() > 0) + { + QString curFile; + for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) + { + curFile = thisDir->canonicalPath()+"/"+(*it); // qDebug(curFile); - DocLnk f; + DocLnk f; // curFile.replace(QRegExp("\\..*"),""); - f.setName((*it)); - f.setFile( curFile); - f.writeLink(); - } - } + f.setName((*it)); + f.setFile( curFile); + f.writeLink(); + } + } } @@ -717,7 +724,7 @@ void AdvancedFm::customDirsToMenu() - Config cfg("AdvancedFm"); - cfg.setGroup("Menu"); + Config cfg("AdvancedFm"); + cfg.setGroup("Menu"); - QStringList list = cfg.readListEntry( "CustomDir", ','); - menuButton->insertItems(list ); + QStringList list = cfg.readListEntry( "CustomDir", ','); + menuButton->insertItems(list ); @@ -731,22 +738,22 @@ void AdvancedFm::dirMenuSelected(int item) { - qDebug("menu item %d", item); - switch(item) - { - - case -21: - case 0: - addCustomDir(); - break; - case -22: - case 1: - removeCustomDir(); - break; - default: - { + qDebug("menu item %d", item); + switch(item) + { + + case -21: + case 0: + addCustomDir(); + break; + case -22: + case 1: + removeCustomDir(); + break; + default: + { // gotoCustomDir( menuButton->text(item)); // gotoCustomDir( customDirMenu->text(item)); - } - break; + } + break; - }; + }; } @@ -755,26 +762,26 @@ void AdvancedFm::addCustomDir() { - Config cfg("AdvancedFm"); - cfg.setGroup("Menu"); - QString dir; - QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); - - dir = CurrentDir()->canonicalPath(); - - bool addIt=true; - for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) - { - if( dir == (*it)) - { - addIt=false; - } - } - if(addIt) - { - menuButton->insertItem(dir); + Config cfg("AdvancedFm"); + cfg.setGroup("Menu"); + QString dir; + QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); + + dir = CurrentDir()->canonicalPath(); + + bool addIt=true; + for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) + { + if( dir == (*it)) + { + addIt=false; + } + } + if(addIt) + { + menuButton->insertItem(dir); // customDirMenu->insertItem(dir); - list << dir; - } + list << dir; + } - cfg.writeEntry("CustomDir", list, ','); - cfg.write(); + cfg.writeEntry("CustomDir", list, ','); + cfg.write(); } @@ -789,3 +796,3 @@ void AdvancedFm::removeCustomDir() QStringList list2; - dir = CurrentDir()->canonicalPath(); + dir = CurrentDir()->canonicalPath(); int ramble=2; @@ -795,4 +802,4 @@ void AdvancedFm::removeCustomDir() { - QMessageBox::message("AdvancedFm", - tr("Cannot remove current directory\nfrom bookmarks.\nIt is not bookmarked!!")); + QMessageBox::message("AdvancedFm", + tr("Cannot remove current directory\nfrom bookmarks.\nIt is not bookmarked!!")); } @@ -800,20 +807,20 @@ void AdvancedFm::removeCustomDir() { - for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) - { - if((*it) != dir)//current item is not our current dir, so add it to temp list - { - list2 <<(*it); - } - else - { + for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) + { + if((*it) != dir)//current item is not our current dir, so add it to temp list + { + list2 <<(*it); + } + else + { // customDirMenu->removeItem( ramble); - menuButton->remove( ramble); + menuButton->remove( ramble); - } - ramble++; + } + ramble++; // ramble--; - } + } - cfg.writeEntry("CustomDir", list2, ','); - cfg.write(); + cfg.writeEntry("CustomDir", list2, ','); + cfg.write(); } @@ -826,24 +833,24 @@ void AdvancedFm::gotoCustomDir(const QString &dir) // qDebug("gotoCustomDir(const QString &dir) " +dir ); - QString curDir = dir; - QDir *thisDir = CurrentDir(); + QString curDir = dir; + QDir *thisDir = CurrentDir(); // if( curDir.isEmpty()) { // } - if( curDir == s_addBookmark) - { - addCustomDir(); - } - if( curDir == s_removeBookmark) - { - removeCustomDir( ); - } - else - { - if(QDir( curDir).exists() ) - { - thisDir->setPath( curDir ); - chdir( curDir.latin1() ); - thisDir->cd( curDir, TRUE); - populateView(); - } - } + if( curDir == s_addBookmark) + { + addCustomDir(); + } + if( curDir == s_removeBookmark) + { + removeCustomDir( ); + } + else + { + if(QDir( curDir).exists() ) + { + thisDir->setPath( curDir ); + chdir( curDir.latin1() ); + thisDir->cd( curDir, TRUE); + populateView(); + } + } } @@ -852,10 +859,10 @@ QDir *AdvancedFm::CurrentDir() { - if ( whichTab == 1) - { - return ¤tDir; - } - else - { - return ¤tRemoteDir; - } + if ( whichTab == 1) + { + return ¤tDir; + } + else + { + return ¤tRemoteDir; + } } @@ -864,10 +871,10 @@ QDir *AdvancedFm::OtherDir() { - if ( whichTab == 1) - { - return ¤tRemoteDir; - } - else - { - return ¤tDir; - } + if ( whichTab == 1) + { + return ¤tRemoteDir; + } + else + { + return ¤tDir; + } } @@ -876,6 +883,6 @@ QListView * AdvancedFm::CurrentView() { - if ( whichTab == 1) - return Local_View; - else - return Remote_View; + if ( whichTab == 1) + return Local_View; + else + return Remote_View; } @@ -884,6 +891,6 @@ QListView * AdvancedFm::OtherView() { - if ( whichTab == 1) - return Remote_View; - else - return Local_View; + if ( whichTab == 1) + return Remote_View; + else + return Local_View; } @@ -892,6 +899,6 @@ void AdvancedFm::setOtherTabCurrent() { - if ( whichTab == 1) - TabWidget->setCurrentTab(1); - else - TabWidget->setCurrentTab(0); + if ( whichTab == 1) + TabWidget->setCurrentTab(1); + else + TabWidget->setCurrentTab(0); } diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index f31956c..c30d8e0 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h @@ -28,2 +28,3 @@ #include <qtimer.h> +#include <qpixmap.h> @@ -93,2 +94,3 @@ protected: OTabWidget *TabWidget; + QPixmap unknownXpm; int whichTab; |