author | llornkcor <llornkcor> | 2003-09-08 22:22:00 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-09-08 22:22:00 (UTC) |
commit | e485a3bd44b3cc70280e03eb8a7958a5252cdd6a (patch) (side-by-side diff) | |
tree | cce07d76c2a9060a774898af46e7c8dc8c7b3403 | |
parent | b3299bab3370865e0e498fd2f7f84f3abbd17e77 (diff) | |
download | opie-e485a3bd44b3cc70280e03eb8a7958a5252cdd6a.zip opie-e485a3bd44b3cc70280e03eb8a7958a5252cdd6a.tar.gz opie-e485a3bd44b3cc70280e03eb8a7958a5252cdd6a.tar.bz2 |
changes for osplitter functionality
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 345 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 7 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmData.cpp | 30 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 317 | ||||
-rw-r--r-- | noncore/apps/advancedfm/filePermissions.cpp | 2 |
5 files changed, 300 insertions, 401 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> @@ -69,4 +71,3 @@ AdvancedFm::~AdvancedFm() { -void AdvancedFm::cleanUp() -{ +void AdvancedFm::cleanUp() { QString sfile=QDir::homeDirPath(); @@ -81,11 +82,4 @@ void AdvancedFm::cleanUp() -void AdvancedFm::tabChanged(QWidget *w) -{ - if( w == tab) - whichTab = 1; - else - whichTab = 2; - -// qDebug("tab changed %d", whichTab ); - +void AdvancedFm::tabChanged(QWidget *) { +// qWarning("tab changed"); QString path = CurrentDir()->canonicalPath(); @@ -93,4 +87,9 @@ void AdvancedFm::tabChanged(QWidget *w) - viewMenu->setItemChecked(viewMenu->idAt(0),TRUE); - viewMenu->setItemChecked(viewMenu->idAt(1),FALSE); + 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); + } @@ -98,4 +97,4 @@ void AdvancedFm::tabChanged(QWidget *w) - setCaption("AdvancedFm :: "+fs+" :: " - +checkDiskSpace( (const QString &) path )+ " kB free" ); + setCaption(tr("AdvancedFm :: ")+fs+" :: " + +checkDiskSpace( (const QString &) path )+ tr(" kB free") ); chdir( path.latin1()); @@ -104,4 +103,3 @@ void AdvancedFm::tabChanged(QWidget *w) -void AdvancedFm::populateView() -{ +void AdvancedFm::populateView() { QPixmap pm; @@ -110,3 +108,3 @@ void AdvancedFm::populateView() QString path = thisDir->canonicalPath(); - +// qWarning("path is "+path); thisView->clear(); @@ -117,4 +115,4 @@ void AdvancedFm::populateView() QString fs= getFileSystemType((const QString &) path); - setCaption("AdvancedFm :: "+fs+" :: " - +checkDiskSpace((const QString &) path)+" kB free" ); + setCaption(tr("AdvancedFm :: ")+fs+" :: " + +checkDiskSpace((const QString &) path)+ tr(" kB free") ); bool isDir=FALSE; @@ -135,2 +133,3 @@ void AdvancedFm::populateView() if( QDir(QDir::cleanDirPath( path +"/"+fileL)).exists() ) { +// if(fileL == "..") fileL+="/"; @@ -213,20 +212,22 @@ void AdvancedFm::populateView() -void AdvancedFm::rePopulate() -{ - int tmpTab = whichTab; - qDebug("%d", tmpTab); - - for(int i =1; i < 3; i++) - { - TabWidget->setCurrentWidget(i - 1); +void AdvancedFm::rePopulate() { populateView(); - } - TabWidget->setCurrentWidget( tmpTab - 1); + setOtherTabCurrent(); + populateView(); + +// 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,4 +237,3 @@ void AdvancedFm::ListClicked(QListViewItem *selectedItem) - if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 )//if symlink - { + if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink strItem2 = dealWithSymName((const QString&)strItem); @@ -243,4 +243,3 @@ void AdvancedFm::ListClicked(QListViewItem *selectedItem) - if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) - { + if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { @@ -250,4 +249,3 @@ void AdvancedFm::ListClicked(QListViewItem *selectedItem) - if( isDirectory ) - { + if( isDirectory ) { CurrentDir()->cd( strItem, TRUE); @@ -260,3 +258,4 @@ void AdvancedFm::ListClicked(QListViewItem *selectedItem) -void AdvancedFm::ListPressed( int mouse, QListViewItem *, const QPoint& , int ) { +void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) { + dealWithSchmooSchmaa( item->listView()); switch (mouse) { @@ -264,4 +263,3 @@ void AdvancedFm::ListPressed( int mouse, QListViewItem *, const QPoint& , int ) { - if(renameBox != 0 ) - { + if(renameBox != 0 ) { cancelRename(); @@ -276,4 +274,5 @@ void AdvancedFm::ListPressed( int mouse, QListViewItem *, const QPoint& , int ) -void AdvancedFm::switchToLocalTab() -{ + +void AdvancedFm::switchToLocalTab() { +//qWarning("switch to local view"); TabWidget->setCurrentWidget(0); @@ -282,4 +281,4 @@ void AdvancedFm::switchToLocalTab() -void AdvancedFm::switchToRemoteTab() -{ +void AdvancedFm::switchToRemoteTab() { +//qWarning("switch to local view"); TabWidget->setCurrentWidget(1); @@ -288,4 +287,3 @@ void AdvancedFm::switchToRemoteTab() -void AdvancedFm::readConfig() -{ +void AdvancedFm::readConfig() { Config cfg("AdvancedFm"); @@ -293,4 +291,3 @@ void AdvancedFm::readConfig() -void AdvancedFm::writeConfig() -{ +void AdvancedFm::writeConfig() { Config cfg("AdvancedFm"); @@ -298,11 +295,7 @@ void AdvancedFm::writeConfig() -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")); @@ -311,10 +304,7 @@ void AdvancedFm::currentPathComboChanged() -void AdvancedFm::fillCombo(const QString ¤tPath) -{ -// qDebug("%d",TabWidget->currentTab()); - if ( whichTab == 1) - { +void AdvancedFm::fillCombo(const QString ¤tPath) { + + if ( whichTab == 1) { currentPathCombo->lineEdit()->setText( currentPath); - if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) - { + if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { currentPathCombo->clear(); @@ -323,8 +313,5 @@ void AdvancedFm::fillCombo(const QString ¤tPath) } - } - else - { + } else { currentPathCombo->lineEdit()->setText( currentPath); - if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) - { + if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { currentPathCombo->clear(); @@ -336,4 +323,3 @@ void AdvancedFm::fillCombo(const QString ¤tPath) -void AdvancedFm::currentPathComboActivated(const QString & currentPath) -{ +void AdvancedFm::currentPathComboActivated(const QString & currentPath) { chdir( currentPath.latin1() ); @@ -344,4 +330,3 @@ void AdvancedFm::currentPathComboActivated(const QString & currentPath) -QStringList AdvancedFm::getPath() -{ +QStringList AdvancedFm::getPath() { QStringList strList; @@ -350,6 +335,4 @@ QStringList AdvancedFm::getPath() QListViewItemIterator it( thisView ); - for ( ; it.current(); ++it ) - { - if ( it.current()->isSelected() ) - { + for ( ; it.current(); ++it ) { + if ( it.current()->isSelected() ) { strList << it.current()->text(0); @@ -361,4 +344,3 @@ QStringList AdvancedFm::getPath() -void AdvancedFm::homeButtonPushed() -{ +void AdvancedFm::homeButtonPushed() { QString current = QDir::homeDirPath(); @@ -370,4 +352,3 @@ void AdvancedFm::homeButtonPushed() -void AdvancedFm::docButtonPushed() -{ +void AdvancedFm::docButtonPushed() { QString current = QPEApplication::documentDir(); @@ -379,4 +360,3 @@ void AdvancedFm::docButtonPushed() -void AdvancedFm::SDButtonPushed() -{ +void AdvancedFm::SDButtonPushed() { QString current = "/mnt/card";// this can change so fix @@ -388,4 +368,3 @@ void AdvancedFm::SDButtonPushed() -void AdvancedFm::CFButtonPushed() -{ +void AdvancedFm::CFButtonPushed() { QString current; @@ -402,4 +381,3 @@ void AdvancedFm::CFButtonPushed() -void AdvancedFm::doAbout() -{ +void AdvancedFm::doAbout() { QMessageBox::message("AdvancedFm",tr("Advanced FileManager\n" @@ -410,8 +388,20 @@ void AdvancedFm::doAbout() -void AdvancedFm::keyPressEvent( QKeyEvent *e) -{ -// e->accept(); - if( CurrentView()->hasFocus() ) +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: @@ -486,4 +476,3 @@ void AdvancedFm::keyPressEvent( QKeyEvent *e) -void AdvancedFm::keyReleaseEvent( QKeyEvent *e) -{ +void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { if( CurrentView()->hasFocus() ) @@ -493,4 +482,3 @@ void AdvancedFm::keyReleaseEvent( QKeyEvent *e) -void AdvancedFm::QPEButtonPushed() -{ +void AdvancedFm::QPEButtonPushed() { QString current = QPEApplication::qpeDir(); @@ -502,4 +490,3 @@ void AdvancedFm::QPEButtonPushed() -void AdvancedFm::parsetab(const QString &fileName) -{ +void AdvancedFm::parsetab(const QString &fileName) { @@ -509,6 +496,4 @@ void AdvancedFm::parsetab(const QString &fileName) FILE *mntfp = setmntent( fileName.latin1(), "r" ); - if ( mntfp ) - { - while ( (me = getmntent( mntfp )) != 0 ) - { + if ( mntfp ) { + while ( (me = getmntent( mntfp )) != 0 ) { QString deviceName = me->mnt_fsname; @@ -516,4 +501,3 @@ void AdvancedFm::parsetab(const QString &fileName) QString mountDir = me->mnt_dir; - if(deviceName != "none") - { + if(deviceName != "none") { if( fsList.contains(filesystemType) == 0 @@ -530,4 +514,3 @@ void AdvancedFm::parsetab(const QString &fileName) -QString AdvancedFm::getFileSystemType(const QString ¤tText) -{ +QString AdvancedFm::getFileSystemType(const QString ¤tText) { parsetab("/etc/mtab"); //why did TT forget filesystem type? @@ -547,4 +530,3 @@ QString AdvancedFm::getFileSystemType(const QString ¤tText) -QString AdvancedFm::getDiskSpace( const QString &path) -{ +QString AdvancedFm::getDiskSpace( const QString &path) { struct statfs fss; @@ -566,4 +548,3 @@ QString AdvancedFm::getDiskSpace( const QString &path) -void AdvancedFm::showFileMenu() -{ +void AdvancedFm::showFileMenu() { QString curApp; @@ -579,9 +560,6 @@ void AdvancedFm::showFileMenu() - if ( QFileInfo(fi).isDir() ) - { + if ( QFileInfo(fi).isDir() ) { m->insertSeparator(); m->insertItem( tr( "Change Directory" ), this, SLOT( doDirChange() )); - } - else - { + } else { @@ -636,5 +614,4 @@ void AdvancedFm::showFileMenu() -void AdvancedFm::cancelMenuTimer() -{ -// qDebug("selectionChanged: cancel menu timer"); +void AdvancedFm::cancelMenuTimer() { + if( menuTimer.isActive() ) @@ -643,7 +620,5 @@ void AdvancedFm::cancelMenuTimer() -QString AdvancedFm::checkDiskSpace(const QString &path) -{ +QString AdvancedFm::checkDiskSpace(const QString &path) { struct statfs fss; - if ( !statfs( path.latin1(), &fss ) ) - { + if ( !statfs( path.latin1(), &fss ) ) { int blkSize = fss.f_bsize; @@ -663,4 +638,3 @@ QString AdvancedFm::checkDiskSpace(const QString &path) -void AdvancedFm::addToDocs() -{ +void AdvancedFm::addToDocs() { QStringList strListPaths = getPath(); @@ -684,4 +658,3 @@ void AdvancedFm::addToDocs() -void AdvancedFm::customDirsToMenu() -{ +void AdvancedFm::customDirsToMenu() { @@ -699,5 +672,3 @@ void AdvancedFm::customDirsToMenu() -void AdvancedFm::dirMenuSelected(int item) -{ - qDebug("menu item %d", item); +void AdvancedFm::dirMenuSelected(int item) { switch(item) @@ -723,4 +694,3 @@ void AdvancedFm::dirMenuSelected(int item) -void AdvancedFm::addCustomDir() -{ +void AdvancedFm::addCustomDir() { Config cfg("AdvancedFm"); @@ -733,6 +703,4 @@ void AdvancedFm::addCustomDir() bool addIt=true; - for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) - { - if( dir == (*it)) - { + for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { + if( dir == (*it)) { addIt=false; @@ -740,4 +708,3 @@ void AdvancedFm::addCustomDir() } - if(addIt) - { + if(addIt) { menuButton->insertItem(dir); @@ -751,4 +718,3 @@ void AdvancedFm::addCustomDir() -void AdvancedFm::removeCustomDir() -{ +void AdvancedFm::removeCustomDir() { // qDebug("remove custom dir"); @@ -763,17 +729,11 @@ void AdvancedFm::removeCustomDir() //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 - { + } 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 { // customDirMenu->removeItem( ramble); @@ -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,12 +759,8 @@ 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 - { + } else { gotoDirectory( dir); @@ -821,10 +776,7 @@ void AdvancedFm::gotoCustomDir(const QString &dir) -QDir *AdvancedFm::CurrentDir() -{ - if ( whichTab == 1) - { +QDir *AdvancedFm::CurrentDir() { + + if ( whichTab == 1) { return ¤tDir; - } - else - { + } else { return ¤tRemoteDir; @@ -833,10 +785,6 @@ QDir *AdvancedFm::CurrentDir() -QDir *AdvancedFm::OtherDir() -{ - if ( whichTab == 1) - { +QDir *AdvancedFm::OtherDir() { + if ( whichTab == 1) { return ¤tRemoteDir; - } - else - { + } else { return ¤tDir; @@ -845,12 +793,13 @@ QDir *AdvancedFm::OtherDir() -QListView * AdvancedFm::CurrentView() -{ - if ( whichTab == 1) +QListView * AdvancedFm::CurrentView() { + if ( whichTab == 1) { +// qWarning("CurrentView Tab 1"); return Local_View; - else + } else { +// qWarning("CurrentView Tab 2"); return Remote_View; } +} -QListView * AdvancedFm::OtherView() -{ +QListView * AdvancedFm::OtherView() { if ( whichTab == 1) @@ -861,15 +810,18 @@ QListView * AdvancedFm::OtherView() -void AdvancedFm::setOtherTabCurrent() -{ - if ( whichTab == 1) +void AdvancedFm::setOtherTabCurrent() { +// qWarning("setOtherTabCurrent()"); + if ( whichTab == 1) { TabWidget->setCurrentWidget(1); - else + } else { TabWidget->setCurrentWidget(0); } + OtherView()->setFocus(); + OtherView()->setSelected( CurrentView()->firstChild(), true); +} 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; @@ -886,3 +838,3 @@ void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { void AdvancedFm::gotoDirectory(const QString &file) { - +// qWarning("goto dir "+file); QString curDir = 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->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->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,2 +153,4 @@ void AdvancedFm::init() { Local_View->setSelectionMode(QListView::Extended); + Local_View->setFocusPolicy(StrongFocus); + Local_View->installEventFilter( this ); @@ -172,3 +177,4 @@ void AdvancedFm::init() { Remote_View->setSelectionMode(QListView::Extended); - + Remote_View->setFocusPolicy(StrongFocus); + Remote_View->installEventFilter( this ); @@ -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() -{ +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,4 +85,3 @@ void AdvancedFm::showHidden() -QString AdvancedFm::dealWithSymName(const QString &fileName) -{ +QString AdvancedFm::dealWithSymName(const QString &fileName) { QString strItem = fileName; @@ -101,4 +90,4 @@ QString AdvancedFm::dealWithSymName(const QString &fileName) -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,4 +233,3 @@ void AdvancedFm::doDelete() -void AdvancedFm::filePerms() -{ +void AdvancedFm::filePerms() { QStringList curFileList = getPath(); @@ -261,4 +239,3 @@ void AdvancedFm::filePerms() - for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) - { + for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { filePermissions *filePerm; @@ -273,4 +250,3 @@ void AdvancedFm::filePerms() -void AdvancedFm::doProperties() -{ +void AdvancedFm::doProperties() { #if defined(QT_QWS_OPIE) @@ -282,7 +258,6 @@ void AdvancedFm::doProperties() - qDebug("%d",curFileList.count()); +// qDebug("%d",curFileList.count()); - for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) - { - qDebug((filePath+*it)); + for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { +// qDebug((filePath+*it)); DocLnk lnk( (filePath+*it)); @@ -296,4 +271,3 @@ void AdvancedFm::doProperties() -void AdvancedFm::upDir() -{ +void AdvancedFm::upDir() { QDir *thisDir = CurrentDir(); @@ -310,4 +284,3 @@ void AdvancedFm::upDir() -void AdvancedFm::copy() -{ +void AdvancedFm::copy() { qApp->processEvents(); @@ -337,4 +310,3 @@ void AdvancedFm::copy() QString curFile, item, destFile; - for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) - { + for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { item=(*it); @@ -346,14 +318,11 @@ void AdvancedFm::copy() - qDebug("Destination file is "+destFile); - qDebug("CurrentFile file is " + curFile); +// qDebug("Destination file is "+destFile); +// qDebug("CurrentFile file is " + curFile); QFile f(destFile); - if( f.exists()) - { - if(doMsg) - { + 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) ) - { + tr("Yes"),tr("No"),0,0,1) ) { case 1: @@ -372,4 +341,4 @@ void AdvancedFm::copy() } + rePopulate(); setOtherTabCurrent(); - populateView(); } @@ -377,4 +346,3 @@ void AdvancedFm::copy() -void AdvancedFm::copyAs() -{ +void AdvancedFm::copyAs() { qApp->processEvents(); @@ -388,4 +356,3 @@ void AdvancedFm::copyAs() - for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) - { + for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { QString destFile; @@ -398,4 +365,3 @@ void AdvancedFm::copyAs() - if( fileDlg->result() == 1 ) - { + if( fileDlg->result() == 1 ) { QString filename = fileDlg->LineEdit1->text(); @@ -404,8 +370,6 @@ void AdvancedFm::copyAs() QFile f( destFile); - if( f.exists()) - { + if( f.exists()) { switch (QMessageBox::warning(this,tr("File Exists!"), item+tr("\nexists. Ok to overwrite?"), - tr("Yes"),tr("No"),0,0,1) ) - { + tr("Yes"),tr("No"),0,0,1) ) { case 0: @@ -427,8 +391,7 @@ void AdvancedFm::copyAs() } + rePopulate(); setOtherTabCurrent(); - populateView(); } -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); @@ -521,9 +478,7 @@ 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; @@ -560,3 +515,3 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest ) success = false; - qWarning(msg); +// qWarning(msg); } @@ -578,4 +533,4 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest ) -void AdvancedFm::runCommand() -{ +void AdvancedFm::runCommand() { + if( !CurrentView()->currentItem()) return; QDir *thisDir = CurrentDir(); @@ -591,5 +546,4 @@ void AdvancedFm::runCommand() - if( fileDlg->result() == 1 ) - { - qDebug(fileDlg->LineEdit1->text()); + if( fileDlg->result() == 1 ) { +// qDebug(fileDlg->LineEdit1->text()); QStringList command; @@ -608,4 +562,4 @@ void AdvancedFm::runCommand() -void AdvancedFm::runCommandStd() -{ +void AdvancedFm::runCommandStd() { + if( !CurrentView()->currentItem()) return; QString curFile; @@ -621,4 +575,3 @@ void AdvancedFm::runCommandStd() - if( fileDlg->result() == 1 ) - { + if( fileDlg->result() == 1 ) { qApp->processEvents(); @@ -628,4 +581,4 @@ void AdvancedFm::runCommandStd() -void AdvancedFm::fileStatus() -{ +void AdvancedFm::fileStatus() { + if( !CurrentView()->currentItem()) return; QString curFile; @@ -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,9 +718,12 @@ 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,4 +772,4 @@ void AdvancedFm::doRename(QListView * view) -void AdvancedFm::renameIt() -{ +void AdvancedFm::renameIt() { + if( !CurrentView()->currentItem()) return; QListView *thisView = CurrentView(); @@ -856,7 +780,6 @@ void AdvancedFm::renameIt() -void AdvancedFm::okRename() -{ +void AdvancedFm::okRename() { + if( !CurrentView()->currentItem()) return; QString newName = renameBox->text(); cancelRename(); -// int tabs=0; QListView * view = CurrentView(); @@ -866,4 +789,2 @@ void AdvancedFm::okRename() - if( view->currentItem() == NULL) - return; if( rename( oldName.latin1(), newName.latin1())== -1) @@ -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); |