📄 fsettings.pas
字号:
end;
//fill up settings tree
nodeMessage := lstSettings.AddChild(nil);
with PTreeSettings(lstSettings.GetNodeData(nodeMessage))^ do begin
Caption := _('Message');
TabNo := -1;
end;
with PTreeSettings(lstSettings.GetNodeData(lstSettings.AddChild(nodeMessage)))^ do
begin
Caption := _('View window');
TabNo := 2;
end;
with PTreeSettings(lstSettings.GetNodeData(lstSettings.AddChild(nodeMessage)))^ do
begin
Caption := _('Compose');
TabNo := 3;
end;
with PTreeSettings(lstSettings.GetNodeData(lstSettings.AddChild(nodeMessage)))^ do
begin
Caption := _('Quoting');
TabNo := 8;
end;
nodeMain:=lstSettings.AddChild(nil);
with PTreeSettings(lstSettings.GetNodeData(nodeMain))^ do begin
Caption := _('Main Window');
TabNo := -1;
end;
with PTreeSettings(lstSettings.GetNodeData(lstSettings.AddChild(nodeMain)))^ do begin
Caption := _('Mailboxes');
TabNo := 4;
end;
with PTreeSettings(lstSettings.GetNodeData(lstSettings.AddChild(nodeMain)))^ do begin
Caption := _('Address book');
TabNo := 5;
end;
with PTreeSettings(lstSettings.GetNodeData(lstSettings.AddChild(nodeMain)))^ do begin
Caption := _('Mail list');
TabNo := 6;
end;
with PTreeSettings(lstSettings.GetNodeData(lstSettings.AddChild(nodeMain)))^ do begin
Caption := _('View window');
TabNo := 2;
end;
with PTreeSettings(lstSettings.GetNodeData(lstSettings.AddChild(nil)))^ do begin
Caption := _('Other');
TabNo := 7;
end;
with PTreeSettings(lstSettings.GetNodeData(lstSettings.AddChild(nil)))^ do begin
Caption := _('Fonts');
TabNo := 9;
end;
(* nodeInet:=lstSettings.AddChild(nil);
with PTreeSettings(lstSettings.GetNodeData(nodeInet))^ do begin
Caption:=_('Internet');
TabNo:=-1;
end;
with PTreeSettings(lstSettings.GetNodeData(lstSettings.AddChild(nodeInet)))^ do begin
Caption:=_('E-Mail');
TabNo:=3;
end;
with PTreeSettings(lstSettings.GetNodeData(lstSettings.AddChild(nodeInet)))^ do begin
Caption:=_('Proxy');
TabNo:=4;
end;
*)
lstSettings.FullExpand;
GetProgramLanguages;
cmboxDefaultAccount.Clear;
for i := 0 to frmMailbox.Profile.Accounts.Count - 1 do
cmboxDefaultAccount.Items.AddObject(frmMailbox.Profile.Accounts[i].AccountName, Pointer(i));
loadSettings;
loadTheme;
//read self position & size
frmMailbox.Profile.Config.ReadControlSettings(Self);
dontChangeStyle := False;
pnlLevels.TabIndex := 0;
end;
procedure TfrmSettings.GetProgramLanguages;
var lst: TStringList;
var i: Integer;
begin
lst := TStringList.Create;
try
frmMain.FindFolders(df.Application + 'locale\', '*.*', lst);
for i := 0 to lst.Count - 1 do begin
AddProgramLanguage(lst.Strings[i]);
end;
finally
FreeAndNil(lst);
end;
end;
procedure TfrmSettings.AddProgramLanguage(const folder: String);
var lang: String;
var strStream: TStringStream;
var bmp: TBitmap;
begin
lang := GetCurrentLanguage;
UseLanguage(folder);
//gettext: flag shown in language list encode flag in *.BMP format with FlagAsText program
//strStream := TStringStream.Create(base64Decode(_('LanguageFlag')));
strStream := TStringStream.Create(base64Decode(String(DefaultInstance.GetTranslationProperty('X-Language-Flag'))));
bmp := TBitmap.Create;
try
bmp.LoadFromStream(strStream);
with ilFlags do begin
Add(bmp, nil);
end;
except
FreeAndNil(strStream);
FreeAndNil(bmp);
end;
with PTreeLang(lstLanguages.GetNodeData(lstLanguages.AddChild(nil)))^ do begin
Col[0] := UTF8Decode(DefaultInstance.GetTranslationProperty('X-Language-English'));//_('EnglishLanguageName');
Col[1] := UTF8Decode(DefaultInstance.GetTranslationProperty('X-Language-Local'));//_('LocalLanguageName');
Col[2] := folder;
ImageIdx := ilFlags.Count - 1;
end;
UseLanguage(lang);
end;
procedure TfrmSettings.lstSettingsFocusChanged(Sender: TBaseVirtualTree;
Node: PVirtualNode; Column: TColumnIndex);
begin
if lstSettings.GetFirstSelected <> nil then begin
if PTreeSettings(lstSettings.GetNodeData(Node)).TabNo <> -1 then begin
lblCaption.Caption := PTreeSettings(lstSettings.GetNodeData(Node)).Caption;
pc.ActivePageIndex := PTreeSettings(lstSettings.GetNodeData(Node)).TabNo;
if pc.ActivePageIndex = 8 then LevelStyleChange(pnlLevels);
end
else begin
lblCaption.Caption := '';
pc.ActivePageIndex := 0;
end;
end;
end;
procedure TfrmSettings.lstSettingsGetText(Sender: TBaseVirtualTree;
Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;
var CellText: WideString);
begin
CellText := PTreeSettings(Sender.GetNodeData(Node)).Caption;
end;
procedure TfrmSettings.lstSettingsGetNodeDataSize(Sender: TBaseVirtualTree;
var NodeDataSize: Integer);
begin
NodeDataSize := SizeOf(TTreeSettings);
end;
procedure TfrmSettings.FormHide(Sender: TObject);
begin
//write self position & size
frmMailbox.Profile.Config.WriteControlSettings(Self);
DeleteFile(df.Temp + 'quotingStyle.html');
end;
procedure TfrmSettings.lstLanguagesDblClick(Sender: TObject);
var i: Integer;
begin
frmMailbox.Profile.Config.WriteString('settings', 'language',
PTreeLang(lstLanguages.GetNodeData(lstLanguages.GetFirstSelected))^.Col[2]);
if MessageDlg(_('Do you want to restart program to apply changes?'),
mtConfirmation, [mbYes, mbNo], 0) = mrYes then
Application.Terminate;
end;
procedure TfrmSettings.lstLanguagesGetNodeDataSize(
Sender: TBaseVirtualTree; var NodeDataSize: Integer);
begin
NodeDataSize := sizeOf(TTreeLang);
end;
procedure TfrmSettings.lstLanguagesGetImageIndex(Sender: TBaseVirtualTree;
Node: PVirtualNode; Kind: TVTImageKind; Column: TColumnIndex;
var Ghosted: Boolean; var ImageIndex: Integer);
begin
//return correct image
with PTreeLang((Sender as TVirtualStringTree).GetNodeData(Node))^ do begin
if (Column = 0) and (Kind in [ikNormal, ikSelected]) then ImageIndex := imageIdx;
end;
end;
procedure TfrmSettings.lstLanguagesGetText(Sender: TBaseVirtualTree;
Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;
var CellText: WideString);
begin
CellText := PTreeLang((Sender as TVirtualStringTree).GetNodeData(Node))^.Col[Column]
end;
procedure TfrmSettings.lstLanguagesChange(Sender: TBaseVirtualTree;
Node: PVirtualNode);
var lang: String;
begin
if Node = nil then exit;
if vsSelected in Node.States then begin
lang := GetCurrentLanguage;
with PTreeLang(lstLanguages.GetNodeData(Node))^ do begin
UseLanguage(col[2]);
end;
lblAuthor.Caption := GetTranslatorNameAndEmail;
UseLanguage(lang);
end;
end;
procedure TfrmSettings.cmdCloseClick(Sender: TObject);
begin
saveSettings;
frmMailbox.LoadBackgrounds(frmMailbox.SelectedTheme);
Self.Close;
end;
procedure TfrmSettings.loadSettings;
begin
//view window
chkboxRawOverHtml.Checked := frmMailbox.Profile.Config.ReadBool(
'frmMailView', 'rawOverHtml', True);
cmboxShowMessagePart.ItemIndex := frmMailbox.Profile.Config.ReadInteger(
'frmMailView', 'showMessagePart', 0);
lblViewWindowFont.Font.Name := frmMailbox.Profile.Config.ReadString(
'frmMailView', 'fontName', lblViewWindowFont.Font.Name);
lblViewWindowFont.Font.Size := frmMailbox.Profile.Config.ReadInteger(
'frmMailView', 'fontSize', lblViewWindowFont.Font.Size);
lblViewWindowFont.Font.Color := frmMailbox.Profile.Config.ReadInteger(
'frmMailView', 'fontColor', lblViewWindowFont.Font.Color);
lblViewWindowFont.Font.Charset := frmMailbox.Profile.Config.ReadInteger(
'frmMailView', 'fontCharset', lblViewWindowFont.Font.Charset);
lblViewWindowFont.Font.Style := TFontStyles(
Byte(frmMailbox.Profile.Config.ReadInteger('frmMailView', 'fontStyle',
Byte(lblViewWindowFont.Font.Style))));
lblViewWindowFont.Caption := lblViewWindowFont.Font.Name + ',' +
IntToStr(lblViewWindowFont.Font.Size);
//other
chkboxDefaultClient.Checked := frmMailbox.Profile.Config.ReadBool(
Self.Name, 'dontCheckIfDefault', False);
chkboxShowTasksWindow.Checked := frmMailbox.Profile.Config.ReadBool(
'frmTasks', 'showMe', True);
chkboxSplash.Checked := frmMailbox.Profile.Config.ReadBool(
Self.Name, 'splash', False);
chkboxSysTray.Checked := frmMailbox.Profile.Config.ReadBool(
'frmMain', 'dontMinimizeToSysTray', False);
cmboxDefaultAccount.ItemIndex := cmboxDefaultAccount.Items.IndexOf(
frmMailbox.Profile.Config.ReadString('frmMailbox', 'defaultAccount', ''));
//maillist
chkboxAskBeforeDeleting.Checked := frmMailbox.Profile.Config.ReadBool(
'frmMaillist', 'askBeforeDeleting', True);
chkboxMarkAsRead.Checked := frmMailbox.Profile.Config.ReadBool(
'frmMaillist', 'markAsRead', True);
//compose
lblComposeFont.Font.Name := frmMailbox.Profile.Config.ReadString(
'frmCompose', 'fontName', lblComposeFont.Font.Name);
lblComposeFont.Font.Size := frmMailbox.Profile.Config.ReadInteger(
'frmCompose', 'fontSize', lblComposeFont.Font.Size);
lblComposeFont.Font.Color := frmMailbox.Profile.Config.ReadInteger(
'frmCompose', 'fontColor', lblComposeFont.Font.Color);
lblComposeFont.Font.Charset := frmMailbox.Profile.Config.ReadInteger(
'frmCompose', 'fontCharset', lblComposeFont.Font.Charset);
lblComposeFont.Font.Style := TFontStyles(
Byte(frmMailbox.Profile.Config.ReadInteger('frmCompose', 'fontStyle',
Byte(lblComposeFont.Font.Style))));
chkboxCountReplies.Checked := frmMailbox.Profile.Config.ReadBool('frmCompose',
'countReplies', True);
chkboxCountForwards.Checked := frmMailbox.Profile.Config.ReadBool('frmCompose',
'countForwards', True);
lblComposeFont.Caption := lblComposeFont.Font.Name + ',' + IntToStr(lblComposeFont.Font.Size);
//mailboxes
chkboxHideProfile.Checked := frmMailbox.Profile.Config.ReadBool('frmMailbox',
'showProfileNode', True);
//address book
//quoting
with frmMailbox.Profile.Config do begin
txtQuoteChar.Text := ReadString('quoting', 'quoteChar', '>');
chkboxColorizeQuotes.Checked := ReadBool('quoting', 'colorizeQuotes', True);
clrText1.Color := ReadInteger('quoting', 'textColor1', clBlack);
clrText2.Color := ReadInteger('quoting', 'textColor2', clBlack);
clrText3.Color := ReadInteger('quoting', 'textColor3', clBlack);
clrText4.Color := ReadInteger('quoting', 'textColor4', clBlack);
clrText5.Color := ReadInteger('quoting', 'textColor5', clBlack);
clrText6.Color := ReadInteger('quoting', 'textColor6', clBlack);
clrText7.Color := ReadInteger('quoting', 'textColor7', clBlack);
clrText8.Color := ReadInteger('quoting', 'textColor8', clBlack);
clrBack1.Color := ReadInteger('quoting', 'backColor1', StrToInt('$009191FF'));
clrBack2.Color := ReadInteger('quoting', 'backColor2', StrToInt('$0074ACEB'));
clrBack3.Color := ReadInteger('quoting', 'backColor3', StrToInt('$00C28D58'));
clrBack4.Color := ReadInteger('quoting', 'backColor4', StrToInt('$00E9E9B6'));
clrBack5.Color := ReadInteger('quoting', 'backColor5', StrToInt('$009AE99A'));
clrBack6.Color := ReadInteger('quoting', 'backColor6', StrToInt('$007CCDA7'));
clrBack7.Color := ReadInteger('quoting', 'backColor7', StrToInt('$00E7A5BF'));
clrBack8.Color := ReadInteger('quoting', 'backColor8', StrToInt('$00FC8D91'));
clrBorder1.Color := ReadInteger('quoting', 'borderColor1', clBlack);
clrBorder2.Color := ReadInteger('quoting', 'borderColor2', clBlack);
clrBorder3.Color := ReadInteger('quoting', 'borderColor3', clBlack);
clrBorder4.Color := ReadInteger('quoting', 'borderColor4', clBlack);
clrBorder5.Color := ReadInteger('quoting', 'borderColor5', clBlack);
clrBorder6.Color := ReadInteger('quoting', 'borderColor6', clBlack);
clrBorder7.Color := ReadInteger('quoting', 'borderColor7', clBlack);
clrBorder8.Color := ReadInteger('quoting', 'borderColor8', clBlack);
cmboxBrWidth1.ItemIndex := Max(cmboxBrWidth1.Items.IndexOf(ReadString('quoting', 'borderWidth1', '1px')), 0);
cmboxBrWidth2.ItemIndex := Max(cmboxBrWidth1.Items.IndexOf(ReadString('quoting', 'borderWidth2', '1px')), 0);
cmboxBrWidth3.ItemIndex := Max(cmboxBrWidth1.Items.IndexOf(ReadString('quoting', 'borderWidth3', '1px')), 0);
cmboxBrWidth4.ItemIndex := Max(cmboxBrWidth1.Items.IndexOf(ReadString('quoting', 'borderWidth4', '1px')), 0);
cmboxBrWidth5.ItemIndex := Max(cmboxBrWidth1.Items.IndexOf(ReadString('quoting', 'borderWidth5', '1px')), 0);
cmboxBrWidth6.ItemIndex := Max(cmboxBrWidth1.Items.IndexOf(ReadString('quoting', 'borderWidth6', '1px')), 0);
cmboxBrWidth7.ItemIndex := Max(cmboxBrWidth1.Items.IndexOf(ReadString('quoting', 'borderWidth7', '1px')), 0);
cmboxBrWidth8.ItemIndex := Max(cmboxBrWidth1.Items.IndexOf(ReadString('quoting', 'borderWidth8', '1px')), 0);
cmboxBS1.ItemIndex := Max(cmboxBS1.Items.IndexOf(ReadString('quoting', 'borderStyle1', 'dashed')), 0);
cmboxBS2.ItemIndex := Max(cmboxBS2.Items.IndexOf(ReadString('quoting', 'borderStyle2', 'dashed')), 0);
cmboxBS3.ItemIndex := Max(cmboxBS3.Items.IndexOf(ReadString('quoting', 'borderStyle3', 'dashed')), 0);
cmboxBS4.ItemIndex := Max(cmboxBS4.Items.IndexOf(ReadString('quoting', 'borderStyle4', 'dashed')), 0);
cmboxBS5.ItemIndex := Max(cmboxBS5.Items.IndexOf(ReadString('quoting', 'borderStyle5', 'dashed')), 0);
cmboxBS6.ItemIndex := Max(cmboxBS6.Items.IndexOf(ReadString('quoting', 'borderStyle6', 'dashed')), 0);
cmboxBS7.ItemIndex := Max(cmboxBS7.Items.IndexOf(ReadString('quoting', 'borderStyle7', 'dashed')), 0);
cmboxBS8.ItemIndex := Max(cmboxBS8.Items.IndexOf(ReadString('quoting', 'borderStyle8', 'dashed')), 0);
txtAdditional1.Lines.Text := ReadString('quoting', 'additionalStyles1', txtAdditional1.Lines.Text);
txtAdditional2.Lines.Text := ReadString('quoting', 'additionalStyles2', txtAdditional2.Lines.Text);
txtAdditional3.Lines.Text := ReadString('quoting', 'additionalStyles3', txtAdditional3.Lines.Text);
txtAdditional4.Lines.Text := ReadString('quoting', 'additionalStyles4', txtAdditional4.Lines.Text);
txtAdditional5.Lines.Text := ReadString('quoting', 'additionalStyles5', txtAdditional5.Lines.Text);
txtAdditional6.Lines.Text := ReadString('quoting', 'additionalStyles6', txtAdditional6.Lines.Text);
txtAdditional7.Lines.Text := ReadString('quoting', 'additionalStyles7', txtAdditional7.Lines.Text);
txtAdditional8.Lines.Text := ReadString('quoting', 'additionalStyles8', txtAdditional8.Lines.Text);
end;
//fonts
chkboxOverrideTree.Checked := frmMailbox.Profile.Config.ReadBool(
Self.Name, 'treeFontOverride', False);
gbTree.Enabled := chkboxOverrideTree.Checked;
lblTreeFont.Font.Name := frmMailbox.Profile.Config.ReadString(
Self.Name, 'treeFontName', lblTreeFont.Font.Name);
lblTreeFont.Font.Size := frmMailbox.Profile.Config.ReadInteger(
Self.Name, 'treeFontSize', lblTreeFont.Font.Size);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -