2
* Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License as
6
* published by the Free Software Foundation; version 2 of the
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20
#ifndef _GRTDBCONNECTPANEL_H_
21
#define _GRTDBCONNECTPANEL_H_
23
#include "wb_config.h"
25
#include <mforms/box.h>
26
#include <mforms/table.h>
27
#include <mforms/label.h>
28
#include <mforms/textentry.h>
29
#include <mforms/selector.h>
30
#include <mforms/tabview.h>
32
#include "db_conn_be.h"
37
class WBPUBLICBACKEND_PUBLIC_FUNC DbConnectPanel : public mforms::Box
40
DbConnectPanel(bool show_connection_combo= true);
41
virtual ~DbConnectPanel();
43
void init(const db_mgmt_ManagementRef &mgmt, const db_mgmt_ConnectionRef &default_conn=db_mgmt_ConnectionRef());
44
void init(DbConnection *conn, const db_mgmt_ConnectionRef &default_conn=db_mgmt_ConnectionRef());
46
void set_default_host_name(const std::string &host, bool update=false);
47
std::string default_host_name() { return _default_host_name; }
49
void set_skip_schema_name(bool flag);
51
void set_enabled(bool flag);
53
mforms::TextEntry *get_name_entry() { return &_name_entry; }
55
DbConnection *get_be() const { return _connection; }
57
void set_active_stored_conn(int stored_conn_index);
58
void set_active_driver(int driver_index);
60
void get_connection_details(int &rdbms_index, int &driver_index);
62
db_mgmt_ConnectionRef get_default_connection() { return _anonymous_connection; }
64
db_mgmt_ConnectionRef get_connection();
65
void set_connection(const db_mgmt_ConnectionRef& conn);
67
boost::signals2::signal<void (std::string,bool)>* signal_validation_state_changed() { return &_signal_validation_state_changed; }
69
bool test_connection();
71
DbConnection *_connection;
72
db_mgmt_ConnectionRef _anonymous_connection;
73
std::map<std::string, grt::DictRef> _parameters_per_driver;
74
std::string _default_host_name;
77
mforms::Label _label1;
78
mforms::Label _label2;
79
mforms::Label _label3;
81
mforms::TextEntry _name_entry;
82
mforms::Selector _stored_connection_sel;
83
mforms::Selector _rdbms_sel;
84
mforms::Selector _driver_sel;
92
mforms::Table _params_table;
93
std::vector<mforms::Box*> _param_rows;
95
mforms::Table _advanced_table;
96
std::vector<mforms::Box*> _advanced_rows;
98
std::list<mforms::View*> _views;
101
void save_param(const std::string& name, const grt::StringRef& param);
102
std::string get_saved_param(const std::string& name);
104
boost::signals2::signal<void (std::string,bool)> _signal_validation_state_changed;
109
bool _delete_connection_be;
110
bool _show_connection_combo;
112
bool _skip_schema_name;
113
std::string _last_validation;
115
void suspend_view_layout(bool flag);
116
void clear_param_controls();
117
void create_control(DbDriverParam *driver_param, ControlType ctrl_type, const MySQL::Geometry::ControlBounds& bounds,
118
const std::string &caption);
120
void set_active_rdbms(int rdbms_index,
123
void change_active_rdbms();
124
void change_active_driver();
126
void set_keychain_password(DbDriverParam *param, bool clear);
128
void param_value_changed(mforms::View *sender);
130
void refresh_stored_connections();
132
void change_active_stored_conn();
133
void reset_stored_conn_list();
141
#endif /* _GRTDBCONNECTFORM_H_ */