Diffstat (limited to 'noncore/apps/advancedfm/advancedfmMenu.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 22 |
1 files changed, 17 insertions, 5 deletions
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 | |||
@@ -1024,20 +1024,29 @@ bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { | |||
1024 | } | 1024 | } |
1025 | } else if ( e->type() == QEvent::FocusOut ) { | 1025 | } else if ( e->type() == QEvent::FocusOut ) { |
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) |
1046 | { | ||
1038 | view = Local_View; | 1047 | view = Local_View; |
1039 | } | 1048 | } |
1040 | else | 1049 | else |
1041 | { | 1050 | { |
1042 | view = Remote_View; | 1051 | view = Remote_View; |
1043 | } | 1052 | } |
@@ -1048,13 +1057,14 @@ void AdvancedFm::cancelRename() { | |||
1048 | if ( resetFocus ) { | 1057 | if ( resetFocus ) { |
1049 | view->viewport()->setFocusProxy( view); | 1058 | view->viewport()->setFocusProxy( view); |
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() ); |
1059 | if ( r.width() > view->visibleWidth() ) | 1069 | if ( r.width() > view->visibleWidth() ) |
1060 | r.setWidth( view->visibleWidth() ); | 1070 | r.setWidth( view->visibleWidth() ); |
@@ -1072,26 +1082,28 @@ void AdvancedFm::doRename(QListView * view) { | |||
1072 | renameBox->setFocus(); | 1082 | renameBox->setFocus(); |
1073 | renameBox->show(); | 1083 | renameBox->show(); |
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 | } |
1083 | 1094 | ||
1084 | void AdvancedFm::remoteRename() | 1095 | void AdvancedFm::remoteRename() |
1085 | { | 1096 | { |
1086 | oldName = Remote_View->currentItem()->text(0); | 1097 | oldName = Remote_View->currentItem()->text(0); |
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; |
1096 | tabs = TabWidget->getCurrentTab(); | 1108 | tabs = TabWidget->getCurrentTab(); |
1097 | if ( tabs == 0) | 1109 | if ( tabs == 0) |