summaryrefslogtreecommitdiff
path: root/noncore/apps/advancedfm/advancedfmMenu.cpp
Unidiff
Diffstat (limited to 'noncore/apps/advancedfm/advancedfmMenu.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp317
1 files changed, 119 insertions, 198 deletions
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp
index 544350c..c0be948 100644
--- a/noncore/apps/advancedfm/advancedfmMenu.cpp
+++ b/noncore/apps/advancedfm/advancedfmMenu.cpp
@@ -48,11 +48,16 @@
48 48
49void AdvancedFm::doDirChange() 49void AdvancedFm::doDirChange() {
50{ 50 QString pathItem = CurrentView()->currentItem()->text(0);
51 if( pathItem == "../") {
51 ListClicked( CurrentView()->currentItem()); 52 ListClicked( CurrentView()->currentItem());
53 } else {
54 if( pathItem.find(" -> ",0,TRUE) != -1)
55 pathItem = dealWithSymName((const QString&)pathItem)+"/";
56// qWarning(pathItem);
57 gotoDirectory( CurrentDir()->path()+"/"+pathItem.left( pathItem.length() - 1) );
58 }
52} 59}
53 60
54void AdvancedFm::showMenuHidden() 61void AdvancedFm::showMenuHidden() {
55{ 62 if (b) {
56 if (b)
57 {
58 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 63 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
@@ -60,7 +65,3 @@ void AdvancedFm::showMenuHidden()
60 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 65 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
61// b=FALSE; 66 } else {
62
63 }
64 else
65 {
66 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 67 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
@@ -68,6 +69,4 @@ void AdvancedFm::showMenuHidden()
68 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); 69 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE);
69// b=TRUE;
70 } 70 }
71 rePopulate(); 71 rePopulate();
72// if(b) qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<< true");
73 b = !b; 72 b = !b;
@@ -75,18 +74,9 @@ void AdvancedFm::showMenuHidden()
75 74
76void AdvancedFm::showHidden() 75void AdvancedFm::showHidden() {
77{ 76 if (b) {
78 if (b)
79 {
80 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 77 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
81 OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 78 OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
82// fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 79 } else {
83// b=FALSE;
84
85 }
86 else
87 {
88 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 80 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
89 OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 81 OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
90// fileMenu->setItemChecked( fileMenu->idAt(0),FALSE);
91// b=TRUE;
92 } 82 }
@@ -95,4 +85,3 @@ void AdvancedFm::showHidden()
95 85
96QString AdvancedFm::dealWithSymName(const QString &fileName) 86QString AdvancedFm::dealWithSymName(const QString &fileName) {
97{
98 QString strItem = fileName; 87 QString strItem = fileName;
@@ -101,4 +90,4 @@ QString AdvancedFm::dealWithSymName(const QString &fileName)
101 90
102void AdvancedFm::runThis() 91void AdvancedFm::runThis() {
103{ 92 if( !CurrentView()->currentItem()) return;
104 QString fs; 93 QString fs;
@@ -113,4 +102,3 @@ void AdvancedFm::runThis()
113 102
114 if(curFile != "../") 103 if(curFile != "../") {
115 {
116 104
@@ -118,3 +106,3 @@ void AdvancedFm::runThis()
118 QFileInfo fileInfo( path + "/" + curFile); 106 QFileInfo fileInfo( path + "/" + curFile);
119 qDebug( fileInfo.owner()); 107// qDebug( fileInfo.owner());
120 108
@@ -126,5 +114,3 @@ void AdvancedFm::runThis()
126 e << curFile; 114 e << curFile;
127 } 115 } else {
128 else
129 {
130 curFile = path + "/" + curFile; 116 curFile = path + "/" + curFile;
@@ -132,8 +118,5 @@ void AdvancedFm::runThis()
132 QString execStr = nf.exec(); 118 QString execStr = nf.exec();
133 qDebug( execStr); 119// qDebug( execStr);
134 if( execStr.isEmpty() ) 120 if( execStr.isEmpty() ) {
135 { 121 } else {
136 }
137 else
138 {
139 nf.execute(); 122 nf.execute();
@@ -144,7 +127,6 @@ void AdvancedFm::runThis()
144 127
145void AdvancedFm::runText() 128void AdvancedFm::runText() {
146{ 129 if( !CurrentView()->currentItem()) return;
147 QString curFile = CurrentView()->currentItem()->text(0); 130 QString curFile = CurrentView()->currentItem()->text(0);
148 if(curFile != "../") 131 if(curFile != "../") {
149 {
150 if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink 132 if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink
@@ -157,4 +139,3 @@ void AdvancedFm::runText()
157 139
158void AdvancedFm::makeDir() 140void AdvancedFm::makeDir() {
159{
160 InputDialog *fileDlg; 141 InputDialog *fileDlg;
@@ -162,4 +143,3 @@ void AdvancedFm::makeDir()
162 fileDlg->exec(); 143 fileDlg->exec();
163 if( fileDlg->result() == 1 ) 144 if( fileDlg->result() == 1 ) {
164 {
165 QDir *thisDir = CurrentDir(); 145 QDir *thisDir = CurrentDir();
@@ -171,4 +151,3 @@ void AdvancedFm::makeDir()
171 151
172void AdvancedFm::doDelete() 152void AdvancedFm::doDelete() {
173{
174 QStringList curFileList = getPath(); 153 QStringList curFileList = getPath();
@@ -237,3 +216,3 @@ void AdvancedFm::doDelete()
237 if( fi.fileName().find("../",0,TRUE)==-1) { 216 if( fi.fileName().find("../",0,TRUE)==-1) {
238 qDebug("remove link files "+myFile); 217// qDebug("remove link files "+myFile);
239 218
@@ -242,3 +221,3 @@ void AdvancedFm::doDelete()
242 lnk = new DocLnk(f); 221 lnk = new DocLnk(f);
243 qDebug("Deleting doclnk " + lnk->linkFile()); 222// qDebug("Deleting doclnk " + lnk->linkFile());
244 if(lnk->isValid()) 223 if(lnk->isValid())
@@ -254,4 +233,3 @@ void AdvancedFm::doDelete()
254 233
255void AdvancedFm::filePerms() 234void AdvancedFm::filePerms() {
256{
257 QStringList curFileList = getPath(); 235 QStringList curFileList = getPath();
@@ -261,4 +239,3 @@ void AdvancedFm::filePerms()
261 239
262 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) 240 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
263 {
264 filePermissions *filePerm; 241 filePermissions *filePerm;
@@ -273,4 +250,3 @@ void AdvancedFm::filePerms()
273 250
274void AdvancedFm::doProperties() 251void AdvancedFm::doProperties() {
275{
276#if defined(QT_QWS_OPIE) 252#if defined(QT_QWS_OPIE)
@@ -282,7 +258,6 @@ void AdvancedFm::doProperties()
282 258
283 qDebug("%d",curFileList.count()); 259// qDebug("%d",curFileList.count());
284 260
285 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) 261 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
286 { 262// qDebug((filePath+*it));
287 qDebug((filePath+*it));
288 DocLnk lnk( (filePath+*it)); 263 DocLnk lnk( (filePath+*it));
@@ -296,4 +271,3 @@ void AdvancedFm::doProperties()
296 271
297void AdvancedFm::upDir() 272void AdvancedFm::upDir() {
298{
299 QDir *thisDir = CurrentDir(); 273 QDir *thisDir = CurrentDir();
@@ -310,4 +284,3 @@ void AdvancedFm::upDir()
310 284
311void AdvancedFm::copy() 285void AdvancedFm::copy() {
312{
313 qApp->processEvents(); 286 qApp->processEvents();
@@ -337,4 +310,3 @@ void AdvancedFm::copy()
337 QString curFile, item, destFile; 310 QString curFile, item, destFile;
338 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) 311 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
339 {
340 item=(*it); 312 item=(*it);
@@ -346,14 +318,11 @@ void AdvancedFm::copy()
346 318
347 qDebug("Destination file is "+destFile); 319// qDebug("Destination file is "+destFile);
348 qDebug("CurrentFile file is " + curFile); 320// qDebug("CurrentFile file is " + curFile);
349 321
350 QFile f(destFile); 322 QFile f(destFile);
351 if( f.exists()) 323 if( f.exists()) {
352 { 324 if(doMsg) {
353 if(doMsg)
354 {
355 switch ( QMessageBox::warning(this,tr("File Exists!"), 325 switch ( QMessageBox::warning(this,tr("File Exists!"),
356 tr("%1 exists. Ok to overwrite?").arg( item ), 326 tr("%1 exists. Ok to overwrite?").arg( item ),
357 tr("Yes"),tr("No"),0,0,1) ) 327 tr("Yes"),tr("No"),0,0,1) ) {
358 {
359 case 1: 328 case 1:
@@ -372,4 +341,4 @@ void AdvancedFm::copy()
372 } 341 }
342 rePopulate();
373 setOtherTabCurrent(); 343 setOtherTabCurrent();
374 populateView();
375 } 344 }
@@ -377,4 +346,3 @@ void AdvancedFm::copy()
377 346
378void AdvancedFm::copyAs() 347void AdvancedFm::copyAs() {
379{
380 qApp->processEvents(); 348 qApp->processEvents();
@@ -388,4 +356,3 @@ void AdvancedFm::copyAs()
388 356
389 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) 357 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
390 {
391 QString destFile; 358 QString destFile;
@@ -398,4 +365,3 @@ void AdvancedFm::copyAs()
398 365
399 if( fileDlg->result() == 1 ) 366 if( fileDlg->result() == 1 ) {
400 {
401 QString filename = fileDlg->LineEdit1->text(); 367 QString filename = fileDlg->LineEdit1->text();
@@ -404,8 +370,6 @@ void AdvancedFm::copyAs()
404 QFile f( destFile); 370 QFile f( destFile);
405 if( f.exists()) 371 if( f.exists()) {
406 {
407 switch (QMessageBox::warning(this,tr("File Exists!"), 372 switch (QMessageBox::warning(this,tr("File Exists!"),
408 item+tr("\nexists. Ok to overwrite?"), 373 item+tr("\nexists. Ok to overwrite?"),
409 tr("Yes"),tr("No"),0,0,1) ) 374 tr("Yes"),tr("No"),0,0,1) ) {
410 {
411 case 0: 375 case 0:
@@ -427,8 +391,7 @@ void AdvancedFm::copyAs()
427 } 391 }
392 rePopulate();
428 setOtherTabCurrent(); 393 setOtherTabCurrent();
429 populateView();
430} 394}
431 395
432void AdvancedFm::copySameDir() 396void AdvancedFm::copySameDir() {
433{
434 qApp->processEvents(); 397 qApp->processEvents();
@@ -440,4 +403,3 @@ void AdvancedFm::copySameDir()
440 403
441 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) 404 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
442 {
443 item=(*it); 405 item=(*it);
@@ -449,4 +411,3 @@ void AdvancedFm::copySameDir()
449 411
450 if( fileDlg->result() == 1 ) 412 if( fileDlg->result() == 1 ) {
451 {
452 413
@@ -456,4 +417,3 @@ void AdvancedFm::copySameDir()
456 QFile f(destFile); 417 QFile f(destFile);
457 if( f.exists()) 418 if( f.exists()) {
458 {
459 switch (QMessageBox::warning(this,tr("Delete"), 419 switch (QMessageBox::warning(this,tr("Delete"),
@@ -476,3 +436,3 @@ void AdvancedFm::copySameDir()
476 436
477 qDebug("copy "+curFile+" as "+destFile); 437// qDebug("copy "+curFile+" as "+destFile);
478 } 438 }
@@ -483,4 +443,3 @@ void AdvancedFm::copySameDir()
483 443
484void AdvancedFm::move() 444void AdvancedFm::move() {
485{
486 qApp->processEvents(); 445 qApp->processEvents();
@@ -488,4 +447,3 @@ void AdvancedFm::move()
488 QStringList curFileList = getPath(); 447 QStringList curFileList = getPath();
489 if( curFileList.count() > 0) 448 if( curFileList.count() > 0) {
490 {
491 QString curFile, destFile, item; 449 QString curFile, destFile, item;
@@ -494,4 +452,3 @@ void AdvancedFm::move()
494 QDir *thatDir = OtherDir(); 452 QDir *thatDir = OtherDir();
495 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) 453 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
496 {
497 item=(*it); 454 item=(*it);
@@ -502,3 +459,3 @@ void AdvancedFm::move()
502 destFile += item; 459 destFile += item;
503 qDebug("Destination file is "+destFile); 460// qDebug("Destination file is "+destFile);
504 461
@@ -508,3 +465,3 @@ void AdvancedFm::move()
508 curFile+= item; 465 curFile+= item;
509 qDebug("CurrentFile file is " + curFile); 466// qDebug("CurrentFile file is " + curFile);
510 467
@@ -521,9 +478,7 @@ void AdvancedFm::move()
521 } 478 }
522 populateView(); 479 rePopulate();
523 setOtherTabCurrent(); 480 setOtherTabCurrent();
524 populateView();
525} 481}
526 482
527bool AdvancedFm::copyFile( const QString & src, const QString & dest ) 483bool AdvancedFm::copyFile( const QString & src, const QString & dest ) {
528{
529 bool success = true; 484 bool success = true;
@@ -538,3 +493,3 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest )
538 if(!srcFile.open( IO_ReadOnly|IO_Raw)) { 493 if(!srcFile.open( IO_ReadOnly|IO_Raw)) {
539 qWarning("open failed"); 494// qWarning("open failed");
540 return success = false; 495 return success = false;
@@ -545,3 +500,3 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest )
545 if( !destFile.open( IO_WriteOnly|IO_Raw ) ) { 500 if( !destFile.open( IO_WriteOnly|IO_Raw ) ) {
546 qWarning("destfile open failed"); 501// qWarning("destfile open failed");
547 return success = false; 502 return success = false;
@@ -560,3 +515,3 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest )
560 success = false; 515 success = false;
561 qWarning(msg); 516// qWarning(msg);
562 } 517 }
@@ -578,4 +533,4 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest )
578 533
579void AdvancedFm::runCommand() 534void AdvancedFm::runCommand() {
580{ 535 if( !CurrentView()->currentItem()) return;
581 QDir *thisDir = CurrentDir(); 536 QDir *thisDir = CurrentDir();
@@ -591,5 +546,4 @@ void AdvancedFm::runCommand()
591 546
592 if( fileDlg->result() == 1 ) 547 if( fileDlg->result() == 1 ) {
593 { 548// qDebug(fileDlg->LineEdit1->text());
594 qDebug(fileDlg->LineEdit1->text());
595 QStringList command; 549 QStringList command;
@@ -608,4 +562,4 @@ void AdvancedFm::runCommand()
608 562
609void AdvancedFm::runCommandStd() 563void AdvancedFm::runCommandStd() {
610{ 564 if( !CurrentView()->currentItem()) return;
611 QString curFile; 565 QString curFile;
@@ -621,4 +575,3 @@ void AdvancedFm::runCommandStd()
621 575
622 if( fileDlg->result() == 1 ) 576 if( fileDlg->result() == 1 ) {
623 {
624 qApp->processEvents(); 577 qApp->processEvents();
@@ -628,4 +581,4 @@ void AdvancedFm::runCommandStd()
628 581
629void AdvancedFm::fileStatus() 582void AdvancedFm::fileStatus() {
630{ 583 if( !CurrentView()->currentItem()) return;
631 QString curFile; 584 QString curFile;
@@ -646,4 +599,3 @@ void AdvancedFm::fileStatus()
646 599
647void AdvancedFm::mkDir() 600void AdvancedFm::mkDir() {
648{
649 makeDir(); 601 makeDir();
@@ -651,4 +603,3 @@ void AdvancedFm::mkDir()
651 603
652void AdvancedFm::rn() 604void AdvancedFm::rn() {
653{
654 renameIt(); 605 renameIt();
@@ -656,4 +607,3 @@ void AdvancedFm::rn()
656 607
657void AdvancedFm::del() 608void AdvancedFm::del() {
658{
659 doDelete(); 609 doDelete();
@@ -661,8 +611,6 @@ void AdvancedFm::del()
661 611
662void AdvancedFm::mkSym() 612void AdvancedFm::mkSym() {
663{
664 QString cmd; 613 QString cmd;
665 QStringList curFileList = getPath(); 614 QStringList curFileList = getPath();
666 if( curFileList.count() > 0) 615 if( curFileList.count() > 0) {
667 {
668 QDir *thisDir = CurrentDir(); 616 QDir *thisDir = CurrentDir();
@@ -670,8 +618,6 @@ void AdvancedFm::mkSym()
670 618
671 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) 619 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
672 {
673 620
674 QString destName = thatDir->canonicalPath()+"/"+(*it); 621 QString destName = thatDir->canonicalPath()+"/"+(*it);
675 if(destName.right(1) == "/") 622 if(destName.right(1) == "/") {
676 {
677 destName = destName.left( destName.length() -1); 623 destName = destName.left( destName.length() -1);
@@ -681,4 +627,3 @@ void AdvancedFm::mkSym()
681 627
682 if( curFile.right(1) == "/") 628 if( curFile.right(1) == "/") {
683 {
684 curFile = curFile.left( curFile.length() -1); 629 curFile = curFile.left( curFile.length() -1);
@@ -687,7 +632,7 @@ void AdvancedFm::mkSym()
687 cmd = "ln -s "+curFile+" "+destName; 632 cmd = "ln -s "+curFile+" "+destName;
688 qDebug(cmd); 633// qDebug(cmd);
689 startProcess( (const QString)cmd ); 634 startProcess( (const QString)cmd );
690 } 635 }
636 rePopulate();
691 setOtherTabCurrent(); 637 setOtherTabCurrent();
692 populateView();
693 } 638 }
@@ -695,4 +640,3 @@ void AdvancedFm::mkSym()
695 640
696void AdvancedFm::doBeam() 641void AdvancedFm::doBeam() {
697{
698 Ir ir; 642 Ir ir;
@@ -716,4 +660,3 @@ void AdvancedFm::doBeam()
716 660
717void AdvancedFm::fileBeamFinished( Ir *) 661void AdvancedFm::fileBeamFinished( Ir *) {
718{
719 QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); 662 QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") );
@@ -721,5 +664,3 @@ void AdvancedFm::fileBeamFinished( Ir *)
721 664
722void AdvancedFm::selectAll() 665void AdvancedFm::selectAll() {
723{
724// if (TabWidget->currentTab() == 0) {
725 QListView *thisView = CurrentView(); 666 QListView *thisView = CurrentView();
@@ -727,10 +668,5 @@ void AdvancedFm::selectAll()
727 thisView->setSelected( thisView->firstChild(),false); 668 thisView->setSelected( thisView->firstChild(),false);
728// } else {
729// Remote_View->selectAll(true);
730// Remote_View->setSelected( Remote_View->firstChild(),false);
731// }
732} 669}
733 670
734void AdvancedFm::startProcess(const QString & cmd) 671void AdvancedFm::startProcess(const QString & cmd) {
735{
736 QStringList command; 672 QStringList command;
@@ -752,5 +688,3 @@ void AdvancedFm::startProcess(const QString & cmd)
752 688
753void AdvancedFm::processEnded(OProcess *) 689void AdvancedFm::processEnded(OProcess *) {
754{
755// populateLocalView();
756 populateView(); 690 populateView();
@@ -758,23 +692,15 @@ void AdvancedFm::processEnded(OProcess *)
758 692
759void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int buflen) { 693void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) {
760 qWarning("received stderrt %d bytes", buflen); 694// qWarning("received stderrt %d bytes", buflen);
761 695
762 QString lineStr = buffer; 696 QString lineStr = buffer;
763// lineStr=lineStr.left(lineStr.length()-1);
764 QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") ); 697 QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") );
765
766// OutputEdit->append(lineStr);
767// OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE);
768} 698}
769 699
770bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) 700bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) {
771{ 701 if ( o->inherits( "QLineEdit" ) ) {
772 if ( o->inherits( "QLineEdit" ) ) 702 if ( e->type() == QEvent::KeyPress ) {
773 {
774 if ( e->type() == QEvent::KeyPress )
775 {
776 QKeyEvent *ke = (QKeyEvent*)e; 703 QKeyEvent *ke = (QKeyEvent*)e;
777 if ( ke->key() == Key_Return || 704 if ( ke->key() == Key_Return ||
778 ke->key() == Key_Enter ) 705 ke->key() == Key_Enter ) {
779 {
780 okRename(); 706 okRename();
@@ -782,4 +708,3 @@ bool AdvancedFm::eventFilter( QObject * o, QEvent * e )
782 } 708 }
783 else if ( ke->key() == Key_Escape ) 709 else if ( ke->key() == Key_Escape ) {
784 {
785 cancelRename(); 710 cancelRename();
@@ -788,4 +713,3 @@ bool AdvancedFm::eventFilter( QObject * o, QEvent * e )
788 } 713 }
789 else if ( e->type() == QEvent::FocusOut ) 714 else if ( e->type() == QEvent::FocusOut ) {
790 {
791 cancelRename(); 715 cancelRename();
@@ -794,9 +718,12 @@ bool AdvancedFm::eventFilter( QObject * o, QEvent * e )
794 } 718 }
795 if ( o->inherits( "QListView" ) ) 719 if ( o->inherits( "QListView" ) ) {
796 { 720 if ( e->type() == QEvent::FocusIn ) {
797 if ( e->type() == QEvent::FocusOut ) 721 if( o == Local_View) { //keep track of which view
798 { 722 whichTab=1;
799 printf("focusIn\n");
800
801 } 723 }
724 else {
725 whichTab=2;
726 }
727 }
728 OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection
802 } 729 }
@@ -807,5 +734,4 @@ bool AdvancedFm::eventFilter( QObject * o, QEvent * e )
807 734
808void AdvancedFm::cancelRename() 735void AdvancedFm::cancelRename() {
809{ 736// qDebug("cancel rename");
810 qDebug("cancel rename");
811 QListView * view; 737 QListView * view;
@@ -816,4 +742,3 @@ void AdvancedFm::cancelRename()
816 renameBox = 0; 742 renameBox = 0;
817 if ( resetFocus ) 743 if ( resetFocus ) {
818 {
819 view->viewport()->setFocusProxy( view); 744 view->viewport()->setFocusProxy( view);
@@ -823,4 +748,4 @@ void AdvancedFm::cancelRename()
823 748
824void AdvancedFm::doRename(QListView * view) 749void AdvancedFm::doRename(QListView * view) {
825{ 750 if( !CurrentView()->currentItem()) return;
826 751
@@ -844,3 +769,2 @@ void AdvancedFm::doRename(QListView * view)
844 renameBox->show(); 769 renameBox->show();
845
846} 770}
@@ -848,4 +772,4 @@ void AdvancedFm::doRename(QListView * view)
848 772
849void AdvancedFm::renameIt() 773void AdvancedFm::renameIt() {
850{ 774 if( !CurrentView()->currentItem()) return;
851 QListView *thisView = CurrentView(); 775 QListView *thisView = CurrentView();
@@ -856,7 +780,6 @@ void AdvancedFm::renameIt()
856 780
857void AdvancedFm::okRename() 781void AdvancedFm::okRename() {
858{ 782 if( !CurrentView()->currentItem()) return;
859 QString newName = renameBox->text(); 783 QString newName = renameBox->text();
860 cancelRename(); 784 cancelRename();
861// int tabs=0;
862 QListView * view = CurrentView(); 785 QListView * view = CurrentView();
@@ -866,4 +789,2 @@ void AdvancedFm::okRename()
866 789
867 if( view->currentItem() == NULL)
868 return;
869 if( rename( oldName.latin1(), newName.latin1())== -1) 790 if( rename( oldName.latin1(), newName.latin1())== -1)
@@ -879,3 +800,3 @@ void AdvancedFm::okRename()
879void AdvancedFm::openSearch() { 800void AdvancedFm::openSearch() {
880 801 QMessageBox::message(tr("Note"),tr("Not Yet Implemented"));
881} 802}