-
Notifications
You must be signed in to change notification settings - Fork 5
/
options.pas
executable file
·1108 lines (992 loc) · 40.1 KB
/
options.pas
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
unit options;
{$I videlibrilanguageconfig.inc}
{$WARN 5024 on : Parameter "$1" not used}
interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, ComCtrls,
Buttons, StdCtrls, bookWatchMain, libraryParser, ExtCtrls,{$ifdef win32}registry,{$endif}
EditBtn,Themes, xquery,applicationformconfig, commoninterface;
//TODO: Fix resizing bug (LCL)
//TODO2: Offenen Einstellungsfenster => Verschwinden aus Programmauswahl
type
{ ToptionForm }
ToptionForm = class(TVideLibriForm)
accountList: TListView;
Button10: TButton;
Button12: TButton;
Button13: TButton;
cbCopyAccountLimits: TCheckBox;
accountType: TComboBox;
templateList: TComboBox;
templateFile: TComboBox;
Label36: TLabel;
Label37: TLabel;
openSSLCAStore: TEdit;
groupingProperty: TComboBox;
Label34: TLabel;
Label35: TLabel;
openSSLCAStoreLabel: TLabel;
lblAccountType: TLabel;
libNameEdit: TEdit;
Label33: TLabel;
PageControlLibs: TPageControl;
Panel6: TPanel;
internetAccessW32: TRadioButton;
internetAccessSynapse: TRadioButton;
Panel7: TPanel;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
TabSheet3: TTabSheet;
templateDefine: TButton;
Button11: TButton;
templateName: TEdit;
Label32: TLabel;
libChange: TButton;
libDelete: TButton;
libAdd: TButton;
checkCertificates: TCheckBox;
Label30: TLabel;
Label31: TLabel;
libList: TListView;
libxml: TMemo;
templatexml: TMemo;
pageLibs: TPage;
Panel4: TPanel;
Panel5: TPanel;
proxySocksName: TEdit;
ShapeOrdered: TShape;
ShapeProvided: TShape;
SocksName: TEdit;
proxySocksPort: TEdit;
Label26: TLabel;
lblShowWarning: TLabel;
Label27: TLabel;
Label28: TLabel;
Label29: TLabel;
mailList: TListView;
autostartAlways: TRadioButton;
autostartDepends: TRadioButton;
autostartNever: TRadioButton;
Bevel1: TBevel;
btnAccountChange: TButton;
btnAccountCreate: TButton;
btnAccountDelete: TButton;
Button1: TButton;
mailadd: TButton;
mailset: TButton;
maildel: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Button7: TButton;
Button8: TButton;
Button9: TButton;
CheckBox1: TCheckBox;
autoUpdate: TCheckBox;
ckbAccountDisabled: TCheckBox;
ckbAccountHistory: TCheckBox;
cmbAccountExtend: TComboBox;
ColorDialog1: TColorDialog;
mailProgram: TEdit;
mailreceiver: TEdit;
mailaccounts: TEdit;
mailinterval: TEdit;
edtHistoryBackupInterval: TEdit;
Label17: TLabel;
Label18: TLabel;
Label20: TLabel;
Label21: TLabel;
Label22: TLabel;
Label23: TLabel;
Label24: TLabel;
Label25: TLabel;
pageMail: TPage;
Panel2: TPanel;
Panel3: TPanel;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
SpeedButton5: TSpeedButton;
SpeedButton6: TSpeedButton;
SpeedButtonLibraryConfig: TSpeedButton;
symbols: TComboBox;
Label19: TLabel;
proxyHTTPName: TEdit;
proxyHTTPSname: TEdit;
proxyHTTPPort: TEdit;
proxyHTTPSport: TEdit;
timeNearMeaning: TEdit;
edtAccountExtendDays: TEdit;
edtAccountUser: TEdit;
edtAccountPass: TEdit;
edtAccountPrettyName: TEdit;
Label1: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
timeNearMeaningLabelLeft: TLabel;
timeNearMeaningLabelRight: TLabel;
Label2: TLabel;
Label3: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
lblRefreshTIming: TLabel;
Label9: TLabel;
lblAccountPass: TLabel;
Label4: TLabel;
Label5: TLabel;
lblAccountLibrary: TLabel;
lblAccountExtend1: TLabel;
lblAccountExtend2: TLabel;
Notebook1: TNotebook;
pageInternet: TPage;
pageColors: TPage;
pageAccount: TPage;
PageBehaviour: TPage;
Page3: TPage;
Panel1: TPanel;
internetWindows: TRadioButton;
internetDirect: TRadioButton;
homepageSimpleBrowser: TRadioButton;
homepageDefaultBrowser: TRadioButton;
internetProxy: TRadioButton;
ShapeTimeNear: TShape;
ShapeLimited: TShape;
ShapeOK: TShape;
ShapeOld: TShape;
TrackBar1: TTrackBar;
TrackBar2: TTrackBar;
procedure accountListSelectItem({%H-}Sender: TObject; Item: TListItem;
Selected: Boolean);
procedure BitBtn1Click({%H-}Sender: TObject);
procedure btnAccountChangeClick({%H-}Sender: TObject);
procedure btnAccountCreateClick({%H-}Sender: TObject);
procedure accountdeleteClick({%H-}Sender: TObject);
procedure Button10Click({%H-}Sender: TObject);
procedure Button11Click({%H-}Sender: TObject);
procedure Button12Click({%H-}Sender: TObject);
procedure Button13Click({%H-}Sender: TObject);
procedure templateFileChange(Sender: TObject);
procedure internetAccessChange({%H-}Sender: TObject);
procedure internetProxyChange({%H-}Sender: TObject);
procedure libAddClick({%H-}Sender: TObject);
procedure libChangeClick({%H-}Sender: TObject);
procedure libDeleteClick({%H-}Sender: TObject);
procedure libListSelectItem({%H-}Sender: TObject; Item: TListItem; Selected: Boolean);
procedure templateDefineClick({%H-}Sender: TObject);
procedure Button2Click({%H-}Sender: TObject);
procedure Button3Click({%H-}Sender: TObject);
procedure Button8Click({%H-}Sender: TObject);
procedure cancelclick({%H-}Sender: TObject);
procedure ComboBox1Change({%H-}Sender: TObject);
procedure edtAccountUserChange({%H-}Sender: TObject);
procedure FormCreate({%H-}Sender: TObject);
procedure FormResize({%H-}Sender: TObject);
procedure FormShow({%H-}Sender: TObject);
procedure ImageList1Change({%H-}Sender: TObject);
procedure lblShowWarningClick({%H-}Sender: TObject);
procedure mailaddClick({%H-}Sender: TObject);
procedure maildelClick({%H-}Sender: TObject);
procedure mailListSelectItem(Sender: TObject; Item: TListItem; Selected: Boolean);
procedure mailsetClick({%H-}Sender: TObject);
procedure Shape1MouseUp(Sender: TOBject; {%H-}Button: TMouseButton;
{%H-}Shift: TShiftState; {%H-}X, {%H-}Y: Integer);
procedure SpeedButton1Click(Sender: TObject);
procedure templateListSelectionChange({%H-}Sender: TObject);
procedure TrackBar1Change({%H-}Sender: TObject);
procedure TrackBar2Change({%H-}Sender: TObject);
private
{ private declarations }
public
{ public declarations }
currentSelectedItem: TListItem;
currentSelectedAccount: TCustomAccountAccess;
currentSelectedExtendType: TExtendType;
function backSelect(const prompt: boolean):TCustomAccountAccess;
procedure addAccount(const account: TCustomAccountAccess);
procedure addUserLibrary(lib: TLibrary);
procedure checkUncommitedAccountChange;
end;
var
optionForm: ToptionForm;
ResourceString
rsDisabled = '!DEAKTIVIERT!';
rsBeforeDueS = '%s Tage vor Frist';
rsAccountExpiration = 'Die Ablaufdaten der Konten sind: ';
implementation
uses newAccountWizard_u, applicationconfig, applicationdesktopconfig, simplehtmltreeparser, androidutils, multipagetemplate, bbutils, internetaccess, simpleinternet,math, bookproperties, xquery.internals.common;
ResourceString
rsAccountDeletion = 'Kontolöschung';
rsAccountDeletionConfirm = 'Soll auf diesem Computer das Konto %s - %s wirklich gelöscht werden? %sDadurch werden auch alle '
+'gespeicherten Bücherdaten dieses Kontos gelöscht ';
rsTemplateDelete = 'Soll das System "%s" wirklich gelöscht werden?';
rsInstallLibTemplate = 'Geben Sie die Internet-Adresse ein, von der ein Update heruntergeladen werden soll:';
rsTemplateInstalled = 'Template installiert';
rsTemplateNotFound = 'Template nicht gefunden: %s';
rsLibNamePrompt = 'Geben Sie den Namen der Bibliothek ein';
rsLibSystemPrompt = 'Welches Katalog-System verwendet die Bibliothek?';
rsVariablePromptOptional = 'Es kann ein Wert für die optionale Variable "%s" gesetzt werden. (%s)';
rsVariablePrompt = 'Das Template benötigt einen Wert für die Variable "%s". (%s)';
rsLibConfirmSave = 'Bibliotheksdaten erstellt. Um sie zu speichern, klicken Sie auf "Bibliothek speichern"';
rsLibDeleteConfirm = 'Wollen Sie die Bücherei %s löschen?';
rsAccountChange = 'Kontoänderung';
rsAccountSaveConfirm = 'Die Kontodaten für das momentan markierte Konto wurden geändert. %sSollen sie gespeichert werden?';
rsDidYouMeanThisAccount = 'Meinen sie dieses Konto: %s Kontoname: %s%s Kontonummer: %s';
rsAutoRenewing = 'Automatische Aktualisierung:';
rsAutoRenewAlways = '%sbei jedem Start';
rsAutoRenewDaily = '%smaximal einmal pro Tag';
rsAutoRenewInterval = '%smaximal alle %s Tage';
rsWarning = 'Anzeige einer Warnung:';
{ ToptionForm }
procedure ToptionForm.addAccount(const account: TCustomAccountAccess);
begin
with accountList.Items.Add do begin
caption:=account.prettyName;
SubItems.add(account.getUser());
SubItems.add(account.passWord);
if account.keepHistory then
SubItems.add(rsYes)
else
SubItems.add(rsNo);
if not account.enabled then
SubItems.add(rsDisabled)
else case account.extendType of
etAlways: SubItems.add(rsAlways);
etAllDepends, etSingleDepends: SubItems.add(Format(rsBeforeDueS, [IntToStr(account.extendDays)]));
etNever: SubItems.add(rsNever);
end;
subItems.Add(account.getLibrary().prettyNameShort);
data:=account;
end;
end;
procedure ToptionForm.addUserLibrary(lib: TLibrary);
var
temp: String;
vars: String;
i: Integer;
li: TListItem;
vpair: TLibraryVariable;
begin
if lib = nil then exit;
li := nil;
for i:=0 to libList.Items.count-1 do
if libList.Items[i].Data=pointer(lib) then li := libList.Items[i];
if li = nil then li := libList.Items.Add;
with li do begin
SubItems.Clear;
temp := lib.id;
if strBeginsWith(temp, '-_-_-_') then system.delete(temp, 1, 6);
Caption:=temp;
data := lib;
SubItems.Add(lib.prettyName);
if lib.template <> nil then SubItems.add(lib.template.name);
vars := '';
for vpair in lib.variables do
if vars = '' then vars := vpair.name
else vars += ', '+vpair.name;
SubItems.add(vars);
end;
end;
function ToptionForm.backSelect(const prompt: boolean):TCustomAccountAccess;
var i,newLibIndex:integer;
currentLib: TCustomAccountAccess;
begin
newLibIndex:=-1;
for i:=0 to accounts.count-1 do begin
currentLib:=accounts[i];
if edtAccountPrettyName.Text=currentLib.prettyName then begin
if edtAccountUser.Text=currentLib.getUser() then begin
newLibIndex:=i;
break;
end else if prompt and (MessageDlg('VideLibri', Format(rsDidYouMeanThisAccount, [#13#10, currentLib.prettyName, #13#10,
currentLib.getUser()]),
mtConfirmation ,[mbYes,mbNo],0)=mrYes) then begin
newLibIndex:=i;
break;
end;
end else if (edtAccountUser.Text=currentLib.getUser()) and prompt and
(MessageDlg('VideLibri', Format(rsDidYouMeanThisAccount, [#13#10, currentLib.prettyName, #13#10, currentLib.getUser()]),
mtConfirmation ,[mbYes,mbNo],0)=mrYes) then begin
newLibIndex:=i;
break;
end;
end;
if newLibIndex<>-1 then begin
result:=accounts[newLibIndex];
accountList.Selected:=accountList.items[newLibIndex];
end else result:=nil;
end;
procedure ToptionForm.FormCreate(Sender: TObject);
var i:integer;
count: LongInt;
list: TList;
temp: String;
sl: TStringList;
begin
//TrackBar1.Color:=clWhite;
// if ThemeServices.ThemesEnabled then TrackBar1.Color:=clWhite;
// else TrackBar1.Color:=cl; //ThemeServices.ColorToRGB(clBtnFace);
//TrackBar1.ControlStyle:=TrackBar1.ControlStyle-[csOpaque];
Notebook1.PageIndex:=0;
//Accountpage
for i:=0 to accounts.count-1 do
addAccount((accounts[i]));
//Colorpage
ShapeLimited.brush.color:=colorLimited;
ShapeOK.brush.color:=colorOK;
ShapeTimeNear.brush.color:=colorTimeNear;
ShapeOld.brush.color:=colorOld;
ShapeOrdered.brush.color:=colorOrdered;
ShapeProvided.brush.color:=colorProvided;
timeNearMeaning.Text:=IntToStr(redTime-currentDate);
symbols.ItemIndex:=userConfig.ReadInteger('appearance','symbols',0);
temp := userConfig.ReadString('appearance','groupingProperty', '');
for i := 0 to high(groupingPropertyMap) do begin
if i <> 0 then groupingProperty.Items.add(groupingPropertyNames[i]);
if groupingPropertyMap[i] = temp then
groupingProperty.ItemIndex := i;
end;
//Internetpage
checkCertificates.Checked:=userConfig.ReadBool('access', 'checkCertificates', true);
openSSLCAStore.text := userConfig.ReadString('access', 'CAPath', '');
case userConfig.readInteger('access','internet-type',0) of
0: internetWindows.Checked:=true;
1: internetDirect.Checked:=true;
2: internetProxy.Checked:=true;
end;
{$IFDEF WINDOWS}
case userConfig.readInteger('access','internet-backend',0) of
0, 1: internetAccessW32.Checked := True;
2: internetAccessSynapse.Checked := True;
end;
{$else}
internetAccessW32.Enabled := false;
internetAccessSynapse.Checked := true;
{$endif}
internetAccessChange(self);
internetProxyChange(internetProxy);
proxyHTTPName.Text:=userConfig.ReadString('access','httpProxyName','');
proxyHTTPPort.Text:=userConfig.ReadString('access','httpProxyPort','');
proxyHTTPSname.Text:=userConfig.ReadString('access','httpsProxyName','');
proxyHTTPSport.Text:=userConfig.ReadString('access','httpsProxyPort','');
proxySocksName.Text:=userConfig.ReadString('access','socksProxyName','');
proxySocksPort.Text:=userConfig.ReadString('access','socksProxyPort','');
case userConfig.readInteger('access','homepage-type',1) of
0: homepageSimpleBrowser.Checked:=true;
1: homepageDefaultBrowser.Checked:=true;
end;
autoUpdate.checked:=userConfig.ReadInteger('updates','auto-check',1)=1;
//Mail
mailProgram.Text := userConfig.ReadString('Mail', 'Sendmail', 'sendmail -i -f "$from" $to');
count := userConfig.ReadInteger('Mail', 'Reportcount', 0);
for i:=0 to count-1 do begin
with mailList.Items.Add do begin
caption := userConfig.ReadString('Mailreport'+IntToStr(i), 'To', '');
SubItems.add(userConfig.ReadString('Mailreport'+IntToStr(i), 'Accounts', ''));
SubItems.add(IntToStr(userConfig.ReadInteger('Mailreport'+IntToStr(i), 'Interval', 1)));
end;
end;
//Autostartpage / Behavior
TrackBar1.Position:=RefreshInterval;
trackbar2.Position:=WarnInterval;
TrackBar1Change(nil);
TrackBar2Change(nil);
case userConfig.readInteger('autostart','type',1) of
0:autostartAlways.Checked:=true;
1:autostartDepends.Checked:=true;
2:autostartNever.Checked:=true;
end;
CheckBox1.Checked:=userConfig.ReadBool('autostart','minimized',true);
edtHistoryBackupInterval.text:=IntToStr(HistoryBackupInterval);
cbCopyAccountLimits.Checked := userConfig.ReadBool('user','copy-limit',false);
//Libpage
sl := TStringList.Create;
libraryManager.enumerateBuiltInTemplates(sl);
libraryManager.enumerateUserTemplates(sl);
sl.Sort();
templateList.Items.Assign(sl);
sl.Free;
count := 1;
for i := 0 to templateList.Items.count-1 do begin
temp := templateList.Items[i];
if striContains(temp, 'user') then
count := max(count, StrToIntDef(strAfter(temp, 'user'), 0) + 1);
end;
templateName.Text := 'user' + IntToStr(count);
count := 1;
list := libraryManager.getUserLibraries();
for i := 0 to list.count - 1 do begin
addUserLibrary(tlibrary(list[i]));
temp := tlibrary(list[i]).id;
if striContains(temp, 'user') then
count := max(count, StrToIntDef(strAfter(temp, 'user'), 0) + 1);
end;
libNameEdit.Text := 'user' + IntToStr(count);
updateActiveInternetConfig;
end;
procedure ToptionForm.FormResize(Sender: TObject);
begin
timeNearMeaning.Left:=timeNearMeaningLabelLeft.Left+timeNearMeaningLabelLeft.Width+4;
timeNearMeaningLabelRight.Left:=timeNearMeaning.Left+timeNearMeaning.Width+4;
end;
procedure ToptionForm.FormShow(Sender: TObject);
begin
Notebook1.Height:=Notebook1.Height+1;
Notebook1.Height:=Notebook1.Height-1;
end;
procedure ToptionForm.ImageList1Change(Sender: TObject);
begin
end;
procedure ToptionForm.lblShowWarningClick(Sender: TObject);
begin
end;
procedure ToptionForm.Button3Click(Sender: TObject);
var
i: Integer;
needRefreshListView: Boolean;
begin
needRefreshListView := false;
colorLimited:=ShapeLimited.brush.color;
colorOK:=ShapeOK.brush.color;
colorTimeNear:=ShapeTimeNear.brush.color;
colorOld:=ShapeOld.brush.color;
colorProvided := ShapeProvided.brush.Color;
colorOrdered := ShapeOrdered.brush.Color;
userConfig.WriteInteger('appearance','limited',colorLimited);
userConfig.WriteInteger('appearance','timeNear',colorTimeNear);
userConfig.WriteInteger('appearance','default',colorOK);
userConfig.WriteInteger('appearance','history',colorOld);
userConfig.WriteInteger('appearance','ordered',colorOrdered);
userConfig.WriteInteger('appearance','provided',colorProvided);
userConfig.WriteInteger('base','near-time',StrToInt(timeNearMeaning.Text));
updateGlobalTimeCache;
if mainForm.ViewOld.Checked then mainform.BookList.BackGroundColor:=ShapeOld.brush.color
else mainform.BookList.BackGroundColor:=ShapeOK.brush.color;
userConfig.WriteInteger('appearance','symbols',symbols.ItemIndex);
if (groupingProperty.ItemIndex >= 0)
and (groupingProperty.ItemIndex < length(groupingPropertyMap))
and (groupingPropertyMap[groupingProperty.ItemIndex] <> userConfig.ReadString('appearance', 'groupingProperty', '')) then begin
userConfig.WriteString('appearance','groupingProperty', groupingPropertyMap[groupingProperty.ItemIndex]);
if (groupingProperty.ItemIndex < mainForm.groupingItem.Count) then
mainForm.groupingItem.Items[groupingProperty.ItemIndex].Checked := true;;
needRefreshListView := true;
end;
needRefreshListView := true; //todo
mainForm.setSymbolAppearance(symbols.ItemIndex);
//Internetpage
if internetAccessW32.Checked then userConfig.writeInteger('access','internet-backend',1)
else if internetAccessSynapse.Checked then userConfig.writeInteger('access','internet-backend', 2);
if internetWindows.Checked then userConfig.writeInteger('access','internet-type',0)
else if internetDirect.Checked then userConfig.writeInteger('access','internet-type',1)
else if internetProxy.Checked then userConfig.writeInteger('access','internet-type',2);
userConfig.WriteString('access','httpProxyName',proxyHTTPName.Text);
userConfig.WriteString('access','httpProxyPort',proxyHTTPPort.Text);
userConfig.WriteString('access','httpsProxyName',proxyHTTPSname.Text);
userConfig.WriteString('access','httpsProxyPort',proxyHTTPSport.Text);
userConfig.WriteString('access','socksProxyName',proxySocksName.Text);
userConfig.WriteString('access','socksProxyPort',proxySocksPort.Text);
if homepageSimpleBrowser.Checked then userConfig.writeInteger('access','homepage-type',0)
else if homepageDefaultBrowser.Checked then userConfig.writeInteger('access','homepage-type',1);
if autoUpdate.Checked then userConfig.WriteInteger('updates','auto-check',1)
else userConfig.WriteInteger('updates','auto-check',0);
userConfig.WriteBool('access', 'checkCertificates', checkCertificates.Checked);
userConfig.WriteString('access', 'CAPath', openSSLCAStore.text);
updateActiveInternetConfig;
//Mail
userConfig.WriteString('Mail', 'Sendmail', mailProgram.Text);
userConfig.WriteInteger('Mail', 'Reportcount', mailList.Items.Count);
for i:=0 to mailList.Items.Count-1 do begin
userConfig.WriteString('Mailreport'+IntToStr(i), 'To', mailList.Items[i].Caption );
userConfig.WriteString('Mailreport'+IntToStr(i), 'Accounts', mailList.Items[i].SubItems[0] );
userConfig.WriteInteger('Mailreport'+IntToStr(i), 'Interval', StrToIntDef(mailList.Items[i].SubItems[1],userConfig.ReadInteger('Mailreport'+IntToStr(i), 'Interval', 1)));
end;
//Autostart/Zeitenpage
userConfig.WriteBool('autostart','minimized',CheckBox1.Checked);
callbacks.updateAutostart(autostartAlways.Checked or autostartDepends.Checked,false);
if autostartAlways.Checked then userConfig.writeInteger('autostart','type',0)
else if autostartDepends.Checked then userConfig.writeInteger('autostart','type',1)
else if autostartNever.Checked then userConfig.writeInteger('autostart','type',2)
else ShowMessage('Autostart kaputt');
RefreshInterval:=TrackBar1.Position;
WarnInterval:=trackbar2.Position;
userConfig.WriteInteger('access','refresh-interval',TrackBar1.Position);
userConfig.WriteInteger('base','warn-interval',TrackBar2.Position);
HistoryBackupInterval:=StrToInt(edtHistoryBackupInterval.Text);
userConfig.WriteInteger('base','history-backup-interval',HistoryBackupInterval);
userConfig.WriteBool('user','copy-limit',cbCopyAccountLimits.Checked);
mainForm.Refresh;
if needRefreshListView then mainform.RefreshListView;
ModalResult:=mrOK;
Close;
end;
procedure ToptionForm.Button8Click(Sender: TObject);
begin
end;
procedure ToptionForm.mailaddClick(Sender: TObject);
begin
with mailList.Items.Add do begin
Caption:=mailreceiver.Text;
SubItems.Add(mailaccounts.Text);
SubItems.Add(mailinterval.Text);
end;
end;
procedure ToptionForm.maildelClick(Sender: TObject);
begin
if (mailList.Items.Count = 0) or (mailList.SelCount = 0) or (mailList.Selected=nil) then exit;
mailList.Items.Delete(mailList.Items.IndexOf(mailList.Selected));
end;
procedure ToptionForm.mailListSelectItem(Sender: TObject; Item: TListItem; Selected: Boolean);
begin
ignore(sender);
ignore(item);
ignore(selected);
if (mailList.Items.Count = 0) or (mailList.SelCount = 0) or (mailList.Selected=nil) then
exit;
with mailList.Selected do begin
mailreceiver.Text:=Caption;
mailaccounts.Text:=SubItems[0];
mailinterval.Text:=SubItems[1];
end;
end;
procedure ToptionForm.mailsetClick(Sender: TObject);
begin
if (mailList.Items.Count = 0) or (mailList.SelCount = 0) or (mailList.Selected=nil) then begin
mailadd.Click;
exit;
end;
with mailList.Selected do begin
Caption:=mailreceiver.Text;
SubItems[0]:=mailaccounts.Text;
SubItems[1]:=mailinterval.Text;
end;
end;
procedure ToptionForm.Shape1MouseUp(Sender: TOBject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if ColorDialog1.Execute then
(sender as tshape).Brush.color:=ColorDialog1.Color;
end;
procedure ToptionForm.SpeedButton1Click(Sender: TObject);
begin
Notebook1.PageIndex:=(sender as tcontrol).Tag;
Notebook1.Height:=Notebook1.Height+1;
Notebook1.Height:=Notebook1.Height-1;
end;
procedure ToptionForm.templateListSelectionChange(Sender: TObject);
var
temp: String;
sl: TStringList;
begin
temp := templateList.Items[templateList.ItemIndex];
templateFile.Clear;
templateFile.Text:='template';
sl := TStringList.Create;
libraryManager.enumerateFilesInDir(assetPath+'libraries/templates/'+temp, sl);
libraryManager.enumerateFilesInDir(userPath+'libraries/templates/'+temp, sl);
sl.Sort();
templateFile.Items.Assign(sl);
sl.free;
templateName.text:=temp;
templateFileChange(sender);
end;
procedure ToptionForm.TrackBar1Change(Sender: TObject);
var
s: String;
begin
s := rsAutoRenewing + LineEnding;
case TrackBar1.Position of
0: lblRefreshTIming.Caption:=Format(rsAutoRenewAlways, [s]);
1: lblRefreshTIming.Caption:=Format(rsAutoRenewDaily, [s]);
else lblRefreshTIming.Caption:=Format(rsAutoRenewInterval, [s, IntToStr(TrackBar1.Position)]);
end;
lblRefreshTIming.Left:=max(0,
min(notebook1.Width - lblRefreshTIming.Width,
TrackBar1.left+15+(TrackBar1.width-15)*(TrackBar1.Position-TrackBar1.min) div (TrackBar1.Max-TrackBar1.min)-lblRefreshTIming.Width div 2
));
end;
procedure ToptionForm.TrackBar2Change(Sender: TObject);
var
s: String;
begin
lblShowWarning.Left:=TrackBar2.left+15+(TrackBar2.width-15)*(TrackBar2.Position-TrackBar2.min) div (TrackBar2.Max-TrackBar2.min)-lblShowWarning.Width div 2;
s := rsWarning + LineEnding;
case TrackBar2.Position of
0: lblShowWarning.Caption:=Format(rsAutoRenewAlways, [s]);
1: lblShowWarning.Caption:=Format(rsAutoRenewDaily, [s]);
else lblShowWarning.Caption:=Format(rsAutoRenewInterval, [s, IntToStr(TrackBar2.Position)]);
end;
end;
procedure ToptionForm.accountListSelectItem(Sender: TObject; Item: TListItem;
Selected: Boolean);
var
lib: TLibrary;
begin
if not Selected then exit;
if TCustomAccountAccess(item.data) <> currentSelectedAccount then
checkUncommitedAccountChange;
currentSelectedItem := item;
currentSelectedAccount:=TCustomAccountAccess(item.data);
lib := currentSelectedAccount.getLibrary();
lblAccountLibrary.Caption:=lib.prettyName;
edtAccountPrettyName.Text:=item.Caption;
edtAccountUser.Text:=item.SubItems[0];
edtAccountPass.Text:=item.SubItems[1];
ckbAccountHistory.Checked:=item.SubItems[2]='ja';
ckbAccountDisabled.Checked:=not currentSelectedAccount.enabled;
if currentSelectedAccount.getLibrary().canModifySingleBooks then begin
cmbAccountExtend.items.Text:=Format(rsRenewOptions, [#13#10, #13#10, #13#10]);
cmbAccountExtend.ItemIndex:=longint(TCustomAccountAccess(item.data).extendType);
end else begin
cmbAccountExtend.items.Text:=Format(rsRenewOptionsNoSingle, [#13#10, #13#10]);
case currentSelectedAccount.extendType of
etAlways: cmbAccountExtend.ItemIndex:=0;
etAllDepends,etSingleDepends: cmbAccountExtend.ItemIndex:=1;
etNever: cmbAccountExtend.ItemIndex:=2;
end;
end;
cmbAccountExtend.OnSelect(cmbAccountExtend);
edtAccountExtendDays.Text:=inttostr(currentSelectedAccount.extendDays);
accountType.ItemIndex := currentSelectedAccount.accountType - 1;
accountType.Visible := lib.segregatedAccounts ;
lblAccountType.Visible := lib.segregatedAccounts ;
{ case currentSelectedAccount.getLibrary().passwordType of
ptCustom: lblAccountPass.caption:='Passwort:';
else lblAccountPass.caption:='Geburtsdatum:';
end;}
end;
procedure ToptionForm.BitBtn1Click(Sender: TObject);
begin
end;
procedure ToptionForm.btnAccountChangeClick(Sender: TObject);
var item:TListItem;
lib: TCustomAccountAccess;
begin
if not Assigned(currentSelectedItem) or not assigned(currentSelectedAccount) then exit;
item:=currentSelectedItem;
lib:=currentSelectedAccount;
if edtAccountPass.text<>item.SubItems[1] then
lib.password:=edtAccountPass.text;
if edtAccountPrettyName.text<>item.Caption then
lib.prettyName:=edtAccountPrettyName.text;
if ckbAccountHistory.Checked<>(item.SubItems[2]=rsYes) then
lib.keepHistory:=ckbAccountHistory.Checked;
lib.extendType:=currentSelectedExtendType;
lib.extendDays:=StrToInt(edtAccountExtendDays.Text);
lib.enabled:=not ckbAccountDisabled.Checked;
if not lib.enabled then item.SubItems[3]:=rsDisabled
else case currentSelectedExtendType of
etAlways: item.SubItems[3]:=rsAlways;
etAllDepends, etSingleDepends: item.SubItems[3]:=Format(rsBeforeDueS, [IntToStr(currentSelectedAccount.extendDays)]);
etNever: item.SubItems[3]:=rsNever;
end;
if accountType.Visible then
lib.accountType := accountType.ItemIndex + 1;
if edtAccountUser.text<>item.SubItems[0] then begin
lib.changeUser(edtAccountUser.text);
accounts.Strings[item.Index]:=lib.getPlusEncodedID();
accounts.save;
mainForm.refreshAccountGUIElements();
mainForm.RefreshListView;
end else lib.saveConfig();
item.Caption:=edtAccountPrettyName.text;
item.SubItems[0]:=edtAccountUser.Text;
item.SubItems[1]:=edtAccountPass.Text;
if ckbAccountHistory.Checked then
item.SubItems[2]:=rsYes
else
item.SubItems[2]:=rsNo;
end;
procedure ToptionForm.btnAccountCreateClick(Sender: TObject);
var newAccount:TnewAccountWizard;
i:integer;
begin
checkUncommitedAccountChange;
newAccount:=TnewAccountWizard.Create(nil);
if (accountList.Selected=nil) or (accountList.Selected.Caption<>edtAccountPrettyName.Text) then begin
newAccount.accountName.Text:=edtAccountUser.text;
newAccount.accountPass.Text:=edtAccountUser.text;
if edtAccountPrettyName.Text<>'' then
newAccount.accountPrettyName.Text:=edtAccountPrettyName.Text;
newAccount.extendDaysEdit.text:=edtAccountExtendDays.text;
end;
newAccount.ShowModal;
newAccount.free;
for i:=accountList.Items.count to accounts.count -1 do
addAccount((accounts[i]));
{if accountList.Selected <> nil then
if (accountList.Selected.Caption=edtAccountPrettyName.Text) or
(accountList.Selected.SubItems[0]=edtAccountUser.Text) then begin
ShowMessage('Das Konto existiert bereits auf diesem Computer und kann deshalb nicht erstellt werden. '#13#10+
'Falls Sie eine Eigenschaft von einem Konto ändern wollen, klicken Sie bitte auf den Button "Konto ändern"'#13#10+
'Falls Sie das Konto neu erstellen wollen, löschen Sie bitte das zuerst das alte, und erstellen es dann neu');
exit;
end;
//TODO: Select library (in btnAccountCreateClick)
libxml:=TAccountAccessSTBDuesseldorf.create;
libxml.init(mainForm.basePath,edtAccountUser.Text);
libxml.setPrettyName(edtAccountPrettyName.Text);
libxml.setPassword(edtAccountPass.Text);
libxml.keepHistory:=ckbAccountHistory.Checked;
libxml.setExtendType(TExtendType( cmbAccountExtend.ItemIndex));
libxml.setExtendDays(StrToInt(edtAccountExtendDays.Text));
addAccount(libxml);
mainForm.addGUIItemsForNewAccount(libxml);
accountIDs.AddObject(libxml.getID(),libxml);
saveLibIDs;
if MessageDlg('Daten laden?',
'Das Konto '+libxml.getPrettyName()+' wurde erstellt.'#13#10'Sollen jetzt die Mediendaten heruntergeladen werden?',
mtConfirmation ,[mbYes,mbNo],0)=mrYes then
mainForm.updateLibrary(libxml,false,false); }
end;
procedure ToptionForm.accountdeleteClick(Sender: TObject);
var selLib: TCustomAccountAccess;
begin
selLib:=backSelect(true);
if selLib=nil then exit;
if MessageDlg(rsAccountDeletion, Format(rsAccountDeletionConfirm, [edtAccountPrettyName.text, edtAccountUser.text, #13#10]),
mtConfirmation ,[mbYes,mbNo],0)=mrYes then begin
accounts.Delete(accountList.Selected.Index);
accounts.save;
accountList.Selected.Delete;
selLib.remove();
mainForm.refreshAccountGUIElements();
mainForm.RefreshListView;
end;
end;
procedure ToptionForm.Button10Click(Sender: TObject);
begin
PageControlLibs.ActivePageIndex := 1;
end;
procedure ToptionForm.Button11Click(Sender: TObject);
begin
if confirm(format(rsTemplateDelete, [templateName.Text])) then begin
DeleteFile(userPath+'libraries/templates/'+templateName.Text+'/template');
RemoveDir(userPath+'libraries/templates/'+templateName.Text);
if (templateList.Items.IndexOf(templateName.text) >= 0) and not DirectoryExists(assetPath+'libraries/templates/'+templateName.text) then
templateList.Items.Delete(templateList.Items.IndexOf(templateName.text));
end;
end;
procedure ToptionForm.Button12Click(Sender: TObject);
begin
PageControlLibs.ActivePageIndex := 2;
end;
procedure ToptionForm.Button13Click(Sender: TObject);
procedure downloadAndInstallTemplate;
var
lib: TLibrary;
url: String;
begin
url := 'https://';
if not InputQuery('VideLibri', rsInstallLibTemplate, url) then exit;
try
lib := libraryManager.downloadAndInstallUserLibrary(url);
if lib <> nil then begin
addUserLibrary(lib);
if (lib.template <> nil) and (templateList.Items.IndexOf(lib.template.name) < 0) then
templateList.Items.add(lib.template.name);;
end;
ShowMessage(rsTemplateInstalled)
except on e: EInternetException do
ShowMessage(Format(rsTemplateNotFound, [e.Message]));
on e: ELibraryException do
ShowMessage(Format(rsTemplateNotFound, [e.Message]));
end;
end;
begin
downloadAndInstallTemplate;
end;
procedure ToptionForm.templateFileChange(Sender: TObject);
var
temp: String;
begin
temp := templateList.Items[templateList.ItemIndex];
temp := 'libraries/templates/'+temp+'/'+templateFile.Text;
try
templatexml.Lines.text := assetFileAsString(temp);
except
on e: Exception do ;
end;
end;
procedure ToptionForm.internetAccessChange(Sender: TObject);
begin
internetWindows.Enabled := internetAccessW32.Checked;
if internetWindows.Checked and not internetWindows.Enabled then internetDirect.Checked := true;
checkCertificates.Checked := checkCertificates.Enabled; //and userConfig.ReadBool('access', 'checkCertificates', true)
openSSLCAStore.Enabled := internetAccessSynapse.Checked;
openSSLCAStoreLabel.Enabled := internetAccessSynapse.Checked;
end;
procedure ToptionForm.internetProxyChange(Sender: TObject);
begin
proxyHTTPName.Enabled := internetProxy.Checked;
proxyHTTPSname.Enabled := internetProxy.Checked;
proxySocksName.Enabled := internetProxy.Checked;
proxyHTTPPort.Enabled := internetProxy.Checked;
proxyHTTPSport.Enabled := internetProxy.Checked;
proxySocksPort.Enabled := internetProxy.Checked;
end;
procedure ToptionForm.libAddClick(Sender: TObject);
var
libname: String;
system: String;
result: String;
i, systemIdx: Integer;
template: TMultiPageTemplate;
meta: TTemplateActionMeta;
vari: String;
desc: String;
begin
libname := '';
if not InputQuery('VideLibri', rsLibNamePrompt, libname) then exit;
systemIdx := InputList(rsLibSystemPrompt, templateList.Items);
if systemIdx < 0 then exit;
system := templateList.Items[systemIdx];
result := '<?xml version="1.0" encoding="UTF-8"?>' + LineEnding;
result += '<library>' + LineEnding;
result += ' <longName value="'+xmlStrEscape(libname)+'"/>'+LineEnding;
result += ' <template value="'+xmlStrEscape(system)+'"/>'+LineEnding;
template := libraryManager.getTemplate(system);
meta := nil;
for i := 0 to high(template.baseActions.children) do
if template.baseActions.children[i] is TTemplateActionMeta then
meta := template.baseActions.children[i] as TTemplateActionMeta ;
if meta <> nil then begin
for i := 0 to high(meta.variables) do begin
vari := meta.variables[i].def;
if meta.variables[i].hasDef then begin
desc := format(rsVariablePromptOptional, [meta.variables[i].name, meta.variables[i].description]);
if not InputQuery('VideLibri', desc, vari) then exit;
if vari <> meta.variables[i].def then
result += ' <variable name="'+xmlStrEscape(meta.variables[i].name)+'" value="'+xmlStrEscape(vari)+'"/>'+LineEnding;
end
else begin
desc := format(rsVariablePrompt, [meta.variables[i].name, meta.variables[i].description]);
if not InputQuery('VideLibri', desc, vari) then exit;
result += ' <variable name="'+xmlStrEscape(meta.variables[i].name)+'" value="'+xmlStrEscape(vari)+'"/>'+LineEnding;
end;
end;
end;
result += ' <testing-search value="yes"/>'+LineEnding;
result += ' <testing-account value="yes"/>'+LineEnding;
result += '</library>' + LineEnding;
ShowMessage(rsLibConfirmSave);
libxml.text := result;
end;
procedure ToptionForm.libChangeClick(Sender: TObject);
var
trueId: String;
begin
if (libList.Selected <> nil) and (libList.Selected.Caption = libNameEdit.Text) then trueid := TLibrary(libList.Selected.Data).id
else trueId := '-_-_-_'+trim(libNameEdit.text);
libraryManager.setUserLibrary(trueId, libxml.Lines.Text);
addUserLibrary(libraryManager.get(trueId));
end;
procedure ToptionForm.libDeleteClick(Sender: TObject);
var
trueId: String;
i: Integer;
begin
if not confirm(Format(rsLibDeleteConfirm, [libNameEdit.Text])) then exit;
if (libList.Selected <> nil) and (libList.Selected.Caption = libNameEdit.Text) then trueid := TLibrary(libList.Selected.Data).id
else trueId := '-_-_-_'+trim(libNameEdit.text);
libraryManager.deleteUserLibrary(trueid);
for i := 0 to libList.Items.Count - 1 do
if libList.Items[i].Caption = trim(libNameEdit.text) then begin
libList.Items.Delete(i);