summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2003-09-08 22:22:00 (UTC)
committer llornkcor <llornkcor>2003-09-08 22:22:00 (UTC)
commite485a3bd44b3cc70280e03eb8a7958a5252cdd6a (patch) (side-by-side diff)
treecce07d76c2a9060a774898af46e7c8dc8c7b3403
parentb3299bab3370865e0e498fd2f7f84f3abbd17e77 (diff)
downloadopie-e485a3bd44b3cc70280e03eb8a7958a5252cdd6a.zip
opie-e485a3bd44b3cc70280e03eb8a7958a5252cdd6a.tar.gz
opie-e485a3bd44b3cc70280e03eb8a7958a5252cdd6a.tar.bz2
changes for osplitter functionality
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp1179
-rw-r--r--noncore/apps/advancedfm/advancedfm.h7
-rw-r--r--noncore/apps/advancedfm/advancedfmData.cpp38
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp591
-rw-r--r--noncore/apps/advancedfm/filePermissions.cpp2
5 files changed, 858 insertions, 959 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index 91318f1..2fc4b49 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -42,2 +42,4 @@
+#include <qpe/qpemessagebox.h>
+
#include <sys/stat.h>
@@ -50,3 +52,3 @@
AdvancedFm::AdvancedFm( )
- : QMainWindow( ) {
+ : QMainWindow( ) {
init();
@@ -60,5 +62,5 @@ AdvancedFm::AdvancedFm( )
currentPathCombo->setFocus();
- channel = new QCopChannel( "QPE/Application/advancedfm", this );
- connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
- this, SLOT( qcopReceive(const QCString&, const QByteArray&)) );
+ channel = new QCopChannel( "QPE/Application/advancedfm", this );
+ connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
+ this, SLOT( qcopReceive(const QCString&, const QByteArray&)) );
}
@@ -69,72 +71,69 @@ AdvancedFm::~AdvancedFm() {
-void AdvancedFm::cleanUp()
-{
- QString sfile=QDir::homeDirPath();
- if(sfile.right(1) != "/")
- sfile+="/._temp";
- else
- sfile+="._temp";
- QFile file( sfile);
- if(file.exists())
- file.remove();
+void AdvancedFm::cleanUp() {
+ QString sfile=QDir::homeDirPath();
+ if(sfile.right(1) != "/")
+ sfile+="/._temp";
+ else
+ sfile+="._temp";
+ QFile file( sfile);
+ if(file.exists())
+ file.remove();
}
-void AdvancedFm::tabChanged(QWidget *w)
-{
- if( w == tab)
- whichTab = 1;
- else
- whichTab = 2;
+void AdvancedFm::tabChanged(QWidget *) {
+// qWarning("tab changed");
+ QString path = CurrentDir()->canonicalPath();
+ currentPathCombo->lineEdit()->setText( path );
+
+ if(whichTab == 1) {
+ viewMenu->setItemChecked(viewMenu->idAt(0), true);
+ viewMenu->setItemChecked(viewMenu->idAt(1), false);
+ } else {
+ viewMenu->setItemChecked(viewMenu->idAt(0), false);
+ viewMenu->setItemChecked(viewMenu->idAt(1), true);
+ }
-// qDebug("tab changed %d", whichTab );
+ QString fs= getFileSystemType( (const QString &) path);
- QString path = CurrentDir()->canonicalPath();
- currentPathCombo->lineEdit()->setText( path );
-
- viewMenu->setItemChecked(viewMenu->idAt(0),TRUE);
- viewMenu->setItemChecked(viewMenu->idAt(1),FALSE);
-
- QString fs= getFileSystemType( (const QString &) path);
-
- setCaption("AdvancedFm :: "+fs+" :: "
- +checkDiskSpace( (const QString &) path )+ " kB free" );
- chdir( path.latin1());
-}
-
-
-void AdvancedFm::populateView()
-{
- QPixmap pm;
- 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 &) path);
- setCaption("AdvancedFm :: "+fs+" :: "
- +checkDiskSpace((const QString &) path)+" kB free" );
- bool isDir=FALSE;
- const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
- QFileInfoListIterator it(*list);
- QFileInfo *fi;
- while ( (fi=it.current()) ) {
+ setCaption(tr("AdvancedFm :: ")+fs+" :: "
+ +checkDiskSpace( (const QString &) path )+ tr(" kB free") );
+ chdir( path.latin1());
+}
+
+
+void AdvancedFm::populateView() {
+ QPixmap pm;
+ QListView *thisView = CurrentView();
+ QDir *thisDir = CurrentDir();
+ QString path = thisDir->canonicalPath();
+// qWarning("path is "+path);
+ 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 &) path);
+ setCaption(tr("AdvancedFm :: ")+fs+" :: "
+ +checkDiskSpace((const QString &) path)+ tr(" kB free") );
+ bool isDir=FALSE;
+ const QFileInfoList *list = thisDir->entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
+ QFileInfoListIterator it(*list);
+ QFileInfo *fi;
+ while ( (fi=it.current()) ) {
if (fi->isSymLink() ) {
- QString symLink=fi->readLink();
- QFileInfo sym( symLink);
- fileS.sprintf( "%10i", sym.size() );
- fileL = fi->fileName() +" -> " + sym.filePath().data();
- fileDate = sym.lastModified().toString();
- } else {
- fileS.sprintf( "%10i", fi->size() );
- fileL = fi->fileName();
- fileDate= fi->lastModified().toString();
- if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) {
- fileL+="/";
- isDir=TRUE;
- }
- }
+ QString symLink=fi->readLink();
+ QFileInfo sym( symLink);
+ fileS.sprintf( "%10i", sym.size() );
+ fileL = fi->fileName() +" -> " + sym.filePath().data();
+ fileDate = sym.lastModified().toString();
+ } else {
+ fileS.sprintf( "%10i", fi->size() );
+ fileL = fi->fileName();
+ fileDate= fi->lastModified().toString();
+ if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) {
+// if(fileL == "..")
+ fileL += "/";
+ isDir=TRUE;
+ }
+ }
QFileInfo fileInfo( path + "/" + fileL);
@@ -142,23 +141,23 @@ void AdvancedFm::populateView()
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
+ 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());
@@ -168,7 +167,7 @@ void AdvancedFm::populateView()
}
- }
- if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) {
- // qDebug(" overlay link image");
- pm= Resource::loadPixmap( "advancedfm/symlink" );
- // pm= Resource::loadPixmap( "folder" );
+ }
+ if( fi->isSymLink() || fileL.find("->",0,TRUE) != -1) {
+ // qDebug(" overlay link image");
+ pm= Resource::loadPixmap( "advancedfm/symlink" );
+ // pm= Resource::loadPixmap( "folder" );
// QPixmap lnk = Resource::loadPixmap( "opie/symlink" );
@@ -177,11 +176,11 @@ void AdvancedFm::populateView()
// pm.setMask( pm.createHeuristicMask( FALSE ) );
- }
- item->setPixmap( 0,pm);
+ }
+ item->setPixmap( 0,pm);
- }
+ }
isDir=FALSE;
++it;
- }
+ }
- if( path.find("dev",0,TRUE) != -1) {
+ if( path.find("dev",0,TRUE) != -1) {
struct stat buf;
@@ -192,3 +191,3 @@ void AdvancedFm::populateView()
if((dir = opendir( path.latin1())) != NULL)
- while ((mydirent = readdir(dir)) != NULL) {
+ while ((mydirent = readdir(dir)) != NULL) {
lstat( mydirent->d_name, &buf);
@@ -200,33 +199,35 @@ void AdvancedFm::populateView()
if( fileL.find(".") == -1 ) {
- item= new QListViewItem( thisView, fileL, fileS, fileDate);
- pm = unknownXpm;
- item->setPixmap( 0,pm);
- }
- }
+ item= new QListViewItem( thisView, fileL, fileS, fileDate);
+ pm = unknownXpm;
+ item->setPixmap( 0,pm);
+ }
+ }
closedir(dir);
- }
+ }
- thisView->setSorting( 3,FALSE);
- fillCombo( (const QString &) path );
+ thisView->setSorting( 3,FALSE);
+ fillCombo( (const QString &) path );
}
-void AdvancedFm::rePopulate()
-{
- int tmpTab = whichTab;
- qDebug("%d", tmpTab);
+void AdvancedFm::rePopulate() {
+ populateView();
+ setOtherTabCurrent();
+ populateView();
- for(int i =1; i < 3; i++)
- {
- TabWidget->setCurrentWidget(i - 1);
- populateView();
- }
- TabWidget->setCurrentWidget( tmpTab - 1);
+// int tmpTab = whichTab;
+// // qDebug("%d", tmpTab);
+
+// for(int i =1; i < 3; i++) {
+// TabWidget->setCurrentWidget(i - 1);
+// populateView();
+// }
+// TabWidget->setCurrentWidget( tmpTab - 1);
}
-void AdvancedFm::ListClicked(QListViewItem *selectedItem)
-{
- if(selectedItem)
- {
+void AdvancedFm::ListClicked(QListViewItem *selectedItem) {
+//qWarning("listclicked");
+ if(selectedItem) {
QString strItem=selectedItem->text(0);
+// qWarning(strItem);
QString strSize=selectedItem->text(1);
@@ -236,197 +237,186 @@ void AdvancedFm::ListClicked(QListViewItem *selectedItem)
- if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 )//if symlink
- {
- strItem2 = dealWithSymName((const QString&)strItem);
- if(QDir(strItem2).exists() )
+ 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( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
- if(QDir(strItem).exists())
+ if(QDir(strItem).exists())
isDirectory = true;
- }
-
- if( isDirectory )
- {
- CurrentDir()->cd( strItem, TRUE);
- populateView();
- CurrentView()->ensureItemVisible( CurrentView()->firstChild());
- }
+ }
+
+ if( isDirectory ) {
+ CurrentDir()->cd( strItem, TRUE);
+ populateView();
+ CurrentView()->ensureItemVisible( CurrentView()->firstChild());
+ }
chdir( strItem.latin1());
- }
+ }
}
-void AdvancedFm::ListPressed( int mouse, QListViewItem *, const QPoint& , int ) {
- switch (mouse) {
- case 1:
- {
- if(renameBox != 0 )
- {
- cancelRename();
+void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) {
+ dealWithSchmooSchmaa( item->listView());
+ switch (mouse) {
+ case 1:
+ {
+ if(renameBox != 0 ) {
+ cancelRename();
}
- }
- break;
- case 2:
- menuTimer.start( 500, TRUE );
- break;
- };
+ }
+ break;
+ case 2:
+ menuTimer.start( 500, TRUE );
+ break;
+ };
}
-void AdvancedFm::switchToLocalTab()
-{
- TabWidget->setCurrentWidget(0);
- Local_View->setFocus();
+
+void AdvancedFm::switchToLocalTab() {
+//qWarning("switch to local view");
+ TabWidget->setCurrentWidget(0);
+ Local_View->setFocus();
}
-void AdvancedFm::switchToRemoteTab()
-{
- TabWidget->setCurrentWidget(1);
- Remote_View->setFocus();
+void AdvancedFm::switchToRemoteTab() {
+//qWarning("switch to local view");
+ TabWidget->setCurrentWidget(1);
+ Remote_View->setFocus();
}
-void AdvancedFm::readConfig()
-{
- Config cfg("AdvancedFm");
+void AdvancedFm::readConfig() {
+ Config cfg("AdvancedFm");
}
-void AdvancedFm::writeConfig()
-{
- Config cfg("AdvancedFm");
+void AdvancedFm::writeConfig() {
+ Config cfg("AdvancedFm");
}
-void AdvancedFm::currentPathComboChanged()
-{
- if(QDir( currentPathCombo->lineEdit()->text()).exists())
- {
+void AdvancedFm::currentPathComboChanged() {
+ if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
CurrentDir()->setPath( currentPathCombo->lineEdit()->text() );
populateView();
- }
- else
- {
+ } else {
QMessageBox::message(tr("Note"),tr("That directory does not exist"));
- }
+ }
}
-void AdvancedFm::fillCombo(const QString &currentPath)
-{
-// qDebug("%d",TabWidget->currentTab());
- if ( whichTab == 1)
- {
+void AdvancedFm::fillCombo(const QString &currentPath) {
+
+ if ( whichTab == 1) {
currentPathCombo->lineEdit()->setText( currentPath);
- if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() )
- {
- currentPathCombo->clear();
- localDirPathStringList.prepend( currentPath );
- currentPathCombo->insertStringList( localDirPathStringList,-1);
- }
- }
- else
- {
+ 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);
- }
- }
-}
-
-void AdvancedFm::currentPathComboActivated(const QString & currentPath)
-{
- chdir( currentPath.latin1() );
- CurrentDir()->cd( currentPath, TRUE);
- populateView();
- update();
-}
-
-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);
+ if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) {
+ currentPathCombo->clear();
+ remoteDirPathStringList.prepend( currentPath );
+ currentPathCombo->insertStringList( remoteDirPathStringList,-1);
+ }
+ }
+}
+
+void AdvancedFm::currentPathComboActivated(const QString & currentPath) {
+ chdir( currentPath.latin1() );
+ CurrentDir()->cd( currentPath, TRUE);
+ populateView();
+ update();
+}
+
+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);
// qDebug(it.current()->text(0));
- }
- }
- return strList;
-}
-
-void AdvancedFm::homeButtonPushed()
-{
- QString current = QDir::homeDirPath();
- chdir( current.latin1() );
- CurrentDir()->cd( current, TRUE);
- populateView();
- update();
-}
-
-void AdvancedFm::docButtonPushed()
-{
- QString current = QPEApplication::documentDir();
- chdir( current.latin1() );
- CurrentDir()->cd( current, TRUE);
- populateView();
- update();
-}
-
-void AdvancedFm::SDButtonPushed()
-{
- QString current = "/mnt/card";// this can change so fix
- chdir( current.latin1() );
- CurrentDir()->cd( current, TRUE);
- populateView();
- update();
-}
-
-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();
-}
-
-
-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"));
-}
-
-void AdvancedFm::keyPressEvent( QKeyEvent *e)
-{
-// e->accept();
- if( CurrentView()->hasFocus() )
- {
+ }
+ }
+ return strList;
+}
+
+void AdvancedFm::homeButtonPushed() {
+ QString current = QDir::homeDirPath();
+ chdir( current.latin1() );
+ CurrentDir()->cd( current, TRUE);
+ populateView();
+ update();
+}
+
+void AdvancedFm::docButtonPushed() {
+ QString current = QPEApplication::documentDir();
+ chdir( current.latin1() );
+ CurrentDir()->cd( current, TRUE);
+ populateView();
+ update();
+}
+
+void AdvancedFm::SDButtonPushed() {
+ QString current = "/mnt/card";// this can change so fix
+ chdir( current.latin1() );
+ CurrentDir()->cd( current, TRUE);
+ populateView();
+ update();
+}
+
+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();
+}
+
+
+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"));
+}
+
+void AdvancedFm::keyPressEvent( QKeyEvent *e) {
+// qWarning("key %d", e->key());
+// if( CurrentView()->hasFocus() )
+ {
switch ( e->key() ) {
+ case Key_Left:
+ upDir();
+ break;
+ case Key_Next:
+ break;
+ case Key_Return:
+ case Key_Enter:
+ navigateToSelected();
+ break;
+ case Key_Tab: {
+ setOtherTabCurrent();
+ }
+ break;
case Key_Delete:
- del();
- break;
+ del();
+ break;
case Key_A:
- copyAs();
- break;
+ copyAs();
+ break;
case Key_C:
- copy();
- break;
+ copy();
+ break;
case Key_E:
- runThis();
- break;
+ runThis();
+ break;
case Key_G:
{
- currentPathCombo->lineEdit()->setFocus();
+ currentPathCombo->lineEdit()->setFocus();
}
@@ -435,57 +425,56 @@ void AdvancedFm::keyPressEvent( QKeyEvent *e)
case Key_H:
- showHidden();
- break;
+ showHidden();
+ break;
case Key_I:
- fileStatus();
- break;
+ fileStatus();
+ break;
case Key_M:
- move();
- break;
+ move();
+ break;
case Key_N:
- mkDir();
- break;
+ mkDir();
+ break;
case Key_P:
- filePerms();
- break;
+ filePerms();
+ break;
case Key_R:
- rn();
- break;
+ rn();
+ break;
case Key_U:
- upDir();
- break;
+ upDir();
+ break;
case Key_1:
- switchToLocalTab();
- break;
+ switchToLocalTab();
+ break;
case Key_2:
- switchToRemoteTab();
- break;
+ switchToRemoteTab();
+ break;
case Key_3:
- CFButtonPushed();
- break;
+ CFButtonPushed();
+ break;
case Key_4:
- SDButtonPushed();
- break;
+ SDButtonPushed();
+ break;
case Key_5:
- homeButtonPushed();
- break;
+ homeButtonPushed();
+ break;
case Key_6:
- docButtonPushed();
- break;
+ docButtonPushed();
+ break;
case Key_7:
- break;
+ break;
case Key_8:
- break;
+ break;
case Key_9:
- break;
+ break;
case Key_0:
- break;
+ break;
};
e->accept();
- }
+ }
}
-void AdvancedFm::keyReleaseEvent( QKeyEvent *e)
-{
- if( CurrentView()->hasFocus() )
- e->ignore();
+void AdvancedFm::keyReleaseEvent( QKeyEvent *e) {
+ if( CurrentView()->hasFocus() )
+ e->ignore();
}
@@ -493,72 +482,65 @@ void AdvancedFm::keyReleaseEvent( QKeyEvent *e)
-void AdvancedFm::QPEButtonPushed()
-{
- QString current = QPEApplication::qpeDir();
- chdir( current.latin1() );
- CurrentDir()->cd( current, TRUE);
- populateView();
- update();
+void AdvancedFm::QPEButtonPushed() {
+ QString current = QPEApplication::qpeDir();
+ chdir( current.latin1() );
+ CurrentDir()->cd( current, TRUE);
+ populateView();
+ update();
}
-void AdvancedFm::parsetab(const QString &fileName)
-{
+void AdvancedFm::parsetab(const QString &fileName) {
- fileSystemTypeList.clear();
- fsList.clear();
- struct mntent *me;
- FILE *mntfp = setmntent( fileName.latin1(), "r" );
- if ( mntfp )
- {
- while ( (me = getmntent( mntfp )) != 0 )
- {
- QString deviceName = me->mnt_fsname;
- QString filesystemType = me->mnt_type;
- QString mountDir = me->mnt_dir;
- if(deviceName != "none")
- {
- if( fsList.contains(filesystemType) == 0
- & filesystemType.find("proc",0,TRUE) == -1
- & filesystemType.find("cramfs",0,TRUE) == -1
- & filesystemType.find("auto",0,TRUE) == -1)
- fsList << filesystemType;
- fileSystemTypeList << mountDir+"::"+filesystemType;
+ fileSystemTypeList.clear();
+ fsList.clear();
+ struct mntent *me;
+ FILE *mntfp = setmntent( fileName.latin1(), "r" );
+ if ( mntfp ) {
+ while ( (me = getmntent( mntfp )) != 0 ) {
+ QString deviceName = me->mnt_fsname;
+ QString filesystemType = me->mnt_type;
+ QString mountDir = me->mnt_dir;
+ if(deviceName != "none") {
+ if( fsList.contains(filesystemType) == 0
+ & filesystemType.find("proc",0,TRUE) == -1
+ & filesystemType.find("cramfs",0,TRUE) == -1
+ & filesystemType.find("auto",0,TRUE) == -1)
+ fsList << filesystemType;
+ fileSystemTypeList << mountDir+"::"+filesystemType;
+ }
+ }
+ }
+ endmntent( mntfp );
+}
+
+QString AdvancedFm::getFileSystemType(const QString &currentText) {
+ parsetab("/etc/mtab"); //why did TT forget filesystem type?
+ QString current = currentText;//.right( currentText.length()-1);
+ QString baseFs;
+ for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) {
+ QString temp = (*it);
+ QString path = temp.left(temp.find("::",0,TRUE) );
+ path = path.right( path.length()-1);
+ if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
+ if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) {
+ return temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
}
- }
- }
- endmntent( mntfp );
-}
-
-QString AdvancedFm::getFileSystemType(const QString &currentText)
-{
- parsetab("/etc/mtab"); //why did TT forget filesystem type?
- QString current = currentText;//.right( currentText.length()-1);
- QString baseFs;
- for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) {
- QString temp = (*it);
- QString path = temp.left(temp.find("::",0,TRUE) );
- path = path.right( path.length()-1);
- if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
- if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) {
- return temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
- }
- }
- return baseFs;
-}
-
-QString AdvancedFm::getDiskSpace( const QString &path)
-{
- struct statfs fss;
- if ( !statfs( path.latin1(), &fss ) ) {
- int blkSize = fss.f_bsize;
+ }
+ return baseFs;
+}
+
+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;
+ 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 "";
}
@@ -566,69 +548,65 @@ QString AdvancedFm::getDiskSpace( const QString &path)
-void AdvancedFm::showFileMenu()
-{
- QString curApp;
- curApp = CurrentView()->currentItem()->text(0);
+void AdvancedFm::showFileMenu() {
+ 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() )
- {
+ if ( QFileInfo(fi).isDir() ) {
m->insertSeparator();
m->insertItem( tr( "Change Directory" ), this, SLOT( doDirChange() ));
- }
- else
- {
+ } else {
if ( app )
- m->insertItem( app->pixmap(), tr( "Open in "
- + app->name() ), this, SLOT( runThis() ) );
+ 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( 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;
}
@@ -636,47 +614,43 @@ void AdvancedFm::showFileMenu()
-void AdvancedFm::cancelMenuTimer()
-{
-// qDebug("selectionChanged: cancel menu timer");
- if( menuTimer.isActive() )
- menuTimer.stop();
+void AdvancedFm::cancelMenuTimer() {
+
+ if( menuTimer.isActive() )
+ menuTimer.stop();
}
-QString AdvancedFm::checkDiskSpace(const QString &path)
-{
- struct statfs fss;
- if ( !statfs( path.latin1(), &fss ) )
- {
- int blkSize = fss.f_bsize;
+QString AdvancedFm::checkDiskSpace(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;
+ 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 "";
}
-void AdvancedFm::addToDocs()
-{
- QStringList strListPaths = getPath();
- QDir *thisDir = CurrentDir();
+void AdvancedFm::addToDocs() {
+ QStringList strListPaths = getPath();
+ QDir *thisDir = CurrentDir();
- if( strListPaths.count() > 0) {
- QString curFile;
+ if( strListPaths.count() > 0) {
+ QString curFile;
for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) {
- curFile = thisDir->canonicalPath()+"/"+(*it);
+ curFile = thisDir->canonicalPath()+"/"+(*it);
// qDebug(curFile);
- QFileInfo fi(curFile);
- DocLnk f;
+ QFileInfo fi(curFile);
+ DocLnk f;
// curFile.replace(QRegExp("\\..*"),"");
- f.setName(fi.baseName() );
- f.setFile( curFile);
- f.writeLink();
+ f.setName(fi.baseName() );
+ f.setFile( curFile);
+ f.writeLink();
}
- }
+ }
}
@@ -684,10 +658,9 @@ void AdvancedFm::addToDocs()
-void AdvancedFm::customDirsToMenu()
-{
+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 );
@@ -699,45 +672,39 @@ void AdvancedFm::customDirsToMenu()
-void AdvancedFm::dirMenuSelected(int item)
-{
- qDebug("menu item %d", item);
- switch(item)
- {
+void AdvancedFm::dirMenuSelected(int item) {
+ switch(item)
+ {
- case -21:
- case 0:
+ case -21:
+ case 0:
addCustomDir();
break;
- case -22:
- case 1:
+ case -22:
+ case 1:
removeCustomDir();
break;
- default:
- {
+ default:
+ {
// gotoCustomDir( menuButton->text(item));
// gotoCustomDir( customDirMenu->text(item));
- }
- break;
-
- };
-}
-
-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)
- {
+ }
+ break;
+
+ };
+}
+
+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);
@@ -745,42 +712,35 @@ void AdvancedFm::addCustomDir()
list << dir;
- }
+ }
- cfg.writeEntry("CustomDir", list, ',');
- cfg.write();
+ cfg.writeEntry("CustomDir", list, ',');
+ cfg.write();
}
-void AdvancedFm::removeCustomDir()
-{
+void AdvancedFm::removeCustomDir() {
// qDebug("remove custom dir");
- Config cfg("AdvancedFm");
- cfg.setGroup("Menu");
- QString dir;
- QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)',');
- QStringList list2;
- dir = CurrentDir()->canonicalPath();
- int ramble=2;
+ Config cfg("AdvancedFm");
+ cfg.setGroup("Menu");
+ QString dir;
+ QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)',');
+ QStringList list2;
+ dir = CurrentDir()->canonicalPath();
+ int ramble=2;
// int ramble=-24;
//first remove list
- if(list.grep(dir,true).isEmpty())
- {
+ if(list.grep(dir,true).isEmpty()) {
QMessageBox::message(tr( "AdvancedFm" ),
tr("Cannot remove current directory\nfrom bookmarks.\nIt is not bookmarked!"));
- }
- 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
- {
+ } 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--;
- }
+ }
@@ -788,3 +748,3 @@ void AdvancedFm::removeCustomDir()
cfg.write();
- }
+ }
// customDirsToMenu();
@@ -793,4 +753,3 @@ void AdvancedFm::removeCustomDir()
-void AdvancedFm::gotoCustomDir(const QString &dir)
-{
+void AdvancedFm::gotoCustomDir(const QString &dir) {
// qDebug("gotoCustomDir(const QString &dir) " +dir );
@@ -800,13 +759,9 @@ void AdvancedFm::gotoCustomDir(const QString &dir)
// }
- if( dir == s_addBookmark)
- {
+ if( dir == s_addBookmark) {
addCustomDir();
- }
- if( dir == s_removeBookmark)
- {
+ }
+ if( dir == s_removeBookmark) {
removeCustomDir( );
- }
- else
- {
- gotoDirectory( dir);
+ } else {
+ gotoDirectory( dir);
// if(QDir( curDir).exists() )
@@ -818,51 +773,48 @@ void AdvancedFm::gotoCustomDir(const QString &dir)
// }
- }
+ }
}
-QDir *AdvancedFm::CurrentDir()
-{
- if ( whichTab == 1)
- {
- return &currentDir;
- }
- else
- {
- return &currentRemoteDir;
- }
+QDir *AdvancedFm::CurrentDir() {
+
+ if ( whichTab == 1) {
+ return &currentDir;
+ } else {
+ return &currentRemoteDir;
+ }
}
-QDir *AdvancedFm::OtherDir()
-{
- if ( whichTab == 1)
- {
- return &currentRemoteDir;
- }
- else
- {
- return &currentDir;
- }
+QDir *AdvancedFm::OtherDir() {
+ if ( whichTab == 1) {
+ return &currentRemoteDir;
+ } else {
+ return &currentDir;
+ }
}
-QListView * AdvancedFm::CurrentView()
-{
- if ( whichTab == 1)
- return Local_View;
- else
- return Remote_View;
+QListView * AdvancedFm::CurrentView() {
+ if ( whichTab == 1) {
+// qWarning("CurrentView Tab 1");
+ return Local_View;
+ } else {
+// qWarning("CurrentView Tab 2");
+ return Remote_View;
+ }
}
-QListView * AdvancedFm::OtherView()
-{
- if ( whichTab == 1)
- return Remote_View;
- else
- return Local_View;
+QListView * AdvancedFm::OtherView() {
+ if ( whichTab == 1)
+ return Remote_View;
+ else
+ return Local_View;
}
-void AdvancedFm::setOtherTabCurrent()
-{
- if ( whichTab == 1)
- TabWidget->setCurrentWidget(1);
- else
- TabWidget->setCurrentWidget(0);
+void AdvancedFm::setOtherTabCurrent() {
+// qWarning("setOtherTabCurrent()");
+ if ( whichTab == 1) {
+ TabWidget->setCurrentWidget(1);
+ } else {
+ TabWidget->setCurrentWidget(0);
+ }
+ OtherView()->setFocus();
+ OtherView()->setSelected( CurrentView()->firstChild(), true);
}
@@ -870,6 +822,6 @@ void AdvancedFm::setOtherTabCurrent()
void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) {
- qDebug("qcop message "+msg );
+// qDebug("qcop message "+msg );
QDataStream stream ( data, IO_ReadOnly );
if ( msg == "openDirectory(QString)" ) {
- qDebug("received");
+// qDebug("received");
QString file;
@@ -880,12 +832,12 @@ void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) {
- void AdvancedFm::setDocument(const QString &file) {
- gotoDirectory( file);
+void AdvancedFm::setDocument(const QString &file) {
+ gotoDirectory( file);
- }
+}
void AdvancedFm::gotoDirectory(const QString &file) {
-
- QString curDir = file;
- QDir *thisDir = CurrentDir();
- if(QDir( curDir).exists() ) {
+// qWarning("goto dir "+file);
+ QString curDir = file;
+ QDir *thisDir = CurrentDir();
+ if(QDir( curDir).exists() ) {
thisDir->setPath( curDir );
@@ -895,13 +847,13 @@ void AdvancedFm::gotoDirectory(const QString &file) {
}
- else if(QFileInfo(curDir).exists()) {
- QFileInfo fileInfo(curDir);
- curDir=fileInfo.dirPath();
- if(QDir( curDir).exists() ) {
- thisDir->setPath( curDir );
- chdir( curDir.latin1() );
- thisDir->cd( curDir, TRUE);
- populateView();
- }
- findFile(file);
- }
+ else if(QFileInfo(curDir).exists()) {
+ QFileInfo fileInfo(curDir);
+ curDir=fileInfo.dirPath();
+ if(QDir( curDir).exists() ) {
+ thisDir->setPath( curDir );
+ chdir( curDir.latin1() );
+ thisDir->cd( curDir, TRUE);
+ populateView();
+ }
+ findFile(file);
+ }
@@ -920 +872,20 @@ void AdvancedFm::findFile(const QString &fileName) {
}
+
+void AdvancedFm::slotSwitchMenu(int ) {
+// qDebug("Switch %d", item);
+ // viewMenu->setItemChecked(item, true);
+}
+
+void AdvancedFm::dealWithSchmooSchmaa(QWidget *w) {
+ tabChanged( w);
+ if( w == Local_View) {
+ Remote_View->clearFocus();
+ } else {
+ Local_View->clearFocus();
+ }
+}
+
+void AdvancedFm::navigateToSelected() {
+ if( !CurrentView()->currentItem()) return;
+ doDirChange();
+}
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h
index 5e2c769..5f6eabb 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -60,2 +60,3 @@ public:
protected slots:
+ void slotSwitchMenu(int);
void selectAll();
@@ -130,4 +131,6 @@ protected:
void setOtherTabCurrent();
+ void dealWithSchmooSchmaa(QWidget *);
protected slots:
+ void openSearch();
void dirMenuSelected(int);
@@ -154,2 +157,4 @@ protected slots:
+// void slotSwitchtoLocal(int);
+
private:
@@ -167,3 +172,3 @@ private:
void gotoDirectory(const QString &);
- void openSearch();
+ void navigateToSelected();
void findFile(const QString &);
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp
index 463b202..ddaa39a 100644
--- a/noncore/apps/advancedfm/advancedfmData.cpp
+++ b/noncore/apps/advancedfm/advancedfmData.cpp
@@ -100,7 +100,9 @@ void AdvancedFm::init() {
- viewMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() ));
- viewMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() ));
-// viewMenu->insertSeparator();
-// viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() ));
- viewMenu->setCheckable(TRUE);
+ viewMenu->insertItem( tr( "Switch to View 1" ), this, SLOT( switchToLocalTab()));
+ viewMenu->insertItem( tr( "Switch to View 2" ), this, SLOT( switchToRemoteTab()));
+// viewMenu->insertSeparator();
+// viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() ));
+ viewMenu->setCheckable(true);
+ viewMenu->setItemChecked( viewMenu->idAt(0), true);
+ viewMenu->setItemChecked( viewMenu->idAt(1), false);
@@ -122,2 +124,3 @@ void AdvancedFm::init() {
menuButton->insertSeparator();
+ menuButton->setFocusPolicy(NoFocus);
@@ -128,3 +131,3 @@ void AdvancedFm::init() {
currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
-
+ currentPathCombo->setFocusPolicy(NoFocus);
layout->addWidget( lineBox );
@@ -150,3 +153,5 @@ void AdvancedFm::init() {
Local_View->setSelectionMode(QListView::Extended);
-
+ Local_View->setFocusPolicy(StrongFocus);
+ Local_View->installEventFilter( this );
+
QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold);
@@ -172,4 +177,5 @@ void AdvancedFm::init() {
Remote_View->setSelectionMode(QListView::Extended);
-
-
+ Remote_View->setFocusPolicy(StrongFocus);
+ Remote_View->installEventFilter( this );
+
QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold);
@@ -205,12 +211,7 @@ void AdvancedFm::init() {
-
- struct utsname name; /* check for embedix kernel running on the zaurus*/
- if (uname(&name) != -1) {
- QString release=name.release;
- if(release.find("embedix",0,TRUE) !=-1) {
+ if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" ))
zaurusDevice=TRUE;
- } else {
+ else
zaurusDevice=FALSE;
- }
- }
+
@@ -282,3 +283,3 @@ void AdvancedFm::initConnections()
// connect( menuButton, SIGNAL( selected( int)), SLOT( dirMenuSelected(int)));
-
+ connect( viewMenu, SIGNAL( activated(int )), this, SLOT(slotSwitchMenu(int )));
// connect( customDirMenu, SIGNAL( activated(int)), this, SLOT( dirMenuSelected(int)));
@@ -286 +287,2 @@ void AdvancedFm::initConnections()
}
+
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp
index 544350c..c0be948 100644
--- a/noncore/apps/advancedfm/advancedfmMenu.cpp
+++ b/noncore/apps/advancedfm/advancedfmMenu.cpp
@@ -48,11 +48,16 @@
-void AdvancedFm::doDirChange()
-{
- ListClicked( CurrentView()->currentItem());
+void AdvancedFm::doDirChange() {
+ QString pathItem = CurrentView()->currentItem()->text(0);
+ if( pathItem == "../") {
+ ListClicked( CurrentView()->currentItem());
+ } else {
+ if( pathItem.find(" -> ",0,TRUE) != -1)
+ pathItem = dealWithSymName((const QString&)pathItem)+"/";
+// qWarning(pathItem);
+ gotoDirectory( CurrentDir()->path()+"/"+pathItem.left( pathItem.length() - 1) );
+ }
}
-void AdvancedFm::showMenuHidden()
-{
- if (b)
- {
+void AdvancedFm::showMenuHidden() {
+ if (b) {
CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
@@ -60,7 +65,3 @@ void AdvancedFm::showMenuHidden()
fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
-// b=FALSE;
-
- }
- else
- {
+ } else {
CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
@@ -68,6 +69,4 @@ void AdvancedFm::showMenuHidden()
fileMenu->setItemChecked( fileMenu->idAt(0),FALSE);
-// b=TRUE;
}
rePopulate();
-// if(b) qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<< true");
b = !b;
@@ -75,18 +74,9 @@ void AdvancedFm::showMenuHidden()
-void AdvancedFm::showHidden()
-{
- if (b)
- {
+void AdvancedFm::showHidden() {
+ if (b) {
CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
-// fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
-// b=FALSE;
-
- }
- else
- {
+ } else {
CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
-// fileMenu->setItemChecked( fileMenu->idAt(0),FALSE);
-// b=TRUE;
}
@@ -95,10 +85,9 @@ void AdvancedFm::showHidden()
-QString AdvancedFm::dealWithSymName(const QString &fileName)
-{
- QString strItem = fileName;
- return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
+QString AdvancedFm::dealWithSymName(const QString &fileName) {
+ QString strItem = fileName;
+ return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
}
-void AdvancedFm::runThis()
-{
+void AdvancedFm::runThis() {
+ if( !CurrentView()->currentItem()) return;
QString fs;
@@ -113,4 +102,3 @@ void AdvancedFm::runThis()
- if(curFile != "../")
- {
+ if(curFile != "../") {
@@ -118,3 +106,3 @@ void AdvancedFm::runThis()
QFileInfo fileInfo( path + "/" + curFile);
- qDebug( fileInfo.owner());
+// qDebug( fileInfo.owner());
@@ -126,5 +114,3 @@ void AdvancedFm::runThis()
e << curFile;
- }
- else
- {
+ } else {
curFile = path + "/" + curFile;
@@ -132,8 +118,5 @@ void AdvancedFm::runThis()
QString execStr = nf.exec();
- qDebug( execStr);
- if( execStr.isEmpty() )
- {
- }
- else
- {
+// qDebug( execStr);
+ if( execStr.isEmpty() ) {
+ } else {
nf.execute();
@@ -144,7 +127,6 @@ void AdvancedFm::runThis()
-void AdvancedFm::runText()
-{
+void AdvancedFm::runText() {
+ if( !CurrentView()->currentItem()) return;
QString curFile = CurrentView()->currentItem()->text(0);
- if(curFile != "../")
- {
+ if(curFile != "../") {
if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink
@@ -157,4 +139,3 @@ void AdvancedFm::runText()
-void AdvancedFm::makeDir()
-{
+void AdvancedFm::makeDir() {
InputDialog *fileDlg;
@@ -162,4 +143,3 @@ void AdvancedFm::makeDir()
fileDlg->exec();
- if( fileDlg->result() == 1 )
- {
+ if( fileDlg->result() == 1 ) {
QDir *thisDir = CurrentDir();
@@ -171,4 +151,3 @@ void AdvancedFm::makeDir()
-void AdvancedFm::doDelete()
-{
+void AdvancedFm::doDelete() {
QStringList curFileList = getPath();
@@ -237,3 +216,3 @@ void AdvancedFm::doDelete()
if( fi.fileName().find("../",0,TRUE)==-1) {
- qDebug("remove link files "+myFile);
+// qDebug("remove link files "+myFile);
@@ -242,3 +221,3 @@ void AdvancedFm::doDelete()
lnk = new DocLnk(f);
- qDebug("Deleting doclnk " + lnk->linkFile());
+// qDebug("Deleting doclnk " + lnk->linkFile());
if(lnk->isValid())
@@ -254,11 +233,9 @@ void AdvancedFm::doDelete()
-void AdvancedFm::filePerms()
-{
- QStringList curFileList = getPath();
- QString filePath;
+void AdvancedFm::filePerms() {
+ QStringList curFileList = getPath();
+ QString filePath;
- filePath = CurrentDir()->canonicalPath()+"/";
+ filePath = CurrentDir()->canonicalPath()+"/";
- for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it )
- {
+ for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
filePermissions *filePerm;
@@ -268,26 +245,24 @@ void AdvancedFm::filePerms()
if( filePerm)
- delete filePerm;
- }
- populateView();
+ delete filePerm;
+ }
+ populateView();
}
-void AdvancedFm::doProperties()
-{
+void AdvancedFm::doProperties() {
#if defined(QT_QWS_OPIE)
- QStringList curFileList = getPath();
+ QStringList curFileList = getPath();
- QString filePath;
- filePath = CurrentDir()->canonicalPath()+"/";
+ QString filePath;
+ filePath = CurrentDir()->canonicalPath()+"/";
- qDebug("%d",curFileList.count());
+// qDebug("%d",curFileList.count());
- for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it )
- {
- qDebug((filePath+*it));
- DocLnk lnk( (filePath+*it));
- LnkProperties prop( &lnk );
- prop.showMaximized();
- prop.exec();
- }
+ for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
+// qDebug((filePath+*it));
+ DocLnk lnk( (filePath+*it));
+ LnkProperties prop( &lnk );
+ prop.showMaximized();
+ prop.exec();
+ }
#endif
@@ -296,4 +271,3 @@ void AdvancedFm::doProperties()
-void AdvancedFm::upDir()
-{
+void AdvancedFm::upDir() {
QDir *thisDir = CurrentDir();
@@ -310,59 +284,54 @@ void AdvancedFm::upDir()
-void AdvancedFm::copy()
-{
- qApp->processEvents();
- QStringList curFileList = getPath();
+void AdvancedFm::copy() {
+ qApp->processEvents();
+ QStringList curFileList = getPath();
- QDir *thisDir = CurrentDir();
- QDir *thatDir = OtherDir();
-
- bool doMsg=true;
- int count=curFileList.count();
- if( count > 0) {
- if(count > 1 ){
- QString msg;
- msg=tr("Really copy\n%1 files?").arg(count);
- switch ( QMessageBox::warning(this,tr("Copy"),msg
- ,tr("Yes"),tr("No"),0,0,1) )
- {
- case 0:
- doMsg=false;
- break;
- case 1:
- return;
- break;
- };
- }
+ QDir *thisDir = CurrentDir();
+ QDir *thatDir = OtherDir();
- QString curFile, item, destFile;
- for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it )
- {
- item=(*it);
- if(item.find("->",0,TRUE)) //symlink
- item = item.left(item.find("->",0,TRUE));
-
- curFile = thisDir->canonicalPath()+"/"+ item;
- destFile = thatDir->canonicalPath()+"/"+ item;
-
- qDebug("Destination file is "+destFile);
- qDebug("CurrentFile file is " + curFile);
-
- QFile f(destFile);
- if( f.exists())
- {
- if(doMsg)
- {
- switch ( QMessageBox::warning(this,tr("File Exists!"),
- tr("%1 exists. Ok to overwrite?").arg( item ),
- tr("Yes"),tr("No"),0,0,1) )
- {
- case 1:
- return;
- break;
- };
- }
+ bool doMsg=true;
+ int count=curFileList.count();
+ if( count > 0) {
+ if(count > 1 ){
+ QString msg;
+ msg=tr("Really copy\n%1 files?").arg(count);
+ switch ( QMessageBox::warning(this,tr("Copy"),msg
+ ,tr("Yes"),tr("No"),0,0,1) )
+ {
+ case 0:
+ doMsg=false;
+ break;
+ case 1:
+ return;
+ break;
+ };
+ }
+
+ QString curFile, item, destFile;
+ for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
+ item=(*it);
+ if(item.find("->",0,TRUE)) //symlink
+ item = item.left(item.find("->",0,TRUE));
+
+ curFile = thisDir->canonicalPath()+"/"+ item;
+ destFile = thatDir->canonicalPath()+"/"+ item;
+
+// qDebug("Destination file is "+destFile);
+// qDebug("CurrentFile file is " + curFile);
+
+ QFile f(destFile);
+ if( f.exists()) {
+ if(doMsg) {
+ switch ( QMessageBox::warning(this,tr("File Exists!"),
+ tr("%1 exists. Ok to overwrite?").arg( item ),
+ tr("Yes"),tr("No"),0,0,1) ) {
+ case 1:
+ return;
+ break;
+ };
+ }
f.remove();
- }
+ }
- if( !copyFile( curFile, destFile) ) {
+ if( !copyFile( curFile, destFile) ) {
QMessageBox::message("AdvancedFm",
@@ -370,6 +339,6 @@ void AdvancedFm::copy()
return;
- }
+ }
}
- setOtherTabCurrent();
- populateView();
+ rePopulate();
+ setOtherTabCurrent();
}
@@ -377,15 +346,13 @@ void AdvancedFm::copy()
-void AdvancedFm::copyAs()
-{
- qApp->processEvents();
+void AdvancedFm::copyAs() {
+ qApp->processEvents();
- QStringList curFileList = getPath();
- QString curFile, item;
- InputDialog *fileDlg;
+ QStringList curFileList = getPath();
+ QString curFile, item;
+ InputDialog *fileDlg;
- QDir *thisDir = CurrentDir();
- QDir *thatDir = OtherDir();
+ QDir *thisDir = CurrentDir();
+ QDir *thatDir = OtherDir();
- for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it )
- {
+ for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
QString destFile;
@@ -398,37 +365,33 @@ void AdvancedFm::copyAs()
- if( fileDlg->result() == 1 )
- {
- QString filename = fileDlg->LineEdit1->text();
- destFile = thatDir->canonicalPath()+"/"+filename;
+ if( fileDlg->result() == 1 ) {
+ QString filename = fileDlg->LineEdit1->text();
+ destFile = thatDir->canonicalPath()+"/"+filename;
- QFile f( destFile);
- if( f.exists())
- {
- switch (QMessageBox::warning(this,tr("File Exists!"),
- item+tr("\nexists. Ok to overwrite?"),
- tr("Yes"),tr("No"),0,0,1) )
- {
- case 0:
- f.remove();
- break;
- case 1:
- return;
- break;
- };
- }
- if( !copyFile( curFile, destFile) ) {
- QMessageBox::message("AdvancedFm",tr("Could not copy\n")
- +curFile +tr("to\n")+destFile);
- return;
- }
- }
+ QFile f( destFile);
+ if( f.exists()) {
+ switch (QMessageBox::warning(this,tr("File Exists!"),
+ item+tr("\nexists. Ok to overwrite?"),
+ tr("Yes"),tr("No"),0,0,1) ) {
+ case 0:
+ f.remove();
+ break;
+ case 1:
+ return;
+ break;
+ };
+ }
+ if( !copyFile( curFile, destFile) ) {
+ QMessageBox::message("AdvancedFm",tr("Could not copy\n")
+ +curFile +tr("to\n")+destFile);
+ return;
+ }
+ }
delete fileDlg;
- }
- setOtherTabCurrent();
- populateView();
+ }
+ rePopulate();
+ setOtherTabCurrent();
}
-void AdvancedFm::copySameDir()
-{
+void AdvancedFm::copySameDir() {
qApp->processEvents();
@@ -440,4 +403,3 @@ void AdvancedFm::copySameDir()
- for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it )
- {
+ for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
item=(*it);
@@ -449,4 +411,3 @@ void AdvancedFm::copySameDir()
- if( fileDlg->result() == 1 )
- {
+ if( fileDlg->result() == 1 ) {
@@ -456,4 +417,3 @@ void AdvancedFm::copySameDir()
QFile f(destFile);
- if( f.exists())
- {
+ if( f.exists()) {
switch (QMessageBox::warning(this,tr("Delete"),
@@ -476,3 +436,3 @@ void AdvancedFm::copySameDir()
- qDebug("copy "+curFile+" as "+destFile);
+// qDebug("copy "+curFile+" as "+destFile);
}
@@ -483,4 +443,3 @@ void AdvancedFm::copySameDir()
-void AdvancedFm::move()
-{
+void AdvancedFm::move() {
qApp->processEvents();
@@ -488,4 +447,3 @@ void AdvancedFm::move()
QStringList curFileList = getPath();
- if( curFileList.count() > 0)
- {
+ if( curFileList.count() > 0) {
QString curFile, destFile, item;
@@ -494,4 +452,3 @@ void AdvancedFm::move()
QDir *thatDir = OtherDir();
- for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it )
- {
+ for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
item=(*it);
@@ -502,3 +459,3 @@ void AdvancedFm::move()
destFile += item;
- qDebug("Destination file is "+destFile);
+// qDebug("Destination file is "+destFile);
@@ -508,3 +465,3 @@ void AdvancedFm::move()
curFile+= item;
- qDebug("CurrentFile file is " + curFile);
+// qDebug("CurrentFile file is " + curFile);
@@ -520,10 +477,8 @@ void AdvancedFm::move()
- }
- populateView();
+ }
+ rePopulate();
setOtherTabCurrent();
- populateView();
}
-bool AdvancedFm::copyFile( const QString & src, const QString & dest )
-{
+bool AdvancedFm::copyFile( const QString & src, const QString & dest ) {
bool success = true;
@@ -538,3 +493,3 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest )
if(!srcFile.open( IO_ReadOnly|IO_Raw)) {
- qWarning("open failed");
+// qWarning("open failed");
return success = false;
@@ -545,3 +500,3 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest )
if( !destFile.open( IO_WriteOnly|IO_Raw ) ) {
- qWarning("destfile open failed");
+// qWarning("destfile open failed");
return success = false;
@@ -550,3 +505,3 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest )
if(write_fd != -1) {
- err =sendfile(write_fd, read_fd, &offset, stat_buf.st_size);
+ err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size);
if( err == -1) {
@@ -560,3 +515,3 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest )
success = false;
- qWarning(msg);
+// qWarning(msg);
}
@@ -578,18 +533,17 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest )
-void AdvancedFm::runCommand()
-{
- QDir *thisDir = CurrentDir();
+void AdvancedFm::runCommand() {
+ if( !CurrentView()->currentItem()) return;
+ QDir *thisDir = CurrentDir();
- QString curFile;
- curFile = thisDir->canonicalPath() +"/"+ CurrentView()->currentItem()->text(0);
+ QString curFile;
+ curFile = thisDir->canonicalPath() +"/"+ CurrentView()->currentItem()->text(0);
- InputDialog *fileDlg;
- fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
- fileDlg->setInputText(curFile);
- fileDlg->exec();
- //QString command;
+ InputDialog *fileDlg;
+ fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
+ fileDlg->setInputText(curFile);
+ fileDlg->exec();
+ //QString command;
- if( fileDlg->result() == 1 )
- {
- qDebug(fileDlg->LineEdit1->text());
+ if( fileDlg->result() == 1 ) {
+// qDebug(fileDlg->LineEdit1->text());
QStringList command;
@@ -605,40 +559,39 @@ void AdvancedFm::runCommand()
- }
+ }
}
-void AdvancedFm::runCommandStd()
-{
- QString curFile;
- QDir *thisDir = CurrentDir();
- QListView *thisView = CurrentView();
- if( thisView->currentItem())
- curFile = thisDir->canonicalPath() +"/"+ thisView->currentItem()->text(0);
+void AdvancedFm::runCommandStd() {
+ if( !CurrentView()->currentItem()) return;
+ QString curFile;
+ QDir *thisDir = CurrentDir();
+ QListView *thisView = CurrentView();
+ if( thisView->currentItem())
+ curFile = thisDir->canonicalPath() +"/"+ thisView->currentItem()->text(0);
- InputDialog *fileDlg;
- fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
- fileDlg->setInputText(curFile);
- fileDlg->exec();
+ InputDialog *fileDlg;
+ fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
+ fileDlg->setInputText(curFile);
+ fileDlg->exec();
- if( fileDlg->result() == 1 )
- {
+ if( fileDlg->result() == 1 ) {
qApp->processEvents();
startProcess( (const QString)fileDlg->LineEdit1->text().latin1());
- }
+ }
}
-void AdvancedFm::fileStatus()
-{
- QString curFile;
- curFile = CurrentView()->currentItem()->text(0);
+void AdvancedFm::fileStatus() {
+ if( !CurrentView()->currentItem()) return;
+ QString curFile;
+ curFile = CurrentView()->currentItem()->text(0);
- QStringList command;
- command << "/bin/sh";
- command << "-c";
- command << "stat -l "+ curFile;
+ QStringList command;
+ command << "/bin/sh";
+ command << "-c";
+ command << "stat -l "+ curFile;
- Output *outDlg;
- outDlg = new Output( command, this, tr("AdvancedFm Output"), true);
- outDlg->showMaximized();
- outDlg->exec();
- qApp->processEvents();
+ Output *outDlg;
+ outDlg = new Output( command, this, tr("AdvancedFm Output"), true);
+ outDlg->showMaximized();
+ outDlg->exec();
+ qApp->processEvents();
}
@@ -646,4 +599,3 @@ void AdvancedFm::fileStatus()
-void AdvancedFm::mkDir()
-{
+void AdvancedFm::mkDir() {
makeDir();
@@ -651,4 +603,3 @@ void AdvancedFm::mkDir()
-void AdvancedFm::rn()
-{
+void AdvancedFm::rn() {
renameIt();
@@ -656,4 +607,3 @@ void AdvancedFm::rn()
-void AdvancedFm::del()
-{
+void AdvancedFm::del() {
doDelete();
@@ -661,8 +611,6 @@ void AdvancedFm::del()
-void AdvancedFm::mkSym()
-{
+void AdvancedFm::mkSym() {
QString cmd;
QStringList curFileList = getPath();
- if( curFileList.count() > 0)
- {
+ if( curFileList.count() > 0) {
QDir *thisDir = CurrentDir();
@@ -670,8 +618,6 @@ void AdvancedFm::mkSym()
- 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) == "/")
- {
+ if(destName.right(1) == "/") {
destName = destName.left( destName.length() -1);
@@ -681,4 +627,3 @@ void AdvancedFm::mkSym()
- if( curFile.right(1) == "/")
- {
+ if( curFile.right(1) == "/") {
curFile = curFile.left( curFile.length() -1);
@@ -687,7 +632,7 @@ void AdvancedFm::mkSym()
cmd = "ln -s "+curFile+" "+destName;
- qDebug(cmd);
+// qDebug(cmd);
startProcess( (const QString)cmd );
}
+ rePopulate();
setOtherTabCurrent();
- populateView();
}
@@ -695,4 +640,3 @@ void AdvancedFm::mkSym()
-void AdvancedFm::doBeam()
-{
+void AdvancedFm::doBeam() {
Ir ir;
@@ -716,4 +660,3 @@ void AdvancedFm::doBeam()
-void AdvancedFm::fileBeamFinished( Ir *)
-{
+void AdvancedFm::fileBeamFinished( Ir *) {
QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") );
@@ -721,5 +664,3 @@ void AdvancedFm::fileBeamFinished( Ir *)
-void AdvancedFm::selectAll()
-{
-// if (TabWidget->currentTab() == 0) {
+void AdvancedFm::selectAll() {
QListView *thisView = CurrentView();
@@ -727,10 +668,5 @@ void AdvancedFm::selectAll()
thisView->setSelected( thisView->firstChild(),false);
-// } else {
-// Remote_View->selectAll(true);
-// Remote_View->setSelected( Remote_View->firstChild(),false);
-// }
}
-void AdvancedFm::startProcess(const QString & cmd)
-{
+void AdvancedFm::startProcess(const QString & cmd) {
QStringList command;
@@ -752,5 +688,3 @@ void AdvancedFm::startProcess(const QString & cmd)
-void AdvancedFm::processEnded(OProcess *)
-{
-// populateLocalView();
+void AdvancedFm::processEnded(OProcess *) {
populateView();
@@ -758,23 +692,15 @@ void AdvancedFm::processEnded(OProcess *)
-void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int buflen) {
- qWarning("received stderrt %d bytes", buflen);
+void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) {
+// qWarning("received stderrt %d bytes", buflen);
QString lineStr = buffer;
-// lineStr=lineStr.left(lineStr.length()-1);
QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") );
-
-// OutputEdit->append(lineStr);
-// OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
}
-bool AdvancedFm::eventFilter( QObject * o, QEvent * e )
-{
- if ( o->inherits( "QLineEdit" ) )
- {
- if ( e->type() == QEvent::KeyPress )
- {
+bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) {
+ if ( o->inherits( "QLineEdit" ) ) {
+ if ( e->type() == QEvent::KeyPress ) {
QKeyEvent *ke = (QKeyEvent*)e;
if ( ke->key() == Key_Return ||
- ke->key() == Key_Enter )
- {
+ ke->key() == Key_Enter ) {
okRename();
@@ -782,4 +708,3 @@ bool AdvancedFm::eventFilter( QObject * o, QEvent * e )
}
- else if ( ke->key() == Key_Escape )
- {
+ else if ( ke->key() == Key_Escape ) {
cancelRename();
@@ -788,4 +713,3 @@ bool AdvancedFm::eventFilter( QObject * o, QEvent * e )
}
- else if ( e->type() == QEvent::FocusOut )
- {
+ else if ( e->type() == QEvent::FocusOut ) {
cancelRename();
@@ -794,10 +718,13 @@ bool AdvancedFm::eventFilter( QObject * o, QEvent * e )
}
- if ( o->inherits( "QListView" ) )
- {
- if ( e->type() == QEvent::FocusOut )
- {
- printf("focusIn\n");
-
- }
- }
+ if ( o->inherits( "QListView" ) ) {
+ if ( e->type() == QEvent::FocusIn ) {
+ if( o == Local_View) { //keep track of which view
+ whichTab=1;
+ }
+ else {
+ whichTab=2;
+ }
+ }
+ OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection
+ }
@@ -807,5 +734,4 @@ bool AdvancedFm::eventFilter( QObject * o, QEvent * e )
-void AdvancedFm::cancelRename()
-{
- qDebug("cancel rename");
+void AdvancedFm::cancelRename() {
+// qDebug("cancel rename");
QListView * view;
@@ -816,4 +742,3 @@ void AdvancedFm::cancelRename()
renameBox = 0;
- if ( resetFocus )
- {
+ if ( resetFocus ) {
view->viewport()->setFocusProxy( view);
@@ -823,4 +748,4 @@ void AdvancedFm::cancelRename()
-void AdvancedFm::doRename(QListView * view)
-{
+void AdvancedFm::doRename(QListView * view) {
+ if( !CurrentView()->currentItem()) return;
@@ -844,3 +769,2 @@ void AdvancedFm::doRename(QListView * view)
renameBox->show();
-
}
@@ -848,5 +772,5 @@ void AdvancedFm::doRename(QListView * view)
-void AdvancedFm::renameIt()
-{
- QListView *thisView = CurrentView();
+void AdvancedFm::renameIt() {
+ if( !CurrentView()->currentItem()) return;
+ QListView *thisView = CurrentView();
oldName = thisView->currentItem()->text(0);
@@ -856,22 +780,19 @@ void AdvancedFm::renameIt()
-void AdvancedFm::okRename()
-{
- QString newName = renameBox->text();
- cancelRename();
-// int tabs=0;
- QListView * view = CurrentView();
- QString path = CurrentDir()->canonicalPath() + "/";
- oldName = path + oldName;
- newName = path + newName;
-
- if( view->currentItem() == NULL)
- return;
- if( rename( oldName.latin1(), newName.latin1())== -1)
- QMessageBox::message(tr("Note"),tr("Could not rename"));
- else
- oldName = "";
-
- view->takeItem( view->currentItem() );
- delete view->currentItem();
- populateView();
+void AdvancedFm::okRename() {
+ if( !CurrentView()->currentItem()) return;
+ QString newName = renameBox->text();
+ cancelRename();
+ QListView * view = CurrentView();
+ QString path = CurrentDir()->canonicalPath() + "/";
+ oldName = path + oldName;
+ newName = path + newName;
+
+ if( rename( oldName.latin1(), newName.latin1())== -1)
+ QMessageBox::message(tr("Note"),tr("Could not rename"));
+ else
+ oldName = "";
+
+ view->takeItem( view->currentItem() );
+ delete view->currentItem();
+ populateView();
}
@@ -879,3 +800,3 @@ void AdvancedFm::okRename()
void AdvancedFm::openSearch() {
-
+ QMessageBox::message(tr("Note"),tr("Not Yet Implemented"));
}
diff --git a/noncore/apps/advancedfm/filePermissions.cpp b/noncore/apps/advancedfm/filePermissions.cpp
index 4de6d12..9698de7 100644
--- a/noncore/apps/advancedfm/filePermissions.cpp
+++ b/noncore/apps/advancedfm/filePermissions.cpp
@@ -33,3 +33,3 @@ filePermissions::filePermissions( QWidget* parent, const char* name, bool modal
if ( !name )
- setName( "filePermissions" );
+ setName( tr("filePermissions") );
// qDebug("FilePermissions "+fileName);