kexi

kexidbconnectionwidget.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2005 Jaroslaw Staniek <js@iidea.pl>
00003 
00004    This program is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this program; see the file COPYING.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018  */
00019 
00020 #ifndef KEXIDBCONNECTIONWIDGET_H
00021 #define KEXIDBCONNECTIONWIDGET_H
00022 
00023 #include "kexidbconnectionwidgetbase.h"
00024 
00025 #include <kexiprojectdata.h>
00026 
00027 #include <ktabwidget.h>
00028 #include <kdialogbase.h>
00029 
00030 class KTextEdit;
00031 class KPushButton;
00032 class KexiDBDriverComboBox;
00033 class KexiDBConnectionWidgetDetailsBase;
00034 class KexiDBConnectionTabWidget;
00035 
00036 class KEXIEXTWIDGETS_EXPORT KexiDBConnectionWidget : public KexiDBConnectionWidgetBase
00037 {
00038     Q_OBJECT
00039 
00040     public:
00041         KexiDBConnectionWidget( QWidget* parent = 0, const char* name = 0 );
00042         virtual ~KexiDBConnectionWidget();
00043 
00047         void setData(const KexiProjectData& data, const QString& shortcutFileName = QString::null);
00048 
00052         void setData(const KexiDB::ConnectionData& data, const QString& shortcutFileName = QString::null);
00053 
00054         KexiProjectData data();
00055 
00057         KPushButton* saveChangesButton() const;
00058 
00060         KPushButton* testConnectionButton() const;
00061 
00062         KexiDBDriverComboBox *driversCombo() const { return m_driversCombo; }
00063 
00065         bool connectionOnly() const;
00066 
00067     signals:
00069         void saveChanges();
00070 
00071         void loadDBList();
00072 
00073     protected slots:
00074         void slotLocationBGrpClicked(int id);
00075         void slotCBToggled(bool on);
00076         virtual void languageChange() { KexiDBConnectionWidgetBase::languageChange(); }
00077 
00078     protected:
00079         void setDataInternal(const KexiProjectData& data, bool connectionOnly, 
00080             const QString& shortcutFileName);
00081 
00082         KexiProjectData m_data;
00083         KexiDBDriverComboBox *m_driversCombo;
00084 
00085         class Private;
00086         Private *d;
00087 
00088 //      friend class KexiDBConnectionTabWidget;
00089 };
00090 
00091 class KEXIEXTWIDGETS_EXPORT KexiDBConnectionTabWidget : public KTabWidget
00092 {
00093     Q_OBJECT
00094 
00095     public:
00096         KexiDBConnectionTabWidget( QWidget* parent = 0, const char* name = 0 );
00097         virtual ~KexiDBConnectionTabWidget();
00098 
00102         void setData(const KexiProjectData& data, const QString& shortcutFileName = QString::null);
00103         void setData(const KexiDB::ConnectionData& data, const QString& shortcutFileName = QString::null);
00104         KexiProjectData currentProjectData();
00105 
00107         bool savePasswordOptionSelected() const;
00108 
00109     signals:
00111         void testConnection();
00112 
00113     protected slots:
00114         void slotTestConnection();
00115 
00116     protected:
00117         KexiDBConnectionWidget *mainWidget;
00118         KexiDBConnectionWidgetDetailsBase* detailsWidget;
00119 
00120     friend class KexiDBConnectionDialog;
00121 };
00122 
00123 class KEXIEXTWIDGETS_EXPORT KexiDBConnectionDialog : public KDialogBase
00124 {
00125     Q_OBJECT
00126 
00127     public:
00136         KexiDBConnectionDialog(const KexiProjectData& data, 
00137             const QString& shortcutFileName = QString::null, 
00138             const KGuiItem& acceptButtonGuiItem = KGuiItem(""));
00139 
00146         KexiDBConnectionDialog(const KexiDB::ConnectionData& data, 
00147             const QString& shortcutFileName = QString::null,
00148             const KGuiItem& acceptButtonGuiItem = KGuiItem(""));
00149 
00150         ~KexiDBConnectionDialog();
00151 
00155         KexiProjectData currentProjectData();
00156 
00158         bool savePasswordOptionSelected() const;
00159 
00160         KexiDBConnectionWidget *mainWidget() const;
00161         KexiDBConnectionWidgetDetailsBase* detailsWidget() const;
00162 
00163     signals:
00165         void saveChanges();
00166 
00168         void testConnection();
00169 
00170         void loadDBList();
00171 
00172     protected:
00173         KexiDBConnectionTabWidget *tabWidget;
00174     
00175     private:
00176         void init();
00177 };
00178 
00179 #endif // KEXIDBCONNECTIONWIDGET_H
KDE Home | KDE Accessibility Home | Description of Access Keys