diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-01-20 01:29:50 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-01-20 01:29:50 +0000 |
commit | 8362bf63dea22bbf6736609b0f49c152f975eb63 (patch) | |
tree | 0eea3928e39e50fae91d4e68b21b1e6cbae25604 /kexi/widget/kexidbconnectionwidget.h | |
download | koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.tar.gz koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.zip |
Added old abandoned KDE3 version of koffice
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1077364 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kexi/widget/kexidbconnectionwidget.h')
-rw-r--r-- | kexi/widget/kexidbconnectionwidget.h | 179 |
1 files changed, 179 insertions, 0 deletions
diff --git a/kexi/widget/kexidbconnectionwidget.h b/kexi/widget/kexidbconnectionwidget.h new file mode 100644 index 00000000..dd8559e5 --- /dev/null +++ b/kexi/widget/kexidbconnectionwidget.h @@ -0,0 +1,179 @@ +/* This file is part of the KDE project + Copyright (C) 2005 Jaroslaw Staniek <[email protected]> + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef KEXIDBCONNECTIONWIDGET_H +#define KEXIDBCONNECTIONWIDGET_H + +#include "kexidbconnectionwidgetbase.h" + +#include <kexiprojectdata.h> + +#include <ktabwidget.h> +#include <kdialogbase.h> + +class KTextEdit; +class KPushButton; +class KexiDBDriverComboBox; +class KexiDBConnectionWidgetDetailsBase; +class KexiDBConnectionTabWidget; + +class KEXIEXTWIDGETS_EXPORT KexiDBConnectionWidget : public KexiDBConnectionWidgetBase +{ + Q_OBJECT + + public: + KexiDBConnectionWidget( QWidget* parent = 0, const char* name = 0 ); + virtual ~KexiDBConnectionWidget(); + + /*! Sets project data \a data. + \a shortcutFileName is only used to check if the file is writable + (if no, "save changes" button will be disabled). */ + void setData(const KexiProjectData& data, const QString& shortcutFileName = QString::null); + + /*! Sets connection data \a data. + \a shortcutFileName is only used to check if the file is writable + (if no, "save changes" button will be disabled). */ + void setData(const KexiDB::ConnectionData& data, const QString& shortcutFileName = QString::null); + + KexiProjectData data(); + + //! \return a pointer to 'save changes' button. You can call hide() for this to hide it. + KPushButton* saveChangesButton() const; + + //! \return a pointer to 'test connection' button. You can call hide() for this to hide it. + KPushButton* testConnectionButton() const; + + KexiDBDriverComboBox *driversCombo() const { return m_driversCombo; } + + //! \return true if only connection data is managed by this widget + bool connectionOnly() const; + + signals: + //! emitted when data saving is needed + void saveChanges(); + + void loadDBList(); + + protected slots: + void slotLocationBGrpClicked(int id); + void slotCBToggled(bool on); + virtual void languageChange() { KexiDBConnectionWidgetBase::languageChange(); } + + protected: + void setDataInternal(const KexiProjectData& data, bool connectionOnly, + const QString& shortcutFileName); + + KexiProjectData m_data; + KexiDBDriverComboBox *m_driversCombo; + + class Private; + Private *d; + +// friend class KexiDBConnectionTabWidget; +}; + +class KEXIEXTWIDGETS_EXPORT KexiDBConnectionTabWidget : public KTabWidget +{ + Q_OBJECT + + public: + KexiDBConnectionTabWidget( QWidget* parent = 0, const char* name = 0 ); + virtual ~KexiDBConnectionTabWidget(); + + /*! Sets connection data \a data. + \a shortcutFileName is only used to check if the file is writable + (if no, "save changes" button will be disabled). */ + void setData(const KexiProjectData& data, const QString& shortcutFileName = QString::null); + void setData(const KexiDB::ConnectionData& data, const QString& shortcutFileName = QString::null); + KexiProjectData currentProjectData(); + + //! \return true if 'save password' option is selected + bool savePasswordOptionSelected() const; + + signals: + //! emitted when test connection is needed + void testConnection(); + + protected slots: + void slotTestConnection(); + + protected: + KexiDBConnectionWidget *mainWidget; + KexiDBConnectionWidgetDetailsBase* detailsWidget; + + friend class KexiDBConnectionDialog; +}; + +class KEXIEXTWIDGETS_EXPORT KexiDBConnectionDialog : public KDialogBase +{ + Q_OBJECT + + public: + /*! Creates a new connection dialog for project data \a data. + Not only connection data is visible but also database name and and title. + \a shortcutFileName is only used to check if the shortcut file is writable + (if no, "save changes" button will be disabled). + The shortcut file is in .KEXIS format. + Connect to saveChanges() signal to react on saving changes. + If \a shortcutFileName is empty, the button will be hidden. + \a acceptButtonGuiItem allows to override default "Open" button's appearance. */ + KexiDBConnectionDialog(const KexiProjectData& data, + const QString& shortcutFileName = QString::null, + const KGuiItem& acceptButtonGuiItem = KGuiItem("")); + + /*! Creates a new connection dialog for connection data \a data. + Only connection data is visible: database name and and title fields are hidden. + \a shortcutFileName is only used to check if the shortcut file is writable + (if no, "save changes" button will be disabled). + The shortcut file is in .KEXIC format. + See above constructor for more details. */ + KexiDBConnectionDialog(const KexiDB::ConnectionData& data, + const QString& shortcutFileName = QString::null, + const KGuiItem& acceptButtonGuiItem = KGuiItem("")); + + ~KexiDBConnectionDialog(); + + /*! \return project data displayed within the dialog. + Information about database name and title can be empty if the dialog + contain only a connection data (if second constructor was used). */ + KexiProjectData currentProjectData(); + + //! \return true if 'save password' option is selected + bool savePasswordOptionSelected() const; + + KexiDBConnectionWidget *mainWidget() const; + KexiDBConnectionWidgetDetailsBase* detailsWidget() const; + + signals: + //! emitted when data saving is needed + void saveChanges(); + + //! emitted when test connection is needed + void testConnection(); + + void loadDBList(); + + protected: + KexiDBConnectionTabWidget *tabWidget; + + private: + void init(); +}; + +#endif // KEXIDBCONNECTIONWIDGET_H |