-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathProperties.cpp
More file actions
2370 lines (2036 loc) · 71.5 KB
/
Properties.cpp
File metadata and controls
2370 lines (2036 loc) · 71.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Properties box
#include "config.h"
#include "i18n.h"
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <unistd.h>
#include <string.h>
#include <time.h>
#include <errno.h>
#include <signal.h>
#include <pwd.h>
#include <grp.h>
#if defined(linux)
#include <mntent.h>
#endif
#include <fx.h>
#include <fxkeys.h>
#include <FXPNGIcon.h>
#include "xfedefs.h"
#include "icons.h"
#include "xfeutils.h"
#include "File.h"
#include "DialogBox.h"
#include "FileDialog.h"
#include "FilePanel.h"
#include "XFileExplorer.h"
#include "MessageBox.h"
#include "Properties.h"
// Global variables
extern FXMainWindow* mainWindow;
extern FXStringDict* fsdevices;
extern FXString xdgdatahome;
// Map
FXDEFMAP(PermFrame) PermFrameMap[] = {};
// Object implementation
FXIMPLEMENT(PermFrame, FXVerticalFrame, PermFrameMap, ARRAYNUMBER(PermFrameMap))
PermFrame::PermFrame(FXComposite* parent, FXObject* target) :
FXVerticalFrame(parent, FRAME_RAISED)
{
FXHorizontalFrame* accessframe = new FXHorizontalFrame(this, LAYOUT_FILL_X|LAYOUT_FILL_Y);
FXHorizontalFrame* chmodframe = new FXHorizontalFrame(this, LAYOUT_FILL_X|LAYOUT_FILL_Y);
// Permissions
FXGroupBox* group1 = new FXGroupBox(accessframe, _("User"), GROUPBOX_TITLE_LEFT|FRAME_GROOVE|LAYOUT_FILL_X);
ur = new FXCheckButton(group1, _("Read"), target, PropertiesBox::ID_RUSR);
uw = new FXCheckButton(group1, _("Write"), target, PropertiesBox::ID_WUSR);
ux = new FXCheckButton(group1, _("Execute"), target, PropertiesBox::ID_XUSR);
FXGroupBox* group2 = new FXGroupBox(accessframe, _("Group"), GROUPBOX_TITLE_LEFT|FRAME_GROOVE|LAYOUT_FILL_X);
gr = new FXCheckButton(group2, _("Read"), target, PropertiesBox::ID_RGRP);
gw = new FXCheckButton(group2, _("Write"), target, PropertiesBox::ID_WGRP);
gx = new FXCheckButton(group2, _("Execute"), target, PropertiesBox::ID_XGRP);
FXGroupBox* group3 = new FXGroupBox(accessframe, _("Others"), GROUPBOX_TITLE_LEFT|FRAME_GROOVE|LAYOUT_FILL_X);
or_ = new FXCheckButton(group3, _("Read"), target, PropertiesBox::ID_ROTH);
ow = new FXCheckButton(group3, _("Write"), target, PropertiesBox::ID_WOTH);
ox = new FXCheckButton(group3, _("Execute"), target, PropertiesBox::ID_XOTH);
FXGroupBox* group4 = new FXGroupBox(accessframe, _("Special"), GROUPBOX_TITLE_LEFT|FRAME_GROOVE|LAYOUT_FILL_X);
suid = new FXCheckButton(group4, _("Set UID"), target, PropertiesBox::ID_SUID);
sgid = new FXCheckButton(group4, _("Set GID"), target, PropertiesBox::ID_SGID);
svtx = new FXCheckButton(group4, _("Sticky"), target, PropertiesBox::ID_SVTX);
// Owner
FXGroupBox* group5 = new FXGroupBox(chmodframe, _("Owner"), GROUPBOX_TITLE_LEFT|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y);
new FXLabel(group5, _("User"));
user = new FXComboBox(group5, 5, NULL, 0, COMBOBOX_STATIC|LAYOUT_FILL_X);
user->setNumVisible(5);
new FXLabel(group5, _("Group"));
grp = new FXComboBox(group5, 5, NULL, 0, COMBOBOX_STATIC|LAYOUT_FILL_X);
grp->setNumVisible(5);
// User names (sorted in ascending order)
struct passwd* pwde;
while ((pwde = getpwent()))
{
user->appendItem(pwde->pw_name);
}
endpwent();
user->setSortFunc(FXList::ascending);
user->sortItems();
// Group names (sorted in ascending order)
struct group* grpe;
while ((grpe = getgrent()))
{
grp->appendItem(grpe->gr_name);
}
endgrent();
grp->setSortFunc(FXList::ascending);
grp->sortItems();
// Initializations
cmd = 0;
flt = 0;
// Command
FXGroupBox* group6 = new FXGroupBox(chmodframe, _("Command"), GROUPBOX_TITLE_LEFT|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y);
FXMatrix* matrix6 = new FXMatrix(group6, 2, MATRIX_BY_COLUMNS|LAYOUT_SIDE_TOP|LAYOUT_FILL_X|LAYOUT_FILL_Y);
cmd_radiotarget.connect(cmd);
set = new FXRadioButton(matrix6, _("Set marked"), &cmd_radiotarget, FXDataTarget::ID_OPTION+PropertiesBox::ID_SET);
rec = new FXCheckButton(matrix6, _("Recursively"), NULL, 0);
clear = new FXRadioButton(matrix6, _("Clear marked"), &cmd_radiotarget, FXDataTarget::ID_OPTION+PropertiesBox::ID_CLEAR);
flt_radiotarget.connect(flt);
all = new FXRadioButton(matrix6, _("Files and folders"), &flt_radiotarget, FXDataTarget::ID_OPTION+PropertiesBox::ID_ALL);
add = new FXRadioButton(matrix6, _("Add marked"), &cmd_radiotarget, FXDataTarget::ID_OPTION+PropertiesBox::ID_ADD);
dironly = new FXRadioButton(matrix6, _("Folders only"), &flt_radiotarget, FXDataTarget::ID_OPTION+PropertiesBox::ID_DIRONLY);
own = new FXCheckButton(matrix6, _("Owner only"), NULL, 0);
fileonly = new FXRadioButton(matrix6, _("Files only"), &flt_radiotarget, FXDataTarget::ID_OPTION+PropertiesBox::ID_FILEONLY);
}
// Map
FXDEFMAP(PropertiesBox) PropertiesBoxMap[] =
{
FXMAPFUNC(SEL_COMMAND, PropertiesBox::ID_ACCEPT_SINGLE, PropertiesBox::onCmdAcceptSingle),
FXMAPFUNC(SEL_COMMAND, PropertiesBox::ID_ACCEPT_MULT, PropertiesBox::onCmdAcceptMult),
FXMAPFUNC(SEL_COMMAND, PropertiesBox::ID_CANCEL, PropertiesBox::onCmdCancel),
FXMAPFUNC(SEL_COMMAND, PropertiesBox::ID_RUSR, PropertiesBox::onCmdCheck),
FXMAPFUNC(SEL_COMMAND, PropertiesBox::ID_WUSR, PropertiesBox::onCmdCheck),
FXMAPFUNC(SEL_COMMAND, PropertiesBox::ID_XUSR, PropertiesBox::onCmdCheck),
FXMAPFUNC(SEL_COMMAND, PropertiesBox::ID_RGRP, PropertiesBox::onCmdCheck),
FXMAPFUNC(SEL_COMMAND, PropertiesBox::ID_WGRP, PropertiesBox::onCmdCheck),
FXMAPFUNC(SEL_COMMAND, PropertiesBox::ID_XGRP, PropertiesBox::onCmdCheck),
FXMAPFUNC(SEL_COMMAND, PropertiesBox::ID_ROTH, PropertiesBox::onCmdCheck),
FXMAPFUNC(SEL_COMMAND, PropertiesBox::ID_WOTH, PropertiesBox::onCmdCheck),
FXMAPFUNC(SEL_COMMAND, PropertiesBox::ID_XOTH, PropertiesBox::onCmdCheck),
FXMAPFUNC(SEL_COMMAND, PropertiesBox::ID_SUID, PropertiesBox::onCmdCheck),
FXMAPFUNC(SEL_COMMAND, PropertiesBox::ID_SGID, PropertiesBox::onCmdCheck),
FXMAPFUNC(SEL_COMMAND, PropertiesBox::ID_SVTX, PropertiesBox::onCmdCheck),
FXMAPFUNC(SEL_UPDATE, 0, PropertiesBox::onUpdSizeAndPerm),
FXMAPFUNC(SEL_COMMAND, PropertiesBox::ID_SET, PropertiesBox::onCmdCommand),
FXMAPFUNC(SEL_COMMAND, PropertiesBox::ID_CLEAR, PropertiesBox::onCmdCommand),
FXMAPFUNC(SEL_COMMAND, PropertiesBox::ID_ADD, PropertiesBox::onCmdCommand),
FXMAPFUNC(SEL_COMMAND, PropertiesBox::ID_DIRONLY, PropertiesBox::onCmdFilter),
FXMAPFUNC(SEL_COMMAND, PropertiesBox::ID_FILEONLY, PropertiesBox::onCmdFilter),
FXMAPFUNC(SEL_COMMAND, PropertiesBox::ID_ALL, PropertiesBox::onCmdFilter),
FXMAPFUNC(SEL_COMMAND, PropertiesBox::ID_BIG_ICON, PropertiesBox::onCmdBrowseIcon),
FXMAPFUNC(SEL_COMMAND, PropertiesBox::ID_MINI_ICON, PropertiesBox::onCmdBrowseIcon),
FXMAPFUNC(SEL_COMMAND, PropertiesBox::ID_BROWSE_OPEN, PropertiesBox::onCmdBrowse),
FXMAPFUNC(SEL_COMMAND, PropertiesBox::ID_BROWSE_VIEW, PropertiesBox::onCmdBrowse),
FXMAPFUNC(SEL_COMMAND, PropertiesBox::ID_BROWSE_EDIT, PropertiesBox::onCmdBrowse),
FXMAPFUNC(SEL_KEYPRESS, 0, PropertiesBox::onCmdKeyPress),
FXMAPFUNC(SEL_CHORE, PropertiesBox::ID_WATCHPROCESS, PropertiesBox::onWatchProcess),
#ifdef STARTUP_NOTIFICATION
FXMAPFUNC(SEL_UPDATE, PropertiesBox::ID_SNDISABLE, PropertiesBox::onUpdSnDisable),
#endif
};
// Object implementation
FXIMPLEMENT(PropertiesBox, DialogBox, PropertiesBoxMap, ARRAYNUMBER(PropertiesBoxMap))
// Construct window for one file
PropertiesBox::PropertiesBox(FXWindow* win, FXString file, FXString path) : DialogBox(win, _("Properties"), DECOR_TITLE|DECOR_BORDER|DECOR_MAXIMIZE|DECOR_STRETCHABLE|DECOR_CLOSE)
{
FXulong filesize;
FXString mod, changed, accessed;
FXString grpid, usrid;
FXLabel* sizelabel = NULL;
struct stat linfo;
FXString type = "", extension, extension2, fileassoc;
FXbool isLink, isBrokenLink;
FXString pathname, referredpath;
char mnttype[64], used[64], avail[64], pctr[64], size[64];
char buf[MAXPATHLEN+1];
FXString hsize;
FILE* p;
// Trash locations
trashfileslocation = xdgdatahome + PATHSEPSTRING TRASHFILESPATH;
trashinfolocation = xdgdatahome + PATHSEPSTRING TRASHINFOPATH;
// Buttons
FXHorizontalFrame* buttons = new FXHorizontalFrame(this, LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X, 0, 0, 0, 0, 10, 10, 5, 5);
// Contents
FXVerticalFrame* contents = new FXVerticalFrame(this, LAYOUT_SIDE_TOP|FRAME_NONE|LAYOUT_FILL_X|LAYOUT_FILL_Y);
// Accept
if (file != "..")
{
FXButton* ok = new FXButton(buttons, _("&Accept"), NULL, this, PropertiesBox::ID_ACCEPT_SINGLE, FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y, 0, 0, 0, 0, 20, 20);
ok->addHotKey(KEY_Return);
}
// Cancel
new FXButton(buttons, _("&Cancel"), NULL, this, PropertiesBox::ID_CANCEL, FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y, 0, 0, 0, 0, 20, 20);
// Switcher
FXTabBook* tabbook = new FXTabBook(contents, NULL, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_RIGHT);
// First item is General
new FXTabItem(tabbook, _("&General"), NULL);
FXPacker* genpack = new FXPacker(tabbook, FRAME_RAISED);
FXGroupBox* generalgroup = new FXGroupBox(genpack, FXString::null, FRAME_NONE|LAYOUT_FILL_X|LAYOUT_FILL_Y);
FXVerticalFrame* generalframe = new FXVerticalFrame(generalgroup, LAYOUT_FILL_X|LAYOUT_FILL_Y);
// Second item is Access Permissions
FXTabItem* permtab = new FXTabItem(tabbook, _("&Permissions"), NULL);
perm = new PermFrame(tabbook, this);
// Permission tab is disabled for parent directory
if (file == "..")
{
permtab->disable();
}
// Third tab - file associations
FXTabItem* fassoctab = new FXTabItem(tabbook, _("&File Associations"), NULL);
FXPacker* fassocpack = new FXPacker(tabbook, FRAME_RAISED);
FXGroupBox* fassocgroup = new FXGroupBox(fassocpack, FXString::null, FRAME_NONE|LAYOUT_FILL_X|LAYOUT_FILL_Y);
FXVerticalFrame* contassoc = new FXVerticalFrame(fassocgroup, LAYOUT_FILL_X|LAYOUT_FILL_Y);
FXMatrix* matrix = new FXMatrix(contassoc, 3, MATRIX_BY_COLUMNS|LAYOUT_SIDE_TOP|LAYOUT_FILL_X|LAYOUT_FILL_Y);
fassoctab->disable();
new FXLabel(matrix, _("Extension:"), NULL, JUSTIFY_LEFT|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_CENTER_Y);
// Use a read-only FXTextField instead of a FXLabel, to allow long strings
ext = new FXTextField(matrix, 20, NULL, 0, JUSTIFY_LEFT|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_CENTER_Y|TEXTFIELD_READONLY|_TEXTFIELD_NOFRAME);
ext->setBackColor(getApp()->getBaseColor());
new FXLabel(matrix, "", NULL, 0);
new FXLabel(matrix, _("Description:"), NULL, JUSTIFY_LEFT|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_CENTER_Y);
descr = new FXTextField(matrix, 30, NULL, 0, FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_FILL_X|LAYOUT_CENTER_Y);
new FXLabel(matrix, "", NULL, 0);
new FXLabel(matrix, _("Open:"), NULL, JUSTIFY_LEFT|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_CENTER_Y);
open = new FXTextField(matrix, 30, NULL, 0, FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_FILL_X|LAYOUT_CENTER_Y);
new FXButton(matrix, _("\tSelect file..."), filedialogicon, this, ID_BROWSE_OPEN, FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_FILL_X|LAYOUT_CENTER_Y, 0, 0, 0, 0, 10, 10);
int is_ar = false;
FXString viewlbl = _("View:");
FXString editlbl = _("Edit:");
extension = file.rafter('.', 1).lower();
if ((extension == "gz") || (extension == "tgz") || (extension == "tar") || (extension == "taz") || (extension == "bz2") ||
(extension == "tbz2") || (extension == "tbz") || (extension == "xz") || (extension == "txz") || (extension == "zip") ||
(extension == "7z") || (extension == "Z") || (extension == "lzh") || (extension == "rar") ||
(extension == "ace") || (extension == "arj"))
{
is_ar = true; // archive
viewlbl = _("Extract:");
}
#if defined(linux)
else if (extension == "rpm")
{
editlbl = _("Install/Upgrade:");
}
#endif
new FXLabel(matrix, viewlbl, NULL, JUSTIFY_LEFT|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_CENTER_Y);
view = new FXTextField(matrix, 30, NULL, 0, FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_FILL_X|LAYOUT_CENTER_Y);
new FXButton(matrix, _("\tSelect file..."), filedialogicon, this, ID_BROWSE_VIEW, FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_FILL_X|LAYOUT_CENTER_Y, 0, 0, 0, 0, 10, 10);
if (!is_ar)
{
new FXLabel(matrix, editlbl, NULL, JUSTIFY_LEFT|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_CENTER_Y);
edit = new FXTextField(matrix, 30, NULL, 0, FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_FILL_X|LAYOUT_CENTER_Y);
new FXButton(matrix, _("\tSelect file..."), filedialogicon, this, ID_BROWSE_EDIT, FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_FILL_X|LAYOUT_CENTER_Y, 0, 0, 0, 0, 10, 10);
}
else
{
edit = NULL;
}
new FXLabel(matrix, _("Big Icon:"), NULL, JUSTIFY_LEFT|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_CENTER_Y);
bigic = new FXTextField(matrix, 30, NULL, 0, FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_FILL_X|LAYOUT_CENTER_Y);
bigicbtn = new FXButton(matrix, _("\tSelect file..."), filedialogicon, this, ID_BIG_ICON, FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_FILL_X|LAYOUT_CENTER_Y, 0, 0, 0, 0, 10, 10);
new FXLabel(matrix, _("Mini Icon:"), NULL, JUSTIFY_LEFT|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_CENTER_Y);
miniic = new FXTextField(matrix, 30, NULL, 0, FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW|LAYOUT_FILL_X|LAYOUT_CENTER_Y);
miniicbtn = new FXButton(matrix, _("\tSelect file..."), filedialogicon, this, ID_MINI_ICON, FRAME_RAISED|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_RIGHT|LAYOUT_CENTER_Y, 0, 0, 0, 0, 10, 10);
// File name
new FXLabel(generalframe, _("Name"), NULL, JUSTIFY_LEFT);
input = new FXTextField(generalframe, 60, NULL, 0, FRAME_THICK|FRAME_SUNKEN|LAYOUT_SIDE_TOP|LAYOUT_FILL_X);
// Complete file path name
pathname = path+PATHSEPSTRING+file;
parentdir = path;
filename = file;
// Unused in this case
files = NULL;
paths = NULL;
// Initialize mount point flag
isMountpoint = false;
// Warn if non UTF-8 file name
if (!isUtf8(pathname.text(), pathname.length()))
{
new FXLabel(generalframe, _("=> Warning: file name is not UTF-8 encoded!"), NULL, LAYOUT_LEFT|LAYOUT_CENTER_Y|LAYOUT_FILL_ROW);
}
// Get file/link stat info
if (lstatrep(pathname.text(), &linfo) != 0)
{
return;
}
// Obtain user name
usrid = FXSystem::userName(linfo.st_uid);
// Obtain group name
grpid = FXSystem::groupName(linfo.st_gid);
perm->user->setText(usrid);
perm->grp->setText(grpid);
oldgrp = grpid;
oldusr = usrid;
// Test if link or broken link
// When valid link, get the referred file path
isLink = S_ISLNK(linfo.st_mode);
isBrokenLink = false;
if (isLink)
{
// Broken link
struct stat info;
if (statrep(pathname.text(), &info) != 0)
{
isBrokenLink = true;
}
// Get the path name of the linked file
referredpath = ::readLink(pathname);
}
orig_mode = linfo.st_mode;
// Initialize exec flag
executable = false;
// Read time format
FXString timeformat = getApp()->reg().readStringEntry("SETTINGS", "time_format", DEFAULT_TIME_FORMAT);
// Mod time of the file / link
mod = FXSystem::time(timeformat.text(), linfo.st_mtime);
// Change time of the file / link
changed = FXSystem::time(timeformat.text(), linfo.st_ctime);
// Accessed time of the file / link
accessed = FXSystem::time(timeformat.text(), linfo.st_atime);
// Size of the file / link
filesize = (FXulong)linfo.st_size;
// Is it a directory?
nbseldirs = 0;
isDirectory = S_ISDIR(linfo.st_mode);
if (isDirectory)
{
// Directory path
FXString dirpath = FXPath::absolute(parentdir, file);
#if defined(linux)
FILE* mtab = setmntent(MTAB_PATH, "r");
struct mntent* mnt;
if (mtab)
{
while ((mnt = getmntent(mtab)))
{
if (!streq(mnt->mnt_type, MNTTYPE_IGNORE) && !streq(mnt->mnt_type, MNTTYPE_SWAP))
{
if (streq(mnt->mnt_dir, dirpath.text()))
{
isMountpoint = true;
snprintf(buf, sizeof(buf)-1, _("Filesystem (%s)"), mnt->mnt_fsname);
type = buf;
strlcpy(mnttype, mnt->mnt_type, strlen(mnt->mnt_type)+1);
}
}
}
endmntent(mtab);
}
#endif
// If it is a mount point
if (isMountpoint)
{
// Caution : use the -P option to be POSIX compatible!
snprintf(buf, sizeof(buf)-1, "df -P -B 1 '%s'", pathname.text());
p = popen(buf, "r");
FXbool success = true;
if (fgets(buf, sizeof(buf), p) == NULL)
{
success = false;
}
if (fgets(buf, sizeof(buf), p) == NULL)
{
success = false;
}
if (success)
{
strtok(buf, " ");
strtok(NULL, " ");
char* pstr;
pstr = strtok(NULL, " ");
strlcpy(used, pstr, strlen(pstr)+1); // get used
pstr = strtok(NULL, " ");
strlcpy(avail, pstr, strlen(pstr)+1); // get available
pstr = strtok(NULL, " ");
strlcpy(pctr, pstr, strlen(pstr)+1); // get percentage
}
else
{
strlcpy(used, "", 1);
strlcpy(avail, "", 1);
strlcpy(pctr, "", 1);
}
pclose(p);
}
// If it is a folder
else
{
type = _("Folder");
nbseldirs = 1;
}
}
else if (S_ISCHR(linfo.st_mode))
{
type = _("Character Device");
}
else if (S_ISBLK(linfo.st_mode))
{
type = _("Block Device");
}
else if (S_ISFIFO(linfo.st_mode))
{
type = _("Named Pipe");
}
else if (S_ISSOCK(linfo.st_mode))
{
type = _("Socket");
}
// Regular file or link
else
{
// Try to use association table
extension2 = FXPath::name(pathname).rafter('.', 2).lower();
if ((extension2 == "tar.gz") || (extension2 == "tar.bz2") || (extension2 == "tar.xz") || (extension2 == "tar.z"))
{
extension = extension2;
}
else
{
extension = FXPath::name(pathname).rafter('.', 1).lower();
}
if (extension != "")
{
fileassoc = getApp()->reg().readStringEntry("FILETYPES", extension.text(), "");
}
// If we have an association
if (!fileassoc.empty())
{
FXString c;
type = fileassoc.section(';', 1);
if (type == "")
{
if (linfo.st_mode&(S_IXUSR|S_IXGRP|S_IXOTH))
{
type = _("Executable");
executable = true;
}
else
{
type = _("Document");
}
}
ext->setText(extension);
c = fileassoc.section(';', 0);
descr->setText(fileassoc.section(';', 1));
open->setText(c.section(',', 0));
view->setText(c.section(',', 1));
if (edit)
{
edit->setText(c.section(',', 2));
}
bigic->setText(fileassoc.section(';', 2));
miniic->setText(fileassoc.section(';', 3));
if (!isLink)
{
fassoctab->enable();
}
// Load big and mini icons
FXString iconpath = getApp()->reg().readStringEntry("SETTINGS", "iconpath", DEFAULTICONPATH);
FXIcon* bigicon = loadiconfile(getApp(), iconpath, bigic->getText());
if (bigicon)
{
bigicbtn->setIcon(bigicon);
}
FXIcon* miniicon = loadiconfile(getApp(), iconpath, miniic->getText());
if (miniicon)
{
miniicbtn->setIcon(miniicon);
}
}
else
{
ext->setText(extension);
if (linfo.st_mode&(S_IXUSR|S_IXGRP|S_IXOTH))
{
type = _("Executable");
executable = true;
}
else
{
type = _("Document");
}
if (!isLink)
{
fassoctab->enable();
}
}
}
// Modify file type for broken links
if (isBrokenLink)
{
type = _("Broken link");
}
// For links, get the file type of the referred file
else if (isLink)
{
struct stat info;
if (statrep(referredpath.text(), &info) == 0)
{
// Folder
if (S_ISDIR(info.st_mode))
{
type = _("Folder");
}
// File
else
{
// Try to use association table
extension2 = FXPath::name(referredpath).rafter('.', 2).lower();
if ((extension2 == "tar.gz") || (extension2 == "tar.bz2") || (extension2 == "tar.xz") || (extension2 == "tar.z"))
{
extension = extension2;
}
else
{
extension = FXPath::name(referredpath).rafter('.', 1).lower();
}
if (extension != "")
{
fileassoc = getApp()->reg().readStringEntry("FILETYPES", extension.text(), "");
}
// If we have an association
if (!fileassoc.empty())
{
type = fileassoc.section(';', 1);
}
// No association
else
{
if (S_ISCHR(info.st_mode))
{
type = _("Character Device");
}
else if (S_ISBLK(info.st_mode))
{
type = _("Block Device");
}
else if (S_ISFIFO(info.st_mode))
{
type = _("Named Pipe");
}
else if (S_ISSOCK(info.st_mode))
{
type = _("Socket");
}
else if (info.st_mode&(S_IXUSR|S_IXGRP|S_IXOTH))
{
type = _("Executable");
executable = true;
}
else
{
type = _("Document");
}
}
}
}
type = _("Link to ")+type;
}
// Parent directory name not editable
if (file == "..")
{
input->setEditable(false);
}
// Root directory name not editable
if ((file == "") && (path == ROOTDIR))
{
input->setText(ROOTDIR);
input->setEditable(false);
}
else
{
input->setText(file);
}
input->setFocus();
// Set permissions
perm->ur->setCheck((linfo.st_mode & S_IRUSR) ? true : false);
perm->uw->setCheck((linfo.st_mode & S_IWUSR) ? true : false);
perm->ux->setCheck((linfo.st_mode & S_IXUSR) ? true : false);
perm->gr->setCheck((linfo.st_mode & S_IRGRP) ? true : false);
perm->gw->setCheck((linfo.st_mode & S_IWGRP) ? true : false);
perm->gx->setCheck((linfo.st_mode & S_IXGRP) ? true : false);
perm->or_->setCheck((linfo.st_mode & S_IROTH) ? true : false);
perm->ow->setCheck((linfo.st_mode & S_IWOTH) ? true : false);
perm->ox->setCheck((linfo.st_mode & S_IXOTH) ? true : false);
perm->suid->setCheck((linfo.st_mode & S_ISUID) ? true : false);
perm->sgid->setCheck((linfo.st_mode & S_ISGID) ? true : false);
perm->svtx->setCheck((linfo.st_mode & S_ISVTX) ? true : false);
perm->set->setCheck();
perm->all->setCheck();
FXLabel* mtType = NULL, *mtUsed = NULL, *mtFree = NULL, *fileType = NULL, *fileChanged = NULL, *fileAccessed = NULL, *fileModified = NULL;
FXbool isInTrash = false;
fileSize = NULL;
// Properties are different for mount points
if (isMountpoint)
{
FXGroupBox* mtgroup = new FXGroupBox(generalframe, _("Mount point"), GROUPBOX_TITLE_LEFT|FRAME_GROOVE|LAYOUT_FILL_X);
FXMatrix* mtmatrix = new FXMatrix(mtgroup, 2, MATRIX_BY_COLUMNS|LAYOUT_FILL_X|LAYOUT_FILL_Y);
new FXLabel(mtmatrix, _("Mount type:"), NULL, LAYOUT_LEFT|JUSTIFY_LEFT);
fileType = new FXLabel(mtmatrix, FXString::null, NULL, LAYOUT_LEFT|LAYOUT_FILL_COLUMN|JUSTIFY_LEFT);
new FXLabel(mtmatrix, _("Used:"), NULL, LAYOUT_LEFT);
mtUsed = new FXLabel(mtmatrix, FXString::null, NULL, LAYOUT_LEFT|LAYOUT_FILL_COLUMN|JUSTIFY_LEFT);
new FXLabel(mtmatrix, _("Free:"), NULL, LAYOUT_LEFT);
mtFree = new FXLabel(mtmatrix, FXString::null, NULL, LAYOUT_LEFT|LAYOUT_FILL_COLUMN|JUSTIFY_LEFT);
new FXLabel(mtmatrix, _("File system:"), NULL, LAYOUT_LEFT);
mtType = new FXLabel(mtmatrix, FXString::null, NULL, LAYOUT_LEFT|LAYOUT_FILL_COLUMN|JUSTIFY_LEFT);
new FXLabel(mtmatrix, _("Location:"), NULL, LAYOUT_LEFT);
//location=new FXText(mtmatrix,NULL,LAYOUT_FILL_X|LAYOUT_FILL_Y); // Use an FXText to allow long text strings
location = new FXLabel(mtmatrix, FXString::null, NULL, LAYOUT_LEFT|LAYOUT_FILL_COLUMN|JUSTIFY_LEFT);
}
else
{
FXGroupBox* attrgroup = new FXGroupBox(generalframe, _("Properties"), GROUPBOX_TITLE_LEFT|FRAME_GROOVE|LAYOUT_FILL_X);
FXMatrix* attrmatrix = new FXMatrix(attrgroup, 2, MATRIX_BY_COLUMNS|LAYOUT_FILL_X|LAYOUT_FILL_Y);
new FXLabel(attrmatrix, _("Type:"), NULL, LAYOUT_LEFT);
fileType = new FXLabel(attrmatrix, FXString::null, NULL, LAYOUT_LEFT|LAYOUT_FILL_COLUMN|JUSTIFY_LEFT);
sizelabel = new FXLabel(attrmatrix, _("Total size:"), NULL, LAYOUT_LEFT);
fileSize = new FXLabel(attrmatrix, "\n", NULL, LAYOUT_LEFT|LAYOUT_FILL_COLUMN|JUSTIFY_LEFT);
new FXLabel(attrmatrix, FXString::null, NULL, LAYOUT_LEFT|JUSTIFY_LEFT);
fileSizeDetails = new FXLabel(attrmatrix, FXString::null, NULL, LAYOUT_LEFT|JUSTIFY_LEFT);
new FXLabel(attrmatrix, _("Location:"), NULL, LAYOUT_LEFT);
location = new FXLabel(attrmatrix, FXString::null, NULL, LAYOUT_LEFT|LAYOUT_FILL_COLUMN|JUSTIFY_LEFT);
if (isLink & !isBrokenLink)
{
new FXLabel(attrmatrix, _("Link to:"), NULL, LAYOUT_LEFT);
linkto = new FXLabel(attrmatrix, FXString::null, NULL, LAYOUT_LEFT|LAYOUT_FILL_COLUMN);
}
else if (isBrokenLink)
{
new FXLabel(attrmatrix, _("Broken link to:"), NULL, LAYOUT_LEFT);
linkto = new FXLabel(attrmatrix, FXString::null, NULL, LAYOUT_LEFT|LAYOUT_FILL_COLUMN);
}
// If the file is in the trash can
if (parentdir.left(trashfileslocation.length()) == trashfileslocation)
{
isInTrash = true;
new FXLabel(attrmatrix, _("Original location:"), NULL, LAYOUT_LEFT);
origlocation = new FXLabel(attrmatrix, FXString::null, NULL, LAYOUT_LEFT|LAYOUT_FILL_COLUMN);
}
FXGroupBox* timegroup = new FXGroupBox(generalframe, _("File Time"), GROUPBOX_TITLE_LEFT|FRAME_GROOVE|LAYOUT_FILL_X);
FXMatrix* timematrix = new FXMatrix(timegroup, 2, MATRIX_BY_COLUMNS|LAYOUT_FILL_X|LAYOUT_FILL_Y);
new FXLabel(timematrix, _("Last Modified:"), NULL, LAYOUT_LEFT);
fileModified = new FXLabel(timematrix, FXString::null, NULL, LAYOUT_LEFT|LAYOUT_FILL_COLUMN);
new FXLabel(timematrix, _("Last Changed:"), NULL, LAYOUT_LEFT);
fileChanged = new FXLabel(timematrix, FXString::null, NULL, LAYOUT_LEFT|LAYOUT_FILL_COLUMN);
new FXLabel(timematrix, _("Last Accessed:"), NULL, LAYOUT_LEFT);
fileAccessed = new FXLabel(timematrix, FXString::null, NULL, LAYOUT_LEFT|LAYOUT_FILL_COLUMN);
#ifdef STARTUP_NOTIFICATION
sngroup = new FXGroupBox(generalframe, _("Startup Notification"), GROUPBOX_TITLE_LEFT|FRAME_GROOVE|LAYOUT_FILL_X);
snbutton = new FXCheckButton(sngroup, _("Disable startup notification for this executable"), this, ID_SNDISABLE);
sndisable_prev = false;
FXString snexcepts = getApp()->reg().readStringEntry("OPTIONS", "startup_notification_exceptions", "");
if (snexcepts != "")
{
FXString entry;
for (int i = 0; ; i++)
{
entry = snexcepts.section(':', i);
if (streq(entry.text(), ""))
{
break;
}
if (streq(entry.text(), filename.text()))
{
sndisable_prev = true;
break;
}
}
}
snbutton->setCheck(sndisable_prev);
#endif
// If the file is in the trash can
if (isInTrash)
{
new FXLabel(timematrix, _("Deletion Date:"), NULL, LAYOUT_LEFT);
deletiondate = new FXLabel(timematrix, FXString::null, NULL, LAYOUT_LEFT|LAYOUT_FILL_COLUMN);
}
}
// File or mount type
fileType->setText(type.text());
// Parent directory
FXString text = parentdir;
// Insert line breaks if text has one line and more than allowed number of characters
if ((text.find('\n') < 0) && (text.length() > MAX_MESSAGE_LENGTH))
{
// Insert \n in the message every MAX_MESSAGE_LENGTH chars
int nb = text.length()/MAX_MESSAGE_LENGTH;
for (int n = 1; n <= nb; n++)
{
text.insert(n*MAX_MESSAGE_LENGTH, '\n');
}
}
location->setText(text);
// Referred file for valid or broken link
if (isLink)
{
linkto->setText(referredpath);
}
// If directory
if (isDirectory)
{
// if mount point
if (isMountpoint)
{
hsize = ::hSize(used);
snprintf(size, sizeof(size)-1, "%s (%s)", hsize.text(), pctr);
mtUsed->setText(size);
hsize = ::hSize(avail);
mtFree->setText(hsize);
mtType->setText(mnttype);
}
// if folder
else
{
fileModified->setText(mod);
fileChanged->setText(changed);
fileAccessed->setText(accessed);
}
}
// Regular file
else
{
#if __WORDSIZE == 64
snprintf(size, sizeof(size)-1, "%lu", filesize);
#else
snprintf(size, sizeof(size)-1, "%llu", filesize);
#endif
hsize = ::hSize(size);
#if __WORDSIZE == 64
snprintf(size, sizeof(size)-1, _("%s (%lu bytes)"), hsize.text(), filesize);
#else
snprintf(size, sizeof(size)-1, _("%s (%llu bytes)"), hsize.text(), filesize);
#endif
sizelabel->setText(_("Size:"));
fileSize->setText(size);
fileModified->setText(mod);
fileChanged->setText(changed);
fileAccessed->setText(accessed);
}
// If the file is in the trash can
if (isInTrash)
{
// Obtain trash base name and sub path
FXString subpath = parentdir+PATHSEPSTRING;
subpath.erase(0, trashfileslocation.length()+1);
FXString trashbasename = subpath.before('/');
if (trashbasename == "")
{
trashbasename = FXPath::name(pathname);
}
subpath.erase(0, trashbasename.length());
// Read the .trashinfo file
FILE* fp;
char line[1024];
FXString origpath = "", delstr = "";
FXlong deldate = 0;
FXbool success = true;
FXString trashinfopathname = trashinfolocation+PATHSEPSTRING+trashbasename+".trashinfo";
if ((fp = fopen(trashinfopathname.text(), "r")) != NULL)
{
// Read the first three lines and get the strings
if (fgets(line, sizeof(line), fp) == NULL)
{
success = false;
}
if (fgets(line, sizeof(line), fp) == NULL)
{
success = false;
}
if (success)
{
origpath = line;
origpath = origpath.after('=');
origpath = origpath.before('\n');
}
if (fgets(line, sizeof(line), fp) == NULL)
{
success = false;
}
if (success)
{
delstr = line;
delstr = delstr.after('=');
delstr = delstr.before('\n');
}
fclose(fp);
}
// Eventually include sub path in the original path
if (subpath == "")
{
origpath = origpath+subpath;
}
else
{
origpath = origpath+subpath+FXPath::name(pathname);
}
// Convert date
deldate = deltime(delstr);
if (deldate != 0)
{
delstr = FXSystem::time(timeformat.text(), deldate);
}
// Maybe there is no deletion information
if (delstr != "")
{
origlocation->setText(origpath);
deletiondate->setText(delstr);
}
}
mode = orig_mode;
perm->cmd = PropertiesBox::ID_SET;
perm->flt = PropertiesBox::ID_ALL;
files = &file;
source = file;
num = 1;
descr_prev = descr->getText();
open_prev = open->getText();
view_prev = view->getText();
if (edit)
{
edit_prev = edit->getText();
}
bigic_prev = bigic->getText();
miniic_prev = miniic->getText();
// Flag used to avoid computing recursive size more than once
recsize = true;
// Class variable initializations
origlocation = NULL;
deletiondate = NULL;
name_encoding = NULL;
username = NULL;
grpname = NULL;
pid = -1;
totaldirsize = 0;
totalnbfiles = 0;
totalnbsubdirs = 0;
}
// Construct window for multiple files
PropertiesBox::PropertiesBox(FXWindow* win, FXString* file, int n, FXString* path) : DialogBox(win, _("Properties"), DECOR_TITLE|DECOR_BORDER|DECOR_MAXIMIZE|DECOR_STRETCHABLE|DECOR_CLOSE)
{
struct stat linfo;
FXString grpid, usrid;
FXString type, extension, extension2, fileassoc;
char buf[MAXPATHLEN+1];
int i, nbselfiles = 0, dotdot = 0;
FXbool firstfile = true;
isDirectory = false;
nbseldirs = 0;
// Buttons
FXHorizontalFrame* buttons = new FXHorizontalFrame(this, LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X, 0, 0, 0, 0, 10, 10, 5, 5);
// Contents
FXVerticalFrame* contents = new FXVerticalFrame(this, LAYOUT_SIDE_TOP|FRAME_NONE|LAYOUT_FILL_X|LAYOUT_FILL_Y);
// Accept
FXButton* ok = new FXButton(buttons, _("&Accept"), NULL, this, PropertiesBox::ID_ACCEPT_MULT, FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y, 0, 0, 0, 0, 20, 20);
ok->addHotKey(KEY_Return);
// Cancel
new FXButton(buttons, _("&Cancel"), NULL, this, PropertiesBox::ID_CANCEL, FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y, 0, 0, 0, 0, 20, 20);
// Switcher
FXTabBook* tabbook = new FXTabBook(contents, NULL, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_RIGHT);
// First item is General
new FXTabItem(tabbook, _("&General"), NULL);
FXVerticalFrame* generalframe = new FXVerticalFrame(tabbook, FRAME_RAISED);
FXGroupBox* attrgroup = new FXGroupBox(generalframe, _("Properties"), GROUPBOX_TITLE_LEFT|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y);
FXMatrix* attrmatrix = new FXMatrix(attrgroup, 2, MATRIX_BY_COLUMNS|LAYOUT_FILL_X|LAYOUT_FILL_Y);
new FXLabel(attrmatrix, _("Selection:"), NULL, LAYOUT_LEFT|JUSTIFY_LEFT);
FXLabel* filesSelected = new FXLabel(attrmatrix, FXString::null, NULL, LAYOUT_LEFT|JUSTIFY_LEFT);
new FXLabel(attrmatrix, FXString::null, NULL, LAYOUT_LEFT|JUSTIFY_LEFT);
FXLabel* filesSelectedDetails = new FXLabel(attrmatrix, FXString::null, NULL, LAYOUT_LEFT|JUSTIFY_LEFT);
new FXLabel(attrmatrix, _("Type:"), NULL, LAYOUT_LEFT|JUSTIFY_LEFT);
FXLabel* filesType = new FXLabel(attrmatrix, FXString::null, NULL, LAYOUT_LEFT|JUSTIFY_LEFT);
new FXLabel(attrmatrix, _("Total size:"), NULL, LAYOUT_LEFT|JUSTIFY_LEFT);
fileSize = new FXLabel(attrmatrix, FXString::null, NULL, LAYOUT_LEFT|JUSTIFY_LEFT);
new FXLabel(attrmatrix, FXString::null, NULL, LAYOUT_LEFT|JUSTIFY_LEFT);
fileSizeDetails = new FXLabel(attrmatrix, FXString::null, NULL, LAYOUT_LEFT|JUSTIFY_LEFT);
// Second item is Access Permissions
new FXTabItem(tabbook, _("&Permissions"), NULL);
perm = new PermFrame(tabbook, this);
// Get file/link info of the first file of the list
// This is used as a guess for the username, group and permissions of the whole list
FXString pathname = path[0]+PATHSEPSTRING+file[0];
if (lstatrep(pathname.text(), &linfo) != 0)
{
return;
}
// Obtain user name
usrid = FXSystem::userName(linfo.st_uid);
// Obtain group name
grpid = FXSystem::groupName(linfo.st_gid);
orig_mode = linfo.st_mode;
perm->ur->setCheck((linfo.st_mode & S_IRUSR) ? true : false);
perm->uw->setCheck((linfo.st_mode & S_IWUSR) ? true : false);
perm->ux->setCheck((linfo.st_mode & S_IXUSR) ? true : false);
perm->gr->setCheck((linfo.st_mode & S_IRGRP) ? true : false);
perm->gw->setCheck((linfo.st_mode & S_IWGRP) ? true : false);
perm->gx->setCheck((linfo.st_mode & S_IXGRP) ? true : false);
perm->or_->setCheck((linfo.st_mode & S_IROTH) ? true : false);
perm->ow->setCheck((linfo.st_mode & S_IWOTH) ? true : false);