kexi

kexidbconnectionwidget.h
1/* This file is part of the KDE project
2 Copyright (C) 2005 Jaroslaw Staniek <js@iidea.pl>
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
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 GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; see the file COPYING. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20#ifndef KEXIDBCONNECTIONWIDGET_H
21#define KEXIDBCONNECTIONWIDGET_H
22
23#include "kexidbconnectionwidgetbase.h"
24
25#include <kexiprojectdata.h>
26
27#include <ktabwidget.h>
28#include <kdialogbase.h>
29
30class KTextEdit;
31class KPushButton;
33class KexiDBConnectionWidgetDetailsBase;
34class KexiDBConnectionTabWidget;
35
36class KEXIEXTWIDGETS_EXPORT KexiDBConnectionWidget : public KexiDBConnectionWidgetBase
37{
38 TQ_OBJECT
39
40
41 public:
42 KexiDBConnectionWidget( TQWidget* parent = 0, const char* name = 0 );
43 virtual ~KexiDBConnectionWidget();
44
48 void setData(const KexiProjectData& data, const TQString& shortcutFileName = TQString());
49
53 void setData(const KexiDB::ConnectionData& data, const TQString& shortcutFileName = TQString());
54
55 KexiProjectData data();
56
58 KPushButton* saveChangesButton() const;
59
61 KPushButton* testConnectionButton() const;
62
63 KexiDBDriverComboBox *driversCombo() const { return m_driversCombo; }
64
66 bool connectionOnly() const;
67
68 signals:
70 void saveChanges();
71
72 void loadDBList();
73
74 protected slots:
75 void slotLocationBGrpClicked(int id);
76 void slotCBToggled(bool on);
77 virtual void languageChange() { KexiDBConnectionWidgetBase::languageChange(); }
78
79 protected:
80 void setDataInternal(const KexiProjectData& data, bool connectionOnly,
81 const TQString& shortcutFileName);
82
83 KexiProjectData m_data;
84 KexiDBDriverComboBox *m_driversCombo;
85
86 class Private;
87 Private *d;
88
89// friend class KexiDBConnectionTabWidget;
90};
91
92class KEXIEXTWIDGETS_EXPORT KexiDBConnectionTabWidget : public KTabWidget
93{
94 TQ_OBJECT
95
96
97 public:
98 KexiDBConnectionTabWidget( TQWidget* parent = 0, const char* name = 0 );
99 virtual ~KexiDBConnectionTabWidget();
100
104 void setData(const KexiProjectData& data, const TQString& shortcutFileName = TQString());
105 void setData(const KexiDB::ConnectionData& data, const TQString& shortcutFileName = TQString());
106 KexiProjectData currentProjectData();
107
109 bool savePasswordOptionSelected() const;
110
111 signals:
113 void testConnection();
114
115 protected slots:
116 void slotTestConnection();
117
118 protected:
119 KexiDBConnectionWidget *mainWidget;
120 KexiDBConnectionWidgetDetailsBase* detailsWidget;
121
122 friend class KexiDBConnectionDialog;
123};
124
125class KEXIEXTWIDGETS_EXPORT KexiDBConnectionDialog : public KDialogBase
126{
127 TQ_OBJECT
128
129
130 public:
139 KexiDBConnectionDialog(const KexiProjectData& data,
140 const TQString& shortcutFileName = TQString(),
141 const KGuiItem& acceptButtonGuiItem = KGuiItem(""));
142
149 KexiDBConnectionDialog(const KexiDB::ConnectionData& data,
150 const TQString& shortcutFileName = TQString(),
151 const KGuiItem& acceptButtonGuiItem = KGuiItem(""));
152
153 ~KexiDBConnectionDialog();
154
158 KexiProjectData currentProjectData();
159
161 bool savePasswordOptionSelected() const;
162
163 KexiDBConnectionWidget *mainWidget() const;
164 KexiDBConnectionWidgetDetailsBase* detailsWidget() const;
165
166 signals:
168 void saveChanges();
169
171 void testConnection();
172
173 void loadDBList();
174
175 protected:
176 KexiDBConnectionTabWidget *tabWidget;
177
178 private:
179 void init();
180};
181
182#endif // KEXIDBCONNECTIONWIDGET_H
Combo box widget for selecting a database driver.
Database specific connection data, e.g. host, port.
Kexi project core data member.