summaryrefslogtreecommitdiff
Unidiff
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,44 +1,46 @@
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 {
@@ -640,59 +642,117 @@ void AdvancedFm::runCommandStd() {
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() {
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>