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/kexidbdrivercombobox.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/kexidbdrivercombobox.h')
-rw-r--r-- | kexi/widget/kexidbdrivercombobox.h | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/kexi/widget/kexidbdrivercombobox.h b/kexi/widget/kexidbdrivercombobox.h new file mode 100644 index 00000000..981b67c3 --- /dev/null +++ b/kexi/widget/kexidbdrivercombobox.h @@ -0,0 +1,102 @@ +/* This file is part of the KDE project + Copyright (C) 2005-2006 Jaroslaw Staniek <js@iidea.pl> + + This library 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 library 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 library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#ifndef KEXIDBDRIVERCOMBOBOX_H +#define KEXIDBDRIVERCOMBOBOX_H + +#include <qwidget.h> +#include <qmap.h> + +#include <kcombobox.h> + +#include <kexidb/driver.h> + +//! \brief Combo box widget for selecting a database driver +/*! This widget provides a combobox for selecting a database driver. + + +\b Usage: \n +\code + KexiDB::DriverManager manager; + KexiDB::Driver::InfoMap drvs = manager.driversInfo(); + + KexiDBDriverComboBox* combo = new KexiDBDriverComboBox(drvs, true, 0); +\endcode + +A more complete example can be found in +<a href="http://websvn.kde.org/trunk/koffice/kexi/tests/widgets/kexidbdrivercombotest.cpp?&view=auto">koffice/kexi/tests/widgets/</a>. + +*/ + +class KEXIEXTWIDGETS_EXPORT KexiDBDriverComboBox : public KComboBox +{ + Q_OBJECT + + public: + enum Options { + ShowFileDrivers = 1, + ShowServerDrivers = 2, + ShowAll = ShowFileDrivers|ShowServerDrivers + }; + + /*! Constructs a KexiDBDriverComboBox object. + + The combobox is populated with the names of the drivers in + \a driversInfo. A suitable value for \a driversInfo can be obtained + from KexiDB::DriverManager::driversInfo(). + + If \a includeFileBasedDrivers is set to false, then only those drivers + that are for database servers (those which have X-Kexi-DriverType=Network + in their .desktop file) are shown. */ + KexiDBDriverComboBox(QWidget* parent, const KexiDB::Driver::InfoMap& driversInfo, + Options options = ShowAll ); + + ~KexiDBDriverComboBox(); + + /*! Gets a list of the names of all drivers. + + Note that this returns just the names of those drivers that are in the + combobox: if the includeFileBasedDrivers argument to the constructor + was false, this won't include the file based drivers either. + + \return a list of names of drivers that were found */ + QStringList driverNames() const { return m_driverNames; } + + /*! Get the name of the currrently selected driver. If the combobox is empty, + QString::null will be returned. + + \return the name of the currently selected driver */ + QString selectedDriverName() const; + + /*! Set the currrently selected driver. + + The combobox entry for \a driverName is selected. If \a driverName + is not listed in the combobox then there is no change. The search + is case insensitive. + + */ + void setDriverName(const QString& driverName); + + protected: + QMap<QString,QString> m_driversMap; + QStringList m_driverNames; +}; + +#endif + |