This repository has been archived by the owner on Sep 15, 2022. It is now read-only.
/
dlgConnect.cpp
102 lines (75 loc) · 2.09 KB
/
dlgConnect.cpp
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
//////////////////////////////////////////////////////////////////////////
//
// pgAdmin III - PostgreSQL Tools
// RCS-ID: $Id$
// Copyright (C) 2002 - 2010, The pgAdmin Development Team
// This software is released under the PostgreSQL Licence
//
// dlgConnect.cpp - Connect to a database
//
//////////////////////////////////////////////////////////////////////////
// App headers
#include "pgAdmin3.h"
#include "dlg/dlgConnect.h"
#include "db/pgConn.h"
#include "frm/frmHint.h"
#include "schema/pgServer.h"
#include "utils/sysLogger.h"
#include "images/connect.xpm"
BEGIN_EVENT_TABLE(dlgConnect, DialogWithHelp)
EVT_BUTTON (wxID_OK, dlgConnect::OnOK)
EVT_BUTTON (wxID_CANCEL, dlgConnect::OnCancel)
END_EVENT_TABLE()
#define stDescription CTRL_STATIC("stDescription")
#define chkStorePwd CTRL_CHECKBOX("chkStorePwd")
#define txtPassword CTRL_TEXT("txtPassword")
dlgConnect::dlgConnect(frmMain *form, const wxString& description, bool storePwd) :
DialogWithHelp(form)
{
wxWindowBase::SetFont(settings->GetSystemFont());
LoadResource((wxWindow*)form, wxT("dlgConnect"));
SetIcon(wxIcon(connect_xpm));
RestorePosition();
// Setup the default values
stDescription->SetLabel(description);
chkStorePwd->SetValue(storePwd);
txtPassword->Enable(true);
if (form == NULL)
chkStorePwd->Hide();
}
dlgConnect::~dlgConnect()
{
SavePosition();
}
wxString dlgConnect::GetHelpPage() const
{
return wxT("connect");
}
void dlgConnect::OnOK(wxCommandEvent& ev)
{
// Display the 'save password' hint if required
if(chkStorePwd->GetValue())
{
if (frmHint::ShowHint(this, HINT_SAVING_PASSWORDS) == wxID_CANCEL)
return;
}
EndModal(wxID_OK);
}
void dlgConnect::OnCancel(wxCommandEvent& ev)
{
EndModal(wxID_CANCEL);
}
int dlgConnect::Go()
{
// Set focus on the Password textbox and show modal
txtPassword->SetFocus();
return ShowModal();
}
wxString dlgConnect::GetPassword()
{
return txtPassword->GetValue();
}
bool dlgConnect::GetStorePwd()
{
return chkStorePwd->GetValue();
}