summaryrefslogtreecommitdiff
path: root/noncore/apps/advancedfm/advancedfmMenu.cpp
authorllornkcor <llornkcor>2003-02-24 02:38:01 (UTC)
committer llornkcor <llornkcor>2003-02-24 02:38:01 (UTC)
commite144592570ddacf26d27f3e2759dbe7f2370d0a0 (patch) (unidiff)
tree054221a40b03bd91945161570a8996a5427e6456 /noncore/apps/advancedfm/advancedfmMenu.cpp
parent56b89312a374b62ee20f6ad2b62b6426183d4d26 (diff)
downloadopie-e144592570ddacf26d27f3e2759dbe7f2370d0a0.zip
opie-e144592570ddacf26d27f3e2759dbe7f2370d0a0.tar.gz
opie-e144592570ddacf26d27f3e2759dbe7f2370d0a0.tar.bz2
cleanup
Diffstat (limited to 'noncore/apps/advancedfm/advancedfmMenu.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp102
1 files changed, 41 insertions, 61 deletions
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp
index 13dad33..c553017 100644
--- a/noncore/apps/advancedfm/advancedfmMenu.cpp
+++ b/noncore/apps/advancedfm/advancedfmMenu.cpp
@@ -65,14 +65,14 @@ void AdvancedFm::showMenuHidden()
65 { 65 {
66 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 66 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
67 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 67 currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
68 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); 68 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE);
69// b=TRUE; 69// b=TRUE;
70 } 70 }
71 populateLocalView(); 71 populateView();
72 populateRemoteView(); 72// populateRemoteView();
73// if(b) qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<< true"); 73// if(b) qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<< true");
74 if(b) b = false; else b = true; 74 if(b) b = false; else b = true;
75} 75}
76 76
77void AdvancedFm::showHidden() 77void AdvancedFm::showHidden()
78{ 78{
@@ -86,13 +86,13 @@ void AdvancedFm::showHidden()
86 else 86 else
87 { 87 {
88 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 88 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
89// fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); 89// fileMenu->setItemChecked( fileMenu->idAt(0),FALSE);
90// b=TRUE; 90// b=TRUE;
91 } 91 }
92 PopulateView(); 92 populateView();
93} 93}
94 94
95QString AdvancedFm::dealWithSymName(const QString &fileName) 95QString AdvancedFm::dealWithSymName(const QString &fileName)
96{ 96{
97 QString strItem = fileName; 97 QString strItem = fileName;
98 return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 98 return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
@@ -162,13 +162,13 @@ void AdvancedFm::makeDir()
162 if( fileDlg->result() == 1 ) 162 if( fileDlg->result() == 1 )
163 { 163 {
164 QDir *thisDir = CurrentDir(); 164 QDir *thisDir = CurrentDir();
165 QString filename = fileDlg->LineEdit1->text(); 165 QString filename = fileDlg->LineEdit1->text();
166 thisDir->mkdir( thisDir->canonicalPath()+"/"+filename); 166 thisDir->mkdir( thisDir->canonicalPath()+"/"+filename);
167 } 167 }
168 PopulateView(); 168 populateView();
169} 169}
170 170
171void AdvancedFm::doDelete() 171void AdvancedFm::doDelete()
172{ 172{
173 173
174 QStringList curFileList = getPath(); 174 QStringList curFileList = getPath();
@@ -211,13 +211,13 @@ void AdvancedFm::doDelete()
211 { 211 {
212 case 0: 212 case 0:
213 { 213 {
214 f=f.left(f.length()-1); 214 f=f.left(f.length()-1);
215 QString cmd="rm -rf "+f; 215 QString cmd="rm -rf "+f;
216 startProcess( (const QString)cmd.latin1() ); 216 startProcess( (const QString)cmd.latin1() );
217 PopulateView(); 217 populateView();
218 } 218 }
219 break; 219 break;
220 case 1: 220 case 1:
221 // exit 221 // exit
222 break; 222 break;
223 }; 223 };
@@ -235,13 +235,13 @@ void AdvancedFm::doDelete()
235 QFile file(f); 235 QFile file(f);
236 if(QFileInfo(myFile).fileName().find("../",0,TRUE)==-1) 236 if(QFileInfo(myFile).fileName().find("../",0,TRUE)==-1)
237 file.remove(); 237 file.remove();
238 } 238 }
239 } 239 }
240 } 240 }
241 PopulateView(); 241 populateView();
242} 242}
243 243
244void AdvancedFm::filePerms() 244void AdvancedFm::filePerms()
245{ 245{
246 QStringList curFileList = getPath(); 246 QStringList curFileList = getPath();
247 QString filePath; 247 QString filePath;
@@ -254,13 +254,13 @@ void AdvancedFm::filePerms()
254 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); 254 filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it));
255 filePerm->showMaximized(); 255 filePerm->showMaximized();
256 filePerm->exec(); 256 filePerm->exec();
257 if( filePerm) 257 if( filePerm)
258 delete filePerm; 258 delete filePerm;
259 } 259 }
260 PopulateView(); 260 populateView();
261} 261}
262 262
263void AdvancedFm::doProperties() 263void AdvancedFm::doProperties()
264{ 264{
265#if defined(QT_QWS_OPIE) 265#if defined(QT_QWS_OPIE)
266 266
@@ -290,13 +290,13 @@ void AdvancedFm::upDir()
290 QDir dir(current); 290 QDir dir(current);
291 dir.cdUp(); 291 dir.cdUp();
292 current = dir.canonicalPath(); 292 current = dir.canonicalPath();
293 chdir( current.latin1() ); 293 chdir( current.latin1() );
294 thisDir->cd( current, TRUE); 294 thisDir->cd( current, TRUE);
295 295
296 PopulateView(); 296 populateView();
297 update(); 297 update();
298} 298}
299 299
300void AdvancedFm::copy() 300void AdvancedFm::copy()
301{ 301{
302 qApp->processEvents(); 302 qApp->processEvents();
@@ -357,15 +357,14 @@ void AdvancedFm::copy()
357 { 357 {
358 QMessageBox::message("AdvancedFm", 358 QMessageBox::message("AdvancedFm",
359 tr( "Could not copy %1 to %2").arg( curFile ).arg( destFile ) ); 359 tr( "Could not copy %1 to %2").arg( curFile ).arg( destFile ) );
360 return; 360 return;
361 } 361 }
362 } 362 }
363 363 setOtherTabCurrent();
364 PopulateView(); 364 populateView();
365 // TabWidget->setCurrentTab(1);
366 } 365 }
367} 366}
368 367
369void AdvancedFm::copyAs() 368void AdvancedFm::copyAs()
370{ 369{
371 qApp->processEvents(); 370 qApp->processEvents();
@@ -414,13 +413,14 @@ void AdvancedFm::copyAs()
414 return; 413 return;
415 } 414 }
416 } 415 }
417 delete fileDlg; 416 delete fileDlg;
418 417
419 } 418 }
420 PopulateView(); 419 setOtherTabCurrent();
420 populateView();
421} 421}
422 422
423void AdvancedFm::copySameDir() 423void AdvancedFm::copySameDir()
424{ 424{
425 qApp->processEvents(); 425 qApp->processEvents();
426 QStringList curFileList = getPath(); 426 QStringList curFileList = getPath();
@@ -467,13 +467,13 @@ void AdvancedFm::copySameDir()
467 } 467 }
468 468
469 qDebug("copy "+curFile+" as "+destFile); 469 qDebug("copy "+curFile+" as "+destFile);
470 } 470 }
471 delete fileDlg; 471 delete fileDlg;
472 } 472 }
473 PopulateView(); 473 populateView();
474} 474}
475 475
476void AdvancedFm::move() 476void AdvancedFm::move()
477{ 477{
478 qApp->processEvents(); 478 qApp->processEvents();
479 479
@@ -509,14 +509,15 @@ void AdvancedFm::move()
509 } else 509 } else
510 QFile::remove(curFile); 510 QFile::remove(curFile);
511 } 511 }
512 } 512 }
513 513
514 } 514 }
515 populateRemoteView(); 515 setOtherTabCurrent();
516 populateLocalView(); 516 populateView();
517 // populateLocalView();
517} 518}
518 519
519bool AdvancedFm::copyFile( const QString & src, const QString & dest ) 520bool AdvancedFm::copyFile( const QString & src, const QString & dest )
520{ 521{
521 char bf[ 50000 ]; 522 char bf[ 50000 ];
522 int bytesRead; 523 int bytesRead;
@@ -640,69 +641,48 @@ void AdvancedFm::del()
640void AdvancedFm::mkSym() 641void AdvancedFm::mkSym()
641{ 642{
642 QString cmd; 643 QString cmd;
643 QStringList curFileList = getPath(); 644 QStringList curFileList = getPath();
644 if( curFileList.count() > 0) 645 if( curFileList.count() > 0)
645 { 646 {
646 if ( whichTab == 1) 647 QDir *thisDir = CurrentDir();
647 { 648 QDir * thatDir = OtherDir();
648 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it )
649 {
650 649
651 QString destName = currentRemoteDir.canonicalPath()+"/"+(*it); 650 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it )
652 if(destName.right(1) == "/")
653 {
654 destName = destName.left( destName.length() -1);
655 }
656 QString curFile = currentDir.canonicalPath()+"/"+(*it);
657 if( curFile.right(1) == "/")
658 {
659 curFile = curFile.left( curFile.length() -1);
660 }
661 cmd = "ln -s "+curFile+" "+destName;
662 qDebug(cmd);
663 startProcess( (const QString)cmd );
664 }
665 populateRemoteView();
666 TabWidget->setCurrentTab(1);
667 }
668 else
669 { 651 {
670 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) 652
653 QString destName = thatDir->canonicalPath()+"/"+(*it);
654 if(destName.right(1) == "/")
671 { 655 {
656 destName = destName.left( destName.length() -1);
657 }
672 658
673 QString destName = currentDir.canonicalPath()+"/"+(*it); 659 QString curFile = thisDir->canonicalPath()+"/"+(*it);
674 if(destName.right(1) == "/")
675 {
676 destName = destName.left( destName.length() -1);
677 }
678 QString curFile = currentRemoteDir.canonicalPath()+"/"+(*it);
679 if( curFile.right(1) == "/")
680 {
681 curFile = curFile.left( curFile.length() -1);
682 }
683 660
684 cmd = "ln -s "+curFile+" "+destName; 661 if( curFile.right(1) == "/")
685 qDebug(cmd); 662 {
686 startProcess( (const QString)cmd ); 663 curFile = curFile.left( curFile.length() -1);
687 } 664 }
688 populateLocalView(); 665
689 TabWidget->setCurrentTab(0); 666 cmd = "ln -s "+curFile+" "+destName;
690 } 667 qDebug(cmd);
691 } 668 startProcess( (const QString)cmd );
669 }
670 setOtherTabCurrent();
671 populateView();
672 }
692} 673}
693 674
694void AdvancedFm::doBeam() 675void AdvancedFm::doBeam()
695{ 676{
696 Ir ir; 677 Ir ir;
697 if(!ir.supported()) 678 if(!ir.supported())
698 { 679 {
699 } 680 }
700 else 681 else
701 { 682 {
702
703 QStringList curFileList = getPath(); 683 QStringList curFileList = getPath();
704 if( curFileList.count() > 0) 684 if( curFileList.count() > 0)
705 { 685 {
706 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) 686 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it )
707 { 687 {
708 688
@@ -752,14 +732,14 @@ void AdvancedFm::startProcess(const QString & cmd)
752 if(!process->start(OProcess::NotifyOnExit) ) 732 if(!process->start(OProcess::NotifyOnExit) )
753 qDebug("could not start process"); 733 qDebug("could not start process");
754} 734}
755 735
756void AdvancedFm::processEnded() 736void AdvancedFm::processEnded()
757{ 737{
758 populateLocalView(); 738// populateLocalView();
759 populateRemoteView(); 739 populateView();
760} 740}
761 741
762bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) 742bool AdvancedFm::eventFilter( QObject * o, QEvent * e )
763{ 743{
764 if ( o->inherits( "QLineEdit" ) ) 744 if ( o->inherits( "QLineEdit" ) )
765 { 745 {
@@ -840,13 +820,13 @@ void AdvancedFm::doRename(QListView * view)
840 820
841void AdvancedFm::renameIt() 821void AdvancedFm::renameIt()
842{ 822{
843 QListView *thisView = CurrentView(); 823 QListView *thisView = CurrentView();
844 oldName = thisView->currentItem()->text(0); 824 oldName = thisView->currentItem()->text(0);
845 doRename( thisView ); 825 doRename( thisView );
846 PopulateView(); 826 populateView();
847} 827}
848 828
849void AdvancedFm::okRename() 829void AdvancedFm::okRename()
850{ 830{
851 QString newName = renameBox->text(); 831 QString newName = renameBox->text();
852 cancelRename(); 832 cancelRename();
@@ -862,8 +842,8 @@ void AdvancedFm::okRename()
862 QMessageBox::message(tr("Note"),tr("Could not rename")); 842 QMessageBox::message(tr("Note"),tr("Could not rename"));
863 else 843 else
864 oldName = ""; 844 oldName = "";
865 845
866 view->takeItem( view->currentItem() ); 846 view->takeItem( view->currentItem() );
867 delete view->currentItem(); 847 delete view->currentItem();
868 PopulateView(); 848 populateView();
869} 849}