summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp16
-rw-r--r--noncore/apps/advancedfm/advancedfmData.cpp4
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp66
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
@@ -261,55 +261,55 @@ void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , in
261 Q_UNUSED(item); 261 Q_UNUSED(item);
262 switch (mouse) { 262 switch (mouse) {
263 case 1: 263 case 1:
264 { 264 {
265 if(renameBox != 0 ) { 265 if(renameBox != 0 ) {
266 cancelRename(); 266 cancelRename();
267 } 267 }
268 } 268 }
269 break; 269 break;
270// case 2: 270// case 2:
271// menuTimer.start( 50, TRUE ); 271// menuTimer.start( 50, TRUE );
272// break; 272// break;
273 }; 273 };
274} 274}
275 275
276 276
277void AdvancedFm::refreshCurrentTab() { 277void AdvancedFm::refreshCurrentTab() {
278 populateView(); 278 populateView();
279 // if ( TabWidget->currentWidget() == tab) { 279 // if ( TabWidget->currentWidget() == tab) {
280 280
281} 281}
282 282
283void AdvancedFm::switchToLocalTab() { 283void AdvancedFm::switchToLocalTab() {
284 TabWidget->setCurrentWidget(0); 284 TabWidget->setCurrentWidget(0);
285 Local_View->setFocus(); 285 // Local_View->setFocus();
286 whichTab = 1; 286 whichTab = 1;
287} 287}
288 288
289void AdvancedFm::switchToRemoteTab() { 289void AdvancedFm::switchToRemoteTab() {
290 TabWidget->setCurrentWidget(1); 290 TabWidget->setCurrentWidget(1);
291 Remote_View->setFocus(); 291 // Remote_View->setFocus();
292 whichTab = 2; 292 whichTab = 2;
293} 293}
294 294
295void AdvancedFm::currentPathComboChanged() { 295void AdvancedFm::currentPathComboChanged() {
296 if(QDir( currentPathCombo->lineEdit()->text()).exists()) { 296 if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
297 CurrentDir()->setPath( currentPathCombo->lineEdit()->text() ); 297 CurrentDir()->setPath( currentPathCombo->lineEdit()->text() );
298 populateView(); 298 populateView();
299 } else { 299 } else {
300 QMessageBox::message(tr("Note"),tr("That directory does not exist")); 300 QMessageBox::message(tr("Note"),tr("That directory does not exist"));
301 } 301 }
302} 302}
303 303
304void AdvancedFm::fillCombo(const QString &currentPath) { 304void AdvancedFm::fillCombo(const QString &currentPath) {
305 305
306 if ( TabWidget->currentWidget() == tab) { 306 if ( TabWidget->currentWidget() == tab) {
307// if ( whichTab == 1) { 307// if ( whichTab == 1) {
308 currentPathCombo->lineEdit()->setText( currentPath); 308 currentPathCombo->lineEdit()->setText( currentPath);
309 if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { 309 if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) {
310 currentPathCombo->clear(); 310 currentPathCombo->clear();
311 localDirPathStringList.prepend( currentPath ); 311 localDirPathStringList.prepend( currentPath );
312 currentPathCombo->insertStringList( localDirPathStringList,-1); 312 currentPathCombo->insertStringList( localDirPathStringList,-1);
313 } 313 }
314 } else { 314 } else {
315 currentPathCombo->lineEdit()->setText( currentPath); 315 currentPathCombo->lineEdit()->setText( currentPath);
@@ -360,51 +360,55 @@ void AdvancedFm::docButtonPushed() {
360void AdvancedFm::SDButtonPushed() { 360void AdvancedFm::SDButtonPushed() {
361 changeTo("/mnt/card");// this can change so fix 361 changeTo("/mnt/card");// this can change so fix
362} 362}
363 363
364void AdvancedFm::CFButtonPushed() { 364void AdvancedFm::CFButtonPushed() {
365 if(zaurusDevice) 365 if(zaurusDevice)
366 changeTo("/mnt/cf"); //zaurus 366 changeTo("/mnt/cf"); //zaurus
367 else 367 else
368 changeTo("/mnt/hda"); //ipaq 368 changeTo("/mnt/hda"); //ipaq
369} 369}
370 370
371void AdvancedFm::QPEButtonPushed() { 371void AdvancedFm::QPEButtonPushed() {
372 changeTo(QPEApplication::qpeDir()); 372 changeTo(QPEApplication::qpeDir());
373} 373}
374 374
375void AdvancedFm::doAbout() { 375void AdvancedFm::doAbout() {
376 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>")); 376 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>"));
377} 377}
378 378
379void AdvancedFm::keyPressEvent( QKeyEvent *e) { 379void AdvancedFm::keyPressEvent( QKeyEvent *e) {
380 Q_UNUSED(e); 380 Q_UNUSED(e);
381} 381}
382 382
383void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { 383void AdvancedFm::keyReleaseEvent( QKeyEvent *e) {
384 if( CurrentView()->hasFocus() ) 384// if( CurrentView()->hasFocus() )
385 e->ignore(); 385// e->ignore();
386 if( e->key() == Key_Left ) 386 if( currentPathCombo->lineEdit()->hasFocus()) {
387 // qDebug("shout!");
388 }
389
390 else if( e->key() == Key_Left )
387 upDir(); 391 upDir();
388 else if( e->key() == Key_Return || e->key() == Key_Enter) 392 else if( e->key() == Key_Return || e->key() == Key_Enter)
389 navigateToSelected(); 393 navigateToSelected();
390 else if( e->key() == Key_Tab) 394 else if( e->key() == Key_Tab)
391 setOtherTabCurrent(); 395 setOtherTabCurrent();
392 else if( e->key() == Key_Delete ) 396 else if( e->key() == Key_Delete )
393 del(); 397 del();
394 else if( e->key() == Key_A) 398 else if( e->key() == Key_A)
395 copyAs(); 399 copyAs();
396 else if( e->key() == Key_C) 400 else if( e->key() == Key_C)
397 copy(); 401 copy();
398 else if( e->key() == Key_E) 402 else if( e->key() == Key_E)
399 runThis(); 403 runThis();
400 else if( e->key() == Key_G) 404 else if( e->key() == Key_G)
401 currentPathCombo->lineEdit()->setFocus(); 405 currentPathCombo->lineEdit()->setFocus();
402 else if( e->key() == Key_H ) 406 else if( e->key() == Key_H )
403 showHidden(); 407 showHidden();
404 else if( e->key() == Key_I) 408 else if( e->key() == Key_I)
405 fileStatus(); 409 fileStatus();
406 else if( e->key() == Key_M) 410 else if( e->key() == Key_M)
407 move(); 411 move();
408 else if( e->key() == Key_N ) 412 else if( e->key() == Key_N )
409 mkDir(); 413 mkDir();
410 else if( e->key() == Key_P) 414 else if( e->key() == Key_P)
@@ -734,49 +738,49 @@ QListView * AdvancedFm::CurrentView() {
734 if ( whichTab == 1) { 738 if ( whichTab == 1) {
735 // qDebug("CurrentView: local"); 739 // qDebug("CurrentView: local");
736 return Local_View; 740 return Local_View;
737 } else { 741 } else {
738// owarn << "CurrentView Tab 2" << oendl; 742// owarn << "CurrentView Tab 2" << oendl;
739 // qDebug("CurrentView: remote"); 743 // qDebug("CurrentView: remote");
740 return Remote_View; 744 return Remote_View;
741 } 745 }
742} 746}
743 747
744QListView * AdvancedFm::OtherView() { 748QListView * AdvancedFm::OtherView() {
745 if ( whichTab == 1) 749 if ( whichTab == 1)
746 return Remote_View; 750 return Remote_View;
747 else 751 else
748 return Local_View; 752 return Local_View;
749} 753}
750 754
751void AdvancedFm::setOtherTabCurrent() { 755void AdvancedFm::setOtherTabCurrent() {
752 // qDebug("setOtherTabCurrent() %d",whichTab); 756 // qDebug("setOtherTabCurrent() %d",whichTab);
753 if ( whichTab == 1) { 757 if ( whichTab == 1) {
754 TabWidget->setCurrentWidget(1); 758 TabWidget->setCurrentWidget(1);
755 } else { 759 } else {
756 TabWidget->setCurrentWidget(0); 760 TabWidget->setCurrentWidget(0);
757 } 761 }
758 OtherView()->setFocus(); 762// OtherView()->setFocus();
759 OtherView()->setSelected( CurrentView()->firstChild(), true); 763 OtherView()->setSelected( CurrentView()->firstChild(), true);
760} 764}
761 765
762void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { 766void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) {
763// odebug << "qcop message "+msg << oendl; 767// odebug << "qcop message "+msg << oendl;
764 QDataStream stream ( data, IO_ReadOnly ); 768 QDataStream stream ( data, IO_ReadOnly );
765 if ( msg == "openDirectory(QString)" ) { 769 if ( msg == "openDirectory(QString)" ) {
766// odebug << "received" << oendl; 770// odebug << "received" << oendl;
767 QString file; 771 QString file;
768 stream >> file; 772 stream >> file;
769 changeTo( (const QString &) file); 773 changeTo( (const QString &) file);
770 } 774 }
771} 775}
772 776
773void AdvancedFm::setDocument(const QString &file) { 777void AdvancedFm::setDocument(const QString &file) {
774 changeTo( file); 778 changeTo( file);
775 779
776} 780}
777 781
778 782
779void AdvancedFm::findFile(const QString &fileName) { 783void AdvancedFm::findFile(const QString &fileName) {
780 QFileInfo fi(fileName); 784 QFileInfo fi(fileName);
781 QListView *thisView = CurrentView(); 785 QListView *thisView = CurrentView();
782 QListViewItemIterator it( thisView ); 786 QListViewItemIterator it( thisView );
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
@@ -107,57 +107,57 @@ void AdvancedFm::init() {
107 viewMenu->setCheckable(true); 107 viewMenu->setCheckable(true);
108 viewMenu->setItemChecked( viewMenu->idAt(0), true); 108 viewMenu->setItemChecked( viewMenu->idAt(0), true);
109 viewMenu->setItemChecked( viewMenu->idAt(1), false); 109 viewMenu->setItemChecked( viewMenu->idAt(1), false);
110 110
111 s_addBookmark = tr("Bookmark Directory"); 111 s_addBookmark = tr("Bookmark Directory");
112 s_removeBookmark = tr("Remove Current Directory from Bookmarks"); 112 s_removeBookmark = tr("Remove Current Directory from Bookmarks");
113 113
114// menuButton->insertItem(""); 114// menuButton->insertItem("");
115 115
116// customDirMenu->insertItem(tr("Add This Directory")); 116// customDirMenu->insertItem(tr("Add This Directory"));
117// customDirMenu->insertItem(tr("Remove This Directory")); 117// customDirMenu->insertItem(tr("Remove This Directory"));
118// customDirMenu->insertSeparator(); 118// customDirMenu->insertSeparator();
119 119
120 QHBoxLayout *CBHB = new QHBoxLayout(); // parent layout will be set later 120 QHBoxLayout *CBHB = new QHBoxLayout(); // parent layout will be set later
121 CBHB->setMargin( 0 ); 121 CBHB->setMargin( 0 );
122 CBHB->setSpacing( 1 ); 122 CBHB->setSpacing( 1 );
123 123
124 menuButton = new MenuButton( this ); 124 menuButton = new MenuButton( this );
125 125
126 menuButton->setUseLabel(false); 126 menuButton->setUseLabel(false);
127 menuButton->setMaximumWidth( 20 ); 127 menuButton->setMaximumWidth( 20 );
128 menuButton->insertItem( s_addBookmark); 128 menuButton->insertItem( s_addBookmark);
129 menuButton->insertItem( s_removeBookmark); 129 menuButton->insertItem( s_removeBookmark);
130 menuButton->insertSeparator(); 130 menuButton->insertSeparator();
131 menuButton->setFocusPolicy(NoFocus); 131// menuButton->setFocusPolicy(NoFocus);
132 CBHB->addWidget( menuButton ); 132 CBHB->addWidget( menuButton );
133 133
134 customDirsToMenu(); 134 customDirsToMenu();
135 135
136 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); 136 currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" );
137 currentPathCombo->setEditable(TRUE); 137 currentPathCombo->setEditable(TRUE);
138 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); 138 currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
139 currentPathCombo->setFocusPolicy(NoFocus); 139 // currentPathCombo->setFocusPolicy(NoFocus);
140 CBHB->addWidget( currentPathCombo ); 140 CBHB->addWidget( currentPathCombo );
141 141
142 layout->addLayout( CBHB ); 142 layout->addLayout( CBHB );
143 143
144 TabWidget = new OSplitter( Horizontal, this, "TabWidget" ); 144 TabWidget = new OSplitter( Horizontal, this, "TabWidget" );
145// TabWidget = new QTabWidget( this, "TabWidget" ); 145// TabWidget = new QTabWidget( this, "TabWidget" );
146 layout->addWidget( TabWidget, 4 ); 146 layout->addWidget( TabWidget, 4 );
147 147
148 tab = new QWidget( TabWidget, "tab" ); 148 tab = new QWidget( TabWidget, "tab" );
149 tabLayout = new QGridLayout( tab ); 149 tabLayout = new QGridLayout( tab );
150 tabLayout->setSpacing( 2); 150 tabLayout->setSpacing( 2);
151 tabLayout->setMargin( 2); 151 tabLayout->setMargin( 2);
152 152
153 Local_View = new QListView( tab, "Local_View" ); 153 Local_View = new QListView( tab, "Local_View" );
154 Local_View->addColumn( tr("File"),130); 154 Local_View->addColumn( tr("File"),130);
155 Local_View->addColumn( tr("Size"),-1); 155 Local_View->addColumn( tr("Size"),-1);
156 Local_View->setColumnAlignment(1,QListView::AlignRight); 156 Local_View->setColumnAlignment(1,QListView::AlignRight);
157 Local_View->addColumn( tr("Date"),-1); 157 Local_View->addColumn( tr("Date"),-1);
158 Local_View->setColumnAlignment(2,QListView::AlignRight); 158 Local_View->setColumnAlignment(2,QListView::AlignRight);
159 Local_View->setAllColumnsShowFocus(TRUE); 159 Local_View->setAllColumnsShowFocus(TRUE);
160 Local_View->setMultiSelection( TRUE ); 160 Local_View->setMultiSelection( TRUE );
161 Local_View->setSelectionMode(QListView::Extended); 161 Local_View->setSelectionMode(QListView::Extended);
162 Local_View->setFocusPolicy(StrongFocus); 162 Local_View->setFocusPolicy(StrongFocus);
163 Local_View->installEventFilter( this ); 163 Local_View->installEventFilter( this );
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
@@ -24,49 +24,49 @@ using namespace Opie::Core;
24/* QT*/ 24/* QT*/
25 25
26#include <qmessagebox.h> 26#include <qmessagebox.h>
27#include <qpopupmenu.h> 27#include <qpopupmenu.h>
28#include <qlistview.h> 28#include <qlistview.h>
29 29
30/* STD */ 30/* STD */
31 31
32#include <errno.h> 32#include <errno.h>
33#include <stdlib.h> 33#include <stdlib.h>
34#include <unistd.h> 34#include <unistd.h>
35#include <sys/stat.h> 35#include <sys/stat.h>
36#include <dirent.h> 36#include <dirent.h>
37#include <sys/sendfile.h> 37#include <sys/sendfile.h>
38#include <fcntl.h> 38#include <fcntl.h>
39 39
40void AdvancedFm::doDirChange() { 40void AdvancedFm::doDirChange() {
41 QString pathItem = CurrentView()->currentItem()->text(0); 41 QString pathItem = CurrentView()->currentItem()->text(0);
42 if( pathItem == "../") { 42 if( pathItem == "../") {
43 ListClicked( CurrentView()->currentItem()); 43 ListClicked( CurrentView()->currentItem());
44 } else { 44 } else {
45 if( pathItem.find(" -> ",0,TRUE) != -1) 45 if( pathItem.find(" -> ",0,TRUE) != -1)
46 pathItem = dealWithSymName((const QString&)pathItem)+"/"; 46 pathItem = dealWithSymName((const QString&)pathItem)+"/";
47// owarn << pathItem << oendl; 47// owarn << pathItem << oendl;
48 gotoDirectory( CurrentDir()->path()+"/"+pathItem.left( pathItem.length() - 1) ); 48 changeTo( CurrentDir()->path()+"/"+pathItem.left( pathItem.length() - 1) );
49 } 49 }
50} 50}
51 51
52void AdvancedFm::showMenuHidden() { 52void AdvancedFm::showMenuHidden() {
53 if (b) { 53 if (b) {
54 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 54 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
55 OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 55 OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
56 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 56 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
57 } else { 57 } else {
58 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 58 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
59 OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 59 OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
60 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); 60 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE);
61 } 61 }
62 b = !b; 62 b = !b;
63 populateView(); 63 populateView();
64} 64}
65 65
66void AdvancedFm::showHidden() { 66void AdvancedFm::showHidden() {
67 if (b) { 67 if (b) {
68 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 68 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
69 OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 69 OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
70 } else { 70 } else {
71 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 71 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
72 OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 72 OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
@@ -719,125 +719,127 @@ void AdvancedFm::startProcess(const QString & cmd) {
719 connect(process, SIGNAL(processExited(Opie::Core::OProcess*)), this, SLOT( processEnded(Opie::Core::OProcess*))); 719 connect(process, SIGNAL(processExited(Opie::Core::OProcess*)), this, SLOT( processEnded(Opie::Core::OProcess*)));
720 720
721 connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)), this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int))); 721 connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)), this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int)));
722 722
723 command << "/bin/sh"; 723 command << "/bin/sh";
724 command << "-c"; 724 command << "-c";
725 command << cmd.latin1(); 725 command << cmd.latin1();
726 *process << command; 726 *process << command;
727 if(!process->start(OProcess::NotifyOnExit, OProcess::All) ) 727 if(!process->start(OProcess::NotifyOnExit, OProcess::All) )
728 odebug << "could not start process" << oendl; 728 odebug << "could not start process" << oendl;
729} 729}
730 730
731void AdvancedFm::processEnded(OProcess *) { 731void AdvancedFm::processEnded(OProcess *) {
732 rePopulate(); 732 rePopulate();
733} 733}
734 734
735void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { 735void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) {
736// owarn << "received stderrt " << buflen << " bytes" << oendl; 736// owarn << "received stderrt " << buflen << " bytes" << oendl;
737 737
738 QString lineStr = buffer; 738 QString lineStr = buffer;
739 QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") ); 739 QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") );
740} 740}
741 741
742bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { 742bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) {
743 if ( o->inherits( "QLineEdit" ) ) { 743 if ( o->inherits( "QLineEdit" ) ) {
744 if ( e->type() == QEvent::KeyPress ) { 744 qDebug("QLineEdit event");
745 QKeyEvent *ke = (QKeyEvent*)e; 745 if ( e->type() == QEvent::KeyPress ) {
746 if ( ke->key() == Key_Return || 746 QKeyEvent *ke = (QKeyEvent*)e;
747 ke->key() == Key_Enter ) { 747 if ( ke->key() == Key_Return ||
748 okRename(); 748 ke->key() == Key_Enter ) {
749 return true; 749 okRename();
750 return true;
750 } 751 }
751 else if ( ke->key() == Key_Escape ) { 752 else if ( ke->key() == Key_Escape ) {
752 cancelRename(); 753 cancelRename();
753 return true; 754 return true;
754 } 755 }
755 } 756 }
756 else if ( e->type() == QEvent::FocusOut ) { 757 else if ( e->type() == QEvent::FocusOut ) {
757 cancelRename(); 758 cancelRename();
758 return true; 759 return true;
759 } 760 }
760 } 761 }
761 if ( o->inherits( "QListView" ) ) { 762/* if ( o->inherits( "QListView" ) ) {
762 if ( e->type() == QEvent::FocusIn ) { 763 if ( e->type() == QEvent::FocusIn ) {
763// if( o == Local_View) { //keep track of which view 764// if( o == Local_View) { //keep track of which view
764 // qDebug("local view"); 765 // qDebug("local view");
765// whichTab = 1; 766// whichTab = 1;
766// } else { 767// } else {
767// whichTab = 2; 768// whichTab = 2;
768 // qDebug("remote view"); 769 // qDebug("remote view");
769// } 770// }
770 } 771 }
771 OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection 772 OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection
772 } 773 }
773 774*/
774 return QWidget::eventFilter( o, e ); 775 return QWidget::eventFilter( o, e );
775} 776}
776 777
777 778
778void AdvancedFm::cancelRename() { 779void AdvancedFm::cancelRename() {
779// odebug << "cancel rename" << oendl; 780// odebug << "cancel rename" << oendl;
780 QListView * view; 781 QListView * view;
781 view = CurrentView(); 782 view = CurrentView();
782 783
783 bool resetFocus = view->viewport()->focusProxy() == renameBox; 784 bool resetFocus = view->viewport()->focusProxy() == renameBox;
784 delete renameBox; 785 delete renameBox;
785 renameBox = 0; 786 renameBox = 0;
786 if ( resetFocus ) { 787 if ( resetFocus ) {
787 view->viewport()->setFocusProxy( view); 788 view->viewport()->setFocusProxy( view);
788 view->setFocus(); 789 view->setFocus();
789 } 790 }
790} 791}
791 792
792void AdvancedFm::doRename(QListView * view) { 793void AdvancedFm::doRename(QListView * view) {
793 if( !CurrentView()->currentItem()) return; 794 if( !CurrentView()->currentItem()) return;
794 795
795 QRect r = view->itemRect( view->currentItem( )); 796 QRect r = view->itemRect( view->currentItem( ));
796 r = QRect( view->viewportToContents( r.topLeft() ), r.size() ); 797 r = QRect( view->viewportToContents( r.topLeft() ), r.size() );
797 r.setX( view->contentsX() ); 798 r.setX( view->contentsX() );
798 if ( r.width() > view->visibleWidth() ) 799 if ( r.width() > view->visibleWidth() )
799 r.setWidth( view->visibleWidth() ); 800 r.setWidth( view->visibleWidth() );
800 801
801 renameBox = new QLineEdit( view->viewport(), "qt_renamebox" ); 802 renameBox = new QLineEdit( view->viewport(), "qt_renamebox" );
802 renameBox->setFrame(true); 803 renameBox->setFrame(true);
803 renameBox->setText( view->currentItem()->text(0) ); 804 renameBox->setText( view->currentItem()->text(0) );
804 renameBox->selectAll(); 805 renameBox->selectAll();
805 renameBox->installEventFilter( this ); 806 renameBox->installEventFilter( this );
806 view->addChild( renameBox, r.x(), r.y() ); 807 view->addChild( renameBox, r.x(), r.y() );
807 renameBox->resize( r.size() ); 808 renameBox->resize( r.size() );
808 view->viewport()->setFocusProxy( renameBox ); 809 view->viewport()->setFocusProxy( renameBox );
809 renameBox->setFocus(); 810 renameBox->setFocus();
810 renameBox->show(); 811 renameBox->show();
811} 812}
812 813
813 814
814void AdvancedFm::renameIt() { 815void AdvancedFm::renameIt() {
815 if( !CurrentView()->currentItem()) return; 816 if( !CurrentView()->currentItem()) return;
816 817
817 QListView *thisView = CurrentView(); 818 QListView *thisView = CurrentView();
818 oldName = thisView->currentItem()->text(0); 819 oldName = thisView->currentItem()->text(0);
819 doRename( thisView ); 820 doRename( thisView );
820} 821}
821 822
822void AdvancedFm::okRename() { 823void AdvancedFm::okRename() {
823 if( !renameBox) return; 824 qDebug("okrename");
824 825 if( !renameBox) return;
825 QString newName = renameBox->text(); 826
826 cancelRename(); 827 QString newName = renameBox->text();
827 QListView * view = CurrentView(); 828 cancelRename();
828 QString path = CurrentDir()->canonicalPath() + "/"; 829 QListView * view = CurrentView();
829 oldName = path + oldName; 830 QString path = CurrentDir()->canonicalPath() + "/";
830 newName = path + newName; 831 oldName = path + oldName;
831 if( rename( oldName.latin1(), newName.latin1())== -1) 832 newName = path + newName;
832 QMessageBox::message(tr("Note"),tr("Could not rename")); 833 if( rename( oldName.latin1(), newName.latin1())== -1)
833 else 834 QMessageBox::message(tr("Note"),tr("Could not rename"));
834 oldName = ""; 835 else
835 QListViewItem *item = view->currentItem(); 836 oldName = "";
836 view->takeItem( item ); 837 QListViewItem *item = view->currentItem();
837 delete item; 838 view->takeItem( item );
838 rePopulate(); 839 delete item;
840 rePopulate();
839} 841}
840 842
841void AdvancedFm::openSearch() { 843void AdvancedFm::openSearch() {
842 QMessageBox::message(tr("Note"),tr("Not Yet Implemented")); 844 QMessageBox::message(tr("Note"),tr("Not Yet Implemented"));
843} 845}