author | llornkcor <llornkcor> | 2003-02-24 02:38:01 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-02-24 02:38:01 (UTC) |
commit | e144592570ddacf26d27f3e2759dbe7f2370d0a0 (patch) (side-by-side diff) | |
tree | 054221a40b03bd91945161570a8996a5427e6456 /noncore/apps/advancedfm/advancedfm.cpp | |
parent | 56b89312a374b62ee20f6ad2b62b6426183d4d26 (diff) | |
download | opie-e144592570ddacf26d27f3e2759dbe7f2370d0a0.zip opie-e144592570ddacf26d27f3e2759dbe7f2370d0a0.tar.gz opie-e144592570ddacf26d27f3e2759dbe7f2370d0a0.tar.bz2 |
cleanup
Diffstat (limited to 'noncore/apps/advancedfm/advancedfm.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 200 |
1 files changed, 44 insertions, 156 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 74654fc..fc6c3bf 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp @@ -76,4 +76,6 @@ AdvancedFm::AdvancedFm( ) initConnections(); - populateLocalView(); - populateRemoteView(); + TabWidget->setCurrentTab(1); + populateView(); + TabWidget->setCurrentTab(0); + populateView(); currentPathCombo->setFocus(); @@ -117,2 +119,3 @@ void AdvancedFm::tabChanged(QWidget *w) chdir( path.latin1()); +//2 populateView(); } @@ -120,15 +123,19 @@ void AdvancedFm::tabChanged(QWidget *w) -void AdvancedFm::populateLocalView() +void AdvancedFm::populateView() { QPixmap pm; - Local_View->clear(); - currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); - currentDir.setMatchAllDirs(TRUE); - currentDir.setNameFilter(filterStr); + QListView *thisView = CurrentView(); + QDir *thisDir = CurrentDir(); + QString path = thisDir->canonicalPath(); + + thisView->clear(); + thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); + thisDir->setMatchAllDirs(TRUE); + thisDir->setNameFilter(filterStr); QString fileL, fileS, fileDate; - QString fs= getFileSystemType((const QString &) currentDir.canonicalPath()); + QString fs= getFileSystemType((const QString &) path); setCaption("AdvancedFm :: "+fs+" :: " - +checkDiskSpace((const QString &) currentDir.canonicalPath())+" kB free" ); + +checkDiskSpace((const QString &) path)+" kB free" ); bool isDir=FALSE; - const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); + const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); QFileInfoListIterator it(*list); @@ -150,3 +157,3 @@ void AdvancedFm::populateLocalView() fileDate= fi->lastModified().toString(); - if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() ) + if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) { @@ -156,6 +163,8 @@ void AdvancedFm::populateLocalView() } - QFileInfo fileInfo( currentDir.canonicalPath()+"/"+fileL); + + QFileInfo fileInfo( path + "/" + fileL); + if(fileL !="./" && fi->exists()) { - item= new QListViewItem( Local_View, fileL, fileS , fileDate); + item= new QListViewItem( thisView, fileL, fileS , fileDate); @@ -205,3 +214,3 @@ void AdvancedFm::populateLocalView() - if(currentDir.canonicalPath().find("dev",0,TRUE) != -1) + if( path.find("dev",0,TRUE) != -1) { @@ -212,3 +221,3 @@ void AdvancedFm::populateLocalView() - if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL) + if((dir = opendir( path.latin1())) != NULL) while ((mydirent = readdir(dir)) != NULL) @@ -223,3 +232,3 @@ void AdvancedFm::populateLocalView() { - item= new QListViewItem( Local_View, fileL, fileS, fileDate); + item= new QListViewItem( thisView, fileL, fileS, fileDate); pm = Resource::loadPixmap( "UnknownDocument-14" ); @@ -232,4 +241,4 @@ void AdvancedFm::populateLocalView() - Local_View->setSorting( 3,FALSE); - fillCombo( (const QString &) currentDir.canonicalPath()); + thisView->setSorting( 3,FALSE); + fillCombo( (const QString &) path ); } @@ -237,123 +246,2 @@ void AdvancedFm::populateLocalView() -void AdvancedFm::populateRemoteView() -{ - QPixmap pm; - Remote_View->clear(); - currentRemoteDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); - currentRemoteDir.setMatchAllDirs(TRUE); - currentRemoteDir.setNameFilter(filterStr); - QString fileL, fileS, fileDate; - - QString fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); - setCaption("AdvancedFm :: "+fs+" :: " - +checkDiskSpace((const QString &) currentRemoteDir.canonicalPath())+" kB free" ); - bool isDir=FALSE; - const QFileInfoList *list = currentRemoteDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); - QFileInfoListIterator it(*list); - QFileInfo *fi; - while ( (fi=it.current()) ) - { - if (fi->isSymLink() ) - { - QString symLink=fi->readLink(); - // qDebug("Symlink detected "+symLink); - QFileInfo sym( symLink); - fileS.sprintf( "%10i", sym.size() ); - fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.filePath().data() ); - fileDate = sym.lastModified().toString(); - } - else - { - // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); - fileS.sprintf( "%10i", fi->size() ); - fileL.sprintf( "%s",fi->fileName().data() ); - fileDate= fi->lastModified().toString(); - - if( QDir(QDir::cleanDirPath( currentRemoteDir.canonicalPath()+"/"+fileL)).exists() ) - { - fileL+="/"; - isDir=TRUE; - // qDebug( fileL); - } - } - - QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+fileL); - if(fileL !="./" && fi->exists()) - { - item= new QListViewItem( Remote_View, fileL, fileS, fileDate); - QPixmap pm; - - if(isDir || fileL.find("/",0,TRUE) != -1) - { - if( !QDir( fi->filePath() ).isReadable()) - 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 - { - MimeType mt(fi->filePath()); - pm=mt.pixmap(); //sets the correct pixmap for mimetype - if(pm.isNull()) - pm = Resource::loadPixmap( "UnknownDocument-14" ); - } - 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(currentRemoteDir.canonicalPath().find("dev",0,TRUE) != -1) - { - struct stat buf; - DIR *dir; - struct dirent *mydirent; - if((dir = opendir( currentRemoteDir.canonicalPath().latin1())) != NULL) - - while ((mydirent = readdir(dir)) != NULL) - { - lstat( mydirent->d_name, &buf); -// qDebug(mydirent->d_name); - fileL.sprintf("%s", mydirent->d_name); - fileS.sprintf("%d,%d", (int) (buf.st_dev>>8)&0xFF, (int) buf.st_dev &0xFF); - fileDate.sprintf("%s", ctime( &buf.st_mtime)); - - if( fileL.find(".") == -1 ) - { - item= new QListViewItem( Remote_View, fileL, fileS, fileDate); - pm = Resource::loadPixmap( "UnknownDocument-14" ); - item->setPixmap( 0,pm); - } - } - - closedir(dir); - } - - Remote_View->setSorting( 3,FALSE); - fillCombo( (const QString &) currentRemoteDir.canonicalPath() ); -} - void AdvancedFm::ListClicked(QListViewItem *selectedItem) @@ -385,3 +273,3 @@ void AdvancedFm::ListClicked(QListViewItem *selectedItem) CurrentDir()->cd( strItem, TRUE); - PopulateView(); + populateView(); CurrentView()->ensureItemVisible( CurrentView()->firstChild()); @@ -436,3 +324,3 @@ void AdvancedFm::currentPathComboChanged() CurrentDir()->setPath( currentPathCombo->lineEdit()->text() ); - PopulateView(); + populateView(); } @@ -473,3 +361,3 @@ void AdvancedFm::currentPathComboActivated(const QString & currentPath) CurrentDir()->cd( currentPath, TRUE); - PopulateView(); + populateView(); update(); @@ -499,3 +387,3 @@ void AdvancedFm::homeButtonPushed() CurrentDir()->cd( current, TRUE); - PopulateView(); + populateView(); update(); @@ -509,3 +397,3 @@ void AdvancedFm::docButtonPushed() CurrentDir()->cd( current, TRUE); - PopulateView(); + populateView(); update(); @@ -518,3 +406,3 @@ void AdvancedFm::SDButtonPushed() CurrentDir()->cd( current, TRUE); - PopulateView(); + populateView(); update(); @@ -532,3 +420,3 @@ void AdvancedFm::CFButtonPushed() CurrentDir()->cd( current, TRUE); - PopulateView(); + populateView(); update(); @@ -633,3 +521,3 @@ void AdvancedFm::QPEButtonPushed() CurrentDir()->cd( current, TRUE); - PopulateView(); + populateView(); update(); @@ -950,3 +838,3 @@ void AdvancedFm::gotoCustomDir(const QString &dir) thisDir->cd( curDir, TRUE); - PopulateView(); + populateView(); } @@ -979,10 +867,2 @@ QDir *AdvancedFm::OtherDir() -void AdvancedFm::PopulateView() -{ - if ( whichTab == 1) - populateLocalView(); - else - populateRemoteView(); -} - QListView * AdvancedFm::CurrentView() @@ -1002 +882,9 @@ QListView * AdvancedFm::OtherView() } + +void AdvancedFm::setOtherTabCurrent() +{ + if ( whichTab == 1) + TabWidget->setCurrentTab(1); + else + TabWidget->setCurrentTab(0); +} |