-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 16 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmData.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 66 |
3 files changed, 46 insertions, 40 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 3cd2067..8d07f69 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp @@ -273,31 +273,31 @@ void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , in }; } void AdvancedFm::refreshCurrentTab() { populateView(); // if ( TabWidget->currentWidget() == tab) { } void AdvancedFm::switchToLocalTab() { TabWidget->setCurrentWidget(0); - Local_View->setFocus(); +// Local_View->setFocus(); whichTab = 1; } void AdvancedFm::switchToRemoteTab() { TabWidget->setCurrentWidget(1); - Remote_View->setFocus(); +// Remote_View->setFocus(); whichTab = 2; } void AdvancedFm::currentPathComboChanged() { if(QDir( currentPathCombo->lineEdit()->text()).exists()) { CurrentDir()->setPath( currentPathCombo->lineEdit()->text() ); populateView(); } else { QMessageBox::message(tr("Note"),tr("That directory does not exist")); } } @@ -372,27 +372,31 @@ 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( e->key() == Key_Left ) +// 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) @@ -746,25 +750,25 @@ QListView * AdvancedFm::OtherView() { return Remote_View; else return Local_View; } void AdvancedFm::setOtherTabCurrent() { // qDebug("setOtherTabCurrent() %d",whichTab); if ( whichTab == 1) { TabWidget->setCurrentWidget(1); } else { TabWidget->setCurrentWidget(0); } - OtherView()->setFocus(); +// OtherView()->setFocus(); OtherView()->setSelected( CurrentView()->firstChild(), true); } void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { // odebug << "qcop message "+msg << oendl; QDataStream stream ( data, IO_ReadOnly ); if ( msg == "openDirectory(QString)" ) { // odebug << "received" << oendl; QString file; stream >> file; changeTo( (const QString &) file); } diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp index d2e1d8e..fe565a0 100644 --- a/noncore/apps/advancedfm/advancedfmData.cpp +++ b/noncore/apps/advancedfm/advancedfmData.cpp @@ -119,33 +119,33 @@ void AdvancedFm::init() { QHBoxLayout *CBHB = new QHBoxLayout(); // parent layout will be set later CBHB->setMargin( 0 ); CBHB->setSpacing( 1 ); menuButton = new MenuButton( this ); menuButton->setUseLabel(false); menuButton->setMaximumWidth( 20 ); menuButton->insertItem( s_addBookmark); menuButton->insertItem( s_removeBookmark); menuButton->insertSeparator(); - menuButton->setFocusPolicy(NoFocus); +// menuButton->setFocusPolicy(NoFocus); CBHB->addWidget( menuButton ); customDirsToMenu(); currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); currentPathCombo->setEditable(TRUE); currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); - currentPathCombo->setFocusPolicy(NoFocus); +// currentPathCombo->setFocusPolicy(NoFocus); CBHB->addWidget( currentPathCombo ); layout->addLayout( CBHB ); TabWidget = new OSplitter( Horizontal, this, "TabWidget" ); // TabWidget = new QTabWidget( this, "TabWidget" ); layout->addWidget( TabWidget, 4 ); tab = new QWidget( TabWidget, "tab" ); tabLayout = new QGridLayout( tab ); tabLayout->setSpacing( 2); tabLayout->setMargin( 2); diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index 5a46579..2e6b0da 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp @@ -36,25 +36,25 @@ using namespace Opie::Core; #include <dirent.h> #include <sys/sendfile.h> #include <fcntl.h> 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)+"/"; // owarn << pathItem << oendl; - gotoDirectory( CurrentDir()->path()+"/"+pathItem.left( pathItem.length() - 1) ); + changeTo( CurrentDir()->path()+"/"+pathItem.left( pathItem.length() - 1) ); } } void AdvancedFm::showMenuHidden() { 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); } 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); @@ -731,55 +731,56 @@ void AdvancedFm::startProcess(const QString & cmd) { void AdvancedFm::processEnded(OProcess *) { rePopulate(); } void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { // owarn << "received stderrt " << buflen << " bytes" << oendl; QString lineStr = buffer; QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") ); } 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 ) { - okRename(); - return true; + if ( o->inherits( "QLineEdit" ) ) { + qDebug("QLineEdit event"); + if ( e->type() == QEvent::KeyPress ) { + QKeyEvent *ke = (QKeyEvent*)e; + if ( ke->key() == Key_Return || + ke->key() == Key_Enter ) { + okRename(); + return true; } - else if ( ke->key() == Key_Escape ) { + else if ( ke->key() == Key_Escape ) { cancelRename(); return true; - } + } } - else if ( e->type() == QEvent::FocusOut ) { + else if ( e->type() == QEvent::FocusOut ) { cancelRename(); return true; - } + } } - if ( o->inherits( "QListView" ) ) { +/* if ( o->inherits( "QListView" ) ) { if ( e->type() == QEvent::FocusIn ) { // if( o == Local_View) { //keep track of which view // qDebug("local view"); // whichTab = 1; // } else { // whichTab = 2; // qDebug("remote view"); // } } OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection } - +*/ return QWidget::eventFilter( o, e ); } void AdvancedFm::cancelRename() { // odebug << "cancel rename" << oendl; QListView * view; view = CurrentView(); bool resetFocus = view->viewport()->focusProxy() == renameBox; delete renameBox; renameBox = 0; @@ -803,41 +804,42 @@ void AdvancedFm::doRename(QListView * view) { 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; + if( !CurrentView()->currentItem()) return; - QListView *thisView = CurrentView(); + QListView *thisView = CurrentView(); oldName = thisView->currentItem()->text(0); doRename( thisView ); } void AdvancedFm::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(); + 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(); } void AdvancedFm::openSearch() { QMessageBox::message(tr("Note"),tr("Not Yet Implemented")); } |