author | llornkcor <llornkcor> | 2005-08-11 10:10:40 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2005-08-11 10:10:40 (UTC) |
commit | 6040d26c56a95d9f5bd09688e22009fc5b5e124d (patch) (unidiff) | |
tree | 53ad03c346cc006d17093918d5cf6bbb09aa4b3b /noncore/apps | |
parent | 8938048502047f781447ed24351512cdca997a2e (diff) | |
download | opie-6040d26c56a95d9f5bd09688e22009fc5b5e124d.zip opie-6040d26c56a95d9f5bd09688e22009fc5b5e124d.tar.gz opie-6040d26c56a95d9f5bd09688e22009fc5b5e124d.tar.bz2 |
add opie-smb
-rw-r--r-- | noncore/apps/advancedfm/advancedfmData.cpp | 5 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 18 |
2 files changed, 21 insertions, 2 deletions
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp index feda198..95e619b 100644 --- a/noncore/apps/advancedfm/advancedfmData.cpp +++ b/noncore/apps/advancedfm/advancedfmData.cpp | |||
@@ -1,135 +1,140 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | advancedfmData.cpp | 2 | advancedfmData.cpp |
3 | ------------------- | 3 | ------------------- |
4 | ** Created: Mon 09-23-2002 13:24:11 | 4 | ** Created: Mon 09-23-2002 13:24:11 |
5 | copyright : (C) 2002 by ljp | 5 | copyright : (C) 2002 by ljp |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | #include "advancedfm.h" | 12 | #include "advancedfm.h" |
13 | 13 | ||
14 | /* OPIE */ | 14 | /* OPIE */ |
15 | #include <opie2/odebug.h> | 15 | #include <opie2/odebug.h> |
16 | #include <opie2/oresource.h> | 16 | #include <opie2/oresource.h> |
17 | #include <qpe/applnk.h> | 17 | #include <qpe/applnk.h> |
18 | #include <qpe/storage.h> | 18 | #include <qpe/storage.h> |
19 | #include <qpe/qpeapplication.h> | 19 | #include <qpe/qpeapplication.h> |
20 | #include <qpe/menubutton.h> | 20 | #include <qpe/menubutton.h> |
21 | using namespace Opie::Core; | 21 | using namespace Opie::Core; |
22 | using namespace Opie::Ui; | 22 | using namespace Opie::Ui; |
23 | 23 | ||
24 | /* QT */ | 24 | /* QT */ |
25 | #include <qframe.h> | ||
25 | #include <qlayout.h> | 26 | #include <qlayout.h> |
26 | #include <qhbox.h> | 27 | #include <qhbox.h> |
27 | #include <qmenubar.h> | 28 | #include <qmenubar.h> |
28 | #include <qcombobox.h> | 29 | #include <qcombobox.h> |
29 | #include <qtoolbutton.h> | 30 | #include <qtoolbutton.h> |
30 | #include <qlineedit.h> | 31 | #include <qlineedit.h> |
31 | #include <qlistview.h> | 32 | #include <qlistview.h> |
32 | 33 | ||
33 | /* STD */ | 34 | /* STD */ |
34 | #include <sys/utsname.h> | 35 | #include <sys/utsname.h> |
35 | 36 | ||
36 | void AdvancedFm::init() { | 37 | void AdvancedFm::init() { |
37 | b = false; | 38 | b = false; |
38 | setCaption( tr( "AdvancedFm" ) ); | 39 | setCaption( tr( "AdvancedFm" ) ); |
39 | 40 | ||
41 | // QFrame* frame = new QFrame(this); | ||
42 | // setCentralWidget(frame); | ||
43 | // QVBoxLayout *layout = new QVBoxLayout( frame ); | ||
44 | |||
40 | QVBoxLayout *layout = new QVBoxLayout( this ); | 45 | QVBoxLayout *layout = new QVBoxLayout( this ); |
41 | layout->setSpacing( 2); | 46 | layout->setSpacing( 2); |
42 | layout->setMargin( 0); // squeeze | 47 | layout->setMargin( 0); // squeeze |
43 | 48 | ||
44 | QMenuBar *menuBar = new QMenuBar(this); | 49 | QMenuBar *menuBar = new QMenuBar(this); |
45 | menuBar->setMargin( 0 ); // squeeze | 50 | menuBar->setMargin( 0 ); // squeeze |
46 | fileMenu = new QPopupMenu( this ); | 51 | fileMenu = new QPopupMenu( this ); |
47 | viewMenu = new QPopupMenu( this ); | 52 | viewMenu = new QPopupMenu( this ); |
48 | // customDirMenu = new QPopupMenu( this ); | 53 | // customDirMenu = new QPopupMenu( this ); |
49 | 54 | ||
50 | layout->addWidget( menuBar ); | 55 | layout->addWidget( menuBar ); |
51 | 56 | ||
52 | menuBar->insertItem( tr( "File" ), fileMenu); | 57 | menuBar->insertItem( tr( "File" ), fileMenu); |
53 | menuBar->insertItem( tr( "View" ), viewMenu); | 58 | menuBar->insertItem( tr( "View" ), viewMenu); |
54 | 59 | ||
55 | bool useBigIcon = qApp->desktop()->size().width() > 330; | 60 | bool useBigIcon = qApp->desktop()->size().width() > 330; |
56 | 61 | ||
57 | cdUpButton = new QToolButton( 0,"cdUpButton"); | 62 | cdUpButton = new QToolButton( 0,"cdUpButton"); |
58 | cdUpButton->setUsesBigPixmap( useBigIcon ); | 63 | cdUpButton->setUsesBigPixmap( useBigIcon ); |
59 | cdUpButton->setPixmap( Opie::Core::OResource::loadPixmap( "up", Opie::Core::OResource::SmallIcon ) ); | 64 | cdUpButton->setPixmap( Opie::Core::OResource::loadPixmap( "up", Opie::Core::OResource::SmallIcon ) ); |
60 | cdUpButton->setAutoRaise( true ); | 65 | cdUpButton->setAutoRaise( true ); |
61 | menuBar->insertItem( cdUpButton ); | 66 | menuBar->insertItem( cdUpButton ); |
62 | 67 | ||
63 | qpeDirButton= new QToolButton( 0,"QPEButton"); | 68 | qpeDirButton= new QToolButton( 0,"QPEButton"); |
64 | qpeDirButton->setUsesBigPixmap( useBigIcon ); | 69 | qpeDirButton->setUsesBigPixmap( useBigIcon ); |
65 | qpeDirButton->setPixmap( Opie::Core::OResource::loadPixmap( "logo/opielogo", Opie::Core::OResource::SmallIcon ) ); | 70 | qpeDirButton->setPixmap( Opie::Core::OResource::loadPixmap( "logo/opielogo", Opie::Core::OResource::SmallIcon ) ); |
66 | qpeDirButton->setAutoRaise( true ); | 71 | qpeDirButton->setAutoRaise( true ); |
67 | menuBar->insertItem( qpeDirButton ); | 72 | menuBar->insertItem( qpeDirButton ); |
68 | 73 | ||
69 | cfButton = new QToolButton( 0, "CFButton"); | 74 | cfButton = new QToolButton( 0, "CFButton"); |
70 | cfButton->setUsesBigPixmap( useBigIcon ); | 75 | cfButton->setUsesBigPixmap( useBigIcon ); |
71 | cfButton->setPixmap( Opie::Core::OResource::loadPixmap( "pcmcia", Opie::Core::OResource::SmallIcon ) ); | 76 | cfButton->setPixmap( Opie::Core::OResource::loadPixmap( "pcmcia", Opie::Core::OResource::SmallIcon ) ); |
72 | cfButton->setAutoRaise( true ); | 77 | cfButton->setAutoRaise( true ); |
73 | menuBar->insertItem( cfButton ); | 78 | menuBar->insertItem( cfButton ); |
74 | 79 | ||
75 | sdButton = new QToolButton( 0, "SDButton"); | 80 | sdButton = new QToolButton( 0, "SDButton"); |
76 | sdButton->setUsesBigPixmap( useBigIcon ); | 81 | sdButton->setUsesBigPixmap( useBigIcon ); |
77 | sdButton->setPixmap( Opie::Core::OResource::loadPixmap( "advancedfm/sdcard", Opie::Core::OResource::SmallIcon ) ); | 82 | sdButton->setPixmap( Opie::Core::OResource::loadPixmap( "advancedfm/sdcard", Opie::Core::OResource::SmallIcon ) ); |
78 | sdButton->setAutoRaise( true ); | 83 | sdButton->setAutoRaise( true ); |
79 | menuBar->insertItem( sdButton ); | 84 | menuBar->insertItem( sdButton ); |
80 | 85 | ||
81 | docButton = new QToolButton( 0,"docsButton"); | 86 | docButton = new QToolButton( 0,"docsButton"); |
82 | docButton->setUsesBigPixmap( useBigIcon ); | 87 | docButton->setUsesBigPixmap( useBigIcon ); |
83 | docButton->setPixmap( Opie::Core::OResource::loadPixmap( "DocsIcon", Opie::Core::OResource::SmallIcon ) ); | 88 | docButton->setPixmap( Opie::Core::OResource::loadPixmap( "DocsIcon", Opie::Core::OResource::SmallIcon ) ); |
84 | docButton->setAutoRaise( true ); | 89 | docButton->setAutoRaise( true ); |
85 | menuBar->insertItem( docButton ); | 90 | menuBar->insertItem( docButton ); |
86 | 91 | ||
87 | homeButton = new QToolButton( 0, "homeButton"); | 92 | homeButton = new QToolButton( 0, "homeButton"); |
88 | homeButton->setUsesBigPixmap( useBigIcon ); | 93 | homeButton->setUsesBigPixmap( useBigIcon ); |
89 | homeButton->setPixmap( Opie::Core::OResource::loadPixmap( "home", Opie::Core::OResource::SmallIcon ) ); | 94 | homeButton->setPixmap( Opie::Core::OResource::loadPixmap( "home", Opie::Core::OResource::SmallIcon ) ); |
90 | homeButton->setAutoRaise( true ); | 95 | homeButton->setAutoRaise( true ); |
91 | menuBar->insertItem( homeButton ); | 96 | menuBar->insertItem( homeButton ); |
92 | 97 | ||
93 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); | 98 | fileMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() )); |
94 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 99 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
95 | fileMenu->insertSeparator(); | 100 | fileMenu->insertSeparator(); |
96 | fileMenu->insertItem( tr( "File Search" ), this, SLOT( openSearch() )); | 101 | fileMenu->insertItem( tr( "File Search" ), this, SLOT( openSearch() )); |
97 | fileMenu->insertSeparator(); | 102 | fileMenu->insertSeparator(); |
98 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); | 103 | fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() )); |
99 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); | 104 | fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() )); |
100 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); | 105 | fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() )); |
101 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); | 106 | fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() )); |
102 | fileMenu->insertSeparator(); | 107 | fileMenu->insertSeparator(); |
103 | fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | 108 | fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); |
104 | fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() )); | 109 | fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() )); |
105 | fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); | 110 | fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() )); |
106 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); | 111 | fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() )); |
107 | fileMenu->setCheckable(TRUE); | 112 | fileMenu->setCheckable(TRUE); |
108 | 113 | ||
109 | viewMenu->insertItem( tr( "Switch to View 1" ), this, SLOT( switchToLocalTab())); | 114 | viewMenu->insertItem( tr( "Switch to View 1" ), this, SLOT( switchToLocalTab())); |
110 | viewMenu->insertItem( tr( "Switch to View 2" ), this, SLOT( switchToRemoteTab())); | 115 | viewMenu->insertItem( tr( "Switch to View 2" ), this, SLOT( switchToRemoteTab())); |
111 | viewMenu->insertItem( tr( "Refresh" ), this, SLOT( refreshCurrentTab())); | 116 | viewMenu->insertItem( tr( "Refresh" ), this, SLOT( refreshCurrentTab())); |
112 | // viewMenu->insertSeparator(); | 117 | // viewMenu->insertSeparator(); |
113 | // viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); | 118 | // viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() )); |
114 | viewMenu->setCheckable(true); | 119 | viewMenu->setCheckable(true); |
115 | viewMenu->setItemChecked( viewMenu->idAt(0), true); | 120 | viewMenu->setItemChecked( viewMenu->idAt(0), true); |
116 | viewMenu->setItemChecked( viewMenu->idAt(1), false); | 121 | viewMenu->setItemChecked( viewMenu->idAt(1), false); |
117 | 122 | ||
118 | s_addBookmark = tr("Bookmark Directory"); | 123 | s_addBookmark = tr("Bookmark Directory"); |
119 | s_removeBookmark = tr("Remove Current Directory from Bookmarks"); | 124 | s_removeBookmark = tr("Remove Current Directory from Bookmarks"); |
120 | 125 | ||
121 | // menuButton->insertItem(""); | 126 | // menuButton->insertItem(""); |
122 | 127 | ||
123 | // customDirMenu->insertItem(tr("Add This Directory")); | 128 | // customDirMenu->insertItem(tr("Add This Directory")); |
124 | // customDirMenu->insertItem(tr("Remove This Directory")); | 129 | // customDirMenu->insertItem(tr("Remove This Directory")); |
125 | // customDirMenu->insertSeparator(); | 130 | // customDirMenu->insertSeparator(); |
126 | 131 | ||
127 | QHBoxLayout *CBHB = new QHBoxLayout(); // parent layout will be set later | 132 | QHBoxLayout *CBHB = new QHBoxLayout(); // parent layout will be set later |
128 | CBHB->setMargin( 0 ); | 133 | CBHB->setMargin( 0 ); |
129 | CBHB->setSpacing( 1 ); | 134 | CBHB->setSpacing( 1 ); |
130 | 135 | ||
131 | menuButton = new MenuButton( this ); | 136 | menuButton = new MenuButton( this ); |
132 | 137 | ||
133 | menuButton->setUseLabel(false); | 138 | menuButton->setUseLabel(false); |
134 | menuButton->setMaximumWidth( 20 ); | 139 | menuButton->setMaximumWidth( 20 ); |
135 | menuButton->insertItem( s_addBookmark); | 140 | menuButton->insertItem( s_addBookmark); |
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index 80324eb..ed280aa 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp | |||
@@ -563,201 +563,215 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest ) { | |||
563 | int read_fd=0; | 563 | int read_fd=0; |
564 | int write_fd=0; | 564 | int write_fd=0; |
565 | struct stat stat_buf; | 565 | struct stat stat_buf; |
566 | off_t offset = 0; | 566 | off_t offset = 0; |
567 | if(!srcFile.open( IO_ReadOnly|IO_Raw)) { | 567 | if(!srcFile.open( IO_ReadOnly|IO_Raw)) { |
568 | // owarn << "open failed" << oendl; | 568 | // owarn << "open failed" << oendl; |
569 | return success = false; | 569 | return success = false; |
570 | } | 570 | } |
571 | read_fd = srcFile.handle(); | 571 | read_fd = srcFile.handle(); |
572 | if(read_fd != -1) { | 572 | if(read_fd != -1) { |
573 | fstat (read_fd, &stat_buf); | 573 | fstat (read_fd, &stat_buf); |
574 | if( !destFile.open( IO_WriteOnly|IO_Raw ) ) { | 574 | if( !destFile.open( IO_WriteOnly|IO_Raw ) ) { |
575 | // owarn << "destfile open failed" << oendl; | 575 | // owarn << "destfile open failed" << oendl; |
576 | return success = false; | 576 | return success = false; |
577 | } | 577 | } |
578 | write_fd = destFile.handle(); | 578 | write_fd = destFile.handle(); |
579 | if(write_fd != -1) { | 579 | if(write_fd != -1) { |
580 | err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size); | 580 | err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size); |
581 | if( err == -1) { | 581 | if( err == -1) { |
582 | QString msg; | 582 | QString msg; |
583 | switch(err) { | 583 | switch(err) { |
584 | case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. "; | 584 | case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. "; |
585 | case EINVAL: msg = "Descriptor is not valid or locked. "; | 585 | case EINVAL: msg = "Descriptor is not valid or locked. "; |
586 | case ENOMEM: msg = "Insufficient memory to read from in_fd."; | 586 | case ENOMEM: msg = "Insufficient memory to read from in_fd."; |
587 | case EIO: msg = "Unspecified error while reading from in_fd."; | 587 | case EIO: msg = "Unspecified error while reading from in_fd."; |
588 | }; | 588 | }; |
589 | success = false; | 589 | success = false; |
590 | // owarn << msg << oendl; | 590 | // owarn << msg << oendl; |
591 | } | 591 | } |
592 | } else { | 592 | } else { |
593 | success = false; | 593 | success = false; |
594 | } | 594 | } |
595 | } else { | 595 | } else { |
596 | success = false; | 596 | success = false; |
597 | } | 597 | } |
598 | srcFile.close(); | 598 | srcFile.close(); |
599 | destFile.close(); | 599 | destFile.close(); |
600 | // Set file permissions | 600 | // Set file permissions |
601 | if( stat( QFile::encodeName(src), &status ) == 0 ) { | 601 | if( stat( QFile::encodeName(src), &status ) == 0 ) { |
602 | chmod( QFile::encodeName(dest), status.st_mode ); | 602 | chmod( QFile::encodeName(dest), status.st_mode ); |
603 | } | 603 | } |
604 | 604 | ||
605 | return success; | 605 | return success; |
606 | } | 606 | } |
607 | 607 | ||
608 | void AdvancedFm::runCommand() { | 608 | void AdvancedFm::runCommand() { |
609 | if( !CurrentView()->currentItem()) return; | 609 | if( !CurrentView()->currentItem()) return; |
610 | QDir *thisDir = CurrentDir(); | 610 | QDir *thisDir = CurrentDir(); |
611 | 611 | ||
612 | QString curFile; | 612 | QString curFile; |
613 | curFile = thisDir->canonicalPath() +"/"+ CurrentView()->currentItem()->text(0); | 613 | curFile = thisDir->canonicalPath() +"/"+ CurrentView()->currentItem()->text(0); |
614 | 614 | ||
615 | InputDialog *fileDlg; | 615 | InputDialog *fileDlg; |
616 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); | 616 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); |
617 | fileDlg->setInputText(curFile); | 617 | fileDlg->setInputText(curFile); |
618 | fileDlg->exec(); | 618 | fileDlg->exec(); |
619 | //QString command; | 619 | //QString command; |
620 | 620 | ||
621 | if( fileDlg->result() == 1 ) { | 621 | if( fileDlg->result() == 1 ) { |
622 | // odebug << fileDlg->LineEdit1->text() << oendl; | 622 | // odebug << fileDlg->LineEdit1->text() << oendl; |
623 | QStringList command; | 623 | QStringList command; |
624 | 624 | ||
625 | command << "/bin/sh"; | 625 | command << "/bin/sh"; |
626 | command << "-c"; | 626 | command << "-c"; |
627 | command << fileDlg->LineEdit1->text(); | 627 | command << fileDlg->LineEdit1->text(); |
628 | Output *outDlg; | 628 | Output *outDlg; |
629 | outDlg = new Output( command, this, tr("AdvancedFm Output"), true); | 629 | outDlg = new Output( command, this, tr("AdvancedFm Output"), true); |
630 | QPEApplication::execDialog( outDlg ); | 630 | QPEApplication::execDialog( outDlg ); |
631 | qApp->processEvents(); | 631 | qApp->processEvents(); |
632 | 632 | ||
633 | } | 633 | } |
634 | } | 634 | } |
635 | 635 | ||
636 | void AdvancedFm::runCommandStd() { | 636 | void AdvancedFm::runCommandStd() { |
637 | if( !CurrentView()->currentItem()) return; | 637 | if( !CurrentView()->currentItem()) return; |
638 | QString curFile; | 638 | QString curFile; |
639 | QDir *thisDir = CurrentDir(); | 639 | QDir *thisDir = CurrentDir(); |
640 | QListView *thisView = CurrentView(); | 640 | QListView *thisView = CurrentView(); |
641 | if( thisView->currentItem()) | 641 | if( thisView->currentItem()) |
642 | curFile = thisDir->canonicalPath() +"/"+ thisView->currentItem()->text(0); | 642 | curFile = thisDir->canonicalPath() +"/"+ thisView->currentItem()->text(0); |
643 | 643 | ||
644 | InputDialog *fileDlg; | 644 | InputDialog *fileDlg; |
645 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); | 645 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); |
646 | fileDlg->setInputText(curFile); | 646 | fileDlg->setInputText(curFile); |
647 | fileDlg->exec(); | 647 | fileDlg->exec(); |
648 | 648 | ||
649 | if( fileDlg->result() == 1 ) { | 649 | if( fileDlg->result() == 1 ) { |
650 | qApp->processEvents(); | 650 | qApp->processEvents(); |
651 | startProcess( (const QString)fileDlg->LineEdit1->text().latin1()); | 651 | startProcess( (const QString)fileDlg->LineEdit1->text().latin1()); |
652 | } | 652 | } |
653 | } | 653 | } |
654 | 654 | ||
655 | void AdvancedFm::fileStatus() { | 655 | void AdvancedFm::fileStatus() { |
656 | if( !CurrentView()->currentItem()) return; | 656 | if( !CurrentView()->currentItem()) return; |
657 | QString curFile; | 657 | QString curFile; |
658 | curFile = CurrentView()->currentItem()->text(0); | 658 | curFile = CurrentView()->currentItem()->text(0); |
659 | 659 | if(QFileInfo("/usr/bin/stat").exists()) { | |
660 | QStringList command; | 660 | QStringList command; |
661 | command << "/bin/sh"; | 661 | command << "/bin/sh"; |
662 | command << "-c"; | 662 | command << "-c"; |
663 | command << "stat -l "+ curFile; | 663 | command << "stat -l "+ curFile; |
664 | |||
665 | Output *outDlg; | 664 | Output *outDlg; |
666 | outDlg = new Output( command, this, tr("AdvancedFm Output"), true); | 665 | outDlg = new Output( command, this, tr("AdvancedFm Output"), true); |
667 | QPEApplication::execDialog( outDlg ); | 666 | QPEApplication::execDialog( outDlg ); |
667 | } else { | ||
668 | /* struct stat buf; | ||
669 | stat( curFile.local8bit(), &buf); | ||
670 | |||
671 | st_dev dev; | ||
672 | st_uid uid; | ||
673 | st_gid gid; | ||
674 | st_size size; | ||
675 | st_atime atime; | ||
676 | st_mtime mtime; | ||
677 | st_ctime ctime; | ||
678 | st_mode mode; | ||
679 | */ | ||
680 | } | ||
681 | |||
668 | qApp->processEvents(); | 682 | qApp->processEvents(); |
669 | } | 683 | } |
670 | 684 | ||
671 | 685 | ||
672 | void AdvancedFm::mkDir() { | 686 | void AdvancedFm::mkDir() { |
673 | makeDir(); | 687 | makeDir(); |
674 | } | 688 | } |
675 | 689 | ||
676 | void AdvancedFm::rn() { | 690 | void AdvancedFm::rn() { |
677 | renameIt(); | 691 | renameIt(); |
678 | } | 692 | } |
679 | 693 | ||
680 | void AdvancedFm::del() { | 694 | void AdvancedFm::del() { |
681 | doDelete(); | 695 | doDelete(); |
682 | } | 696 | } |
683 | 697 | ||
684 | void AdvancedFm::mkSym() { | 698 | void AdvancedFm::mkSym() { |
685 | QString cmd; | 699 | QString cmd; |
686 | QStringList curFileList = getPath(); | 700 | QStringList curFileList = getPath(); |
687 | if( curFileList.count() > 0) { | 701 | if( curFileList.count() > 0) { |
688 | QDir *thisDir = CurrentDir(); | 702 | QDir *thisDir = CurrentDir(); |
689 | QDir * thatDir = OtherDir(); | 703 | QDir * thatDir = OtherDir(); |
690 | 704 | ||
691 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 705 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
692 | 706 | ||
693 | QString destName = thatDir->canonicalPath()+"/"+(*it); | 707 | QString destName = thatDir->canonicalPath()+"/"+(*it); |
694 | if(destName.right(1) == "/") { | 708 | if(destName.right(1) == "/") { |
695 | destName = destName.left( destName.length() -1); | 709 | destName = destName.left( destName.length() -1); |
696 | } | 710 | } |
697 | 711 | ||
698 | QString curFile = thisDir->canonicalPath()+"/"+(*it); | 712 | QString curFile = thisDir->canonicalPath()+"/"+(*it); |
699 | 713 | ||
700 | if( curFile.right(1) == "/") { | 714 | if( curFile.right(1) == "/") { |
701 | curFile = curFile.left( curFile.length() -1); | 715 | curFile = curFile.left( curFile.length() -1); |
702 | } | 716 | } |
703 | 717 | ||
704 | cmd = "ln -s "+curFile+" "+destName; | 718 | cmd = "ln -s "+curFile+" "+destName; |
705 | // odebug << cmd << oendl; | 719 | // odebug << cmd << oendl; |
706 | startProcess( (const QString)cmd ); | 720 | startProcess( (const QString)cmd ); |
707 | } | 721 | } |
708 | rePopulate(); | 722 | rePopulate(); |
709 | setOtherTabCurrent(); | 723 | setOtherTabCurrent(); |
710 | } | 724 | } |
711 | } | 725 | } |
712 | 726 | ||
713 | void AdvancedFm::doBeam() { | 727 | void AdvancedFm::doBeam() { |
714 | Ir ir; | 728 | Ir ir; |
715 | if(!ir.supported()) { | 729 | if(!ir.supported()) { |
716 | } else { | 730 | } else { |
717 | QStringList curFileList = getPath(); | 731 | QStringList curFileList = getPath(); |
718 | if( curFileList.count() > 0) { | 732 | if( curFileList.count() > 0) { |
719 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 733 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
720 | QString curFile = (*it); | 734 | QString curFile = (*it); |
721 | QString curFilePath = CurrentDir()->canonicalPath()+"/"+curFile; | 735 | QString curFilePath = CurrentDir()->canonicalPath()+"/"+curFile; |
722 | if( curFilePath.right(1) == "/") { | 736 | if( curFilePath.right(1) == "/") { |
723 | curFilePath = curFilePath.left( curFilePath.length() -1); | 737 | curFilePath = curFilePath.left( curFilePath.length() -1); |
724 | } | 738 | } |
725 | Ir *file = new Ir(this, "IR"); | 739 | Ir *file = new Ir(this, "IR"); |
726 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished(Ir*))); | 740 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished(Ir*))); |
727 | file->send( curFilePath, curFile ); | 741 | file->send( curFilePath, curFile ); |
728 | } | 742 | } |
729 | } | 743 | } |
730 | } | 744 | } |
731 | } | 745 | } |
732 | 746 | ||
733 | void AdvancedFm::fileBeamFinished( Ir *) { | 747 | void AdvancedFm::fileBeamFinished( Ir *) { |
734 | QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); | 748 | QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); |
735 | } | 749 | } |
736 | 750 | ||
737 | void AdvancedFm::selectAll() { | 751 | void AdvancedFm::selectAll() { |
738 | QListView *thisView = CurrentView(); | 752 | QListView *thisView = CurrentView(); |
739 | thisView->selectAll(true); | 753 | thisView->selectAll(true); |
740 | thisView->setSelected( thisView->firstChild(),false); | 754 | thisView->setSelected( thisView->firstChild(),false); |
741 | } | 755 | } |
742 | 756 | ||
743 | void AdvancedFm::startProcess(const QString & cmd) { | 757 | void AdvancedFm::startProcess(const QString & cmd) { |
744 | QStringList command; | 758 | QStringList command; |
745 | OProcess *process; | 759 | OProcess *process; |
746 | process = new OProcess(); | 760 | process = new OProcess(); |
747 | connect(process,SIGNAL(processExited(Opie::Core::OProcess*)),this,SLOT(processEnded(Opie::Core::OProcess*))); | 761 | connect(process,SIGNAL(processExited(Opie::Core::OProcess*)),this,SLOT(processEnded(Opie::Core::OProcess*))); |
748 | connect(process,SIGNAL(receivedStderr(Opie::Core::OProcess*,char*,int)),this,SLOT(oprocessStderr(Opie::Core::OProcess*,char*,int))); | 762 | connect(process,SIGNAL(receivedStderr(Opie::Core::OProcess*,char*,int)),this,SLOT(oprocessStderr(Opie::Core::OProcess*,char*,int))); |
749 | 763 | ||
750 | command << "/bin/sh"; | 764 | command << "/bin/sh"; |
751 | command << "-c"; | 765 | command << "-c"; |
752 | command << cmd.latin1(); | 766 | command << cmd.latin1(); |
753 | *process << command; | 767 | *process << command; |
754 | if(!process->start(OProcess::NotifyOnExit, OProcess::All) ) | 768 | if(!process->start(OProcess::NotifyOnExit, OProcess::All) ) |
755 | odebug << "could not start process" << oendl; | 769 | odebug << "could not start process" << oendl; |
756 | } | 770 | } |
757 | 771 | ||
758 | void AdvancedFm::processEnded(OProcess *) { | 772 | void AdvancedFm::processEnded(OProcess *) { |
759 | rePopulate(); | 773 | rePopulate(); |
760 | } | 774 | } |
761 | 775 | ||
762 | void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { | 776 | void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { |
763 | // owarn << "received stderrt " << buflen << " bytes" << oendl; | 777 | // owarn << "received stderrt " << buflen << " bytes" << oendl; |