Skip to content
Snippets Groups Projects
Commit c3a66c8c authored by rswindell's avatar rswindell
Browse files

Added support for mail domains.cfg alias configuration.

Added read/write to registry for log/list and font colors.
parent b048a343
No related branches found
No related tags found
No related merge requests found
...@@ -630,6 +630,7 @@ void __fastcall TMainForm::FormCreate(TObject *Sender) ...@@ -630,6 +630,7 @@ void __fastcall TMainForm::FormCreate(TObject *Sender)
Application->MessageBox("Error opening registry key" Application->MessageBox("Error opening registry key"
,REG_KEY,MB_OK|MB_ICONEXCLAMATION); ,REG_KEY,MB_OK|MB_ICONEXCLAMATION);
Application->Terminate(); Application->Terminate();
return;
} }
if(Registry->ValueExists("MainFormTop")) if(Registry->ValueExists("MainFormTop"))
Top=Registry->ReadInteger("MainFormTop"); Top=Registry->ReadInteger("MainFormTop");
...@@ -984,6 +985,59 @@ int __fastcall TMainForm::PageNum(TPageControl* obj) ...@@ -984,6 +985,59 @@ int __fastcall TMainForm::PageNum(TPageControl* obj)
return(PAGE_LOWERLEFT); return(PAGE_LOWERLEFT);
return(PAGE_LOWERRIGHT); return(PAGE_LOWERRIGHT);
} }
void __fastcall TMainForm::ReadColor(TRegistry* Registry
,AnsiString name, TColor& color)
{
if(Registry->ValueExists(name + "Color"))
color=StringToColor(Registry->ReadString(name + "Color"));
}
void __fastcall TMainForm::WriteColor(TRegistry* Registry
,AnsiString name, TColor color)
{
Registry->WriteString(name + "Color", ColorToString(color));
}
void __fastcall TMainForm::ReadFont(AnsiString subkey, TFont* Font)
{
// Read Registry keys
TRegistry* Registry=new TRegistry;
AnsiString key = REG_KEY + subkey + "Font";
if(!Registry->OpenKey(key,true)) {
Application->MessageBox("Error opening registry key"
,key.c_str(),MB_OK|MB_ICONEXCLAMATION);
Application->Terminate();
return;
}
if(Registry->ValueExists("Name"))
Font->Name=Registry->ReadString("Name");
if(Registry->ValueExists("Color"))
Font->Color=StringToColor(Registry->ReadString("Color"));
if(Registry->ValueExists("Height"))
Font->Height=Registry->ReadInteger("Height");
if(Registry->ValueExists("Size"))
Font->Size=Registry->ReadInteger("Size");
Registry->CloseKey();
delete Registry;
}
void __fastcall TMainForm::WriteFont(AnsiString subkey, TFont* Font)
{
// Read Registry keys
TRegistry* Registry=new TRegistry;
AnsiString key = REG_KEY + subkey + "Font";
if(!Registry->OpenKey(key,true)) {
Application->MessageBox("Error opening registry key"
,key.c_str(),MB_OK|MB_ICONEXCLAMATION);
Application->Terminate();
return;
}
Registry->WriteString("Name",Font->Name);
Registry->WriteString("Color",ColorToString(Font->Color));
Registry->WriteInteger("Height",Font->Height);
Registry->WriteInteger("Size",Font->Size);
Registry->CloseKey();
delete Registry;
}
void __fastcall TMainForm::StartupTimerTick(TObject *Sender) void __fastcall TMainForm::StartupTimerTick(TObject *Sender)
{ {
bool TelnetFormFloating=false; bool TelnetFormFloating=false;
...@@ -1011,6 +1065,7 @@ void __fastcall TMainForm::StartupTimerTick(TObject *Sender) ...@@ -1011,6 +1065,7 @@ void __fastcall TMainForm::StartupTimerTick(TObject *Sender)
Application->MessageBox("Error opening registry key" Application->MessageBox("Error opening registry key"
,REG_KEY,MB_OK|MB_ICONEXCLAMATION); ,REG_KEY,MB_OK|MB_ICONEXCLAMATION);
Application->Terminate(); Application->Terminate();
return;
} }
TopPanel->Height=Height/3; TopPanel->Height=Height/3;
...@@ -1060,6 +1115,19 @@ void __fastcall TMainForm::StartupTimerTick(TObject *Sender) ...@@ -1060,6 +1115,19 @@ void __fastcall TMainForm::StartupTimerTick(TObject *Sender)
if(Registry->ValueExists("FtpFormPage")) if(Registry->ValueExists("FtpFormPage"))
FtpFormPage=Registry->ReadInteger("FtpFormPage"); FtpFormPage=Registry->ReadInteger("FtpFormPage");
ReadColor(Registry,"TelnetLog",TelnetForm->Log->Color);
ReadFont("TelnetLog",TelnetForm->Log->Font);
ReadColor(Registry,"EventsLog",EventsForm->Log->Color);
ReadFont("EventsLog",EventsForm->Log->Font);
ReadColor(Registry,"MailLog",MailForm->Log->Color);
ReadFont("MailLog",MailForm->Log->Font);
ReadColor(Registry,"FtpLog",FtpForm->Log->Color);
ReadFont("FtpLog",FtpForm->Log->Font);
ReadColor(Registry,"NodeList",NodeForm->ListBox->Color);
ReadFont("NodeList",NodeForm->ListBox->Font);
ReadColor(Registry,"ClientList",ClientForm->ListView->Color);
ReadFont("ClientList",ClientForm->ListView->Font);
if(Registry->ValueExists("TelnetFormTop")) if(Registry->ValueExists("TelnetFormTop"))
TelnetForm->Top=Registry->ReadInteger("TelnetFormTop"); TelnetForm->Top=Registry->ReadInteger("TelnetFormTop");
if(Registry->ValueExists("TelnetFormLeft")) if(Registry->ValueExists("TelnetFormLeft"))
...@@ -1426,6 +1494,7 @@ void __fastcall TMainForm::SaveSettings(TObject* Sender) ...@@ -1426,6 +1494,7 @@ void __fastcall TMainForm::SaveSettings(TObject* Sender)
Application->MessageBox("Error creating registry key" Application->MessageBox("Error creating registry key"
,REG_KEY,MB_OK|MB_ICONEXCLAMATION); ,REG_KEY,MB_OK|MB_ICONEXCLAMATION);
Application->Terminate(); Application->Terminate();
return;
} }
Registry->WriteInteger("MainFormTop",Top); Registry->WriteInteger("MainFormTop",Top);
...@@ -1499,6 +1568,19 @@ void __fastcall TMainForm::SaveSettings(TObject* Sender) ...@@ -1499,6 +1568,19 @@ void __fastcall TMainForm::SaveSettings(TObject* Sender)
Registry->WriteInteger("ClientFormPage" Registry->WriteInteger("ClientFormPage"
,PageNum((TPageControl*)ClientForm->HostDockSite)); ,PageNum((TPageControl*)ClientForm->HostDockSite));
WriteColor(Registry,"TelnetLog",TelnetForm->Log->Color);
WriteFont("TelnetLog",TelnetForm->Log->Font);
WriteColor(Registry,"EventsLog",EventsForm->Log->Color);
WriteFont("EventsLog",EventsForm->Log->Font);
WriteColor(Registry,"MailLog",MailForm->Log->Color);
WriteFont("MailLog",MailForm->Log->Font);
WriteColor(Registry,"FtpLog",FtpForm->Log->Color);
WriteFont("FtpLog",FtpForm->Log->Font);
WriteColor(Registry,"NodeList",NodeForm->ListBox->Color);
WriteFont("NodeList",NodeForm->ListBox->Font);
WriteColor(Registry,"ClientList",ClientForm->ListView->Color);
WriteFont("ClientList",ClientForm->ListView->Font);
Registry->WriteBool("ToolBarVisible",Toolbar->Visible); Registry->WriteBool("ToolBarVisible",Toolbar->Visible);
Registry->WriteBool("StatusBarVisible",StatusBar->Visible); Registry->WriteBool("StatusBarVisible",StatusBar->Visible);
......
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
#include <ImgList.hpp> #include <ImgList.hpp>
#include <Buttons.hpp> #include <Buttons.hpp>
#include <Graphics.hpp> #include <Graphics.hpp>
#include <vcl\Registry.hpp> /* TRegistry */
#include "Trayicon.h" #include "Trayicon.h"
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
#define APP_TITLE "Synchronet Control Panel" #define APP_TITLE "Synchronet Control Panel"
...@@ -176,7 +177,7 @@ __published: // IDE-managed Components ...@@ -176,7 +177,7 @@ __published: // IDE-managed Components
TMenuItem *BBSEditIPFilterMsg; TMenuItem *BBSEditIPFilterMsg;
TMenuItem *BBSEditHostFilter; TMenuItem *BBSEditHostFilter;
TMenuItem *BBSEditHostFilterMsg; TMenuItem *BBSEditHostFilterMsg;
TMenuItem *AllowedRelayList1; TMenuItem *AllowedRelayList;
TMenuItem *SaveSettingsMenuOption; TMenuItem *SaveSettingsMenuOption;
TMenuItem *N6; TMenuItem *N6;
TMenuItem *TelnetEditMenuItem; TMenuItem *TelnetEditMenuItem;
...@@ -232,6 +233,7 @@ __published: // IDE-managed Components ...@@ -232,6 +233,7 @@ __published: // IDE-managed Components
TToolButton *ToolButton3; TToolButton *ToolButton3;
TToolButton *ReloadConfigButton; TToolButton *ReloadConfigButton;
TMenuItem *MailViewSpamLog; TMenuItem *MailViewSpamLog;
TMenuItem *DomainList;
void __fastcall FileExitMenuItemClick(TObject *Sender); void __fastcall FileExitMenuItemClick(TObject *Sender);
void __fastcall ViewToolbarMenuItemClick(TObject *Sender); void __fastcall ViewToolbarMenuItemClick(TObject *Sender);
void __fastcall FormClose(TObject *Sender, TCloseAction &Action); void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
...@@ -320,6 +322,10 @@ public: // User declarations ...@@ -320,6 +322,10 @@ public: // User declarations
TPageControl* __fastcall PageControl(int num); TPageControl* __fastcall PageControl(int num);
int __fastcall PageNum(TPageControl* obj); int __fastcall PageNum(TPageControl* obj);
void __fastcall FormMinimize(TObject *Sender); void __fastcall FormMinimize(TObject *Sender);
void __fastcall ReadColor(TRegistry*, AnsiString, TColor&);
void __fastcall WriteColor(TRegistry*, AnsiString, TColor);
void __fastcall ReadFont(AnsiString, TFont*);
void __fastcall WriteFont(AnsiString, TFont*);
}; };
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment