summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2003-02-21 22:44:28 (UTC)
committer llornkcor <llornkcor>2003-02-21 22:44:28 (UTC)
commita7448ec87d97a0128618e83ad7526bd884ef8853 (patch) (side-by-side diff)
tree0dda2db8da959c26d0ec089bec161ae28486d2cc
parentd48baa03492fd4785ca273defb4e21bf8c0d1c08 (diff)
downloadopie-a7448ec87d97a0128618e83ad7526bd884ef8853.zip
opie-a7448ec87d97a0128618e83ad7526bd884ef8853.tar.gz
opie-a7448ec87d97a0128618e83ad7526bd884ef8853.tar.bz2
fix rename cancel.. hehehe
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp18
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp22
2 files changed, 35 insertions, 5 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index c653b90..9edf7c1 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -54,32 +54,34 @@
#include <stdlib.h>
#include <sys/stat.h>
#include <dirent.h>
#include <stdio.h>
#include <time.h>
#include <fcntl.h>
#include <mntent.h>
#include <string.h>
#include <errno.h>
#include <sys/vfs.h>
#include <mntent.h>
#include <sys/utsname.h>
AdvancedFm::AdvancedFm( )
: QMainWindow( ) {
init();
+ renameBox = 0;
+
initConnections();
populateLocalView();
populateRemoteView();
currentPathCombo->setFocus();
}
AdvancedFm::~AdvancedFm() {
}
void AdvancedFm::cleanUp() {
QString sfile=QDir::homeDirPath();
if(sfile.right(1) != "/")
sfile+="/._temp";
else
sfile+="._temp";
QFile file( sfile);
@@ -389,44 +391,59 @@ void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) {
// qDebug("clicked item "+strItem);
// DocLnk doc( strItem, FALSE );
// doc.execute();
// Remote_View->clearSelection();
}
} //end not symlink
chdir(strItem.latin1());
}
}
}
void AdvancedFm::localListPressed( int mouse, QListViewItem *, const QPoint& , int ) {
// qDebug("list pressed");
switch (mouse) {
case 1:
+ {
+ if(renameBox != 0 )
+ {
+ qDebug("cancel rename");
+ cancelRename();
+ }
+
+ }
break;
case 2:
menuTimer.start( 500, TRUE );
qDebug("Start menu timer\n");
break;
};
}
void AdvancedFm::remoteListPressed( int mouse, QListViewItem*, const QPoint&, int ) {
switch (mouse) {
case 1:
+ {
+ if(renameBox != 0 )
+ {
+ qDebug("cancel rename");
+ cancelRename();
+ }
+ }
break;
case 2:
menuTimer.start( 500, TRUE );
qDebug("Start menu timer");
break;
};
}
void AdvancedFm::switchToLocalTab() {
TabWidget->setCurrentTab(0);
Local_View->setFocus();
}
void AdvancedFm::switchToRemoteTab() {
TabWidget->setCurrentTab(1);
@@ -866,16 +883,17 @@ void AdvancedFm::addToDocs() {
f.writeLink();
}
} else {
for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) {
curFile = currentRemoteDir.canonicalPath()+"/"+(*it);
qDebug(curFile);
DocLnk f;
// curFile.replace(QRegExp("\\..*"),"");
f.setName((*it));
f.setFile( curFile);
f.writeLink();
}
}
}
}
+
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp
index f067013..2ddcabc 100644
--- a/noncore/apps/advancedfm/advancedfmMenu.cpp
+++ b/noncore/apps/advancedfm/advancedfmMenu.cpp
@@ -1014,94 +1014,106 @@ 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;
} else if ( ke->key() == Key_Escape ) {
cancelRename();
return true;
}
} else if ( e->type() == QEvent::FocusOut ) {
cancelRename();
return true;
}
}
+ if ( o->inherits( "QListView" ) ) {
+ if ( e->type() == QEvent::FocusOut ) {
+ printf("focusIn\n");
+
+ }
+ }
+
return QWidget::eventFilter( o, e );
}
-void AdvancedFm::cancelRename() {
+void AdvancedFm::cancelRename()
+{
qDebug("cancel rename");
QListView * view;
- if (TabWidget->getCurrentTab() == 0) {
+ if (TabWidget->getCurrentTab() == 0)
+ {
view = Local_View;
}
else
{
view = Remote_View;
}
bool resetFocus = view->viewport()->focusProxy() == renameBox;
delete renameBox;
renameBox = 0;
if ( resetFocus ) {
view->viewport()->setFocusProxy( view);
view->setFocus();
}
}
-void AdvancedFm::doRename(QListView * view) {
+void AdvancedFm::doRename(QListView * view)
+{
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::localRename() {
+void AdvancedFm::localRename()
+{
oldName = Local_View->currentItem()->text(0);
doRename(Local_View );
populateLocalView();
}
void AdvancedFm::remoteRename()
{
oldName = Remote_View->currentItem()->text(0);
doRename(Local_View );
populateRemoteView();
}
-void AdvancedFm::okRename() {
+void AdvancedFm::okRename()
+{
QString newName = renameBox->text();
cancelRename();
int tabs=0;
QListView * view;
tabs = TabWidget->getCurrentTab();
if ( tabs == 0)
{
view = Local_View;
QString path = currentDir.canonicalPath() + "/";
oldName = path + oldName;
newName = path + newName;
}
else
{
view = Remote_View;
QString path = currentRemoteDir.canonicalPath() + "/";