~ubuntu-branches/ubuntu/quantal/mysql-workbench/quantal

« back to all changes in this revision

Viewing changes to backend/wbpublic/grtui/grtdb_connect_panel.h

  • Committer: Package Import Robot
  • Author(s): Dmitry Smirnov
  • Date: 2012-03-01 21:57:30 UTC
  • Revision ID: package-import@ubuntu.com-20120301215730-o7y8av8y38n162ro
Tags: upstream-5.2.38+dfsg
ImportĀ upstreamĀ versionĀ 5.2.38+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* 
 
2
 * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
 
3
 *
 
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
 
7
 * License.
 
8
 * 
 
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.
 
13
 * 
 
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
 
17
 * 02110-1301  USA
 
18
 */
 
19
 
 
20
#ifndef _GRTDBCONNECTPANEL_H_
 
21
#define _GRTDBCONNECTPANEL_H_
 
22
 
 
23
#include "wb_config.h"
 
24
 
 
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>
 
31
 
 
32
#include "db_conn_be.h"
 
33
 
 
34
namespace grtui
 
35
{
 
36
 
 
37
class WBPUBLICBACKEND_PUBLIC_FUNC DbConnectPanel : public mforms::Box
 
38
{
 
39
public:
 
40
  DbConnectPanel(bool show_connection_combo= true);
 
41
  virtual ~DbConnectPanel();
 
42
 
 
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());
 
45
  
 
46
  void set_default_host_name(const std::string &host, bool update=false);
 
47
  std::string default_host_name() { return _default_host_name; }
 
48
  
 
49
  void set_skip_schema_name(bool flag);
 
50
 
 
51
  void set_enabled(bool flag);
 
52
  
 
53
  mforms::TextEntry *get_name_entry() { return  &_name_entry; }
 
54
 
 
55
  DbConnection *get_be() const { return _connection; }
 
56
 
 
57
  void set_active_stored_conn(int stored_conn_index);
 
58
  void set_active_driver(int driver_index);
 
59
 
 
60
  void get_connection_details(int &rdbms_index, int &driver_index);
 
61
  
 
62
  db_mgmt_ConnectionRef get_default_connection() { return _anonymous_connection; }
 
63
  
 
64
  db_mgmt_ConnectionRef get_connection();
 
65
  void set_connection(const db_mgmt_ConnectionRef& conn);
 
66
  
 
67
  boost::signals2::signal<void (std::string,bool)>* signal_validation_state_changed() { return &_signal_validation_state_changed; }
 
68
 
 
69
  bool test_connection();
 
70
protected:
 
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;
 
75
 
 
76
  mforms::Table _table;
 
77
  mforms::Label _label1;
 
78
  mforms::Label _label2;
 
79
  mforms::Label _label3;
 
80
  
 
81
  mforms::TextEntry _name_entry;
 
82
  mforms::Selector _stored_connection_sel;
 
83
  mforms::Selector _rdbms_sel;
 
84
  mforms::Selector _driver_sel;
 
85
  mforms::Label _desc1;
 
86
  mforms::Label _desc2;
 
87
  mforms::Label _desc3;
 
88
  
 
89
  mforms::TabView _tab;
 
90
 
 
91
 
 
92
  mforms::Table _params_table;
 
93
  std::vector<mforms::Box*> _param_rows;
 
94
 
 
95
  mforms::Table _advanced_table;
 
96
  std::vector<mforms::Box*> _advanced_rows;
 
97
 
 
98
  std::list<mforms::View*> _views;
 
99
  
 
100
private:
 
101
  void save_param(const std::string& name, const grt::StringRef& param);
 
102
  std::string get_saved_param(const std::string& name);
 
103
  
 
104
  boost::signals2::signal<void (std::string,bool)> _signal_validation_state_changed;
 
105
  
 
106
  int _rdbms_index;
 
107
  int _driver_index;
 
108
  bool _initialized;
 
109
  bool _delete_connection_be;
 
110
  bool _show_connection_combo;
 
111
  bool _updating;
 
112
  bool _skip_schema_name;
 
113
  std::string _last_validation;
 
114
 
 
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);
 
119
 
 
120
  void set_active_rdbms(int rdbms_index,
 
121
                        int driver_index);
 
122
  
 
123
  void change_active_rdbms();
 
124
  void change_active_driver();
 
125
  
 
126
  void set_keychain_password(DbDriverParam *param, bool clear);
 
127
  
 
128
  void param_value_changed(mforms::View *sender);
 
129
  
 
130
  void refresh_stored_connections();
 
131
  
 
132
  void change_active_stored_conn();
 
133
  void reset_stored_conn_list();
 
134
  
 
135
  int open_editor();
 
136
};
 
137
 
 
138
};
 
139
 
 
140
 
 
141
#endif /* _GRTDBCONNECTFORM_H_ */