Add write file autoSaveConfig.reg, small optimization frmLog

При выходе из приложения конфигурация сохраняется в файле autoSaveConfig.reg.
Уплотнение вывода информации в frmLog. Если поле Detail пустое то туда помещается содержимое Context.
Шаблон для письма переименован в mail.template.
This commit is contained in:
lsv 2022-01-14 16:51:11 +05:00
parent d0325c4dac
commit 90fc629fa0
4 changed files with 14 additions and 3 deletions

View file

@ -127,7 +127,7 @@ void frmLog::OnSendMail(wxCommandEvent& event) {
#ifdef DEBUG
wxString fn = "C:\\Users\\lsv\\Source\\Repos\\pgadmin64\\pgadmin\\x64\\Debug_(3.0)\\testhtml.txt" ;
#else
wxString fn = "testhtml.txt";
wxString fn = "mail.template";
#endif // DEBUG
wxUtfFile file(fn, wxFile::read, wxFONTENCODING_UTF8);
if (file.IsOpened())
@ -548,6 +548,7 @@ frmLog::frmLog(frmMain *form, const wxString &_title, pgServer *srv) : pgFrame(N
entries[1].Set(wxACCEL_CTRL, (int)'S', MNU_SEND_MAIL);
wxAcceleratorTable accel(2, entries);
SetAcceleratorTable(accel);
SetAcceleratorTable(accel);
m_notebook = new wxNotebook( this, wxID_ANY );

View file

@ -873,6 +873,7 @@ private:
bool moveLongValue(const wxChar *oldKey, const wxChar *newKey, int index = -1);
wxFileConfig *defaultSettings;
wxString appName;
};
#endif

View file

@ -533,8 +533,6 @@ Line Storage::getLineParse(const wxString& str, bool csv) {
//fields.Add(logMessage);
wxString logDetail = tk.GetNextToken();
//fields.Add(logDetail);
st.logDetail = { static_cast<unsigned short int>(t.Len()),static_cast<unsigned short int>(logDetail.Len()) };
t += logDetail;
wxString logHint = tk.GetNextToken();
//fields.Add(logHint);
wxString logQuery = tk.GetNextToken();
@ -544,6 +542,12 @@ Line Storage::getLineParse(const wxString& str, bool csv) {
wxString logCursorpos = tk.GetNextToken();
if (!logDebug.IsEmpty() && logHint.IsEmpty())
logHint = logDebug;
if (!logContext.IsEmpty() && logDetail.IsEmpty())
logDetail = logContext;
st.logDetail = { static_cast<unsigned short int>(t.Len()),static_cast<unsigned short int>(logDetail.Len()) };
t += logDetail;
st.logHint = { static_cast<unsigned short int>(t.Len()),static_cast<unsigned short int>(logHint.Len()) };
t += logHint;
st.logMessage = { static_cast<unsigned short int>(t.Len()),static_cast<unsigned short int>(logMessage.Len()) };

View file

@ -31,6 +31,7 @@
#include "utils/misc.h"
sysSettings::sysSettings(const wxString &name) : wxConfig(name)
{
appName = name;
// Open the default settings file
defaultSettings = NULL;
if (!settingsIni.IsEmpty())
@ -62,7 +63,11 @@ sysSettings::sysSettings(const wxString &name) : wxConfig(name)
sysSettings::~sysSettings()
{
wxRegKey key(wxRegKey::HKCU, "Software\\"+appName);
wxString fn= wxStandardPaths::Get().GetUserConfigDir() + wxT("\\postgresql\\autoSaveConfig.reg");
if (wxFileName::FileExists(fn)) wxRemoveFile(fn);
key.Export(fn);
if(defaultSettings)
{
delete defaultSettings;