summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp200
-rw-r--r--noncore/apps/advancedfm/advancedfm.h6
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp102
3 files changed, 87 insertions, 221 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
@@ -75,6 +75,8 @@ AdvancedFm::AdvancedFm( )
initConnections();
- populateLocalView();
- populateRemoteView();
+ TabWidget->setCurrentTab(1);
+ populateView();
+ TabWidget->setCurrentTab(0);
+ populateView();
currentPathCombo->setFocus();
}
@@ -116,20 +118,25 @@ void AdvancedFm::tabChanged(QWidget *w)
+checkDiskSpace( (const QString &) path )+ " kB free" );
chdir( path.latin1());
+//2 populateView();
}
-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);
QFileInfo *fi;
@@ -149,5 +156,5 @@ void AdvancedFm::populateLocalView()
fileL.sprintf( "%s",fi->fileName().data() );
fileDate= fi->lastModified().toString();
- if( QDir(QDir::cleanDirPath( currentDir.canonicalPath()+"/"+fileL)).exists() )
+ if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() )
{
fileL+="/";
@@ -155,8 +162,10 @@ 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);
if(isDir || fileL.find("/",0,TRUE) != -1)
@@ -204,5 +213,5 @@ void AdvancedFm::populateLocalView()
}
- if(currentDir.canonicalPath().find("dev",0,TRUE) != -1)
+ if( path.find("dev",0,TRUE) != -1)
{
struct stat buf;
@@ -211,5 +220,5 @@ void AdvancedFm::populateLocalView()
struct dirent *mydirent;
- if((dir = opendir( currentDir.canonicalPath().latin1())) != NULL)
+ if((dir = opendir( path.latin1())) != NULL)
while ((mydirent = readdir(dir)) != NULL)
{
@@ -222,5 +231,5 @@ void AdvancedFm::populateLocalView()
if( fileL.find(".") == -1 )
{
- item= new QListViewItem( Local_View, fileL, fileS, fileDate);
+ item= new QListViewItem( thisView, fileL, fileS, fileDate);
pm = Resource::loadPixmap( "UnknownDocument-14" );
item->setPixmap( 0,pm);
@@ -231,130 +240,9 @@ void AdvancedFm::populateLocalView()
}
- Local_View->setSorting( 3,FALSE);
- fillCombo( (const QString &) currentDir.canonicalPath());
+ thisView->setSorting( 3,FALSE);
+ fillCombo( (const QString &) path );
}
-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)
{
@@ -384,5 +272,5 @@ void AdvancedFm::ListClicked(QListViewItem *selectedItem)
{
CurrentDir()->cd( strItem, TRUE);
- PopulateView();
+ populateView();
CurrentView()->ensureItemVisible( CurrentView()->firstChild());
}
@@ -435,5 +323,5 @@ void AdvancedFm::currentPathComboChanged()
{
CurrentDir()->setPath( currentPathCombo->lineEdit()->text() );
- PopulateView();
+ populateView();
}
else
@@ -472,5 +360,5 @@ void AdvancedFm::currentPathComboActivated(const QString & currentPath)
chdir( currentPath.latin1() );
CurrentDir()->cd( currentPath, TRUE);
- PopulateView();
+ populateView();
update();
}
@@ -498,5 +386,5 @@ void AdvancedFm::homeButtonPushed()
chdir( current.latin1() );
CurrentDir()->cd( current, TRUE);
- PopulateView();
+ populateView();
update();
}
@@ -508,5 +396,5 @@ void AdvancedFm::docButtonPushed()
CurrentDir()->cd( current, TRUE);
- PopulateView();
+ populateView();
update();
}
@@ -517,5 +405,5 @@ void AdvancedFm::SDButtonPushed()
chdir( current.latin1() );
CurrentDir()->cd( current, TRUE);
- PopulateView();
+ populateView();
update();
}
@@ -531,5 +419,5 @@ void AdvancedFm::CFButtonPushed()
chdir( current.latin1() );
CurrentDir()->cd( current, TRUE);
- PopulateView();
+ populateView();
update();
}
@@ -632,5 +520,5 @@ void AdvancedFm::QPEButtonPushed()
chdir( current.latin1() );
CurrentDir()->cd( current, TRUE);
- PopulateView();
+ populateView();
update();
}
@@ -949,5 +837,5 @@ void AdvancedFm::gotoCustomDir(const QString &dir)
chdir( curDir.latin1() );
thisDir->cd( curDir, TRUE);
- PopulateView();
+ populateView();
}
}
@@ -978,12 +866,4 @@ QDir *AdvancedFm::OtherDir()
}
-void AdvancedFm::PopulateView()
-{
- if ( whichTab == 1)
- populateLocalView();
- else
- populateRemoteView();
-}
-
QListView * AdvancedFm::CurrentView()
{
@@ -1001,2 +881,10 @@ QListView * AdvancedFm::OtherView()
return Local_View;
}
+
+void AdvancedFm::setOtherTabCurrent()
+{
+ 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 8eec6ba..024ab29 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -64,9 +64,7 @@ protected slots:
void del();
void rn();
- void populateLocalView();
- void populateRemoteView();
+ void populateView();
void showHidden();
void showMenuHidden();
-// void showRemoteHidden();
void writeConfig();
void readConfig();
@@ -126,5 +124,5 @@ protected:
QListView *CurrentView();
QListView *OtherView();
- void PopulateView();
+ void setOtherTabCurrent();
protected slots:
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp
index 13dad33..c553017 100644
--- a/noncore/apps/advancedfm/advancedfmMenu.cpp
+++ b/noncore/apps/advancedfm/advancedfmMenu.cpp
@@ -69,6 +69,6 @@ void AdvancedFm::showMenuHidden()
// b=TRUE;
}
- populateLocalView();
- populateRemoteView();
+ populateView();
+// populateRemoteView();
// if(b) qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<< true");
if(b) b = false; else b = true;
@@ -90,5 +90,5 @@ void AdvancedFm::showHidden()
// b=TRUE;
}
- PopulateView();
+ populateView();
}
@@ -166,5 +166,5 @@ void AdvancedFm::makeDir()
thisDir->mkdir( thisDir->canonicalPath()+"/"+filename);
}
- PopulateView();
+ populateView();
}
@@ -215,5 +215,5 @@ void AdvancedFm::doDelete()
QString cmd="rm -rf "+f;
startProcess( (const QString)cmd.latin1() );
- PopulateView();
+ populateView();
}
break;
@@ -239,5 +239,5 @@ void AdvancedFm::doDelete()
}
}
- PopulateView();
+ populateView();
}
@@ -258,5 +258,5 @@ void AdvancedFm::filePerms()
delete filePerm;
}
- PopulateView();
+ populateView();
}
@@ -294,5 +294,5 @@ void AdvancedFm::upDir()
thisDir->cd( current, TRUE);
- PopulateView();
+ populateView();
update();
}
@@ -361,7 +361,6 @@ void AdvancedFm::copy()
}
}
-
- PopulateView();
-// TabWidget->setCurrentTab(1);
+ setOtherTabCurrent();
+ populateView();
}
}
@@ -418,5 +417,6 @@ void AdvancedFm::copyAs()
}
- PopulateView();
+ setOtherTabCurrent();
+ populateView();
}
@@ -471,5 +471,5 @@ void AdvancedFm::copySameDir()
delete fileDlg;
}
- PopulateView();
+ populateView();
}
@@ -513,6 +513,7 @@ void AdvancedFm::move()
}
- populateRemoteView();
- populateLocalView();
+ setOtherTabCurrent();
+ populateView();
+// populateLocalView();
}
@@ -644,50 +645,30 @@ void AdvancedFm::mkSym()
if( curFileList.count() > 0)
{
- if ( whichTab == 1)
- {
- for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it )
- {
+ QDir *thisDir = CurrentDir();
+ QDir * thatDir = OtherDir();
- QString destName = currentRemoteDir.canonicalPath()+"/"+(*it);
- if(destName.right(1) == "/")
- {
- destName = destName.left( destName.length() -1);
- }
- QString curFile = currentDir.canonicalPath()+"/"+(*it);
- if( curFile.right(1) == "/")
- {
- curFile = curFile.left( curFile.length() -1);
- }
- cmd = "ln -s "+curFile+" "+destName;
- qDebug(cmd);
- startProcess( (const QString)cmd );
- }
- populateRemoteView();
- TabWidget->setCurrentTab(1);
- }
- else
+ for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it )
{
- for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it )
+
+ QString destName = thatDir->canonicalPath()+"/"+(*it);
+ if(destName.right(1) == "/")
{
+ destName = destName.left( destName.length() -1);
+ }
- QString destName = currentDir.canonicalPath()+"/"+(*it);
- if(destName.right(1) == "/")
- {
- destName = destName.left( destName.length() -1);
- }
- QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it);
- if( curFile.right(1) == "/")
- {
- curFile = curFile.left( curFile.length() -1);
- }
+ QString curFile = thisDir->canonicalPath()+"/"+(*it);
- cmd = "ln -s "+curFile+" "+destName;
- qDebug(cmd);
- startProcess( (const QString)cmd );
- }
- populateLocalView();
- TabWidget->setCurrentTab(0);
- }
- }
+ if( curFile.right(1) == "/")
+ {
+ curFile = curFile.left( curFile.length() -1);
+ }
+
+ cmd = "ln -s "+curFile+" "+destName;
+ qDebug(cmd);
+ startProcess( (const QString)cmd );
+ }
+ setOtherTabCurrent();
+ populateView();
+ }
}
@@ -700,5 +681,4 @@ void AdvancedFm::doBeam()
else
{
-
QStringList curFileList = getPath();
if( curFileList.count() > 0)
@@ -756,6 +736,6 @@ void AdvancedFm::startProcess(const QString & cmd)
void AdvancedFm::processEnded()
{
- populateLocalView();
- populateRemoteView();
+// populateLocalView();
+ populateView();
}
@@ -844,5 +824,5 @@ void AdvancedFm::renameIt()
oldName = thisView->currentItem()->text(0);
doRename( thisView );
- PopulateView();
+ populateView();
}
@@ -866,4 +846,4 @@ void AdvancedFm::okRename()
view->takeItem( view->currentItem() );
delete view->currentItem();
- PopulateView();
+ populateView();
}