author | llornkcor <llornkcor> | 2005-02-06 04:03:25 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2005-02-06 04:03:25 (UTC) |
commit | e23dd592fc71aa22c449363231eac2f8ebd2a45b (patch) (side-by-side diff) | |
tree | 6944284c2632754357578581b564413f0fa09109 | |
parent | b09f9ce74d40f47bc336b4647c6c091a4f3bd5b6 (diff) | |
download | opie-e23dd592fc71aa22c449363231eac2f8ebd2a45b.zip opie-e23dd592fc71aa22c449363231eac2f8ebd2a45b.tar.gz opie-e23dd592fc71aa22c449363231eac2f8ebd2a45b.tar.bz2 |
fix #1499 - rename working
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 36 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 3 |
2 files changed, 4 insertions, 35 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 8cc5d7b..56e3282 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp @@ -312,144 +312,112 @@ QStringList AdvancedFm::getPath() { if ( it.current()->isSelected() ) { strList << it.current()->text(0); // odebug << it.current()->text(0) << oendl; } } return strList; } void AdvancedFm::changeTo(const QString &dir) { chdir( dir.latin1()); CurrentDir()->cd(dir, TRUE); populateView(); update(); } void AdvancedFm::homeButtonPushed() { changeTo(QDir::homeDirPath()); } void AdvancedFm::docButtonPushed() { changeTo(QPEApplication::documentDir()); } void AdvancedFm::SDButtonPushed() { Opie::Core::OStorageInfo info; changeTo(info.sdPath()); } void AdvancedFm::CFButtonPushed() { Opie::Core::OStorageInfo info; changeTo(info.cfPath()); } void AdvancedFm::QPEButtonPushed() { changeTo(QPEApplication::qpeDir()); } void AdvancedFm::doAbout() { QMessageBox::message("AdvancedFm",tr("<P>Advanced FileManager is copyright 2002-2003 by L.J.Potter<llornkcor@handhelds.org> and is licensed by the GPL</P>")); } void AdvancedFm::keyPressEvent( QKeyEvent *e) { Q_UNUSED(e); } void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { // if( CurrentView()->hasFocus() ) // e->ignore(); + if( currentPathCombo->lineEdit()->hasFocus()) { // qDebug("shout!"); } else if( e->key() == Key_Left ) upDir(); else if( e->key() == Key_Return || e->key() == Key_Enter) navigateToSelected(); else if( e->key() == Key_Tab) setOtherTabCurrent(); else if( e->key() == Key_Delete ) del(); - else if( e->key() == Key_A) - copyAs(); - else if( e->key() == Key_C) - copy(); - else if( e->key() == Key_E) - runThis(); - else if( e->key() == Key_G) - currentPathCombo->lineEdit()->setFocus(); - else if( e->key() == Key_H ) - showHidden(); - else if( e->key() == Key_I) - fileStatus(); - else if( e->key() == Key_M) - move(); - else if( e->key() == Key_N ) - mkDir(); - else if( e->key() == Key_P) - filePerms(); - else if( e->key() == Key_R ) - rn(); - else if( e->key() == Key_U ) - upDir(); - else if( e->key() == Key_1) - switchToLocalTab(); - else if( e->key() == Key_2) - switchToRemoteTab(); - else if( e->key() == Key_3) - CFButtonPushed(); - else if( e->key() == Key_4) - SDButtonPushed(); - else if( e->key() == Key_5 ) - homeButtonPushed(); - else if( e->key() == Key_6 ) - docButtonPushed(); else e->accept(); + } 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; } } } endmntent( mntfp ); } QString AdvancedFm::getFileSystemType(const QString ¤tText) { 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; // int totalBlks = fs.f_blocks; diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index 6abdc85..80324eb 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp @@ -820,54 +820,55 @@ void AdvancedFm::cancelRename() { void AdvancedFm::doRename(QListView * view) { if( !CurrentView()->currentItem()) return; QRect r = view->itemRect( view->currentItem( )); r = QRect( view->viewportToContents( r.topLeft() ), r.size() ); r.setX( view->contentsX() ); if ( r.width() > view->visibleWidth() ) r.setWidth( view->visibleWidth() ); renameBox = new QLineEdit( view->viewport(), "qt_renamebox" ); renameBox->setFrame(true); renameBox->setText( view->currentItem()->text(0) ); renameBox->selectAll(); renameBox->installEventFilter( this ); view->addChild( renameBox, r.x(), r.y() ); renameBox->resize( r.size() ); view->viewport()->setFocusProxy( renameBox ); renameBox->setFocus(); renameBox->show(); } void AdvancedFm::renameIt() { if( !CurrentView()->currentItem()) return; QListView *thisView = CurrentView(); oldName = thisView->currentItem()->text(0); doRename( thisView ); } void AdvancedFm::okRename() { qDebug("okrename"); if( !renameBox) 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 = ""; QListViewItem *item = view->currentItem(); view->takeItem( item ); delete item; - rePopulate(); + populateView(); + } void AdvancedFm::openSearch() { QMessageBox::message(tr("Note"),tr("Not Yet Implemented")); } |