-
Notifications
You must be signed in to change notification settings - Fork 6
/
QPM_HotRecovery.prg
2051 lines (1919 loc) · 105 KB
/
QPM_HotRecovery.prg
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
/*
* QPM - QAC based Project Manager
*
* Copyright 2011-2021 Fernando Yurisich <[email protected]>
* https://teamqpm.github.io/
*
* Based on QAC - Project Manager for (x)Harbour
* Copyright 2006-2011 Carozo de Quilmes <[email protected]>
* http://www.CarozoDeQuilmes.com.ar
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "minigui.ch"
#include <QPM.ch>
#ifdef QPM_HOTRECOVERY
//#define __HOTTRACE__
#ifdef __HOTTRACE__
#translate $US_Log() => US_Log( Procname( 1 ) + "(" + alltrim( str( procline( 1 ) ) ) + ")" , .F. )
#else
#translate $US_Log() => //
#endif
#define B_SYSOUT_YES .T.
#define B_SYSOUT_NO .F.
#define B_COMPARE_YES .T.
#define B_COMPARE_NO .F.
#define SORT_VERSIONS SortHea // Aqui podria ir SortHea o SortPan, es decir algun sort que no freeze la primera row como hace SortPRG
// Public variables
memvar HR_nLookTimeOut
memvar HR_nVersionsDefault
memvar HR_nVersionsDigitosMax
memvar HR_nVersionsMinimun
memvar HR_nVersionsSet
memvar HR_nLimitForPack
memvar HR_nRadioFileSysOut
memvar HR_nRadioFileType
memvar HR_nRadioFileFrom
memvar HR_nRadioFileTarget
memvar HR_cMemoFrom
memvar HR_cMemoFromVersionsPRG
memvar HR_cMemoFromVersionsHEA
memvar HR_cMemoFromVersionsPAN
memvar HR_cMemoFromExternal
memvar HR_cMemoTarget
memvar HR_cMemoTargetItemPRG
memvar HR_cMemoTargetItemHEA
memvar HR_cMemoTargetItemPAN
memvar HR_cMemoTargetVersionsPRG
memvar HR_cMemoTargetVersionsHEA
memvar HR_cMemoTargetVersionsPAN
memvar HR_cNameFrom
memvar HR_cNameTarget
memvar HR_cLastExternalFileName
memvar HR_bWinHotRecoveryMinimized
memvar HR_cHotItemType
memvar HR_bSuspendChangeGrid
memvar HR_cCompareFileOutput
memvar HR_aColorBackVersionsFrom
memvar HR_aColorBackVersionsTarget
memvar HR_aColorBackCompare
memvar HR_nActualDiff
memvar HR_nTotalDiff
memvar HR_cFocus
memvar HotPUB_nGridImgNone
memvar HotGridImgComment
memvar HotGridImgFrom
memvar HotGridImgTarget
memvar HotGridImgFromComment
memvar HotGridImgTargetComment
memvar nHotPUB_nGridImgTop
memvar vHotImagesGrid
memvar vHotImagesTranslateGrid
// Private variables
memvar oW_HTML
memvar o_HTML
memvar cFromFile
memvar cTargetFile
memvar cFileAux
memvar Incremento
memvar cAux
Function QPM_HotRecoveryBuscoCod()
$US_Log()
DBGoBottom()
Return ( field->HR_COD + 1 )
Function QPM_HotInitPublicVariables()
$US_Log()
PUBLIC HR_ControlFileRC := ""
PUBLIC QPM_HR_Database := ""
PUBLIC HR_nLookTimeOut := 20 // Seconds()
PUBLIC HR_nVersionsDefault := 100 // Versiones a Conservar
PUBLIC HR_nVersionsDigitosMax := 5 // Maximo de digitos para cantidad de versiones a guardar
PUBLIC HR_nVersionsMinimun := 50 // Minimo de versiones a guardar
PUBLIC HR_nVersionsSet := HR_nVersionsDefault
PUBLIC HR_nLimitForPack := 75 // Cantidad de Registros deleteados antes de hacer pack
PUBLIC HR_nRadioFileSysOut := 1
PUBLIC HR_nRadioFileType := 1
PUBLIC HR_nRadioFileFrom := 1
PUBLIC HR_nRadioFileTarget := 1
PUBLIC HR_cMemoFrom := ""
PUBLIC HR_cMemoFromVersionsPRG := ""
PUBLIC HR_cMemoFromVersionsHEA := ""
PUBLIC HR_cMemoFromVersionsPAN := ""
PUBLIC HR_cMemoFromExternal := ""
PUBLIC HR_cMemoTarget := ""
PUBLIC HR_cMemoTargetItemPRG := ""
PUBLIC HR_cMemoTargetItemHEA := ""
PUBLIC HR_cMemoTargetItemPAN := ""
PUBLIC HR_cMemoTargetVersionsPRG := ""
PUBLIC HR_cMemoTargetVersionsHEA := ""
PUBLIC HR_cMemoTargetVersionsPAN := ""
PUBLIC HR_cNameFrom := ""
PUBLIC HR_cNameTarget := ""
PUBLIC HR_cLastExternalFileName := ""
PUBLIC HR_bWinHotRecoveryMinimized := .F.
PUBLIC HR_cHotItemType := "PRG"
PUBLIC HR_bSuspendChangeGrid := .F.
PUBLIC HR_cCompareFileOutput := ""
PUBLIC HR_aColorBackVersionsFrom := {255,255,128}
// PUBLIC HR_aColorBackVersionsTarget := {255,128,159}
// PUBLIC HR_aColorBackVersionsTarget := {219,219,219}
PUBLIC HR_aColorBackVersionsTarget := {218,194,146}
PUBLIC HR_aColorBackCompare := DEF_COLORWHITE
PUBLIC HR_nActualDiff := 0
PUBLIC HR_nTotalDiff := 0
PUBLIC HR_cFocus := ""
PUBLIC HR_bNumberOnPRG := .T.
PUBLIC HR_bNumberOnHEA := .T.
PUBLIC HR_bNumberOnPAN := .T.
if len( alltrim( str( HR_nVersionsSet ) ) ) > HR_nVersionsDigitosMax
US_Log( "Error in character length for HR_nVersionsSet" )
Return .F.
endif
// =============================================================================
// For images in Grid
PUBLIC HotPUB_nGridImgNone := 0
PUBLIC HotGridImgComment := 1
PUBLIC HotGridImgFrom := 2
PUBLIC HotGridImgTarget := 3
PUBLIC HotGridImgFromComment := 4
PUBLIC HotGridImgTargetComment := 5
PUBLIC nHotPUB_nGridImgTop := 5 /* igual a la ultima variable HotGridImg... */
//
PUBLIC vHotImagesGrid := {}
aadd( vHotImagesGrid , 'GridNone' ) // 0 0 0000 0000
aadd( vHotImagesGrid , 'GridHotComment') // 1 1 0000 0001
aadd( vHotImagesGrid , 'GridHotFrom') // 2 2 0000 0010
aadd( vHotImagesGrid , 'GridHotFromComment') // 3 3 0000 0011
aadd( vHotImagesGrid , 'GridHotTarget') // 4 4 0000 0100
aadd( vHotImagesGrid , 'GridHotTargetComment') // 5 5 0000 0101
PUBLIC vHotImagesTranslateGrid := {}
/* Para representar 256 pongo 23 */
aadd( vHotImagesTranslateGrid , { 0 , 0 } )
aadd( vHotImagesTranslateGrid , { 1 , 1 } )
aadd( vHotImagesTranslateGrid , { 2 , 2 } )
aadd( vHotImagesTranslateGrid , { 3 , 3 } )
aadd( vHotImagesTranslateGrid , { 4 , 4 } )
aadd( vHotImagesTranslateGrid , { 5 , 5 } )
// =============================================================================
Return .T.
Function QPM_HotRecovery( cFun , cSubFun , cType , cFileName , cRecoveryFile )
Local OPEN_nSecondsInit := Seconds()
Local OPEN_cOldTxt
Local OPEN_cAreaOld
Local cMemoFileTxt := "" , cMemoFileZip := ""
Local bZipFileError := .F. , bZipFileLong := .F.
Local bZipDataError := .F. , bZipDataLong := .T. // Cambiar a .F. cuando se implemente el zipeado y adaptar la funcion HotPutComment()
Local nNewCod := 0 , cRecoveryFileZip := US_FileNameOnlyPathAndName( cRecoveryFile ) + "_Hot.zip"
Local cHash := HB_MD5( US_Upper( US_FileNameOnlyNameAndExt( cFileName ) ) )
$US_Log()
do case
case cFun == "ADD"
OPEN_cAreaOld := dbf()
OPEN_cOldTxt := GetMGWaitTxt()
Do While !US_Use( .T. , "DBFCDX" , QPM_HR_Database , "HOTREC" , DEF_DBF_EXCLUSIVE , DEF_DBF_WRITE ) .and. ( seconds() - OPEN_nSecondsInit ) < HR_nLookTimeOut
SetMGWaitTxt( "Waiting for Hot Recovery Database: " + alltrim( str( int( HR_nLookTimeOut - ( seconds() - OPEN_nSecondsInit ) ) ) ) + " seconds..." )
DO EVENTS
enddo
SetMGWaitTxt( OPEN_cOldTxt )
if dbf() == "HOTREC"
nNewCod := QPM_HotRecoveryBuscoCod()
DBAppend()
if !HB_ZipFile( cRecoveryFileZip , cRecoveryFile )
bZipFileError := .T.
else
cMemoFileTxt := MemoRead( cRecoveryFile )
cMemoFileZip := MemoRead( cRecoveryFileZip )
if at( '\\#' , cMemoFileZip ) > 0 // esto es para evitar SIEMPRE la doble busqueda, entonces solo se busca dos veces si aparece '\\#'
if at( '\\#26//' , cMemoFileZip ) > 0
bZipFileError := .T.
else
if at( '\\#00//' , cMemoFileZip ) > 0
bZipFileError := .T.
endif
endif
endif
endif
if !bZipFileError
cMemoFileZip := US_MaskBinData( cMemoFileZip )
if len( cMemoFileTxt ) <= len( cMemoFileZip )
bZipFileLong := .T.
endif
endif
REPLACE HR_COD With nNewCod , ;
HR_HASH With cHash , ;
HR_SECU With 0 , ;
HR_DATA_TY With if( bZipDataError .or. bZipDataLong , "T" , "Z" ) , ;
HR_DATA With "FUNCTION " + cSubFun + HB_OsNewLine() + ;
"FULLNAME " + ChgPathToReal( cFileName ) + HB_OsNewLine() + ;
"RELATIVENAME " + cFileName + HB_OsNewLine() + ;
"FILE_TYPE " + cType + HB_OsNewLine() + ;
"FILE_DATETIME " + DToS( US_FileDate( cRecoveryFile ) ) + US_StrCero( US_TimeSec( US_FileTime( cRecoveryFile ) ) , 5 ) + HB_OsNewLine() + ;
"VERSION_DATETIME " + US_DateSeconds() + HB_OsNewLine() + ;
"VERSION_COMPUTER " + US_GetComputerName() + HB_OsNewLine() + ;
"VERSION_USER " + US_GetUserName() , ;
HR_FILE_TY With if( bZipFileError .or. bZipFileLong , "T" , "Z" ) , ;
HR_FILE With if( bZipFileError .or. bZipFileLong , cMemoFileTxt , cMemoFileZip )
// INI ONLY FOR TEST
if .F.
if !bZipFileError .and. !bZipFileLong
QPM_MemoWrit( cRecoveryFileZip + "TesT" , US_UnMaskBinData( field->HR_FILE ) )
HB_UNZIPFILE( cRecoveryFileZip + "TesT" , , .T. , , US_FileNameOnlyPath( cRecoveryFile ) + DEF_SLASH + "ZipTest" , "*.*" )
if !( memoread( cRecoveryFile ) == memoread( US_FileNameOnlyPath( cRecoveryFile ) + DEF_SLASH + "ZipTest" + DEF_SLASH + US_FileNameOnlyNameAndExt( CrecoveryFile ) ) )
US_Log( "Fallo en test de zip file for HotRecovery" )
endif
ferase( cRecoveryFileZip + "TesT" )
ferase( US_FileNameOnlyPath( cRecoveryFile ) + DEF_SLASH + "ZipTest" + DEF_SLASH + US_FileNameOnlyNameAndExt( CrecoveryFile ) )
US_DirRemoveLoop( US_FileNameOnlyPath( cRecoveryFile ) + DEF_SLASH + "ZipTest" , 3 )
endif
endif
// FIN ONLY FOR TEST
ferase( cRecoveryFile )
ferase( cRecoveryFileZip )
QPM_HotRecoveryDecalaje( "HR_SECU" , "HR_HASH" , cHash )
QPM_HotRecoveryClear( "HR_SECU" , HR_nVersionsSet )
DBCloseArea( "HOTREC" )
else
ferase( cRecoveryFile )
US_Log( "Error in Open Exclusive for DBF HotRecovery Database: " + QPM_HR_Database + HB_OsNewLine() + ;
"No version saved for this source" + HB_OsNewLine() + ;
"Free Hot Recovery Database and/or reinit all QPM instances" )
endif
if !empty( OPEN_cAreaOld )
DBSelectArea( OPEN_cAreaOld )
endif
otherwise
US_Log( "Invalid Function: " + US_VarToStr( cFun ) )
endcase
Return nNewCod
Function QPM_HotRecoveryDecalaje( cCampo , cHash , hHash )
$US_Log()
REPLACE &( cCampo ) With ( &( cCampo ) + 1 ) FOR &( cHash ) == hHash
Return .T.
Function QPM_HotRecoveryClear( cCampo , nLimit )
Local nRecords := 0
$US_Log()
DELETE ALL FOR &( cCampo ) > nLimit
COUNT TO nRecords
if ( LastRec() - nRecords ) > HR_nLimitForPack
PACK
endif
Return .T.
Function QPM_HotRecoveryMenu()
$US_Log()
Local cOldRegPath
Local cOldRegPathDif := .F.
If Empty( PUB_cProjectFile )
MyMsgStop( 'No project is open.' )
Return .F.
EndIf
if GetProperty( "VentanaMain" , "GPrgFiles" , "ItemCount" ) < 1
MyMsgStop( 'The PRG file list is empty.' )
Return .F.
EndIf
if .F. // suspendido mientras se use ventana MODAL
if HR_bWinHotRecoveryMinimized
DoMethod( "WinHotRecovery" , "restore" )
Return .T.
else
if _IsWindowDefined( "WinHotRecovery" )
DoMethod( "WinHotRecovery" , "setfocus" )
Return .T.
endif
endif
endif
Private oW_HTML
Private o_HTML
cOldRegPath := US_GetReg( HKEY_CURRENT_USER , "Software\ComponentSoftware\CSDiff" , "CSDiffPath" )
if !( US_Upper( alltrim( cOldRegPath ) ) == US_Upper( alltrim( PUB_cQPM_Folder ) ) )
US_SetReg( HKEY_CURRENT_USER , "Software\ComponentSoftware\CSDiff" , "CSDiffPath" , PUB_cQPM_Folder )
cOldRegPathDif := .T.
endif
DEFINE WINDOW WinHotRecovery ;
AT 25 , 25 ;
WIDTH GetDesktopRealWidth() - 50 ;
HEIGHT GetDesktopRealHeight() - 50 ;
ICON "XHOTRECOVERY" ;
TITLE "Hot Recovery for QPM projects" ;
MODAL ;
NOSIZE ;
ON INIT QPM_Wait( "QPM_HotRecoveryInit()" , "Loading ..." ) ;
ON RELEASE QPM_HotRelease() ;
ON INTERACTIVECLOSE US_NOP()
ON KEY ESCAPE OF WinHotRecovery ACTION DoMethod( "WinHotRecovery" , "release" )
@ 07 , 05 FRAME FrameType ;
WIDTH 347 ;
HEIGHT 40 ;
OPAQUE
@ 15 , 50 RADIOGROUP HR_FileType ;
OPTIONS { 'Sources' , 'Headers' , 'Forms' } ;
WIDTH 70 ;
VALUE HR_nRadioFileType ;
TOOLTIP "Select file type for Recovery or Compare" ;
ON CHANGE QPM_HotChangeType() ;
HORIZONTAL
@ 07 , 365 FRAME FrameSysOut ;
WIDTH ( GetProperty( "WinHotRecovery" , "width" ) - 375 ) ;
HEIGHT 40 ;
OPAQUE
@ 15 , 400 RADIOGROUP HR_FileSysOut ;
OPTIONS if( PUB_bW800 , { 'Compared' , '"From"/"Base"' , '"Target"/"New"' } , { 'View Compared Files' , 'View Only "From"/"Base"' , 'View Only "Target"/"New"' } ) ;
WIDTH ( ( GetProperty( "WinHotRecovery" , "Width" ) - 400 ) / if( PUB_bW800 , 3.7 , 3.4 ) ) ;
VALUE HR_nRadioFileSysout ;
TOOLTIP "Select view" ;
ON CHANGE QPM_HotChangeSysOut( B_COMPARE_YES ) ;
HORIZONTAL
@ 55 , 05 FRAME FrameHotRecovery ;
WIDTH ( GetProperty( "WinHotRecovery" , "width" ) - 15 ) ;
HEIGHT ( GetProperty( "WinHotRecovery" , "height" ) - 90 ) ;
OPAQUE
@ 75, 365 RICHEDITBOX HR_RichEdit ;
WIDTH GetProperty( "WinHotRecovery" , "width" ) - 390 ;
HEIGHT GetProperty( "WinHotRecovery" , "height" ) - 126 ;
READONLY ;
FONT 'Courier New' ;
SIZE 9
SetProperty( "WinHotRecovery" , "HR_RichEdit" , "visible" , .F. )
DEFINE LABEL LHR_ComboNavigatePos
ROW 80
COL 367
WIDTH 140
VALUE "Go To Diference #"
FONTBOLD .T.
FONTCOLOR DEF_COLORBLUE
FONTSIZE 10
TRANSPARENT if( IsXPThemeActive() , .T. , .F. )
END LABEL
@ 77 , 490 COMBOBOX CHR_GoToPos ;
ITEMS {} ;
VALUE 1 ;
WIDTH 70 ;
HEIGHT 200 ;
TOOLTIP "Go to difference number ..." ;
ON CHANGE HotNavigate( HR_nActualDiff := ( GetProperty( "WinHotRecovery" , "CHR_GoToPos" , "value" ) - 1 ) )
DEFINE BUTTON BHR_NavigatePrev
ROW 75
COL 570
WIDTH 25
HEIGHT 25
PICTURE "UP15x15"
TOOLTIP "Go to previous difference"
ONCLICK HotNavigate( --HR_nActualDiff )
END BUTTON
DEFINE BUTTON BHR_NavigateNext
ROW 75
COL 600
WIDTH 25
HEIGHT 25
PICTURE "DOWN"
TOOLTIP "Go to next difference"
ONCLICK HotNavigate( ++HR_nActualDiff )
END BUTTON
DEFINE LABEL LHR_NavigatePos
ROW 80
COL 640
WIDTH 290
VALUE ""
FONTBOLD .T.
FONTCOLOR DEF_COLORBLUE
FONTSIZE 14
TRANSPARENT if( IsXPThemeActive() , .T. , .F. )
END LABEL
@ 115 - 2 , 365 - 2 FRAME FrameActiveX ;
WIDTH ( GetProperty( "WinHotRecovery" , "width" ) - 390 ) + 4 ;
HEIGHT ( GetProperty( "WinHotRecovery" , "height" ) - 166 ) + 4
oW_HTML := TActiveX():New( "WinHotRecovery" , "Shell.Explorer.2" , 115 , 365 , GetProperty( "WinHotRecovery" , "width" ) - 390 , GetProperty( "WinHotRecovery" , "height" ) - 166 )
o_HTML := oW_HTML:Load()
// ---------
DEFINE FRAME FrameHotRecoveryFileFrom
ROW 70
COL 18
WIDTH 334
HEIGHT ( ( ( GetProperty( "WinHotRecovery" , "height" ) / 2 ) - 70 ) - 17 )
CAPTION "Select File 'From' for Hot Recovery"
OPAQUE .T.
FONTNAME "Arial"
FONTSIZE 12
FONTBOLD .T.
FONTITALIC .T.
FONTCOLOR {255,0,0}
END FRAME
@ 100 , 50 RADIOGROUP HR_FileFrom ;
OPTIONS { 'Hot Recovery Versions Database' , 'External File' } ;
WIDTH 215 ;
VALUE HR_nRadioFileFrom ;
TOOLTIP 'Select "From" file for Hot Recovery or "Base" file for Compare' ;
ON CHANGE QPM_HotChangeFrom()
DEFINE BUTTON B_CommentFrom
ROW 130
COL 265
WIDTH 80
HEIGHT 25
CAPTION "Comment"
TOOLTIP "Add / Modify / Remove version's comments"
ONCLICK HotGetComment( "FROM" )
END BUTTON
DEFINE LABEL LHR_ExternalFileFrom
ROW if( PUB_bW800 , 162 , 192 )
COL 40
WIDTH 290
VALUE " 'From' for Hot Recovery or 'Base' for Compare:"
TRANSPARENT if( IsXPThemeActive() , .T. , .F. )
END LABEL
DEFINE TEXTBOX THR_ExternalFileFrom
ROW if( PUB_bW800 , 180 , 220 )
COL 25
WIDTH 270
ONLOSTFOCUS QPM_HotChangeExternal()
END TEXTBOX
DEFINE BUTTON BHR_ExternalFileFrom
ROW if( PUB_bW800 , 180 , 220 )
COL 300
WIDTH 25
HEIGHT 25
PICTURE "folderselect"
TOOLTIP "Select File 'From' for Hot Recovery or 'Base' for Compare"
ONCLICK If ( !Empty( HR_cLastExternalFileName := GetFile( { {'All files','*.*'} } , 'Select File' , US_FileNameOnlyPath( GetProperty( "WinHotRecovery" , "THR_ExternalFileFrom" , "value" ) ) , .F. , .T. ) ) , ( SetProperty( "WinHotRecovery" , "THR_ExternalFileFrom" , "value" , HR_cLastExternalFileName ) , QPM_HotChangeExternal() ) , )
END BUTTON
SetProperty( "WinHotRecovery" , "LHR_ExternalFileFrom" , "visible" , .F. )
SetProperty( "WinHotRecovery" , "THR_ExternalFileFrom" , "visible" , .F. )
SetProperty( "WinHotRecovery" , "BHR_ExternalFileFrom" , "visible" , .F. )
@ 167, 25 GRID HR_GridVersionsFromPRG ;
WIDTH 320 ;
HEIGHT ( ( ( GetProperty( "WinHotRecovery" , "height" ) / 2 ) - 167 ) - 23 ) ;
HEADERS { 'S' , 'Ver' , 'File Date Time' , 'Version Created at' , 'Comment' , 'Source Relative Name' , 'Source Full Name' , 'Version Created on' , 'Version Created by' , 'Code' , 'Offset' } ;
WIDTHS { 20 , 20 , 100 , 100 , 10 , 1000 , 1000 , 20 , 20 , 20 , 20 };
ITEMS {} ;
VALUE 1 ;
IMAGE vHotImagesGrid ;
BACKCOLOR HR_aColorBackVersionsFrom ;
ON HEADCLICK { {||SORT_VERSIONS( "WinHotRecovery" , "HR_GridVersionsFromPRG" ,1)} , {||SORT_VERSIONS( "WinHotRecovery" , "HR_GridVersionsFromPRG" ,2)} , {||SORT_VERSIONS( "WinHotRecovery" , "HR_GridVersionsFromPRG" ,3)} , {||SORT_VERSIONS( "WinHotRecovery" , "HR_GridVersionsFromPRG" ,4)} } ;
ON DBLCLICK { HotGetComment( "FROM" ) } ;
ON CHANGE { || if( !bPrgSorting .and. !PUB_bLite , if( HR_bNumberOnPrg , QPM_Wait( "QPM_HotChangeGrid( 'FROM' , 'VERSIONS' , 'PRG' )" , "Comparing ..." ) , QPM_HotChangeGrid( 'FROM' , 'VERSIONS' , 'PRG' ) ) , US_NOP() ) } ;
JUSTIFY { BROWSE_JTFY_LEFT }
@ 167, 25 GRID HR_GridVersionsFromHEA ;
WIDTH 320 ;
HEIGHT ( ( ( GetProperty( "WinHotRecovery" , "height" ) / 2 ) - 167 ) - 23 ) ;
HEADERS { 'S' , 'Ver' , 'File Date Time' , 'Version Created at' , 'Comment' , 'Header Relative Name' , 'Header Full Name' , 'Version Created on' , 'Version Created by' , 'Code' , 'Offset' } ;
WIDTHS { 20 , 20 , 100 , 100 , 10 , 1000 , 1000 , 20 , 20 , 20 , 20 };
ITEMS {} ;
VALUE 1 ;
IMAGE vHotImagesGrid ;
BACKCOLOR HR_aColorBackVersionsFrom ;
ON HEADCLICK { {||SORT_VERSIONS( "WinHotRecovery" , "HR_GridVersionsFromHEA" ,1)} , {||SORT_VERSIONS( "WinHotRecovery" , "HR_GridVersionsFromHEA" ,2)} , {||SORT_VERSIONS( "WinHotRecovery" , "HR_GridVersionsFromHEA" ,3)} , {||SORT_VERSIONS( "WinHotRecovery" , "HR_GridVersionsFromHEA" ,4)} } ;
ON DBLCLICK { HotGetComment( "FROM" ) } ;
ON CHANGE { || if( !bHEASorting .and. !PUB_bLite , if( HR_bNumberOnHEA , QPM_Wait( "QPM_HotChangeGrid( 'FROM' , 'VERSIONS' , 'HEA' )" , "Comparing ..." ) , QPM_HotChangeGrid( 'FROM' , 'VERSIONS' , 'HEA' ) ) , US_NOP() ) } ;
JUSTIFY { BROWSE_JTFY_LEFT }
SetProperty( "WinHotRecovery" , "HR_GridVersionsFromHEA" , "visible" , .F. )
@ 167, 25 GRID HR_GridVersionsFromPAN ;
WIDTH 320 ;
HEIGHT ( ( ( GetProperty( "WinHotRecovery" , "height" ) / 2 ) - 167 ) - 23 ) ;
HEADERS { 'S' , 'Ver' , 'File Date Time' , 'Version Created at' , 'Comment' , 'Form Relative Name' , 'Form Full Name' , 'Version Created on' , 'Version Created by' , 'Code' , 'Offset' } ;
WIDTHS { 20 , 20 , 100 , 100 , 10 , 1000 , 1000 , 20 , 20 , 20 , 20 };
ITEMS {} ;
VALUE 1 ;
IMAGE vHotImagesGrid ;
BACKCOLOR HR_aColorBackVersionsFrom ;
ON HEADCLICK { {||SORT_VERSIONS( "WinHotRecovery" , "HR_GridVersionsFromPAN" ,1)} , {||SORT_VERSIONS( "WinHotRecovery" , "HR_GridVersionsFromPAN" ,2)} , {||SORT_VERSIONS( "WinHotRecovery" , "HR_GridVersionsFromPAN" ,3)} , {||SORT_VERSIONS( "WinHotRecovery" , "HR_GridVersionsFromPAN" ,4)} } ;
ON DBLCLICK { HotGetComment( "FROM" ) } ;
ON CHANGE { || if( !bPANSorting .and. !PUB_bLite , if( HR_bNumberOnPAN , QPM_Wait( "QPM_HotChangeGrid( 'FROM' , 'VERSIONS' , 'PAN' )" , "Comparing ..." ) , QPM_HotChangeGrid( 'FROM' , 'VERSIONS' , 'PAN' ) ) , US_NOP() ) } ;
JUSTIFY { BROWSE_JTFY_LEFT }
SetProperty( "WinHotRecovery" , "HR_GridVersionsFromPAN" , "visible" , .F. )
// ---------
@ ( GetProperty( "WinHotRecovery" , "height" ) / 2 ) - 03 , 18 FRAME FrameHotRecoveryFileTarget ;
CAPTION "Select File 'Target' for Hot Recovery" ;
WIDTH 334 ;
HEIGHT ( GetProperty( "WinHotRecovery" , "height" ) - 147 ) - ( ( GetProperty( "WinHotRecovery" , "height" ) / 2 ) - 60 ) ;
FONT "Arial" SIZE 12 ;
BOLD ITALIC ;
FONTCOLOR {255,0,0} ;
OPAQUE
@ ( GetProperty( "WinHotRecovery" , "height" ) / 2 ) + 27 , 50 RADIOGROUP HR_FileTarget ;
OPTIONS { 'Item of Project (Last Version)' , 'Hot Recovery Versions Database' } ;
WIDTH 215 ;
VALUE HR_nRadioFileTarget ;
TOOLTIP 'Select "Target" file for Hot Recovery or "New" file for Compare' ;
ON CHANGE QPM_HotChangeTarget()
DEFINE BUTTON B_CommentTarget
ROW ( GetProperty( "WinHotRecovery" , "height" ) / 2 ) + 57
COL 265
WIDTH 80
HEIGHT 25
CAPTION "Comment"
TOOLTIP "Add / Modify / Remove version's comments"
ONCLICK HotGetComment( "TARGET" )
END BUTTON
//
@ ( GetProperty( "WinHotRecovery" , "height" ) / 2 ) + 94 , 25 GRID HR_GridVersionsTargetPRG ;
WIDTH 320 ;
HEIGHT ( GetProperty( "WinHotRecovery" , "height" ) - 250 ) - ( ( GetProperty( "WinHotRecovery" , "height" ) / 2 ) - 60 ) ;
HEADERS { 'S' , 'Ver' , 'File Date Time' , 'Version Created at' , 'Comment' , 'Source Relative Name' , 'Source Full Name' , 'Version Created on' , 'Version Created by' , 'Code' , 'Offset' } ;
WIDTHS { 20 , 20 , 100 , 100 , 10 , 1000 , 1000 , 20 , 20 , 20 , 20 };
ITEMS {} ;
VALUE 1 ;
IMAGE vHotImagesGrid ;
BACKCOLOR HR_aColorBackVersionsTarget ;
ON HEADCLICK { {||SORT_VERSIONS( "WinHotRecovery" , "HR_GridVersionsTargetPRG" ,1)} , {||SORT_VERSIONS( "WinHotRecovery" , "HR_GridVersionsTargetPRG" ,2)} , {||SORT_VERSIONS( "WinHotRecovery" , "HR_GridVersionsTargetPRG" ,3)} , {||SORT_VERSIONS( "WinHotRecovery" , "HR_GridVersionsTargetPRG" ,4)} } ;
ON DBLCLICK { HotGetComment( "TARGET" ) } ;
ON CHANGE { || if( !bPrgSorting .and. !PUB_bLite , if( HR_bNumberOnPrg , QPM_Wait( "QPM_HotChangeGrid( 'TARGET' , 'VERSIONS' , 'PRG' )" , "Comparing ..." ) , QPM_HotChangeGrid( 'TARGET' , 'VERSIONS' , 'PRG' ) ) , US_NOP() ) } ;
JUSTIFY { BROWSE_JTFY_LEFT }
SetProperty( "WinHotRecovery" , "HR_GridVersionsTargetPRG" , "visible" , .F. )
@ ( GetProperty( "WinHotRecovery" , "height" ) / 2 ) + 94 , 25 GRID HR_GridVersionsTargetHEA ;
WIDTH 320 ;
HEIGHT ( GetProperty( "WinHotRecovery" , "height" ) - 250 ) - ( ( GetProperty( "WinHotRecovery" , "height" ) / 2 ) - 60 ) ;
HEADERS { 'S' , 'Ver' , 'File Date Time' , 'Version Created at' , 'Comment' , 'Header Relative Name' , 'Header Full Name' , 'Version Created on' , 'Version Created by' , 'Code' , 'Offset' } ;
WIDTHS { 20 , 20 , 100 , 100 , 10 , 1000 , 1000 , 20 , 20 , 20 , 20 };
ITEMS {} ;
VALUE 1 ;
IMAGE vHotImagesGrid ;
BACKCOLOR HR_aColorBackVersionsTarget ;
ON HEADCLICK { {||SORT_VERSIONS( "WinHotRecovery" , "HR_GridVersionsTargetHEA" ,1)} , {||SORT_VERSIONS( "WinHotRecovery" , "HR_GridVersionsTargetHEA" ,2)} , {||SORT_VERSIONS( "WinHotRecovery" , "HR_GridVersionsTargetHEA" ,3)} , {||SORT_VERSIONS( "WinHotRecovery" , "HR_GridVersionsTargetHEA" ,4)} } ;
ON DBLCLICK { HotGetComment( "TARGET" ) } ;
ON CHANGE { || if( !bHEASorting .and. !PUB_bLite , if( HR_bNumberOnHEA , QPM_Wait( "QPM_HotChangeGrid( 'TARGET' , 'VERSIONS' , 'HEA' )" , "Comparing ..." ) , QPM_HotChangeGrid( 'TARGET' , 'VERSIONS' , 'HEA' ) ) , US_NOP() ) } ;
JUSTIFY { BROWSE_JTFY_LEFT }
SetProperty( "WinHotRecovery" , "HR_GridVersionsTargetHEA" , "visible" , .F. )
@ ( GetProperty( "WinHotRecovery" , "height" ) / 2 ) + 94 , 25 GRID HR_GridVersionsTargetPAN ;
WIDTH 320 ;
HEIGHT ( GetProperty( "WinHotRecovery" , "height" ) - 250 ) - ( ( GetProperty( "WinHotRecovery" , "height" ) / 2 ) - 60 ) ;
HEADERS { 'S' , 'Ver' , 'File Date Time' , 'Version Created at' , 'Comment' , 'Form Relative Name' , 'Form Full Name' , 'Version Created on' , 'Version Created by' , 'Code' , 'Offset' } ;
WIDTHS { 20 , 20 , 100 , 100 , 10 , 1000 , 1000 , 20 , 20 , 20 , 20 };
ITEMS {} ;
VALUE 1 ;
IMAGE vHotImagesGrid ;
BACKCOLOR HR_aColorBackVersionsTarget ;
ON HEADCLICK { {||SORT_VERSIONS( "WinHotRecovery" , "HR_GridVersionsTargetPAN" ,1)} , {||SORT_VERSIONS( "WinHotRecovery" , "HR_GridVersionsTargetPAN" ,2)} , {||SORT_VERSIONS( "WinHotRecovery" , "HR_GridVersionsTargetPAN" ,3)} , {||SORT_VERSIONS( "WinHotRecovery" , "HR_GridVersionsTargetPAN" ,4)} } ;
ON DBLCLICK { HotGetComment( "TARGET" ) } ;
ON CHANGE { || if( !bPANSorting .and. !PUB_bLite , if( HR_bNumberOnPAN , QPM_Wait( "QPM_HotChangeGrid( 'TARGET' , 'VERSIONS' , 'PAN' )" , "Comparing ..." ) , QPM_HotChangeGrid( 'TARGET' , 'VERSIONS' , 'PAN' ) ) , US_NOP() ) } ;
JUSTIFY { BROWSE_JTFY_LEFT }
SetProperty( "WinHotRecovery" , "HR_GridVersionsTargetPAN" , "visible" , .F. )
@ ( GetProperty( "WinHotRecovery" , "height" ) / 2 ) + 94 , 25 GRID HR_GridItemTargetPRG ;
WIDTH 320 ;
HEIGHT ( GetProperty( "WinHotRecovery" , "height" ) - 250 ) - ( ( GetProperty( "WinHotRecovery" , "height" ) / 2 ) - 60 ) ;
HEADERS { 'S' , 'Source Name' , 'Source Relative Name' , 'Source Full Name' , 'File Date Time' , 'Offset' , 'Version' } ;
WIDTHS { 20 , 100 , 100 , 1000 , 100 , 20 , 20 };
ITEMS {} ;
VALUE 1 ;
IMAGE vImagesGrid ;
BACKCOLOR DEF_COLORBACKPRG ;
ON HEADCLICK { {||SortPRG( "WinHotRecovery" , "HR_GridItemTargetPRG" ,1)} , {||SortPRG( "WinHotRecovery" , "HR_GridItemTargetPRG" ,2)} , {||SortPRG( "WinHotRecovery" , "HR_GridItemTargetPRG" ,3)} , {||SortPRG( "WinHotRecovery" , "HR_GridItemTargetPRG" ,4)} } ;
ON CHANGE { || if( !bPrgSorting .and. !PUB_bLite , if( HR_bNumberOnPrg , QPM_Wait( "QPM_HotChangeGrid( 'TARGET' , 'ITEM' , 'PRG' )" , "Comparing ..." ) , QPM_HotChangeGrid( 'TARGET' , 'ITEM' , 'PRG' ) ) , US_NOP() ) } ;
JUSTIFY { BROWSE_JTFY_LEFT }
@ ( GetProperty( "WinHotRecovery" , "height" ) / 2 ) + 94 , 25 GRID HR_GridItemTargetHEA ;
WIDTH 320 ;
HEIGHT ( GetProperty( "WinHotRecovery" , "height" ) - 250 ) - ( ( GetProperty( "WinHotRecovery" , "height" ) / 2 ) - 60 ) ;
HEADERS { 'S' , 'Header Name' , 'Header Relative Name' , 'Header Full Name' , 'File Date Time' , 'Offset' , 'Version' } ;
WIDTHS { 20 , 100 , 100 , 1000 , 100 , 20 , 20 };
ITEMS {} ;
VALUE 1 ;
IMAGE vImagesGrid ;
TOOLTIP '' ;
BACKCOLOR DEF_COLORBACKHEA ;
ON HEADCLICK { {||SortHEA( "WinHotRecovery" , "HR_GridItemTargetHEA" ,1)} , {||SortHEA( "WinHotRecovery" , "HR_GridItemTargetHEA" ,2)} , {||SortHEA( "WinHotRecovery" , "HR_GridItemTargetHEA" ,3)} , {||SortHEA( "WinHotRecovery" , "HR_GridItemTargetHEA" ,4)} } ;
ON CHANGE { || if( !bHEASorting .and. !PUB_bLite , if( HR_bNumberOnHEA , QPM_Wait( "QPM_HotChangeGrid( 'TARGET' , 'ITEM' , 'HEA' )" , "Comparing ..." ) , QPM_HotChangeGrid( 'TARGET' , 'ITEM' , 'HEA' ) ) , US_NOP() ) } ;
JUSTIFY { BROWSE_JTFY_LEFT }
SetProperty( "WinHotRecovery" , "HR_GridItemTargetHEA" , "visible" , .F. )
@ ( GetProperty( "WinHotRecovery" , "height" ) / 2 ) + 94 , 25 GRID HR_GridItemTargetPAN ;
WIDTH 320 ;
HEIGHT ( GetProperty( "WinHotRecovery" , "height" ) - 250 ) - ( ( GetProperty( "WinHotRecovery" , "height" ) / 2 ) - 60 ) ;
HEADERS { 'S' , 'Form Name' , 'Form Relative Name' , 'Form Full Name' , 'File Date Time' , 'Offset' , 'Version' } ;
WIDTHS { 20 , 100 , 100 , 1000 , 100 , 20 , 20 };
ITEMS {} ;
VALUE 1 ;
IMAGE vImagesGrid ;
TOOLTIP '' ;
BACKCOLOR DEF_COLORBACKPAN ;
ON HEADCLICK { {||SortPAN( "WinHotRecovery" , "HR_GridItemTargetPAN" ,1)} , {||SortPAN( "WinHotRecovery" , "HR_GridItemTargetPAN" ,2)} , {||SortPAN( "WinHotRecovery" , "HR_GridItemTargetPAN" ,3)} , {||SortPAN( "WinHotRecovery" , "HR_GridItemTargetPAN" ,4)} } ;
ON CHANGE { || if( !bPANSorting .and. !PUB_bLite , if( HR_bNumberOnPAN , QPM_Wait( "QPM_HotChangeGrid( 'TARGET' , 'ITEM' , 'PAN' )" , "Comparing ..." ) , QPM_HotChangeGrid( 'TARGET' , 'ITEM' , 'PAN' ) ) , US_NOP() ) } ;
JUSTIFY { BROWSE_JTFY_LEFT }
SetProperty( "WinHotRecovery" , "HR_GridItemTargetPAN" , "visible" , .F. )
// ---------
DEFINE BUTTON BHR_RecoveryProcess
ROW GetProperty( "WinHotRecovery" , "height" ) - 77
COL 25
WIDTH 320
CAPTION "Recover File"
TOOLTIP 'Recover "From" file in "Target" file'
ONCLICK QPM_HotRecoveryProcess()
END BUTTON
END WINDOW
ACTIVATE WINDOW WinHotRecovery
if cOldRegPathDif
US_SetReg( HKEY_CURRENT_USER , "Software\ComponentSoftware\CSDiff" , "CSDiffPath" , cOldRegPath )
endif
Return .T.
Function QPM_HotRecoveryInit()
$US_Log()
CambioTitulo()
// INI SOLO para nuevos indices
if .F.
HotRecoveryReindex()
endif
// FIN SOLO para nuevos indices
HR_cLastExternalFileName := Gbl_HR_cLastExternalFileName
SetProperty( "WinHotRecovery" , "THR_ExternalFileFrom" , "value" , HR_cLastExternalFileName )
HR_cCompareFileOutput := US_ShortName( PUB_cProjectFolder ) + DEF_SLASH + "_" + PUB_cSecu + "CompareOutput" + US_DateTimeCen() + ".htm"
HR_bSuspendChangeGrid := .T.
QPM_HotCargoItems( 'PRG' )
QPM_HotCargoItems( 'HEA' )
QPM_HotCargoItems( 'PAN' )
SetProperty( "WinHotRecovery" , "HR_GridItemTargetPRG" , "value" , GetProperty( "VentanaMain" , "GPRGFiles" , "value" ) )
QPM_HotCargoVersions( 'PRG' )
QPM_HotCargoVersions( 'HEA' )
QPM_HotCargoVersions( 'PAN' )
HR_bSuspendChangeGrid := .F.
QPM_HotCargoMemo( "FROM" , "EXTERNAL" , "" )
QPM_HotCargoMemo( "FROM" , "VERSIONS" , "PRG" )
QPM_HotCargoMemo( "TARGET" , "VERSIONS" , "PRG" )
QPM_HotCargoMemo( "TARGET" , "ITEM" , "PRG" )
QPM_HotChangeType()
HR_cFocus := "HR_GridItemTargetPRG"
DoMethod( "WinHotRecovery" , HR_cFocus , "setfocus" )
Return .T.
Function QPM_HotChangeType()
$US_Log()
do case
case GetProperty( "WinHotRecovery" , "HR_FileType" , "value" ) == 1
HR_cHotItemType := "PRG"
case GetProperty( "WinHotRecovery" , "HR_FileType" , "value" ) == 2
HR_cHotItemType := "HEA"
case GetProperty( "WinHotRecovery" , "HR_FileType" , "value" ) == 3
HR_cHotItemType := "PAN"
endcase
QPM_HotChangeFrom( B_SYSOUT_NO )
QPM_HotChangeTarget( B_SYSOUT_NO )
QPM_HotChangeSysOut()
Return .T.
Function QPM_HotChangeSysOut( bCompare )
$US_Log()
if bCompare == NIL
bCompare := B_COMPARE_YES
endif
do case
case GetProperty( "WinHotRecovery" , "HR_FileSysOut" , "value" ) == 1
if bCompare
HR_nActualDiff := 0
QPM_HotCompare( HR_cMemoFrom , HR_cMemoTarget , HR_cNameFrom , HR_cNameTarget )
HotNavigate( 0 )
endif
oW_HTML:Show()
SetProperty( "WinHotRecovery" , "FrameActiveX" , "visible" , .T. )
SetProperty( "WinHotRecovery" , "HR_RichEdit" , "visible" , .F. )
SetProperty( "WinHotRecovery" , "HR_RichEdit" , "backcolor" , HR_aColorBackCompare )
SetProperty( "WinHotRecovery" , "LHR_ComboNavigatePos" , "visible" , .T. )
SetProperty( "WinHotRecovery" , "CHR_GoToPos" , "visible" , .T. )
SetProperty( "WinHotRecovery" , "LHR_NavigatePos" , "visible" , .T. )
SetProperty( "WinHotRecovery" , "BHR_NavigatePrev" , "visible" , .T. )
SetProperty( "WinHotRecovery" , "BHR_NavigateNext" , "visible" , .T. )
case GetProperty( "WinHotRecovery" , "HR_FileSysOut" , "value" ) == 2
oW_HTML:Hide()
SetProperty( "WinHotRecovery" , "FrameActiveX" , "visible" , .F. )
SetProperty( "WinHotRecovery" , "HR_RichEdit" , "visible" , .T. )
SetProperty( "WinHotRecovery" , "HR_RichEdit" , "value" , HR_cMemoFrom )
SetProperty( "WinHotRecovery" , "HR_RichEdit" , "caretpos" , 0 )
SetProperty( "WinHotRecovery" , "HR_RichEdit" , "backcolor" , HR_aColorBackVersionsFrom )
SetProperty( "WinHotRecovery" , "LHR_ComboNavigatePos" , "visible" , .F. )
SetProperty( "WinHotRecovery" , "CHR_GoToPos" , "visible" , .F. )
SetProperty( "WinHotRecovery" , "LHR_NavigatePos" , "visible" , .F. )
SetProperty( "WinHotRecovery" , "BHR_NavigatePrev" , "visible" , .F. )
SetProperty( "WinHotRecovery" , "BHR_NavigateNext" , "visible" , .F. )
case GetProperty( "WinHotRecovery" , "HR_FileSysOut" , "value" ) == 3
oW_HTML:Hide()
SetProperty( "WinHotRecovery" , "FrameActiveX" , "visible" , .F. )
SetProperty( "WinHotRecovery" , "HR_RichEdit" , "visible" , .T. )
SetProperty( "WinHotRecovery" , "HR_RichEdit" , "value" , HR_cMemoTarget )
SetProperty( "WinHotRecovery" , "HR_RichEdit" , "caretpos" , 0 )
if GetProperty( "WinHotRecovery" , "HR_FileTarget" , "value" ) == 1
do case
case HR_cHotItemType == "PRG"
SetProperty( "WinHotRecovery" , "HR_RichEdit" , "backcolor" , DEF_COLORBACKPRG )
case HR_cHotItemType == "HEA"
SetProperty( "WinHotRecovery" , "HR_RichEdit" , "backcolor" , DEF_COLORBACKHEA )
case HR_cHotItemType == "PAN"
SetProperty( "WinHotRecovery" , "HR_RichEdit" , "backcolor" , DEF_COLORBACKPAN )
endcase
else
SetProperty( "WinHotRecovery" , "HR_RichEdit" , "backcolor" , HR_aColorBackVersionsTarget )
endif
SetProperty( "WinHotRecovery" , "LHR_ComboNavigatePos" , "visible" , .F. )
SetProperty( "WinHotRecovery" , "CHR_GoToPos" , "visible" , .F. )
SetProperty( "WinHotRecovery" , "LHR_NavigatePos" , "visible" , .F. )
SetProperty( "WinHotRecovery" , "BHR_NavigatePrev" , "visible" , .F. )
SetProperty( "WinHotRecovery" , "BHR_NavigateNext" , "visible" , .F. )
endcase
Return .T.
Function QPM_HotChangeFrom( bSysOut )
$US_Log()
if bSysOut == NIL
bSysOut := B_SYSOUT_YES
endif
do case
case GetProperty( "WinHotRecovery" , "HR_FileFrom" , "value" ) == 1
SetProperty( "WinHotRecovery" , "B_CommentFrom" , "enabled" , .T. )
SetProperty( "WinHotRecovery" , "LHR_ExternalFileFrom" , "visible" , .F. )
SetProperty( "WinHotRecovery" , "THR_ExternalFileFrom" , "visible" , .F. )
SetProperty( "WinHotRecovery" , "BHR_ExternalFileFrom" , "visible" , .F. )
do case
case HR_cHotItemType == "PRG"
SetProperty( "WinHotRecovery" , "HR_GridVersionsFromPRG" , "visible" , .T. )
SetProperty( "WinHotRecovery" , "HR_GridVersionsFromHEA" , "visible" , .F. )
SetProperty( "WinHotRecovery" , "HR_GridVersionsFromPAN" , "visible" , .F. )
HR_cMemoFrom := HR_cMemoFromVersionsPRG
if GetProperty( "WinHotRecovery" , "HR_GridVersionsFromPRG" , "itemcount" ) > 0
HR_cNameFrom := QPM_HotGetNameVersionsFrom( "WinHotRecovery" , "HR_GridVersionsFromPRG" , GetProperty( "WinHotRecovery" , "HR_GridVersionsFromPRG" , "value" ) )
else
HR_cNameFrom := "Version doesn't exists"
endif
case HR_cHotItemType == "HEA"
SetProperty( "WinHotRecovery" , "HR_GridVersionsFromPRG" , "visible" , .F. )
SetProperty( "WinHotRecovery" , "HR_GridVersionsFromHEA" , "visible" , .T. )
SetProperty( "WinHotRecovery" , "HR_GridVersionsFromPAN" , "visible" , .F. )
HR_cMemoFrom := HR_cMemoFromVersionsHEA
if GetProperty( "WinHotRecovery" , "HR_GridVersionsFromHEA" , "itemcount" ) > 0
HR_cNameFrom := QPM_HotGetNameVersionsFrom( "WinHotRecovery" , "HR_GridVersionsFromHEA" , GetProperty( "WinHotRecovery" , "HR_GridVersionsFromHEA" , "value" ) )
else
HR_cNameFrom := "Version doesn't exists"
endif
case HR_cHotItemType == "PAN"
SetProperty( "WinHotRecovery" , "HR_GridVersionsFromPRG" , "visible" , .F. )
SetProperty( "WinHotRecovery" , "HR_GridVersionsFromHEA" , "visible" , .F. )
SetProperty( "WinHotRecovery" , "HR_GridVersionsFromPAN" , "visible" , .T. )
HR_cMemoFrom := HR_cMemoFromVersionsPAN
if GetProperty( "WinHotRecovery" , "HR_GridVersionsFromPAN" , "itemcount" ) > 0
HR_cNameFrom := QPM_HotGetNameVersionsFrom( "WinHotRecovery" , "HR_GridVersionsFromPAN" , GetProperty( "WinHotRecovery" , "HR_GridVersionsFromPAN" , "value" ) )
else
HR_cNameFrom := "Version doesn't exists"
endif
endcase
case GetProperty( "WinHotRecovery" , "HR_FileFrom" , "value" ) == 2
SetProperty( "WinHotRecovery" , "B_CommentFrom" , "enabled" , .F. )
SetProperty( "WinHotRecovery" , "LHR_ExternalFileFrom" , "visible" , .T. )
SetProperty( "WinHotRecovery" , "THR_ExternalFileFrom" , "visible" , .T. )
SetProperty( "WinHotRecovery" , "BHR_ExternalFileFrom" , "visible" , .T. )
SetProperty( "WinHotRecovery" , "HR_GridVersionsFromPRG" , "visible" , .F. )
SetProperty( "WinHotRecovery" , "HR_GridVersionsFromHEA" , "visible" , .F. )
SetProperty( "WinHotRecovery" , "HR_GridVersionsFromPAN" , "visible" , .F. )
HR_cMemoFrom := HR_cMemoFromExternal
HR_cNameFrom := QPM_HotGetNameExternal( GetProperty( "WinHotRecovery" , "THR_ExternalFileFrom" , "value" ) )
endcase
if bSysOut
QPM_HotChangeSysOut()
endif
Return .T.
Function QPM_HotChangeTarget( bSysOut )
$US_Log()
if bSysOut == NIL
bSysOut := B_SYSOUT_YES
endif
do case
case GetProperty( "WinHotRecovery" , "HR_FileTarget" , "value" ) == 1
SetProperty( "WinHotRecovery" , "B_CommentTarget" , "enabled" , .F. )
SetProperty( "WinHotRecovery" , "BHR_RecoveryProcess" , "enabled" , .T. )
do case
case HR_cHotItemType == "PRG"
SetProperty( "WinHotRecovery" , "HR_GridItemTargetPRG" , "visible" , .T. )
SetProperty( "WinHotRecovery" , "HR_GridItemTargetHEA" , "visible" , .F. )
SetProperty( "WinHotRecovery" , "HR_GridItemTargetPAN" , "visible" , .F. )
HR_cMemoTarget := HR_cMemoTargetItemPRG
HR_cNameTarget := QPM_HotGetNameItemTarget( "WinHotRecovery" , "HR_GridItemTargetPRG" , GetProperty( "WinHotRecovery" , "HR_GridItemTargetPRG" , "value" ) )
case HR_cHotItemType == "HEA"
SetProperty( "WinHotRecovery" , "HR_GridItemTargetPRG" , "visible" , .F. )
SetProperty( "WinHotRecovery" , "HR_GridItemTargetHEA" , "visible" , .T. )
SetProperty( "WinHotRecovery" , "HR_GridItemTargetPAN" , "visible" , .F. )
HR_cMemoTarget := HR_cMemoTargetItemHEA
HR_cNameTarget := QPM_HotGetNameItemTarget( "WinHotRecovery" , "HR_GridItemTargetHEA" , GetProperty( "WinHotRecovery" , "HR_GridItemTargetHEA" , "value" ) )
case HR_cHotItemType == "PAN"
SetProperty( "WinHotRecovery" , "HR_GridItemTargetPRG" , "visible" , .F. )
SetProperty( "WinHotRecovery" , "HR_GridItemTargetHEA" , "visible" , .F. )
SetProperty( "WinHotRecovery" , "HR_GridItemTargetPAN" , "visible" , .T. )
HR_cMemoTarget := HR_cMemoTargetItemPAN
HR_cNameTarget := QPM_HotGetNameItemTarget( "WinHotRecovery" , "HR_GridItemTargetPAN" , GetProperty( "WinHotRecovery" , "HR_GridItemTargetPAN" , "value" ) )
endcase
SetProperty( "WinHotRecovery" , "HR_GridVersionsTargetPRG" , "visible" , .F. )
SetProperty( "WinHotRecovery" , "HR_GridVersionsTargetHEA" , "visible" , .F. )
SetProperty( "WinHotRecovery" , "HR_GridVersionsTargetPAN" , "visible" , .F. )
SetProperty( "WinHotRecovery" , "FrameHotRecoveryFileFrom" , "caption" , "Select File 'From' for Hot Recovery" )
SetProperty( "WinHotRecovery" , "FrameHotRecoveryFileTarget" , "caption" , "Select File 'Target' for Hot Recovery" )
case GetProperty( "WinHotRecovery" , "HR_FileTarget" , "value" ) == 2
SetProperty( "WinHotRecovery" , "B_CommentTarget" , "enabled" , .T. )
SetProperty( "WinHotRecovery" , "BHR_RecoveryProcess" , "enabled" , .F. )
SetProperty( "WinHotRecovery" , "HR_GridItemTargetPRG" , "visible" , .F. )
SetProperty( "WinHotRecovery" , "HR_GridItemTargetHEA" , "visible" , .F. )
SetProperty( "WinHotRecovery" , "HR_GridItemTargetPAN" , "visible" , .F. )
do case
case HR_cHotItemType == "PRG"
SetProperty( "WinHotRecovery" , "HR_GridVersionsTargetPRG" , "visible" , .T. )
SetProperty( "WinHotRecovery" , "HR_GridVersionsTargetHEA" , "visible" , .F. )
SetProperty( "WinHotRecovery" , "HR_GridVersionsTargetPAN" , "visible" , .F. )
HR_cMemoTarget := HR_cMemoTargetVersionsPRG
if GetProperty( "WinHotRecovery" , "HR_GridVersionsTargetPRG" , "itemcount" ) > 0
HR_cNameTarget := QPM_HotGetNameVersionsTarget( "WinHotRecovery" , "HR_GridVersionsTargetPRG" , GetProperty( "WinHotRecovery" , "HR_GridVersionsTargetPRG" , "value" ) )
else
HR_cNameTarget := "Version doesn't exists"
endif
case HR_cHotItemType == "HEA"
SetProperty( "WinHotRecovery" , "HR_GridVersionsTargetPRG" , "visible" , .F. )
SetProperty( "WinHotRecovery" , "HR_GridVersionsTargetHEA" , "visible" , .T. )
SetProperty( "WinHotRecovery" , "HR_GridVersionsTargetPAN" , "visible" , .F. )
HR_cMemoTarget := HR_cMemoTargetVersionsHEA
if GetProperty( "WinHotRecovery" , "HR_GridVersionsTargetHEA" , "itemcount" ) > 0
HR_cNameTarget := QPM_HotGetNameVersionsTarget( "WinHotRecovery" , "HR_GridVersionsTargetHEA" , GetProperty( "WinHotRecovery" , "HR_GridVersionsTargetHEA" , "value" ) )
else
HR_cNameTarget := "Version doesn't exists"
endif
case HR_cHotItemType == "PAN"
SetProperty( "WinHotRecovery" , "HR_GridVersionsTargetPRG" , "visible" , .F. )
SetProperty( "WinHotRecovery" , "HR_GridVersionsTargetHEA" , "visible" , .F. )
SetProperty( "WinHotRecovery" , "HR_GridVersionsTargetPAN" , "visible" , .T. )
HR_cMemoTarget := HR_cMemoTargetVersionsPAN
if GetProperty( "WinHotRecovery" , "HR_GridVersionsTargetPAN" , "itemcount" ) > 0
HR_cNameTarget := QPM_HotGetNameVersionsTarget( "WinHotRecovery" , "HR_GridVersionsTargetPAN" , GetProperty( "WinHotRecovery" , "HR_GridVersionsTargetPAN" , "value" ) )
else
HR_cNameTarget := "Version doesn't exists"
endif
endcase
SetProperty( "WinHotRecovery" , "FrameHotRecoveryFileFrom" , "caption" , "Select File 'Base' for Compare Process" )
SetProperty( "WinHotRecovery" , "FrameHotRecoveryFileTarget" , "caption" , "Select File 'New' for Compare Process" )
endcase
if bSysOut
QPM_HotChangeSysOut()
endif
Return .T.
Function QPM_HotCargoMemo( cZona , cSubZona , cType )
$US_Log()
if cType == NIL
cType := ""
endif
cType := US_Upper( cType )
cZona := US_Upper( cZona )
cSubZona := US_Upper( cSubZona )
if cSubZona == "EXTERNAL"
&( "HR_cMemo" + cZona + cSubZona + cType ) := MemoRead( GetProperty( "WinHotRecovery" , "THR_ExternalFileFrom" , "value" ) )
else
if cSubZona == "VERSIONS"
if GetProperty( "WinHotRecovery" , "HR_Grid" + cSubZona + cZona + cType , "itemcount" ) > 0
&( "HR_cMemo" + cZona + cSubZona + cType ) := QPM_HotObtengo( GetProperty( "WinHotRecovery" , "HR_Grid" + cSubZona + cZona + cType , "cell" , GetProperty( "WinHotRecovery" , "HR_Grid" + cSubZona + cZona + cType , "value" ) , DEF_N_VER_COLCODE ) )
else
&( "HR_cMemo" + cZona + cSubZona + cType ) := "This Hot Recovery Version Doesn't Exists !!!" + HB_OsNewLine()
endif
else
&( "HR_cMemo" + cZona + cSubZona + cType ) := memoread( ChgPathToReal( GetProperty( "WinHotRecovery" , "HR_Grid" + cSubZona + cZona + cType , "cell" , GetProperty( "WinHotRecovery" , "HR_Grid" + cSubZona + cZona + cType , "value" ) , DEF_N_ITEM_COLFULLNAME ) ) )
endif
endif
if alltrim( &( "HR_cMemo" + cZona + cSubZona + cType ) ) == ""
&( "HR_cMemo" + cZona + cSubZona + cType ) := "Empty File/Version or File not Found" + HB_OsNewLine()
endif
Return .T.
Function QPM_HotCargoItems( cType )
$US_Log()
Local i
DoMethod( "WinHotRecovery" , "HR_GridItemTarget" + cType , "DeleteAllItems" )
for i:=1 to GetProperty( "VentanaMain" , "G" + cType + "Files" , "ItemCount" )
if GridImage( "VentanaMain" , "G" + cType + "Files" , i , &( "nCol" + cType + "Status" ) , "?" , PUB_nGridImgEquis )
DoMethod( "WinHotRecovery" , "HR_GridItemTarget" + cType , "AddItem" , { PUB_nGridImgEquis , ;
GetProperty( "VentanaMain" , "G" + cType + "Files" , "cell" , i , &( "nCol" + cType + "Name" ) ) , ;
GetProperty( "VentanaMain" , "G" + cType + "Files" , "cell" , i , &( "nCol" + cType + "FullName" ) ) , ;
ChgPathToReal( GetProperty( "VentanaMain" , "G" + cType + "Files" , "cell" , i , &( "nCol" + cType + "FullName" ) ) ) , ;
'' , ;
'0' , ;
'1' } )
else
DoMethod( "WinHotRecovery" , "HR_GridItemTarget" + cType , "AddItem" , { PUB_nGridImgNone , ;
GetProperty( "VentanaMain" , "G" + cType + "Files" , "cell" , i , &( "nCol" + cType + "Name" ) ) , ;
GetProperty( "VentanaMain" , "G" + cType + "Files" , "cell" , i , &( "nCol" + cType + "FullName" ) ) , ;
ChgPathToReal( GetProperty( "VentanaMain" , "G" + cType + "Files" , "cell" , i , &( "nCol" + cType + "FullName" ) ) ) , ;
US_Dis_DateSeconds2( DToS( US_FileDate( ChgPathToReal( GetProperty( "VentanaMain" , "G" + cType + "Files" , "cell" , i , &( "nCol" + cType + "FullName" ) ) ) ) ) + US_StrCero( US_TimeSec( US_FileTime( ChgPathToReal( GetProperty( "VentanaMain" , "G" + cType + "Files" , "cell" , i , &( "nCol" + cType + "FullName" ) ) ) ) ) , 5 ) ) , ;
"0" , ;
"1" } )
if GridImage( "VentanaMain" , "G" + cType + "Files" , i , &( "nCol" + cType + "Status" ) , "?" , PUB_nGridImgEdited )
GridImage( "WinHotRecovery" , "HR_GridItemTarget" + cType , i , DEF_N_ITEM_COLIMAGE , "+" , PUB_nGridImgEdited )
endif
endif
next
SetProperty( "WinHotRecovery" , "HR_GridItemTarget" + cType , "value" , 1 )
DoMethod( "WinHotRecovery" , "HR_GridItemTarget" + cType , "ColumnsAutoFitH" )
QPM_HotCargoMemo( "TARGET" , "ITEM" , cType )
Return .T.
Function QPM_HotCargoVersions( cType )
Local OPEN_cAreaOld := dbf()
Local OPEN_cOldTxt := GetMGWaitTxt()
Local OPEN_nSecondsInit := Seconds()
Local cActual, cActualHash
Local cAuxLinea, nInx, cRelativeName := "" , cFullName := "" , cComment
Local cFileDateTime := "" , LOC_cVersionDateTime := "" , LOC_cVersionComputer := "" , LOC_cVersionUser := ""
Local i := 0
$US_Log()
Do While !US_Use( .T. , "DBFCDX" , QPM_HR_Database , "HOTREC" , DEF_DBF_EXCLUSIVE , DEF_DBF_WRITE ) .and. ( seconds() - OPEN_nSecondsInit ) < HR_nLookTimeOut
SetMGWaitTxt( "Waiting for Hot Recovery Database: " + alltrim( str( int( HR_nLookTimeOut - ( seconds() - OPEN_nSecondsInit ) ) ) ) + " seconds..." )
DO EVENTS
enddo
SetMGWaitTxt( OPEN_cOldTxt )
if dbf() == "HOTREC"
cActual := GetProperty( "WinHotRecovery" , "HR_GridItemTarget" + cType , "cell" , GetProperty( "WinHotRecovery" , "HR_GridItemTarget" + cType , "value" ) , DEF_N_ITEM_COLNAME )