author | llornkcor <llornkcor> | 2003-02-21 22:44:28 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-02-21 22:44:28 (UTC) |
commit | a7448ec87d97a0128618e83ad7526bd884ef8853 (patch) (unidiff) | |
tree | 0dda2db8da959c26d0ec089bec161ae28486d2cc | |
parent | d48baa03492fd4785ca273defb4e21bf8c0d1c08 (diff) | |
download | opie-a7448ec87d97a0128618e83ad7526bd884ef8853.zip opie-a7448ec87d97a0128618e83ad7526bd884ef8853.tar.gz opie-a7448ec87d97a0128618e83ad7526bd884ef8853.tar.bz2 |
fix rename cancel.. hehehe
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 34 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 26 |
2 files changed, 45 insertions, 15 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 | |||
@@ -66,8 +66,10 @@ | |||
66 | 66 | ||
67 | AdvancedFm::AdvancedFm( ) | 67 | AdvancedFm::AdvancedFm( ) |
68 | : QMainWindow( ) { | 68 | : QMainWindow( ) { |
69 | init(); | 69 | init(); |
70 | renameBox = 0; | ||
71 | |||
70 | initConnections(); | 72 | initConnections(); |
71 | populateLocalView(); | 73 | populateLocalView(); |
72 | populateRemoteView(); | 74 | populateRemoteView(); |
73 | currentPathCombo->setFocus(); | 75 | currentPathCombo->setFocus(); |
@@ -401,8 +403,16 @@ void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) { | |||
401 | void AdvancedFm::localListPressed( int mouse, QListViewItem *, const QPoint& , int ) { | 403 | void AdvancedFm::localListPressed( int mouse, QListViewItem *, const QPoint& , int ) { |
402 | // qDebug("list pressed"); | 404 | // qDebug("list pressed"); |
403 | switch (mouse) { | 405 | switch (mouse) { |
404 | case 1: | 406 | case 1: |
407 | { | ||
408 | if(renameBox != 0 ) | ||
409 | { | ||
410 | qDebug("cancel rename"); | ||
411 | cancelRename(); | ||
412 | } | ||
413 | |||
414 | } | ||
405 | break; | 415 | break; |
406 | case 2: | 416 | case 2: |
407 | menuTimer.start( 500, TRUE ); | 417 | menuTimer.start( 500, TRUE ); |
408 | qDebug("Start menu timer\n"); | 418 | qDebug("Start menu timer\n"); |
@@ -411,16 +421,23 @@ void AdvancedFm::localListPressed( int mouse, QListViewItem *, const QPoint& , i | |||
411 | } | 421 | } |
412 | 422 | ||
413 | void AdvancedFm::remoteListPressed( int mouse, QListViewItem*, const QPoint&, int ) { | 423 | void AdvancedFm::remoteListPressed( int mouse, QListViewItem*, const QPoint&, int ) { |
414 | 424 | ||
415 | switch (mouse) { | 425 | switch (mouse) { |
416 | case 1: | 426 | case 1: |
417 | break; | 427 | { |
418 | case 2: | 428 | if(renameBox != 0 ) |
419 | menuTimer.start( 500, TRUE ); | 429 | { |
420 | qDebug("Start menu timer"); | 430 | qDebug("cancel rename"); |
421 | break; | 431 | cancelRename(); |
422 | }; | 432 | } |
433 | } | ||
434 | break; | ||
435 | case 2: | ||
436 | menuTimer.start( 500, TRUE ); | ||
437 | qDebug("Start menu timer"); | ||
438 | break; | ||
439 | }; | ||
423 | } | 440 | } |
424 | 441 | ||
425 | 442 | ||
426 | void AdvancedFm::switchToLocalTab() { | 443 | void AdvancedFm::switchToLocalTab() { |
@@ -878,4 +895,5 @@ void AdvancedFm::addToDocs() { | |||
878 | } | 895 | } |
879 | } | 896 | } |
880 | } | 897 | } |
881 | } | 898 | } |
899 | |||
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 | |||
@@ -1026,18 +1026,27 @@ bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { | |||
1026 | cancelRename(); | 1026 | cancelRename(); |
1027 | return true; | 1027 | return true; |
1028 | } | 1028 | } |
1029 | } | 1029 | } |
1030 | if ( o->inherits( "QListView" ) ) { | ||
1031 | if ( e->type() == QEvent::FocusOut ) { | ||
1032 | printf("focusIn\n"); | ||
1033 | |||
1034 | } | ||
1035 | } | ||
1036 | |||
1030 | return QWidget::eventFilter( o, e ); | 1037 | return QWidget::eventFilter( o, e ); |
1031 | } | 1038 | } |
1032 | 1039 | ||
1033 | 1040 | ||
1034 | void AdvancedFm::cancelRename() { | 1041 | void AdvancedFm::cancelRename() |
1042 | { | ||
1035 | qDebug("cancel rename"); | 1043 | qDebug("cancel rename"); |
1036 | QListView * view; | 1044 | QListView * view; |
1037 | if (TabWidget->getCurrentTab() == 0) { | 1045 | if (TabWidget->getCurrentTab() == 0) |
1038 | view = Local_View; | 1046 | { |
1039 | } | 1047 | view = Local_View; |
1048 | } | ||
1040 | else | 1049 | else |
1041 | { | 1050 | { |
1042 | view = Remote_View; | 1051 | view = Remote_View; |
1043 | } | 1052 | } |
@@ -1050,9 +1059,10 @@ void AdvancedFm::cancelRename() { | |||
1050 | view->setFocus(); | 1059 | view->setFocus(); |
1051 | } | 1060 | } |
1052 | } | 1061 | } |
1053 | 1062 | ||
1054 | void AdvancedFm::doRename(QListView * view) { | 1063 | void AdvancedFm::doRename(QListView * view) |
1064 | { | ||
1055 | 1065 | ||
1056 | QRect r = view->itemRect( view->currentItem( )); | 1066 | QRect r = view->itemRect( view->currentItem( )); |
1057 | r = QRect( view->viewportToContents( r.topLeft() ), r.size() ); | 1067 | r = QRect( view->viewportToContents( r.topLeft() ), r.size() ); |
1058 | r.setX( view->contentsX() ); | 1068 | r.setX( view->contentsX() ); |
@@ -1074,9 +1084,10 @@ void AdvancedFm::doRename(QListView * view) { | |||
1074 | 1084 | ||
1075 | } | 1085 | } |
1076 | 1086 | ||
1077 | 1087 | ||
1078 | void AdvancedFm::localRename() { | 1088 | void AdvancedFm::localRename() |
1089 | { | ||
1079 | oldName = Local_View->currentItem()->text(0); | 1090 | oldName = Local_View->currentItem()->text(0); |
1080 | doRename(Local_View ); | 1091 | doRename(Local_View ); |
1081 | populateLocalView(); | 1092 | populateLocalView(); |
1082 | } | 1093 | } |
@@ -1087,9 +1098,10 @@ void AdvancedFm::remoteRename() | |||
1087 | doRename(Local_View ); | 1098 | doRename(Local_View ); |
1088 | populateRemoteView(); | 1099 | populateRemoteView(); |
1089 | } | 1100 | } |
1090 | 1101 | ||
1091 | void AdvancedFm::okRename() { | 1102 | void AdvancedFm::okRename() |
1103 | { | ||
1092 | QString newName = renameBox->text(); | 1104 | QString newName = renameBox->text(); |
1093 | cancelRename(); | 1105 | cancelRename(); |
1094 | int tabs=0; | 1106 | int tabs=0; |
1095 | QListView * view; | 1107 | QListView * view; |