summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2003-02-24 02:38:01 (UTC)
committer llornkcor <llornkcor>2003-02-24 02:38:01 (UTC)
commite144592570ddacf26d27f3e2759dbe7f2370d0a0 (patch) (side-by-side diff)
tree054221a40b03bd91945161570a8996a5427e6456
parent56b89312a374b62ee20f6ad2b62b6426183d4d26 (diff)
downloadopie-e144592570ddacf26d27f3e2759dbe7f2370d0a0.zip
opie-e144592570ddacf26d27f3e2759dbe7f2370d0a0.tar.gz
opie-e144592570ddacf26d27f3e2759dbe7f2370d0a0.tar.bz2
cleanup
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
@@ -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);
+}
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
@@ -65,7 +65,5 @@ protected slots:
void rn();
- void populateLocalView();
- void populateRemoteView();
+ void populateView();
void showHidden();
void showMenuHidden();
-// void showRemoteHidden();
void writeConfig();
@@ -127,3 +125,3 @@ protected:
QListView *OtherView();
- void PopulateView();
+ void setOtherTabCurrent();
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
@@ -70,4 +70,4 @@ void AdvancedFm::showMenuHidden()
}
- populateLocalView();
- populateRemoteView();
+ populateView();
+// populateRemoteView();
// if(b) qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<< true");
@@ -91,3 +91,3 @@ void AdvancedFm::showHidden()
}
- PopulateView();
+ populateView();
}
@@ -167,3 +167,3 @@ void AdvancedFm::makeDir()
}
- PopulateView();
+ populateView();
}
@@ -216,3 +216,3 @@ void AdvancedFm::doDelete()
startProcess( (const QString)cmd.latin1() );
- PopulateView();
+ populateView();
}
@@ -240,3 +240,3 @@ void AdvancedFm::doDelete()
}
- PopulateView();
+ populateView();
}
@@ -259,3 +259,3 @@ void AdvancedFm::filePerms()
}
- PopulateView();
+ populateView();
}
@@ -295,3 +295,3 @@ void AdvancedFm::upDir()
- PopulateView();
+ populateView();
update();
@@ -362,5 +362,4 @@ void AdvancedFm::copy()
}
-
- PopulateView();
-// TabWidget->setCurrentTab(1);
+ setOtherTabCurrent();
+ populateView();
}
@@ -419,3 +418,4 @@ void AdvancedFm::copyAs()
}
- PopulateView();
+ setOtherTabCurrent();
+ populateView();
}
@@ -472,3 +472,3 @@ void AdvancedFm::copySameDir()
}
- PopulateView();
+ populateView();
}
@@ -514,4 +514,5 @@ void AdvancedFm::move()
}
- populateRemoteView();
- populateLocalView();
+ setOtherTabCurrent();
+ populateView();
+// populateLocalView();
}
@@ -645,48 +646,28 @@ void AdvancedFm::mkSym()
{
- 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();
+ }
}
@@ -701,3 +682,2 @@ void AdvancedFm::doBeam()
{
-
QStringList curFileList = getPath();
@@ -757,4 +737,4 @@ void AdvancedFm::processEnded()
{
- populateLocalView();
- populateRemoteView();
+// populateLocalView();
+ populateView();
}
@@ -845,3 +825,3 @@ void AdvancedFm::renameIt()
doRename( thisView );
- PopulateView();
+ populateView();
}
@@ -867,3 +847,3 @@ void AdvancedFm::okRename()
delete view->currentItem();
- PopulateView();
+ populateView();
}