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.cpp102
1 files changed, 81 insertions, 21 deletions
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
@@ -13,6 +13,7 @@
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>
@@ -26,6 +27,7 @@ using namespace Opie::Core;
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
@@ -654,30 +656,88 @@ void AdvancedFm::runCommandStd() {
654 656
655void AdvancedFm::fileStatus() { 657void AdvancedFm::fileStatus() {
656 if( !CurrentView()->currentItem()) return; 658 if( !CurrentView()->currentItem()) return;
659
657 QString curFile; 660 QString curFile;
658 curFile = CurrentView()->currentItem()->text(0); 661 curFile = CurrentView()->currentItem()->text(0);
659 if(QFileInfo("/usr/bin/stat").exists()) { 662
660 QStringList command; 663 QFileInfo curFileInfo(curFile);
661 command << "/bin/sh"; 664
662 command << "-c"; 665 FileInfoDialog *infoDlg = new FileInfoDialog(this);
663 command << "stat -l "+ curFile; 666 infoDlg->setCaption(tr("Info for %1").arg(curFile));
664 Output *outDlg; 667
665 outDlg = new Output( command, this, tr("AdvancedFm Output"), true); 668 uint size = curFileInfo.size();
666 QPEApplication::execDialog( outDlg ); 669 QString sizestr;
667 } else { 670 if( size > 1048576 )
668/* struct stat buf; 671 sizestr = tr("%1MB (%2 bytes)").arg(QString().sprintf("%.0f", size / 1048576.0)).arg(size);
669 stat( curFile.local8bit(), &buf); 672 else if( size > 1024 )
670 673 sizestr = tr("%1kB (%2 bytes)").arg(QString().sprintf("%.0f", size / 1024.0)).arg(size);
671 st_dev dev; 674 else
672 st_uid uid; 675 sizestr = tr("%1 bytes").arg(size);
673 st_gid gid; 676
674 st_size size; 677 infoDlg->sizeLabel->setText(sizestr);
675 st_atime atime; 678
676 st_mtime mtime; 679 if(curFileInfo.isSymLink())
677 st_ctime ctime; 680 infoDlg->typeLabel->setText(tr("symbolic link"));
678 st_mode mode; 681 else if(curFileInfo.isFile()) {
679*/ 682 if(curFileInfo.isExecutable())
683 infoDlg->typeLabel->setText(tr("executable file"));
684 else
685 infoDlg->typeLabel->setText(tr("file"));
680 } 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 );
681 741
682 qApp->processEvents(); 742 qApp->processEvents();
683} 743}