summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp34
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp26
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
@@ -64,12 +64,14 @@
64#include <mntent.h> 64#include <mntent.h>
65#include <sys/utsname.h> 65#include <sys/utsname.h>
66 66
67AdvancedFm::AdvancedFm( ) 67AdvancedFm::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();
74} 76}
75 77
@@ -399,30 +401,45 @@ void AdvancedFm::remoteListClicked(QListViewItem *selectedItem) {
399 401
400 402
401void AdvancedFm::localListPressed( int mouse, QListViewItem *, const QPoint& , int ) { 403void 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");
409 break; 419 break;
410 }; 420 };
411} 421}
412 422
413void AdvancedFm::remoteListPressed( int mouse, QListViewItem*, const QPoint&, int ) { 423void 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
426void AdvancedFm::switchToLocalTab() { 443void AdvancedFm::switchToLocalTab() {
427 TabWidget->setCurrentTab(0); 444 TabWidget->setCurrentTab(0);
428 Local_View->setFocus(); 445 Local_View->setFocus();
@@ -876,6 +893,7 @@ void AdvancedFm::addToDocs() {
876 f.setFile( curFile); 893 f.setFile( curFile);
877 f.writeLink(); 894 f.writeLink();
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
@@ -1024,22 +1024,31 @@ 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
1034void AdvancedFm::cancelRename() { 1041void 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 }
1044 1053
1045 bool resetFocus = view->viewport()->focusProxy() == renameBox; 1054 bool resetFocus = view->viewport()->focusProxy() == renameBox;
@@ -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
1054void AdvancedFm::doRename(QListView * view) { 1063void 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
1078void AdvancedFm::localRename() { 1088void 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
1084void AdvancedFm::remoteRename() 1095void 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
1091void AdvancedFm::okRename() { 1102void 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)