summaryrefslogtreecommitdiffstats
path: root/kexi/widget/kexidatasourcecombobox.h
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 01:29:50 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 01:29:50 +0000
commit8362bf63dea22bbf6736609b0f49c152f975eb63 (patch)
tree0eea3928e39e50fae91d4e68b21b1e6cbae25604 /kexi/widget/kexidatasourcecombobox.h
downloadkoffice-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/kexidatasourcecombobox.h')
-rw-r--r--kexi/widget/kexidatasourcecombobox.h88
1 files changed, 88 insertions, 0 deletions
diff --git a/kexi/widget/kexidatasourcecombobox.h b/kexi/widget/kexidatasourcecombobox.h
new file mode 100644
index 00000000..01a02d03
--- /dev/null
+++ b/kexi/widget/kexidatasourcecombobox.h
@@ -0,0 +1,88 @@
+/* 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 KEXIDATASOURCECOMBOBOX_H
+#define KEXIDATASOURCECOMBOBOX_H
+
+#include <kcombobox.h>
+
+class KexiProject;
+namespace KexiPart {
+ class Item;
+}
+
+/**
+ * A combo box listing availabe data sources (tables and queries)
+ * with icons. "Define query..." item can be also prepended.
+ */
+class KEXIEXTWIDGETS_EXPORT KexiDataSourceComboBox : public KComboBox
+{
+ Q_OBJECT
+
+ public:
+ KexiDataSourceComboBox(QWidget *parent, const char *name=0);
+ ~KexiDataSourceComboBox();
+
+ //! \return global project that is used to retrieve schema informationm for this combo box.
+ KexiProject* project() const;
+
+ //! \return name of selected table or query. Can return null string.
+ //! You should use isSelectionValid() to check validity of the input.
+ QString selectedMimeType() const;
+
+ //! \return name of selected table or query. Can return null string or nonexisting name,
+ //! so you should use isSelectionValid() to check validity of the input.
+ QString selectedName() const;
+
+ //! \return true if current selection is valid
+ bool isSelectionValid() const;
+
+ /*! \return index of item of mime type \a mimeType and name \a name.
+ Returs -1 of no such item exists. */
+ int findItem(const QString& mimeType, const QString& name);
+
+ public slots:
+ //! Sets global project that is used to retrieve schema informationm for this combo box.
+ //! Tables visibility can be set using \a showTables queries visibility using \a showQueries.
+ void setProject(KexiProject *prj, bool showTables = true, bool showQueries = true);
+
+ /*! Sets item for data source described by \a mimeType and \a name.
+ If \a mimeType is empty, either "kexi/table" and "kexi/query" are tried. */
+ void setDataSource(const QString& mimeType, const QString& name);
+
+ signals:
+ //! Emitted whenever data source changes.
+ //! Even setting invalid data source or clearing it will emit this signal.
+ void dataSourceChanged();
+
+ protected slots:
+ void slotNewItemStored(KexiPart::Item& item);
+ void slotItemRemoved(const KexiPart::Item& item);
+ void slotItemRenamed(const KexiPart::Item& item, const QCString& oldName);
+ void slotActivated( int index );
+ void slotReturnPressed(const QString & text);
+
+ protected:
+ virtual void focusOutEvent( QFocusEvent *e );
+
+ class Private;
+ Private *d;
+};
+
+#endif