forked from svn2github/freearc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FileManager.hs
892 lines (764 loc) · 40.7 KB
/
FileManager.hs
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
{-# OPTIONS_GHC -cpp #-}
----------------------------------------------------------------------------------------------------
---- FreeArc archive manager ------
----------------------------------------------------------------------------------------------------
module FileManager where
import Prelude hiding (catch)
import Control.Concurrent
import Control.Exception
import Control.Monad
import Data.Char
import Data.IORef
import Data.List
import Data.Maybe
import Numeric hiding (readInt)
import System.IO.Unsafe
import System.Cmd
import System.Process
#if defined(FREEARC_WIN)
import System.Win32
import Foreign.Ptr
#endif
import Graphics.UI.Gtk
import Graphics.UI.Gtk.ModelView as New
import Utils
import Errors
import Files
import FileInfo
import Charsets
import Compression
import Encryption
import Options
import Cmdline
import UI
import ArhiveStructure
import ArhiveDirectory
import ArcExtract
import FileManPanel
import FileManUtils
import FileManDialogs
import FileManDialogAdd
-- |Maximum size of command line
aMAX_CMDLINE_LENGTH = 32000 `div` 4
----------------------------------------------------------------------------------------------------
---- Îáðàáîòêà GUI-ñïåöèôè÷íûõ âàðèàöèé êîìàíäíîé ñòðîêè -------------------------------------------
----------------------------------------------------------------------------------------------------
parseGUIcommands run args exec = do
let extract fm' exec cmd arcnames = extractDialog fm' exec cmd arcnames "" []
add fm' exec cmd files = addDialog fm' exec cmd files NoMode
loadTranslation
case args of
["--settings-dialog"] -> openSettingsDialog -- Äèàëîã íàñòðîåê
"--add-dialog":xs -> openDialog xs exec add -- Äèàëîã óïàêîâêè
"--extract-dialog":xs -> openDialog xs exec extract -- Äèàëîã ðàñïàêîâêè
["--register"] -> registerShellExtensions Nothing -- Ðåãèñòðàöèÿ â Explorer
["--unregister"] -> unregisterShellExtensions -- Óäàëåíèå ðåãèñòðàöèè â Explorer
[] -> myGUI run args -- Ïðè âûçîâå ïðîãðàììû áåç àðãóìåíòîâ èëè ñ îäíèì àðãóìåíòîì (èìåíåì êàòàëîãà/àðõèâà)
[_] -> myGUI run args -- çàïóñêàåì ïîëíîöåííûé Archive Manager
_ -> startGUI >> exec args -- à èíà÷å - ïðîñòî îòðàáàòûâàåì êîìàíäû (äå)àðõèâàöèè
-- Äèàëîã íàñòðîåê
openSettingsDialog = do
startGUI
gui $ do
fm' <- newEmptyFM
settingsDialog fm'
mainQuit
-- Îòêðûòü äèàëîã (ðàñ)ïàêîâêè è çàòåì âûïîëíèòü çàïðîøåííóþ êîìàíäó
openDialog (cmd:"--":params) exec dialog = do
startGUI
cmdChan <- newChan
gui $ do
let exec _bgmode = writeChan cmdChan
fm' <- newEmptyFM
dialog fm' exec cmd params
--
cmds <- readChan cmdChan
exec$ joinWith [";"] cmds
openDialog params exec dialog = do
startGUI
gui $ debugMsg "FileManager.hs: attempt to run dialog with incorrect parameters to command"
----------------------------------------------------------------------------------------------------
---- Ãëàâíîå ìåíþ ïðîãðàììû è òóëáàð ïîä íèì -------------------------------------------------------
----------------------------------------------------------------------------------------------------
-- File: New Archive, Open Archive, New SFX, Change Drive, Select All, Select Group, Deselect Group, Invert Selection
-- Commands (èëè Actions): Add, Extract, Test, ArcInfo, View, Delete, Rename
-- Tools: Wizard (åñëè òàêîâîé áóäåò), Protect, Comment, Convert to EXE, Encrypt, Add Recovery record, Repair
-- Options: Configuration, Save settings, Load settings, View log, Clear log
-- Help: ñîáñòâåííî ñàì Help, Goto Homepage (è/èëè Check for update), About
uiDef =
"<ui>"++
" <menubar>"++
" <menu name=\"File\" action=\"FileAction\">"++
" <menuitem name=\"OpenArchive\" action=\"OpenArchiveAction\" />"++
" <separator/>"++
" <menuitem name=\"Select all\" action=\"SelectAllAction\" />"++
" <menuitem name=\"Select\" action=\"SelectAction\" />"++
" <menuitem name=\"Unselect\" action=\"UnselectAction\" />"++
" <menuitem name=\"Invert selection\" action=\"InvertSelectionAction\" />"++
" <menuitem name=\"Refresh\" action=\"RefreshAction\" />"++
" <separator/>"++
" <placeholder name=\"FileMenuAdditions\" />"++
" <menuitem name=\"Exit\" action=\"ExitAction\"/>"++
" </menu>"++
" <menu name=\"Commands\" action=\"CommandsAction\">"++
" <menuitem name=\"Add\" action=\"AddAction\" />"++
" <menuitem name=\"Extract\" action=\"ExtractAction\" />"++
" <menuitem name=\"Test\" action=\"TestAction\" />"++
" <menuitem name=\"ArcInfo\" action=\"ArcInfoAction\" />"++
" <menuitem name=\"Delete\" action=\"DeleteAction\" />"++
" </menu>"++
" <menu name=\"Tools\" action=\"ToolsAction\">"++
" <menuitem name=\"Lock\" action=\"LockAction\" />"++
" <menuitem name=\"Comment\" action=\"CommentAction\" />"++
" <menuitem name=\"Recompress\" action=\"RecompressAction\" />"++
" <menuitem name=\"Convert to SFX\" action=\"ConvertToSFXAction\" />"++
" <menuitem name=\"Convert to FreeArc\" action=\"ConvertToFreeArcAction\" />"++
" <separator/>"++
" <menuitem name=\"Encrypt\" action=\"EncryptAction\" />"++
" <menuitem name=\"Protect\" action=\"ProtectAction\" />"++
" <menuitem name=\"Repair\" action=\"RepairAction\" />"++
" <separator/>"++
" <menuitem name=\"Modify\" action=\"ModifyAction\" />"++
" <menuitem name=\"Join archives\" action=\"JoinArchivesAction\" />"++
" </menu>"++
" <menu name=\"Options\" action=\"OptionsAction\">"++
" <menuitem name=\"Settings\" action=\"SettingsAction\" />"++
" <separator/>"++
" <menuitem name=\"ViewLog\" action=\"ViewLogAction\" />"++
" <menuitem name=\"ClearLog\" action=\"ClearLogAction\" />"++
" </menu>"++
" <menu name=\"Help\" action=\"HelpAction\">"++
" <menuitem name=\"MainHelp\" action=\"MainHelpAction\" />"++
" <separator/>"++
" <menuitem name=\"CmdlineHelp\" action=\"CmdlineHelpAction\" />"++
" <menuitem name=\"OpenHomepage\" action=\"OpenHomepageAction\" />"++
" <menuitem name=\"OpenForum\" action=\"OpenForumAction\" />"++
" <menuitem name=\"CheckForUpdate\" action=\"CheckForUpdateAction\" />"++
" <separator/>"++
" <menuitem name=\"About\" action=\"AboutAction\" />"++
" </menu>"++
" </menubar>"++
" <toolbar>"++
" <placeholder name=\"FileToolItems\">"++
" <toolitem name=\"OpenArchive\" action=\"OpenArchiveAction\" />"++
" <separator/>"++
" <toolitem name=\"Add\" action=\"AddAction\" />"++
" <toolitem name=\"Extract\" action=\"ExtractAction\" />"++
" <toolitem name=\"Test\" action=\"TestAction\" />"++
" <toolitem name=\"ArcInfo\" action=\"ArcInfoAction\" />"++
" <toolitem name=\"Delete\" action=\"DeleteAction\" />"++
" <separator/>"++
" <toolitem name=\"Lock\" action=\"LockAction\" />"++
" <toolitem name=\"Recompress\" action=\"RecompressAction\" />"++
" <toolitem name=\"Convert to SFX\" action=\"ConvertToSFXAction\" />"++
" <toolitem name=\"Join archives\" action=\"JoinArchivesAction\" />"++
" <separator/>"++
" <toolitem name=\"Refresh\" action=\"RefreshAction\" />"++
" </placeholder>"++
" </toolbar>"++
"</ui>"
----------------------------------------------------------------------------------------------------
---- Âèçóàëüíàÿ ÷àñòü ôàéë-ìåíåäæåðà ---------------------------------------------------------------
----------------------------------------------------------------------------------------------------
myGUI run args = do
fileManagerMode =: True
runGUI $ do
parseCmdline ["l", "a"] -- èíèöèàëèçàöèÿ: display, ëîãôàéë
-- Ñïèñîê àññîöèàöèé êëàâèøà->äåéñòâèå
onKeyActions <- newList
let onKey = curry (onKeyActions <<=)
-- Ñîçäàäèì îêíî èíäèêàòîðà ïðîãðåññà è çàãðóçèì íàñòðîéêè/ëîêàëèçàöèþ
(windowProgress, (clearMessageBox,showMessageBox)) <- runIndicators
-- Main menu
standardGroup <- actionGroupNew "standard"
let action name = (concat$ map (mapHead toUpper)$ words$ drop 5 name)++"Action" -- "9999 the name" -> "TheNameAction"
let names = split ',' "0050 File,0258 Commands,0259 Tools,0260 Options,0261 Help"
for names $ \name -> do
label <- i18n name
actionGroupAddAction standardGroup =<< actionNew (action name) label Nothing Nothing
-- Menus and toolbars
let anew name comment icon accel = do
[i18name,i18comment] <- i18ns [name,comment]
action <- actionNew (action name) i18comment (Just i18comment) icon
action `set` [actionShortLabel := i18name]
actionGroupAddActionWithAccel standardGroup action (Just accel)
accel `onKey` actionActivate action
return action
--
openAct <- anew "0262 Open archive" "0265 Open archive" (Just stockOpen) "<Alt>O"
selectAllAct<- anew "0263 Select all" "0290 Select all files" (Just stockSelectAll) "<Ctrl>A"
selectAct <- anew "0037 Select" "0047 Select files" (Just stockAdd) "KP_Add"
unselectAct <- anew "0038 Unselect" "0048 Unselect files" (Just stockRemove) "KP_Subtract"
invertSelAct<- anew "0264 Invert selection" "0291 Invert selection" (Nothing) "KP_Multiply"
refreshAct <- anew "0039 Refresh" "0049 Reread archive/directory" (Just stockRefresh) "F5"
exitAct <- anew "0036 Exit" "0046 Quit application" (Just stockQuit) "<Alt>Q"
addAct <- anew "0030 Add" "0040 Add files to archive(s)" (Just stockMediaRecord) "<Alt>A"
extractAct <- anew "0035 Extract" "0045 Extract files from archive(s)" (Just stockMediaPlay) "<Alt>E"
testAct <- anew "0034 Test" "0044 Test files in archive(s)" (Just stockSpellCheck) "<Alt>T"
arcinfoAct <- anew "0086 ArcInfo" "0087 Information about archive" (Just stockInfo) "<Alt>I"
deleteAct <- anew "0033 Delete" "0043 Delete files (from archive)" (Just stockDelete) "Delete"
lockAct <- anew "0266 Lock" "0267 Lock archive from further changes" (Just stockDialogAuthentication) "<Alt>L"
commentAct <- anew "0268 Comment" "0269 Edit archive comment" (Just stockEdit) "<Alt>C"
recompressAct<-anew "0293 Recompress" "0294 Recompress files in archive" (Just stockGotoBottom) "<Alt>R"
toSfxAct <- anew "0270 Convert to SFX" "0271 Convert archive to SFX" (Just stockConvert) "<Alt>S"
toFaAct <- anew "0426 Convert to FreeArc" "0427 Convert foreign archive to FreeArc format" (Nothing) ""
encryptAct <- anew "0272 Encrypt" "0273 Encrypt archive contents" (Nothing) ""
addRrAct <- anew "0274 Protect" "0275 Add Recovery record to archive" (Nothing) "<Alt>P"
repairAct <- anew "0379 Repair" "0380 Repair damaged archive" (Nothing) ""
modifyAct <- anew "0031 Modify" "0041 Modify archive(s)" (Just stockEdit) "<Alt>M"
joinAct <- anew "0032 Join archives" "0042 Join archives together" (Just stockCopy) "<Alt>J"
settingsAct <- anew "0064 Settings" "0065 Edit program settings" (Just stockPreferences) ""
viewLogAct <- anew "0276 View log" "0277 View logfile" (Nothing) ""
clearLogAct <- anew "0278 Clear log" "0279 Clear logfile" (Nothing) ""
helpAct <- anew "0280 Main help" "0281 Help on using FreeArc" (Just stockHelp) "F1"
helpCmdAct <- anew "0282 Cmdline help" "0283 Help on FreeArc command line" (Just stockHelp) ""
homepageAct <- anew "0284 Open Homepage" "0285 Open program site" (Just stockHome) ""
openForumAct<- anew "0373 Open forum" "0374 Open program forum" (Nothing) ""
openWikiAct <- anew "0375 Open wiki" "0376 Open program wiki" (Nothing) ""
whatsnewAct <- anew "0286 Check for update" "0287 Check for new program version" (Just stockDialogInfo) ""
aboutAct <- anew "0288 About" "0289 About" (Just stockAbout) ""
menufile <- findFile configFilePlaces aMENU_FILE
uiData <- if menufile>"" then fileGetBinary menufile else return uiDef
ui <- uiManagerNew
uiManagerAddUiFromString ui uiData
uiManagerInsertActionGroup ui standardGroup 0
window <- windowNew
(Just menuBar) <- uiManagerGetWidget ui "/ui/menubar"
(Just toolBar) <- uiManagerGetWidget ui "/ui/toolbar"
(listUI, listView, listModel, listSelection, columns, onColumnTitleClicked) <- createFilePanel
statusLabel <- labelNew Nothing
miscSetAlignment statusLabel 0 0.5
messageCombo <- New.comboBoxNewText
statusbar <- statusbarNew
ctx <- statusbarGetContextId statusbar ""
statusbarPush statusbar ctx " "
widgetSetSizeRequest messageCombo 30 (-1)
lowBox <- vBoxNew False 0
boxPackStart lowBox statusLabel PackNatural 2
boxPackStart lowBox messageCombo PackGrow 2
--boxPackStart lowBox statusbar PackNatural 0
-- Ñîçäàäèì ïåðåìåííóþ äëÿ õðàíåíèÿ òåêóùåãî ñîñòîÿíèÿ ôàéë-ìåíåäæåðà
fm' <- newFM window listView listModel listSelection statusLabel messageCombo
fmUpdateConfigFiles fm'
-- Îòðèõòóåì òóëáàð
let toolbar = castToToolbar toolBar
toolbarCaptions <- fmGetHistoryBool fm' "ToolbarCaptions" True
toolbar `set` [toolbarStyle := if toolbarCaptions then ToolbarBoth else ToolbarIcons]
toolbar `toolbarSetIconSize` iconSizeLargeToolbar
n <- toolbarGetNItems toolbar
for [0..n-1] $ \i -> do
Just button <- toolbarGetNthItem toolbar i
toolItemSetHomogeneous button False
-- Ïîëîñêà íàâèãàöèè
naviBar <- hBoxNew False 0
upButton <- button "0006 Up "
curdir <- fmEntryWithHistory fm' "dir/arcname" (const$ return True) (fmCanonicalizePath fm')
saveDirButton <- button "0007 Save "
boxPackStart naviBar (widget upButton) PackNatural 0
#if defined(FREEARC_WIN)
-- Ìåíþ âûáîðà äèñêà
driveButton <- button "C:"
driveMenu <- makePopupMenu (chdir fm'.(++"\\").head.words) =<< getDrives
driveButton `onClick` (widgetShowAll driveMenu >> menuPopup driveMenu Nothing)
boxPackStart naviBar (widget driveButton) PackNatural 0
#endif
boxPackStart naviBar (widget curdir) PackGrow 0
boxPackStart naviBar (widget saveDirButton) PackNatural 0
-- Öåëèêîì îêíî ôàéë-ìåíåäæåðà
vBox <- vBoxNew False 0
set vBox [boxHomogeneous := False]
boxPackStart vBox menuBar PackNatural 0
boxPackStart vBox toolBar PackNatural 0
boxPackStart vBox naviBar PackNatural 0
boxPackStart vBox listUI PackGrow 0
boxPackStart vBox lowBox PackNatural 0
containerAdd window vBox
-- Ñïèñîê äåéñòâèé, âûïîëíÿåìûõ ïðè çàêðûòèè îêíà ôàéë-ìåíåäæåðà
onExit <- newList
-- Ñïèñîê àññîöèàöèé êëàâèøà->äåéñòâèå
listView `onKeyPress` \event -> do
x <- lookup (eventKey event) `fmap` listVal onKeyActions
case x of
Just action -> do action; return True
Nothing -> return False
----------------------------------------------------------------------------------------------------
---- Ñîõðàíåíèå/âîññòàíîâëåíèå ðàçìåðà è ïîëîæåíèÿ ãëàâíîãî îêíà è êîëîíîê â í¸ì -------------------
----------------------------------------------------------------------------------------------------
window `windowSetPosition` WinPosCenter
--windowSetGeometryHints window (Just window) (Just (1,1)) (Just (32000,32000)) Nothing Nothing Nothing
--widgetSetSizeRequest window 700 500
--window `windowSetGravity` GravityStatic
--window `windowSetPosition` WinPosNone
--windowSetDefaultSize window 200 100
-- Ïðè ñòàðòå âîññòàíîâèì ñîõðàí¸ííûé ðàçìåð îêíà
fmRestoreSizePos fm' window "MainWindow" "-10000 -10000 720 500"
-- Ñîõðàíèì ðàçìåð è ïîëîæåíèå ãëàâíîãî îêíà ïîñëå åãî ïåðåìåùåíèÿ
window `onConfigure` \e -> do
fmSaveSizePos fm' window "MainWindow"
return False
-- Çàïîìíèì, áûëî ëè îêíî ìàêñèìèçèðîâàíî
window `onWindowState` \e -> do
let isMax x = case x of
WindowStateMaximized -> True
_ -> False
fmSaveMaximized fm' "MainWindow" (any isMax (eventWindowState e))
return False
-- Ïðè çàêðûòèè ïðîãðàììû ñîõðàíèì ïîðÿäîê è øèðèíó êîëîíîê
onExit <<= do
colnames <- New.treeViewGetColumns listView >>= mapM New.treeViewColumnGetTitle
fmReplaceHistory fm' "ColumnOrder" (unwords$ catMaybes colnames)
for columns $ \(name,col1) -> do
w <- New.treeViewColumnGetWidth col1
fmReplaceHistory fm' (name++"ColumnWidth") (show w)
-- Ïðè ñòàðòå âîññòàíîâèì ñîõðàí¸ííûå ïîðÿäîê è øèðèíó êîëîíîê
order <- (reverse.words) `fmap` fmGetHistory1 fm' "ColumnOrder" ""
for order $ \colname -> do
whenJust (lookup colname columns) $
New.treeViewMoveColumnFirst listView
for columns $ \(name,col1) -> do
w <- readInt `fmap` fmGetHistory1 fm' (name++"ColumnWidth") "150"
New.treeViewColumnSetFixedWidth col1 w
----------------------------------------------------------------------------------------------------
---- Íàâèãàöèîííàÿ ÷àñòü ôàéë-ìåíåäæåðà ------------------------------------------------------------
----------------------------------------------------------------------------------------------------
-- for [upButton,saveDirButton] (`buttonSetFocusOnClick` False)
-- Âûâîäèòü errors/warnings/messages âíèçó îêíà FreeArc
showErrors' <- ref True
errorHandlers ++= [whenM (val showErrors') . condPrintLineLn "w"]
errorHandlers ++= [whenM (val showErrors') . postGUIAsync . fmStackMsg fm']
warningHandlers ++= [whenM (val showErrors') . postGUIAsync . fmStackMsg fm']
loggingHandlers ++= [postGUIAsync . fmStackMsg fm']
-- Îòêëþ÷àåò âûâîä ñîîáùåíèé îá îøèáêàõ íà âðåìÿ âûïîëíåíèÿ action
let hideErrors action = bracket (showErrors' <=> False) (showErrors' =: ) (\_ -> action)
-- Ïåðåõâàò è îáðàáîòêà îøèáîê
errorMsg <- ref ""
errorHandlers ++= [(errorMsg =:)]
let withErrorHandler onError = handle$ \e->do operationTerminated =: False
fmErrorMsg fm' =<< val errorMsg
sequence_ onError
-- Ïðè âîçíèêíîâåíèè îøèáêè âûäàòü å¸ ïîëüçîâàòåëþ
let msgboxOnError = withErrorHandler []
-- Ïðè âîçíèêíîâåíèè îøèáêè âûäàòü å¸ ïîëüçîâàòåëþ è çàâåðùèòü âûïîëíåíèå ïðîãðàììû
let terminateOnError = withErrorHandler [shutdown "" aEXIT_CODE_FATAL_ERROR]
-- Ïåðåéòè â çàäàííûé êàòàëîã/àðõèâ èëè âûïîëíèòü êîìàíäó
let select filename = do
fm <- val fm'
handle (\e -> (operationTerminated =: False) >> runFile filename (fm_curdir fm) False) $ do -- ïðè íåóäà÷å ïåðåõîäà çàïóñòèì ôàéë :)
hideErrors $ do
chdir fm' filename
New.treeViewScrollToPoint (fm_view fm) 0 0
--New.treeViewSetCursor (fm_view fm) [0] Nothing
-- Ïåðåõîä â ðîäèòåëüñêèé êàòàëîã
let goParentDir = do
fm <- val fm'
unless (isFM_Archive fm && isURL(fm_arcname fm) && fm_arcdir fm=="") $ do -- Çàïðåòèòü Up èç àðõèâà â èíåòå
chdir fm' ".."
-- Âûáèðàåì êàòàëîã/àðõèâ, èç êîòîðîãî ìû òîëüêî ÷òî âûøëè
fmSetCursor fm' (takeFileName$ fm_current fm)
-- Çàïèñü òåêóùåãî êàòàëîãà â èñòîðèþ
let saveCurdirToHistory = do
fm <- val fm'
fmAddHistory fm' (isFM_Archive fm.$bool "dir" "arcname") =<< fmCanonicalizePath fm' =<< val curdir
-- Ïðè íàæàòèè Enter íà ñòðîêå â ñïèñêå îòêðûâàåì âûáðàííûé àðõèâ/êàòàëîã
listView `New.onRowActivated` \path column -> do
fm <- val fm'
file <- fmFileAt fm' path
unless (isFM_Archive fm && not(fdIsDir file)) $ do -- Run command don't yet work directly from archives
select (fmname file)
-- Ïðè single-click íà ñâîáîäíîì ïðîñòðàíñòâå ñïðàâà/ñíèçó ñíèìàåì îòìåòêó ñî âñåõ ôàéëîâ,
-- ïðè double-click òàì æå âûáèðàåì âñå ôàéëû
listView `onButtonPress` \e -> do
path <- New.treeViewGetPathAtPos listView (round$ eventX e, round$ eventY e)
coltitle <- case path of
Just (_,column,_) -> New.treeViewColumnGetTitle column >>== fromMaybe ""
_ -> return ""
-- Ïóñòàÿ ñòðîêà â coltitle îçíà÷àåò êëèê çà ïðåäåëàìè ñïèñêà ôàéëîâ
coltitle=="" &&& e.$eventButton==LeftButton &&&
((if e.$eventClick==SingleClick then fmUnselectAll else fmSelectAll) fm' >> return True)
-- Ïðè ïåðåõîäå â äðóãîé êàòàëîã/àðõèâ îòîáðàçèòü åãî èìÿ â ñòðîêå ââîäà
fm' `fmOnChdir` do
fm <- val fm'
curdir =: fm_current fm
-- Ñîõðàíÿåì â èñòîðèþ èìåíà àðõèâîâ
isFM_Archive fm &&& fm_arcdir fm=="" &&& saveCurdirToHistory
-- Ïåðå÷èòàåì èñòîðèþ ñ äèñêà
rereadHistory curdir
-- Ïðè ïåðåõîäå â äðóãîé êàòàëîã/àðõèâ - îòîáðàçèòü åãî èìÿ â çàãîëîâêå îêíà
fm' `fmOnChdir` do
fm <- val fm'
let title | isFM_Archive fm = takeFileName (fm_arcname fm) </> fm_arcdir fm
| otherwise = takeFileName (fm_dir fm) ||| fm_dir fm
set (fm_window fm) [windowTitle := title++" - "++aARC_NAME]
-- Ïåðåõîäèì â ðîä. êàòàëîã ïî êíîïêå Up èëè íàæàòèþ BackSpace â ñïèñêå ôàéëîâ
upButton `onClick` goParentDir
"BackSpace" `onKey` goParentDir
-- Ñîõðàíåíèå âûáðàííîãî àðõèâà/êàòàëîãà â èñòîðèè
saveDirButton `onClick` do
saveCurdirToHistory
-- Îòêðûòèå äðóãîãî êàòàëîãà èëè àðõèâà (Enter â ñòðîêå ââîäà)
entry curdir `onEntryActivate` do
saveCurdirToHistory
select =<< val curdir
-- Îòêðûòèå äðóãîãî êàòàëîãà èëè àðõèâà (âûáîð èç èñòîðèè)
widget curdir `New.onChanged` do
whenJustM_ (New.comboBoxGetActive$ widget curdir) $ \_ -> do
saveCurdirToHistory
select =<< val curdir
-- Âûïîëíèòü action íàä ôàéëàìè, ñîñòîÿùèìè â ñîîòíîøåíèè makeRE ñ èìåíåì ôàéëà ïîä êóðñîðîì
let byFile action makeRE = do
filename <- fmGetCursor fm'
action fm' ((match$ makeRE filename).fdBasename)
-- Êëàâèøè Shift/Ctrl/Alt-Plus/Minus ñ òåìè æå îïåðàöèÿìè êàê â FAR
"<Shift>KP_Add" `onKey` fmSelectAll fm'
"<Shift>KP_Subtract" `onKey` fmUnselectAll fm'
"<Ctrl>KP_Add" `onKey` byFile fmSelectFilenames (("*" ++).takeExtension)
"<Ctrl>KP_Subtract" `onKey` byFile fmUnselectFilenames (("*" ++).takeExtension)
"<Alt>KP_Add" `onKey` byFile fmSelectFilenames ((++".*").dropExtension)
"<Alt>KP_Subtract" `onKey` byFile fmUnselectFilenames ((++".*").dropExtension)
-- Ïðè íàæàòèè çàãîëîâêà ñòîëáöà â ñïèñêå ôàéëîâ - ñîðòèðîâàòü ïî ýòîìó ñòîëáöó
-- (ïðè ïîâòîðíîì íàæàòèè - ñîðòèðîâàòü â îáðàòíîì ïîðÿäêå)
onColumnTitleClicked =: \column -> do
fmModifySortOrder fm' (showSortOrder columns) (calcNewSortOrder column)
refreshCommand fm'
fmSaveSortOrder fm' =<< fmGetSortOrder fm' -- çàïèøåì â êîíôèã ïîðÿäîê ñîðòèðîâêè
-- Îòñîðòèðóåì ôàéëû ïî ñîõðàí¸ííîìó êðèòåðèþ
fmSetSortOrder fm' (showSortOrder columns) =<< fmRestoreSortOrder fm'
----------------------------------------------------------------------------------------------------
---- Äâèæîê âûïîëíåíèÿ êîíñîëüíûõ êîìàíä âíóòðè FM gui ---------------------------------------------
----------------------------------------------------------------------------------------------------
-- Ïðè âûïîëíåíèè îïåðàöèé íå âûõîäèì ïî èñêëþ÷åíèÿì, à ïå÷àòàåì ñîîáùåíèÿ î íèõ â ëîãôàéë
let myHandleErrors action = do operationTerminated =: False
parent_id =:: myThreadId
action `catch` handler
whenM (val operationTerminated) $ do
sleepSeconds 0.1
operationTerminated =: False
where bg action = do
done <- newEmptyMVar
forkIO (action >> putMVar done ())
forkIO (foreverM (sleepSeconds 0.01 >> whenM (val operationTerminated) (putMVar done ())))
takeMVar done
handler ex = do
unlessM (val operationTerminated) $ do
errmsg <- case ex of
Deadlock -> i18n"0011 No threads to run: infinite loop or deadlock?"
ErrorCall s -> return s
other -> return$ show ex
condPrintLineLn "w" errmsg
return ()
condPrintLineLn "w" ""
-- Òðåä, âûïîëíÿþùèé êîìàíäû àðõèâàòîðà
cmdChan <- newChan
forkIO $ do
foreverM $ do
commands <- readChan cmdChan
when (commands==[["ExitProgram"]]) $ do fileManagerMode =: True; shutdown "" aEXIT_CODE_SUCCESS
postGUIAsync$ do widgetShowAll windowProgress
for commands $ \cmd -> do
myHandleErrors (parseCmdline cmd >>= mapM_ run)
whenM (isEmptyChan cmdChan)$ postGUIAsync$ do widgetHide windowProgress; clearMessageBox; warningsBefore =:: val warnings; refreshCommand fm'
--uiDoneProgram
-- Depending on execution mode, either queue commands or run external FreeArc instances
let exec detach cmds =
if detach
then do freearc <- getExeName
fm <- val fm'
for cmds $ \cmd -> do
let full_cmd = unparseCommand (freearc:cmd)
if length(full_cmd) < aMAX_CMDLINE_LENGTH
then Files.runCommand full_cmd (fm_curdir fm) False
else forkIO_ $ do
withTempFile (unicode2utf8$ unparseCommand cmd) $ \cmdfile -> do
Files.runCommand (unparseCommand [freearc,'@':cmdfile]) (fm_curdir fm) True
else writeChan cmdChan cmds
-- Çàêðûòèå îêíà ôàéë-ìåíåäæåðà
let closeMainWindow = do
sequence_ =<< listVal onExit
fileManagerMode =: False
showMessageBox
widgetHide window
writeChan cmdChan [["ExitProgram"]]
window `onDestroy` closeMainWindow
----------------------------------------------------------------------------------------------------
---- Ìåíþ File -------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
-- Îòêðûòü àðõèâ
openAct `onActionActivate` do
fm <- val fm'
let curfile = if isFM_Archive fm then fm_arcname fm else fm_dir fm </> "."
chooseFile window FileChooserActionOpen "0305 Open archive" aARCFILE_FILTER (return curfile) $ \filename -> do
msgboxOnError $
chdir fm' filename
-- Select/unselect files by user-supplied mask
let byDialog method msg = do
whenJustM_ (fmInputString fm' "mask" msg (const$ return True) return) $ \mask -> do
method fm' ((match mask).fdBasename)
selectAct `onActionActivate` byDialog fmSelectFilenames "0008 Select files"
unselectAct `onActionActivate` byDialog fmUnselectFilenames "0009 Unselect files"
-- Âûäåëèòü âñå ôàéëû
selectAllAct `onActionActivate` do
fmSelectAll fm'
-- Èíâåðòèðîâàòü âûäåëåíèå
invertSelAct `onActionActivate` do
fmInvertSelection fm'
-- Îáíîâèòü ñïèñîê ôàéëîâ àêòóàëüíûìè äàííûìè
refreshAct `onActionActivate` do
refreshCommand fm'
-- Âûõîä èç ïðîãðàììû
exitAct `onActionActivate`
closeMainWindow
----------------------------------------------------------------------------------------------------
---- Ìåíþ Commands ---------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
-- Óïàêîâêà äàííûõ
addAct `onActionActivate` do
compressionOperation fm' addDialog exec "a" NoMode
-- Ðàñïàêîâêà àðõèâ(îâ)
extractAct `onActionActivate` do
archiveOperation fm' $
extractDialog fm' exec "x"
rereadHistory curdir
-- Òåñòèðîâàíèå àðõèâ(îâ)
testAct `onActionActivate` do
archiveOperation fm' $
extractDialog fm' exec "t"
-- Èíôîðìàöèÿ îá àðõèâå
arcinfoAct `onActionActivate` do
msgboxOnError $
archiveOperation fm' $
arcinfoDialog fm' exec NoMode
-- Óäàëåíèå ôàéëîâ (èç àðõèâà)
deleteAct `onActionActivate` do
fm <- val fm'
files <- getSelection fm' (if isFM_Archive fm then xCmdFiles else const [])
if null files then fmErrorMsg fm' "0012 There are no files selected!" else do
msg <- i18n$ case files of [_] | isFM_Archive fm -> "0160 Delete %1 from archive?"
| otherwise -> "0161 Delete %1?"
_ | isFM_Archive fm -> "0019 Delete %2 file(s) from archive?"
| otherwise -> "0020 Delete %2 file(s)?"
whenM (askOkCancel window (formatn msg [head files, show3$ length files])) $ do
fmDeleteSelected fm'
if isFM_Archive fm
-- Ñòåðåòü ôàéëû èç àðõèâà
then do closeFMArc fm'
let arcname = fm_arcname fm
exec False [["d", "--noarcext", "--", arcname]++files]
-- Óäàëèòü ôàéëû íà äèñêå
else mapM_ (ignoreErrors.fileRemove.(fm_dir fm </>)) files
----------------------------------------------------------------------------------------------------
---- Ìåíþ Tools ------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
-- Çàùèòèòü àðõèâ îò çàïèñè
lockAct `onActionActivate` do
multiArchiveOperation fm' $ \archives -> do
let msg = "0299 Lock archive(s)?"
whenM (askOkCancel window (formatn msg [head archives, show3$ length archives])) $ do
closeFMArc fm'
for archives $ \arcname -> do
exec False [["ch", "--noarcext", "-k", "--", arcname]]
-- Èçìåíèòü êîììåíòàðèé àðõèâà
commentAct `onActionActivate` do
msgboxOnError $
archiveOperation fm' $
arcinfoDialog fm' exec CommentMode
-- Ïðåîáðàçîâàòü àðõèâ â SFX
recompressAct `onActionActivate` do
compressionOperation fm' addDialog exec "ch" RecompressMode
-- Ïðåîáðàçîâàòü àðõèâ â SFX
toSfxAct `onActionActivate` do
compressionOperation fm' addDialog exec "ch" MakeSFXMode
-- Ïðåîáðàçîâàòü ÷óæîé àðõèâ â ôîðìàò FreeArc
toFaAct `onActionActivate` do
compressionOperation fm' addDialog exec "cvt" NoMode
-- Çàøèôðîâàòü àðõèâ
encryptAct `onActionActivate` do
compressionOperation fm' addDialog exec "ch" EncryptionMode
-- Äîáàâèòü RR â àðõèâ
addRrAct `onActionActivate` do
compressionOperation fm' addDialog exec "ch" ProtectionMode
-- Âîññòàíîâèòü ïîâðåæä¸ííûé àðõèâ
repairAct `onActionActivate` do
multiArchiveOperation fm' $ \archives -> do
let msg = "0381 Repair archive(s)? Repaired archive(s) will be placed into files named fixed.*"
whenM (askOkCancel window (formatn msg [head archives, show3$ length archives])) $ do
closeFMArc fm'
for archives $ \arcname -> do
exec False [["r", "--noarcext", "--", arcname]]
-- Ìîäèôèêàöèÿ àðõèâîâ
modifyAct `onActionActivate` do
compressionOperation fm' addDialog exec "ch" NoMode
-- Îáúåäèíåíèå àðõèâîâ
joinAct `onActionActivate` do
compressionOperation fm' addDialog exec "j" NoMode
----------------------------------------------------------------------------------------------------
---- Ìåíþ Options ----------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
-- Îêíî íàñòðîåê ïðîãðàììû
settingsAct `onActionActivate` do
settingsDialog fm'
-- Äåéñòâèÿ ñ ëîãôàéëîì
let withLogfile action = do
logfileHist <- fmGetHistory fm' "logfile"
case logfileHist of
logfile:_ | logfile>"" -> action logfile
_ -> fmErrorMsg fm' "0303 No log file specified in Settings dialog!"
-- Ïðîñìîòðåòü ëîãôàéë
viewLogAct `onActionActivate` do
withLogfile runViewCommand
-- Óäàëèòü ëîãôàéë
clearLogAct `onActionActivate` do
withLogfile $ \logfile -> do
msg <- i18n"0304 Clear logfile %1?"
whenM (askOkCancel window (format msg logfile)) $ do
filePutBinary logfile ""
----------------------------------------------------------------------------------------------------
---- Ìåíþ Help -------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
-- Home/news page for the current locale
homeURL <- ((aARC_WEBSITE ++ "/") ++) ==<< i18n"0254 "
newsURL <- ((aARC_WEBSITE ++ "/") ++) ==<< i18n"0255 News.aspx"
forumURL <- ((aARC_WEBSITE ++ "/") ++) ==<< i18n"0457 redirects/forum.aspx"
wikiURL <- ((aARC_WEBSITE ++ "/") ++) ==<< i18n"0458 redirects/wiki.aspx"
-- Îòêðûòü URL
#ifdef FREEARC_WIN
let openWebsite url = runFile url "." False
#else
let openWebsite url = do browser <- runProgram "gconftool-2 --get '/desktop/gnome/url-handlers/http/command'"
browser <- return$ if "%s" `isInfixOf` browser then browser else "firefox \"%s\""
System.Process.runCommand (browser.$ replaceAll "%s" url)
return ()
#endif
-- Îòêðûòü ôàéë ïîìîùè
let openHelp helpfile = do
doc <- i18n helpfile
file <- findFile libraryFilePlaces (iif isWindows "../Documentation" "Documentation" </> doc)
case file of
"" -> return ()
_ -> openWebsite ((isWindows&&&windosifyPath) file)
-- Ïðî÷èòàòü ÈÄ, ñãåíåð¸ííûé äëÿ ýòîãî êîìïüþòåðà
let getUserID = do
#ifndef FREEARC_WIN
-- Èìèòàöèÿ íåðàáîòàþùåãî Windows Registry äëÿ äðóãèõ ÎÑ
let registryGetStr root branch key = return Nothing
registrySetStr root branch key value = return ()
hKEY_LOCAL_MACHINE = ()
#endif
-- Ñíà÷àëà èùåì åãî â èíè-ôàéëå
userid <- fmGetHistory1 fm' "UserID" ""
if userid/="" then return (Just userid) else do
-- Åñëè íå ïîëó÷èëîñü - ÷èòàåì êëþ÷ ïðåäûäóùåé èíñòàëëÿöèè èç Windows Registry...
userid <- do userid <- registryGetStr hKEY_LOCAL_MACHINE "SOFTWARE\\FreeArc" "UserID"
case userid of
Just userid -> return userid
-- ... èëè â êðàéíåì ñëó÷àå - ãåíåðèì íîâûé
Nothing -> generateRandomBytes 8 >>== encode16
-- È çàïèñûâàåì åãî ïîâñþäó
registrySetStr hKEY_LOCAL_MACHINE "SOFTWARE\\FreeArc" "UserID" userid
fmReplaceHistory fm' "UserID" userid
-- Âîçâðàùàåì åãî òîëüêî åñëè çàïèñü â èíè-ôàéë áûëà óñïåøíîé
userid1 <- fmGetHistory1 fm' "UserID" ""
return (if userid==userid1 then Just userid else Nothing)
-- Âîçâðàùàåò True ðàç â ñóòêè
let daily = do
last <- fmGetHistory1 fm' "LastCheck" ""
now <- getUnixTime
let day = round$ 24.37*60*60
if last>"" && (now - readI last < day) then return False else do
fmReplaceHistory fm' "LastCheck" (show now)
now1 <- fmGetHistory1 fm' "LastCheck" ""
return (show now==now1)
-- Size of maximum memory block we can allocate in bytes
maxBlock <- getMaxMemToAlloc
-- Ðåãèñòðèðóåò èñïîëüçîâàíèå ïðîãðàììû è ïðîâåðÿåò íîâîñòè
-- (manual=True - ðó÷íîé âûçîâ èç ìåíþ, False - åæåäíåâíàÿ àâòîïðîâåðêà)
let checkNews manual = do
postGUIAsync$ fmStackMsg fm' "0295 Checking for updates..."
forkIO_ $ do
-- Ñîîáùèì îá èñïîëüçîâàíèè ïðîãðàììû
whenJustM_ getUserID $ \userid -> do
#ifdef FREEARC_WIN
si <- getSystemInfo; let ramLimit = showMem (si.$siMaximumApplicationAddress.$ptrToWordPtr.$toInteger `roundTo` (4*mb))
#endif
language <- i18n"0000 English"
let url = aARC_WEBSITE ++ "/CheckNews.aspx?user=" ++ userid ++ "&version=" ++ urlEncode aARC_VERSION
++ "&OS%20family=" ++ iif isWindows "Windows" "Unix"
++ "&RAM=" ++ showMem (toInteger getPhysicalMemory `roundTo` (4*mb))
#ifdef FREEARC_WIN
++ "&address%20space=" ++ ramLimit
#endif
++ "&largest%20memory%20block=" ++ showMem (maxBlock `roundDown` (100*mb))
++ "&number%20of%20cores=" ++ show getProcessorsCount
++ "&language=" ++ urlEncode language
-- Ñîîáùàåì ñòàòèñòèêó è ïðîâåðÿåì ñòðàíèöó íîâîñòåé
handleErrors
-- Âûïîëíÿåòñÿ ïðè íåäîñòóïíîñòè ñòðàíèöû
(when manual$ postGUIAsync$ do
msg <- i18n"0296 Cannot open %1. Do you want to check the page with browser?"
whenM (askOkCancel window (format msg newsURL)) $ do
openWebsite newsURL)
-- Ïîïûòêà ïðî÷èòàòü ñòðàíèöó
(fileGetBinary url >>== (`showHex` "").crc32) $ \new_crc -> do
-- Ñòðàíèöà íîâîñòåé óñïåøíî ïðî÷èòàíà
old_crc <- fmGetHistory1 fm' "news_crc" ""
postGUIAsync$ do
fmStackMsg fm' ""
if (new_crc == old_crc) then do
msg <- i18n"0297 Nothing new at %1"
manual &&& fmInfoMsg fm' (format msg newsURL)
else do
fmReplaceHistory fm' "news_crc" new_crc
msg <- i18n"0298 Found new information at %1! Open the page with browser?"
whenM (askOkCancel window (format msg newsURL)) $ do
openWebsite newsURL
-- Äâàæäû â ÷àñ ïðîâåðÿòü îòñóòñòâèå íîâîñòåé
forkIO_ $ do
whenM (fmGetHistoryBool fm' "CheckNews" True) $ do
foreverM $ do
whenM daily $ do
checkNews False
sleepSeconds (30*60)
-- Ïîìîùü ïî èñïîëüçîâàíèþ GUI
helpAct `onActionActivate` do
openHelp "0256 FreeArc-GUI-Eng.htm"
-- Ïîìîùü ïî èñïîëüçîâàíèþ êîìàíäíîé ñòðîêè
helpCmdAct `onActionActivate` do
openHelp "0257 FreeArc036-eng.htm"
-- Äîìàøíÿÿ ñòðàíèöà ïðîãðàììû
homepageAct `onActionActivate` do
openWebsite homeURL
-- Äîìàøíÿÿ ñòðàíèöà ïðîãðàììû
openForumAct `onActionActivate` do
openWebsite forumURL
-- Äîìàøíÿÿ ñòðàíèöà ïðîãðàììû
openWikiAct `onActionActivate` do
openWebsite wikiURL
-- Ïðîâåðêà îáíîâëåíèé íà ñàéòå
whatsnewAct `onActionActivate` do
checkNews True
-- Äèàëîã About
aboutAct `onActionActivate` do
bracketCtrlBreak "aboutDialogDestroy" aboutDialogNew widgetDestroy $ \dialog -> do
dialog `set` [windowTransientFor := window
,aboutDialogName := aARC_NAME
,aboutDialogVersion := aARC_VERSION_WITH_DATE
,aboutDialogCopyright := "(c) "++aARC_EMAIL
,aboutDialogComments := unlines aARC_LICENSE
,aboutDialogWebsite := homeURL
,aboutDialogAuthors := ["Igor Pavlov (author of 7-zip, LZMA and EXE filter)"
,"Dmitry Shkarin (author of PPMd)"
,"Ilya Grebnov (author of GRZipII and LZP filter)"
,"Alexander Djourik and Pavel Zhilin (authors of TTA)"
,"Dmitry Subbotin (author of Carryless rangecoder)"
,"Joachim Henke (coauthor of Tornado)"
,"Mark Shevchenko (author of GUI SFX and web site)"
,aARC_EMAIL++" (author of remaining parts)"
]]
dialogRun dialog
return ()
-- Âêëþ÷èòü ïîääåðæêó URL â äèàëîãå About
aboutDialogSetUrlHook openWebsite
-- Èíèöèàëèçèðóåì ñîñòîÿíèå ôàéë-ìåíåäæåðà êàòàëîãîì/àðõèâîì, çàäàííûì â êîìàíäíîé ñòðîêå (ïðè åãî îòñóòñòâèè - òåêóùèì êàòàëîãîì)
terminateOnError $
chdir fm' (head (args++["."]))
fmStatusBarTotals fm'
widgetShowAll window