summaryrefslogtreecommitdiff
authorkorovkin <korovkin>2006-12-30 18:15:58 (UTC)
committer korovkin <korovkin>2006-12-30 18:15:58 (UTC)
commit188c44c1196c3597a84189c2d148813df16dfe95 (patch) (unidiff)
tree15cecf27f6db8ce2b42c182e1cec87706ba01ef9
parentbb6f32ae999168fc44d50d3523c3ef232824185a (diff)
downloadopie-188c44c1196c3597a84189c2d148813df16dfe95.zip
opie-188c44c1196c3597a84189c2d148813df16dfe95.tar.gz
opie-188c44c1196c3597a84189c2d148813df16dfe95.tar.bz2
Fix for bug# 0001553 Submited by Paul Eggleton
avancedfm uses FileInfoDialog and QFileInfo to display the selected file information.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.pro1
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp114
-rw-r--r--noncore/apps/advancedfm/fileInfoDialog.ui418
3 files changed, 506 insertions, 27 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.pro b/noncore/apps/advancedfm/advancedfm.pro
index 396f912..90d29e3 100644
--- a/noncore/apps/advancedfm/advancedfm.pro
+++ b/noncore/apps/advancedfm/advancedfm.pro
@@ -1,15 +1,16 @@
1TEMPLATE = app 1TEMPLATE = app
2CONFIG += qte warn_on quick-app debug 2CONFIG += qte warn_on quick-app debug
3HEADERS = advancedfm.h filePermissions.h output.h 3HEADERS = advancedfm.h filePermissions.h output.h
4SOURCES = advancedfm.cpp advancedfmData.cpp advancedfmMenu.cpp filePermissions.cpp output.cpp main.cpp 4SOURCES = advancedfm.cpp advancedfmData.cpp advancedfmMenu.cpp filePermissions.cpp output.cpp main.cpp
5TARGET = advancedfm 5TARGET = advancedfm
6INTERFACES += fileInfoDialog.ui
6INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
7DEPENDPATH += $(OPIEDIR)/include 8DEPENDPATH += $(OPIEDIR)/include
8LIBS += -lqpe -lopiecore2 -lopieui2 9LIBS += -lqpe -lopiecore2 -lopieui2
9 10
10!contains(CONFIG,quick-app) { 11!contains(CONFIG,quick-app) {
11 DESTDIR = $(OPIEDIR)/bin 12 DESTDIR = $(OPIEDIR)/bin
12 DEFINES += NOQUICKLAUNCH 13 DEFINES += NOQUICKLAUNCH
13} 14}
14 15
15include( $(OPIEDIR)/include.pro ) 16include( $(OPIEDIR)/include.pro )
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp
index ed280aa..9181810 100644
--- a/noncore/apps/advancedfm/advancedfmMenu.cpp
+++ b/noncore/apps/advancedfm/advancedfmMenu.cpp
@@ -1,124 +1,126 @@
1/*************************************************************************** 1/***************************************************************************
2 AdvancedFm.cpp 2 AdvancedFm.cpp
3 ------------------- 3 -------------------
4 ** Created: Sat Mar 9 23:33:09 2002 4 ** Created: Sat Mar 9 23:33:09 2002
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 12
13#include "advancedfm.h" 13#include "advancedfm.h"
14#include "output.h" 14#include "output.h"
15#include "filePermissions.h" 15#include "filePermissions.h"
16#include "fileInfoDialog.h"
16 17
17/* OPIE */ 18/* OPIE */
18#include <opie2/odebug.h> 19#include <opie2/odebug.h>
19#include <qpe/lnkproperties.h> 20#include <qpe/lnkproperties.h>
20#include <qpe/qpeapplication.h> 21#include <qpe/qpeapplication.h>
21#include <qpe/applnk.h> 22#include <qpe/applnk.h>
22using namespace Opie::Core; 23using namespace Opie::Core;
23 24
24/* QT*/ 25/* QT*/
25 26
26#include <qmessagebox.h> 27#include <qmessagebox.h>
27#include <qpopupmenu.h> 28#include <qpopupmenu.h>
28#include <qlistview.h> 29#include <qlistview.h>
30#include <qlabel.h>
29 31
30/* STD */ 32/* STD */
31 33
32#include <errno.h> 34#include <errno.h>
33#include <stdlib.h> 35#include <stdlib.h>
34#include <unistd.h> 36#include <unistd.h>
35#include <sys/stat.h> 37#include <sys/stat.h>
36#include <dirent.h> 38#include <dirent.h>
37#include <sys/sendfile.h> 39#include <sys/sendfile.h>
38#include <fcntl.h> 40#include <fcntl.h>
39 41
40void AdvancedFm::doDirChange() { 42void AdvancedFm::doDirChange() {
41 QString pathItem = CurrentView()->currentItem()->text(0); 43 QString pathItem = CurrentView()->currentItem()->text(0);
42 if( pathItem == "../") { 44 if( pathItem == "../") {
43 ListClicked( CurrentView()->currentItem()); 45 ListClicked( CurrentView()->currentItem());
44 } else { 46 } else {
45 if( pathItem.find(" -> ",0,TRUE) != -1) 47 if( pathItem.find(" -> ",0,TRUE) != -1)
46 pathItem = dealWithSymName((const QString&)pathItem)+"/"; 48 pathItem = dealWithSymName((const QString&)pathItem)+"/";
47// owarn << pathItem << oendl; 49// owarn << pathItem << oendl;
48 changeTo( CurrentDir()->path()+"/"+pathItem.left( pathItem.length() - 1) ); 50 changeTo( CurrentDir()->path()+"/"+pathItem.left( pathItem.length() - 1) );
49 } 51 }
50} 52}
51 53
52void AdvancedFm::showMenuHidden() { 54void AdvancedFm::showMenuHidden() {
53 if (b) { 55 if (b) {
54 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 56 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
55 OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 57 OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
56 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); 58 fileMenu->setItemChecked( fileMenu->idAt(0),TRUE);
57 } else { 59 } else {
58 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 60 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
59 OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 61 OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
60 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); 62 fileMenu->setItemChecked( fileMenu->idAt(0),FALSE);
61 } 63 }
62 b = !b; 64 b = !b;
63 populateView(); 65 populateView();
64} 66}
65 67
66void AdvancedFm::showHidden() { 68void AdvancedFm::showHidden() {
67 if (b) { 69 if (b) {
68 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 70 CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
69 OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 71 OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
70 } else { 72 } else {
71 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 73 CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
72 OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 74 OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
73 } 75 }
74 populateView(); 76 populateView();
75} 77}
76 78
77QString AdvancedFm::dealWithSymName(const QString &fileName) { 79QString AdvancedFm::dealWithSymName(const QString &fileName) {
78 QString strItem = fileName; 80 QString strItem = fileName;
79 return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 81 return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
80} 82}
81 83
82void AdvancedFm::runThis() { 84void AdvancedFm::runThis() {
83 if( !CurrentView()->currentItem()) return; 85 if( !CurrentView()->currentItem()) return;
84 QString fs; 86 QString fs;
85 QDir *thisDir = CurrentDir(); 87 QDir *thisDir = CurrentDir();
86 88
87 QString curFile = CurrentView()->currentItem()->text(0); 89 QString curFile = CurrentView()->currentItem()->text(0);
88 QString path = thisDir->canonicalPath(); 90 QString path = thisDir->canonicalPath();
89 91
90 if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink 92 if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink
91 93
92 curFile = dealWithSymName((const QString&)curFile); 94 curFile = dealWithSymName((const QString&)curFile);
93 95
94 if(curFile != "../") { 96 if(curFile != "../") {
95 97
96 fs = getFileSystemType((const QString &) path); 98 fs = getFileSystemType((const QString &) path);
97 QFileInfo fileInfo( path + "/" + curFile); 99 QFileInfo fileInfo( path + "/" + curFile);
98// odebug << fileInfo.owner() << oendl; 100// odebug << fileInfo.owner() << oendl;
99 101
100 if( (fileInfo.permission( QFileInfo::ExeUser) 102 if( (fileInfo.permission( QFileInfo::ExeUser)
101 | fileInfo.permission( QFileInfo::ExeGroup) 103 | fileInfo.permission( QFileInfo::ExeGroup)
102 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { 104 | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) {
103 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { 105 | fs == "vfat" && fileInfo.filePath().contains("/bin") ) {
104 QCopEnvelope e("QPE/System", "execute(QString)" ); 106 QCopEnvelope e("QPE/System", "execute(QString)" );
105 e << curFile; 107 e << curFile;
106 } else { 108 } else {
107 curFile = path + "/" + curFile; 109 curFile = path + "/" + curFile;
108 DocLnk nf(curFile); 110 DocLnk nf(curFile);
109 QString execStr = nf.exec(); 111 QString execStr = nf.exec();
110// odebug << execStr << oendl; 112// odebug << execStr << oendl;
111 if( execStr.isEmpty() ) { 113 if( execStr.isEmpty() ) {
112 } else { 114 } else {
113 nf.execute(); 115 nf.execute();
114 } 116 }
115 } 117 }
116 } 118 }
117} 119}
118 120
119void AdvancedFm::runText() { 121void AdvancedFm::runText() {
120 if( !CurrentView()->currentItem()) return; 122 if( !CurrentView()->currentItem()) return;
121 QString curFile = CurrentView()->currentItem()->text(0); 123 QString curFile = CurrentView()->currentItem()->text(0);
122 if(curFile != "../") { 124 if(curFile != "../") {
123 if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink 125 if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink
124 curFile = dealWithSymName((const QString&)curFile); 126 curFile = dealWithSymName((const QString&)curFile);
@@ -560,219 +562,277 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest ) {
560 QFile srcFile(src); 562 QFile srcFile(src);
561 QFile destFile(dest); 563 QFile destFile(dest);
562 int err=0; 564 int err=0;
563 int read_fd=0; 565 int read_fd=0;
564 int write_fd=0; 566 int write_fd=0;
565 struct stat stat_buf; 567 struct stat stat_buf;
566 off_t offset = 0; 568 off_t offset = 0;
567 if(!srcFile.open( IO_ReadOnly|IO_Raw)) { 569 if(!srcFile.open( IO_ReadOnly|IO_Raw)) {
568// owarn << "open failed" << oendl; 570// owarn << "open failed" << oendl;
569 return success = false; 571 return success = false;
570 } 572 }
571 read_fd = srcFile.handle(); 573 read_fd = srcFile.handle();
572 if(read_fd != -1) { 574 if(read_fd != -1) {
573 fstat (read_fd, &stat_buf); 575 fstat (read_fd, &stat_buf);
574 if( !destFile.open( IO_WriteOnly|IO_Raw ) ) { 576 if( !destFile.open( IO_WriteOnly|IO_Raw ) ) {
575// owarn << "destfile open failed" << oendl; 577// owarn << "destfile open failed" << oendl;
576 return success = false; 578 return success = false;
577 } 579 }
578 write_fd = destFile.handle(); 580 write_fd = destFile.handle();
579 if(write_fd != -1) { 581 if(write_fd != -1) {
580 err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size); 582 err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size);
581 if( err == -1) { 583 if( err == -1) {
582 QString msg; 584 QString msg;
583 switch(err) { 585 switch(err) {
584 case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. "; 586 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. "; 587 case EINVAL: msg = "Descriptor is not valid or locked. ";
586 case ENOMEM: msg = "Insufficient memory to read from in_fd."; 588 case ENOMEM: msg = "Insufficient memory to read from in_fd.";
587 case EIO: msg = "Unspecified error while reading from in_fd."; 589 case EIO: msg = "Unspecified error while reading from in_fd.";
588 }; 590 };
589 success = false; 591 success = false;
590// owarn << msg << oendl; 592// owarn << msg << oendl;
591 } 593 }
592 } else { 594 } else {
593 success = false; 595 success = false;
594 } 596 }
595 } else { 597 } else {
596 success = false; 598 success = false;
597 } 599 }
598 srcFile.close(); 600 srcFile.close();
599 destFile.close(); 601 destFile.close();
600 // Set file permissions 602 // Set file permissions
601 if( stat( QFile::encodeName(src), &status ) == 0 ) { 603 if( stat( QFile::encodeName(src), &status ) == 0 ) {
602 chmod( QFile::encodeName(dest), status.st_mode ); 604 chmod( QFile::encodeName(dest), status.st_mode );
603 } 605 }
604 606
605 return success; 607 return success;
606} 608}
607 609
608void AdvancedFm::runCommand() { 610void AdvancedFm::runCommand() {
609 if( !CurrentView()->currentItem()) return; 611 if( !CurrentView()->currentItem()) return;
610 QDir *thisDir = CurrentDir(); 612 QDir *thisDir = CurrentDir();
611 613
612 QString curFile; 614 QString curFile;
613 curFile = thisDir->canonicalPath() +"/"+ CurrentView()->currentItem()->text(0); 615 curFile = thisDir->canonicalPath() +"/"+ CurrentView()->currentItem()->text(0);
614 616
615 InputDialog *fileDlg; 617 InputDialog *fileDlg;
616 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); 618 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
617 fileDlg->setInputText(curFile); 619 fileDlg->setInputText(curFile);
618 fileDlg->exec(); 620 fileDlg->exec();
619 //QString command; 621 //QString command;
620 622
621 if( fileDlg->result() == 1 ) { 623 if( fileDlg->result() == 1 ) {
622// odebug << fileDlg->LineEdit1->text() << oendl; 624// odebug << fileDlg->LineEdit1->text() << oendl;
623 QStringList command; 625 QStringList command;
624 626
625 command << "/bin/sh"; 627 command << "/bin/sh";
626 command << "-c"; 628 command << "-c";
627 command << fileDlg->LineEdit1->text(); 629 command << fileDlg->LineEdit1->text();
628 Output *outDlg; 630 Output *outDlg;
629 outDlg = new Output( command, this, tr("AdvancedFm Output"), true); 631 outDlg = new Output( command, this, tr("AdvancedFm Output"), true);
630 QPEApplication::execDialog( outDlg ); 632 QPEApplication::execDialog( outDlg );
631 qApp->processEvents(); 633 qApp->processEvents();
632 634
633 } 635 }
634} 636}
635 637
636void AdvancedFm::runCommandStd() { 638void AdvancedFm::runCommandStd() {
637 if( !CurrentView()->currentItem()) return; 639 if( !CurrentView()->currentItem()) return;
638 QString curFile; 640 QString curFile;
639 QDir *thisDir = CurrentDir(); 641 QDir *thisDir = CurrentDir();
640 QListView *thisView = CurrentView(); 642 QListView *thisView = CurrentView();
641 if( thisView->currentItem()) 643 if( thisView->currentItem())
642 curFile = thisDir->canonicalPath() +"/"+ thisView->currentItem()->text(0); 644 curFile = thisDir->canonicalPath() +"/"+ thisView->currentItem()->text(0);
643 645
644 InputDialog *fileDlg; 646 InputDialog *fileDlg;
645 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); 647 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
646 fileDlg->setInputText(curFile); 648 fileDlg->setInputText(curFile);
647 fileDlg->exec(); 649 fileDlg->exec();
648 650
649 if( fileDlg->result() == 1 ) { 651 if( fileDlg->result() == 1 ) {
650 qApp->processEvents(); 652 qApp->processEvents();
651 startProcess( (const QString)fileDlg->LineEdit1->text().latin1()); 653 startProcess( (const QString)fileDlg->LineEdit1->text().latin1());
652 } 654 }
653} 655}
654 656
655void AdvancedFm::fileStatus() { 657void AdvancedFm::fileStatus() {
656 if( !CurrentView()->currentItem()) return; 658 if( !CurrentView()->currentItem()) return;
657 QString curFile; 659
658 curFile = CurrentView()->currentItem()->text(0); 660 QString curFile;
659 if(QFileInfo("/usr/bin/stat").exists()) { 661 curFile = CurrentView()->currentItem()->text(0);
660 QStringList command; 662
661 command << "/bin/sh"; 663 QFileInfo curFileInfo(curFile);
662 command << "-c"; 664
663 command << "stat -l "+ curFile; 665 FileInfoDialog *infoDlg = new FileInfoDialog(this);
664 Output *outDlg; 666 infoDlg->setCaption(tr("Info for %1").arg(curFile));
665 outDlg = new Output( command, this, tr("AdvancedFm Output"), true); 667
666 QPEApplication::execDialog( outDlg ); 668 uint size = curFileInfo.size();
667 } else { 669 QString sizestr;
668/* struct stat buf; 670 if( size > 1048576 )
669 stat( curFile.local8bit(), &buf); 671 sizestr = tr("%1MB (%2 bytes)").arg(QString().sprintf("%.0f", size / 1048576.0)).arg(size);
670 672 else if( size > 1024 )
671 st_dev dev; 673 sizestr = tr("%1kB (%2 bytes)").arg(QString().sprintf("%.0f", size / 1024.0)).arg(size);
672 st_uid uid; 674 else
673 st_gid gid; 675 sizestr = tr("%1 bytes").arg(size);
674 st_size size; 676
675 st_atime atime; 677 infoDlg->sizeLabel->setText(sizestr);
676 st_mtime mtime; 678
677 st_ctime ctime; 679 if(curFileInfo.isSymLink())
678 st_mode mode; 680 infoDlg->typeLabel->setText(tr("symbolic link"));
679*/ 681 else if(curFileInfo.isFile()) {
680 } 682 if(curFileInfo.isExecutable())
681 683 infoDlg->typeLabel->setText(tr("executable file"));
682 qApp->processEvents(); 684 else
685 infoDlg->typeLabel->setText(tr("file"));
686 }
687 else if(curFileInfo.isDir())
688 infoDlg->typeLabel->setText(tr("directory"));
689 else
690 infoDlg->typeLabel->setText(tr("unknown"));
691
692 infoDlg->ownerLabel->setText( QString("%1 (%2)").arg(curFileInfo.owner()).arg(curFileInfo.ownerId()) );
693 infoDlg->groupLabel->setText( QString("%1 (%2)").arg(curFileInfo.group()).arg(curFileInfo.groupId()) );
694
695 infoDlg->lastReadLabel->setText( curFileInfo.lastRead().toString() );
696 infoDlg->lastModifiedLabel->setText( curFileInfo.lastModified().toString() );
697
698 QString perms;
699 // User
700 if(curFileInfo.permission(QFileInfo::ReadUser))
701 perms += "r";
702 else
703 perms += "-";
704 if(curFileInfo.permission(QFileInfo::WriteUser))
705 perms += "w";
706 else
707 perms += "-";
708 if(curFileInfo.permission(QFileInfo::ExeUser))
709 perms += "x";
710 else
711 perms += "-";
712 // Group
713 if(curFileInfo.permission(QFileInfo::ReadGroup))
714 perms += "r";
715 else
716 perms += "-";
717 if(curFileInfo.permission(QFileInfo::WriteGroup))
718 perms += "w";
719 else
720 perms += "-";
721 if(curFileInfo.permission(QFileInfo::ExeGroup))
722 perms += "x";
723 else
724 perms += "-";
725 // Other
726 if(curFileInfo.permission(QFileInfo::ReadOther))
727 perms += "r";
728 else
729 perms += "-";
730 if(curFileInfo.permission(QFileInfo::WriteOther))
731 perms += "w";
732 else
733 perms += "-";
734 if(curFileInfo.permission(QFileInfo::ExeOther))
735 perms += "x";
736 else
737 perms += "-";
738 infoDlg->permsLabel->setText( perms );
739
740 QPEApplication::execDialog( infoDlg );
741
742 qApp->processEvents();
683} 743}
684 744
685 745
686void AdvancedFm::mkDir() { 746void AdvancedFm::mkDir() {
687 makeDir(); 747 makeDir();
688} 748}
689 749
690void AdvancedFm::rn() { 750void AdvancedFm::rn() {
691 renameIt(); 751 renameIt();
692} 752}
693 753
694void AdvancedFm::del() { 754void AdvancedFm::del() {
695 doDelete(); 755 doDelete();
696} 756}
697 757
698void AdvancedFm::mkSym() { 758void AdvancedFm::mkSym() {
699 QString cmd; 759 QString cmd;
700 QStringList curFileList = getPath(); 760 QStringList curFileList = getPath();
701 if( curFileList.count() > 0) { 761 if( curFileList.count() > 0) {
702 QDir *thisDir = CurrentDir(); 762 QDir *thisDir = CurrentDir();
703 QDir * thatDir = OtherDir(); 763 QDir * thatDir = OtherDir();
704 764
705 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 765 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
706 766
707 QString destName = thatDir->canonicalPath()+"/"+(*it); 767 QString destName = thatDir->canonicalPath()+"/"+(*it);
708 if(destName.right(1) == "/") { 768 if(destName.right(1) == "/") {
709 destName = destName.left( destName.length() -1); 769 destName = destName.left( destName.length() -1);
710 } 770 }
711 771
712 QString curFile = thisDir->canonicalPath()+"/"+(*it); 772 QString curFile = thisDir->canonicalPath()+"/"+(*it);
713 773
714 if( curFile.right(1) == "/") { 774 if( curFile.right(1) == "/") {
715 curFile = curFile.left( curFile.length() -1); 775 curFile = curFile.left( curFile.length() -1);
716 } 776 }
717 777
718 cmd = "ln -s "+curFile+" "+destName; 778 cmd = "ln -s "+curFile+" "+destName;
719// odebug << cmd << oendl; 779// odebug << cmd << oendl;
720 startProcess( (const QString)cmd ); 780 startProcess( (const QString)cmd );
721 } 781 }
722 rePopulate(); 782 rePopulate();
723 setOtherTabCurrent(); 783 setOtherTabCurrent();
724 } 784 }
725} 785}
726 786
727void AdvancedFm::doBeam() { 787void AdvancedFm::doBeam() {
728 Ir ir; 788 Ir ir;
729 if(!ir.supported()) { 789 if(!ir.supported()) {
730 } else { 790 } else {
731 QStringList curFileList = getPath(); 791 QStringList curFileList = getPath();
732 if( curFileList.count() > 0) { 792 if( curFileList.count() > 0) {
733 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 793 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
734 QString curFile = (*it); 794 QString curFile = (*it);
735 QString curFilePath = CurrentDir()->canonicalPath()+"/"+curFile; 795 QString curFilePath = CurrentDir()->canonicalPath()+"/"+curFile;
736 if( curFilePath.right(1) == "/") { 796 if( curFilePath.right(1) == "/") {
737 curFilePath = curFilePath.left( curFilePath.length() -1); 797 curFilePath = curFilePath.left( curFilePath.length() -1);
738 } 798 }
739 Ir *file = new Ir(this, "IR"); 799 Ir *file = new Ir(this, "IR");
740 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished(Ir*))); 800 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished(Ir*)));
741 file->send( curFilePath, curFile ); 801 file->send( curFilePath, curFile );
742 } 802 }
743 } 803 }
744 } 804 }
745} 805}
746 806
747void AdvancedFm::fileBeamFinished( Ir *) { 807void AdvancedFm::fileBeamFinished( Ir *) {
748 QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); 808 QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") );
749} 809}
750 810
751void AdvancedFm::selectAll() { 811void AdvancedFm::selectAll() {
752 QListView *thisView = CurrentView(); 812 QListView *thisView = CurrentView();
753 thisView->selectAll(true); 813 thisView->selectAll(true);
754 thisView->setSelected( thisView->firstChild(),false); 814 thisView->setSelected( thisView->firstChild(),false);
755} 815}
756 816
757void AdvancedFm::startProcess(const QString & cmd) { 817void AdvancedFm::startProcess(const QString & cmd) {
758 QStringList command; 818 QStringList command;
759 OProcess *process; 819 OProcess *process;
760 process = new OProcess(); 820 process = new OProcess();
761 connect(process,SIGNAL(processExited(Opie::Core::OProcess*)),this,SLOT(processEnded(Opie::Core::OProcess*))); 821 connect(process,SIGNAL(processExited(Opie::Core::OProcess*)),this,SLOT(processEnded(Opie::Core::OProcess*)));
762 connect(process,SIGNAL(receivedStderr(Opie::Core::OProcess*,char*,int)),this,SLOT(oprocessStderr(Opie::Core::OProcess*,char*,int))); 822 connect(process,SIGNAL(receivedStderr(Opie::Core::OProcess*,char*,int)),this,SLOT(oprocessStderr(Opie::Core::OProcess*,char*,int)));
763 823
764 command << "/bin/sh"; 824 command << "/bin/sh";
765 command << "-c"; 825 command << "-c";
766 command << cmd.latin1(); 826 command << cmd.latin1();
767 *process << command; 827 *process << command;
768 if(!process->start(OProcess::NotifyOnExit, OProcess::All) ) 828 if(!process->start(OProcess::NotifyOnExit, OProcess::All) )
769 odebug << "could not start process" << oendl; 829 odebug << "could not start process" << oendl;
770} 830}
771 831
772void AdvancedFm::processEnded(OProcess *) { 832void AdvancedFm::processEnded(OProcess *) {
773 rePopulate(); 833 rePopulate();
774} 834}
775 835
776void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { 836void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) {
777// owarn << "received stderrt " << buflen << " bytes" << oendl; 837// owarn << "received stderrt " << buflen << " bytes" << oendl;
778 838
diff --git a/noncore/apps/advancedfm/fileInfoDialog.ui b/noncore/apps/advancedfm/fileInfoDialog.ui
new file mode 100644
index 0000000..c8997fc
--- a/dev/null
+++ b/noncore/apps/advancedfm/fileInfoDialog.ui
@@ -0,0 +1,418 @@
1<!DOCTYPE UI><UI>
2<class>FileInfoDialog</class>
3<widget>
4 <class>QDialog</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>FileInfoDialog</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>225</width>
15 <height>303</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>FileInfoDialog</string>
21 </property>
22 <vbox>
23 <property stdset="1">
24 <name>margin</name>
25 <number>11</number>
26 </property>
27 <property stdset="1">
28 <name>spacing</name>
29 <number>6</number>
30 </property>
31 <widget>
32 <class>QGroupBox</class>
33 <property stdset="1">
34 <name>name</name>
35 <cstring>GroupBox1</cstring>
36 </property>
37 <property stdset="1">
38 <name>sizePolicy</name>
39 <sizepolicy>
40 <hsizetype>5</hsizetype>
41 <vsizetype>5</vsizetype>
42 </sizepolicy>
43 </property>
44 <property stdset="1">
45 <name>title</name>
46 <string>General</string>
47 </property>
48 <grid>
49 <property stdset="1">
50 <name>margin</name>
51 <number>11</number>
52 </property>
53 <property stdset="1">
54 <name>spacing</name>
55 <number>6</number>
56 </property>
57 <widget row="0" column="1" >
58 <class>QLabel</class>
59 <property stdset="1">
60 <name>name</name>
61 <cstring>typeLabel</cstring>
62 </property>
63 <property stdset="1">
64 <name>sizePolicy</name>
65 <sizepolicy>
66 <hsizetype>1</hsizetype>
67 <vsizetype>1</vsizetype>
68 </sizepolicy>
69 </property>
70 <property stdset="1">
71 <name>text</name>
72 <string>executable file</string>
73 </property>
74 </widget>
75 <widget row="1" column="1" >
76 <class>QLabel</class>
77 <property stdset="1">
78 <name>name</name>
79 <cstring>sizeLabel</cstring>
80 </property>
81 <property stdset="1">
82 <name>sizePolicy</name>
83 <sizepolicy>
84 <hsizetype>1</hsizetype>
85 <vsizetype>1</vsizetype>
86 </sizepolicy>
87 </property>
88 <property stdset="1">
89 <name>text</name>
90 <string>3kb (3100 bytes)</string>
91 </property>
92 </widget>
93 <widget row="2" column="1" >
94 <class>QLabel</class>
95 <property stdset="1">
96 <name>name</name>
97 <cstring>ownerLabel</cstring>
98 </property>
99 <property stdset="1">
100 <name>sizePolicy</name>
101 <sizepolicy>
102 <hsizetype>1</hsizetype>
103 <vsizetype>1</vsizetype>
104 </sizepolicy>
105 </property>
106 <property stdset="1">
107 <name>maximumSize</name>
108 <size>
109 <width>32767</width>
110 <height>32767</height>
111 </size>
112 </property>
113 <property stdset="1">
114 <name>text</name>
115 <string>bill (100)</string>
116 </property>
117 <property stdset="1">
118 <name>alignment</name>
119 <set>AlignVCenter|AlignLeft</set>
120 </property>
121 <property>
122 <name>hAlign</name>
123 </property>
124 </widget>
125 <widget row="2" column="0" >
126 <class>QLabel</class>
127 <property stdset="1">
128 <name>name</name>
129 <cstring>ownerCaptionLabel</cstring>
130 </property>
131 <property stdset="1">
132 <name>sizePolicy</name>
133 <sizepolicy>
134 <hsizetype>1</hsizetype>
135 <vsizetype>1</vsizetype>
136 </sizepolicy>
137 </property>
138 <property stdset="1">
139 <name>maximumSize</name>
140 <size>
141 <width>32767</width>
142 <height>32767</height>
143 </size>
144 </property>
145 <property stdset="1">
146 <name>text</name>
147 <string>Owner:</string>
148 </property>
149 <property stdset="1">
150 <name>alignment</name>
151 <set>AlignVCenter|AlignLeft</set>
152 </property>
153 <property>
154 <name>hAlign</name>
155 </property>
156 </widget>
157 <widget row="1" column="0" >
158 <class>QLabel</class>
159 <property stdset="1">
160 <name>name</name>
161 <cstring>sizeCaptionLabel</cstring>
162 </property>
163 <property stdset="1">
164 <name>sizePolicy</name>
165 <sizepolicy>
166 <hsizetype>1</hsizetype>
167 <vsizetype>1</vsizetype>
168 </sizepolicy>
169 </property>
170 <property stdset="1">
171 <name>maximumSize</name>
172 <size>
173 <width>32767</width>
174 <height>32767</height>
175 </size>
176 </property>
177 <property stdset="1">
178 <name>text</name>
179 <string>Size:</string>
180 </property>
181 </widget>
182 <widget row="0" column="0" >
183 <class>QLabel</class>
184 <property stdset="1">
185 <name>name</name>
186 <cstring>typeCaptionLabel</cstring>
187 </property>
188 <property stdset="1">
189 <name>sizePolicy</name>
190 <sizepolicy>
191 <hsizetype>1</hsizetype>
192 <vsizetype>1</vsizetype>
193 </sizepolicy>
194 </property>
195 <property stdset="1">
196 <name>maximumSize</name>
197 <size>
198 <width>60</width>
199 <height>32767</height>
200 </size>
201 </property>
202 <property stdset="1">
203 <name>text</name>
204 <string>Type:</string>
205 </property>
206 </widget>
207 <widget row="3" column="0" >
208 <class>QLabel</class>
209 <property stdset="1">
210 <name>name</name>
211 <cstring>groupCaptionLabel</cstring>
212 </property>
213 <property stdset="1">
214 <name>sizePolicy</name>
215 <sizepolicy>
216 <hsizetype>1</hsizetype>
217 <vsizetype>1</vsizetype>
218 </sizepolicy>
219 </property>
220 <property stdset="1">
221 <name>text</name>
222 <string>Group:</string>
223 </property>
224 </widget>
225 <widget row="3" column="1" >
226 <class>QLabel</class>
227 <property stdset="1">
228 <name>name</name>
229 <cstring>groupLabel</cstring>
230 </property>
231 <property stdset="1">
232 <name>sizePolicy</name>
233 <sizepolicy>
234 <hsizetype>1</hsizetype>
235 <vsizetype>1</vsizetype>
236 </sizepolicy>
237 </property>
238 <property stdset="1">
239 <name>text</name>
240 <string>users (500)</string>
241 </property>
242 </widget>
243 <widget row="4" column="0" >
244 <class>QLabel</class>
245 <property stdset="1">
246 <name>name</name>
247 <cstring>permsCaptionLabel</cstring>
248 </property>
249 <property stdset="1">
250 <name>sizePolicy</name>
251 <sizepolicy>
252 <hsizetype>1</hsizetype>
253 <vsizetype>1</vsizetype>
254 </sizepolicy>
255 </property>
256 <property stdset="1">
257 <name>text</name>
258 <string>Permissions:</string>
259 </property>
260 </widget>
261 <widget row="4" column="1" >
262 <class>QLabel</class>
263 <property stdset="1">
264 <name>name</name>
265 <cstring>permsLabel</cstring>
266 </property>
267 <property stdset="1">
268 <name>sizePolicy</name>
269 <sizepolicy>
270 <hsizetype>1</hsizetype>
271 <vsizetype>1</vsizetype>
272 </sizepolicy>
273 </property>
274 <property stdset="1">
275 <name>text</name>
276 <string>rwxrwxrwx</string>
277 </property>
278 </widget>
279 </grid>
280 </widget>
281 <widget>
282 <class>QGroupBox</class>
283 <property stdset="1">
284 <name>name</name>
285 <cstring>GroupBox2</cstring>
286 </property>
287 <property stdset="1">
288 <name>title</name>
289 <string>Times</string>
290 </property>
291 <grid>
292 <property stdset="1">
293 <name>margin</name>
294 <number>11</number>
295 </property>
296 <property stdset="1">
297 <name>spacing</name>
298 <number>6</number>
299 </property>
300 <widget row="0" column="1" >
301 <class>QLabel</class>
302 <property stdset="1">
303 <name>name</name>
304 <cstring>lastReadLabel</cstring>
305 </property>
306 <property stdset="1">
307 <name>text</name>
308 <string>users (500)</string>
309 </property>
310 </widget>
311 <widget row="1" column="1" >
312 <class>QLabel</class>
313 <property stdset="1">
314 <name>name</name>
315 <cstring>lastModifiedLabel</cstring>
316 </property>
317 <property stdset="1">
318 <name>sizePolicy</name>
319 <sizepolicy>
320 <hsizetype>1</hsizetype>
321 <vsizetype>1</vsizetype>
322 </sizepolicy>
323 </property>
324 <property stdset="1">
325 <name>maximumSize</name>
326 <size>
327 <width>32767</width>
328 <height>32767</height>
329 </size>
330 </property>
331 <property stdset="1">
332 <name>text</name>
333 <string>users (500)</string>
334 </property>
335 <property stdset="1">
336 <name>alignment</name>
337 <set>AlignVCenter|AlignLeft</set>
338 </property>
339 <property>
340 <name>hAlign</name>
341 </property>
342 </widget>
343 <widget row="0" column="0" >
344 <class>QLabel</class>
345 <property stdset="1">
346 <name>name</name>
347 <cstring>lastReadCaptionLabel</cstring>
348 </property>
349 <property stdset="1">
350 <name>sizePolicy</name>
351 <sizepolicy>
352 <hsizetype>1</hsizetype>
353 <vsizetype>1</vsizetype>
354 </sizepolicy>
355 </property>
356 <property stdset="1">
357 <name>maximumSize</name>
358 <size>
359 <width>60</width>
360 <height>32767</height>
361 </size>
362 </property>
363 <property stdset="1">
364 <name>text</name>
365 <string>Accessed:</string>
366 </property>
367 <property stdset="1">
368 <name>alignment</name>
369 <set>AlignVCenter|AlignLeft</set>
370 </property>
371 <property>
372 <name>hAlign</name>
373 </property>
374 </widget>
375 <widget row="1" column="0" >
376 <class>QLabel</class>
377 <property stdset="1">
378 <name>name</name>
379 <cstring>lastModifiedCaptionLabel</cstring>
380 </property>
381 <property stdset="1">
382 <name>sizePolicy</name>
383 <sizepolicy>
384 <hsizetype>1</hsizetype>
385 <vsizetype>1</vsizetype>
386 </sizepolicy>
387 </property>
388 <property stdset="1">
389 <name>text</name>
390 <string>Modified:</string>
391 </property>
392 </widget>
393 </grid>
394 </widget>
395 <spacer>
396 <property>
397 <name>name</name>
398 <cstring>Spacer1</cstring>
399 </property>
400 <property stdset="1">
401 <name>orientation</name>
402 <enum>Vertical</enum>
403 </property>
404 <property stdset="1">
405 <name>sizeType</name>
406 <enum>Expanding</enum>
407 </property>
408 <property>
409 <name>sizeHint</name>
410 <size>
411 <width>20</width>
412 <height>20</height>
413 </size>
414 </property>
415 </spacer>
416 </vbox>
417</widget>
418</UI>