summaryrefslogtreecommitdiffstats
path: root/kexi/widget/relations/kexirelationview.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/relations/kexirelationview.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/relations/kexirelationview.h')
-rw-r--r--kexi/widget/relations/kexirelationview.h167
1 files changed, 167 insertions, 0 deletions
diff --git a/kexi/widget/relations/kexirelationview.h b/kexi/widget/relations/kexirelationview.h
new file mode 100644
index 00000000..2de6620d
--- /dev/null
+++ b/kexi/widget/relations/kexirelationview.h
@@ -0,0 +1,167 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Lucijan Busch <lucijan@gmx.at>
+ Copyright (C) 2003-2004, 2006 Jaroslaw Staniek <js@iidea.pl>
+
+ 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 KEXIRELATIONVIEW_H
+#define KEXIRELATIONVIEW_H
+
+#include <qguardedptr.h>
+#include <qscrollview.h>
+#include <qptrlist.h>
+#include <qdict.h>
+
+#include <kexidb/tableschema.h>
+
+#include "kexirelationviewconnection.h"
+
+class QFrame;
+
+class KexiRelationViewTable;
+class KexiRelationViewTableContainer;
+class KAction;
+class KPopupMenu;
+
+namespace KexiDB
+{
+ class Reference;
+ class Connection;
+}
+
+typedef QDict<KexiRelationViewTableContainer> TablesDict;
+typedef QDictIterator<KexiRelationViewTableContainer> TablesDictIterator;
+typedef QPtrList<KexiRelationViewConnection> ConnectionList;
+typedef QPtrListIterator<KexiRelationViewConnection> ConnectionListIterator;
+
+struct SourceConnection
+{
+ QString masterTable;
+ QString detailsTable;
+ QString masterField;
+ QString detailsField;
+};
+
+/*! @short provides a view for displaying relations between database tables.
+
+ It is currently used for two purposes:
+ - displaying global database relations
+ - displaying relations defined for a database query
+
+ The class is for displaying only - retrieving data and updating data on the backend side is implemented
+ in KexiRelationWidget, and more specifically in: Kexi Relation Part and Kexi Query Part.
+*/
+class KEXIRELATIONSVIEW_EXPORT KexiRelationView : public QScrollView
+{
+ Q_OBJECT
+
+ public:
+ KexiRelationView(QWidget *parent, const char *name=0);
+ virtual ~KexiRelationView();
+
+ //! \return a dictionary of added tables
+ TablesDict* tables() { return &m_tables; }
+
+ /*! Adds a table \a t to the area. This changes only visual representation.
+ If \a rect is valid, table widget geometry will be initialized.
+ \return added table container or 0 on failure.
+ */
+ KexiRelationViewTableContainer* addTableContainer(KexiDB::TableSchema *t,
+ const QRect &rect = QRect());
+
+ /*! \return table container for table \a t. */
+ KexiRelationViewTableContainer * tableContainer(KexiDB::TableSchema *t) const;
+
+ //! Adds a connection \a con to the area. This changes only visual representation.
+ void addConnection(const SourceConnection& _conn /*, bool interactive=true*/);
+
+ void setReadOnly(bool);
+
+ inline KexiRelationViewConnection* selectedConnection() const { return m_selectedConnection; }
+
+ inline KexiRelationViewTableContainer* focusedTableView() const { return m_focusedTableView; }
+
+ virtual QSize sizeHint() const;
+
+ const ConnectionList* connections() const { return &m_connectionViews; }
+
+// KexiRelationViewTableContainer* containerForTable(KexiDB::TableSchema* tableSchema);
+
+ signals:
+ void tableContextMenuRequest( const QPoint& pos );
+ void connectionContextMenuRequest( const QPoint& pos );
+ void emptyAreaContextMenuRequest( const QPoint& pos );
+ void tableViewGotFocus();
+ void connectionViewGotFocus();
+ void emptyAreaGotFocus();
+ void tableHidden(KexiDB::TableSchema& t);
+ void tablePositionChanged(KexiRelationViewTableContainer*);
+ void aboutConnectionRemove(KexiRelationViewConnection*);
+
+ public slots:
+ //! Clears current selection - table/query or connection
+ void clearSelection();
+
+ /*! Removes all tables and connections from the view.
+ Does not emit signals like tableHidden(). */
+ void clear();
+
+ /*! Removes all coonections from the view. */
+ void removeAllConnections();
+
+ /*! Hides all tables except \a tables. */
+ void hideAllTablesExcept( KexiDB::TableSchema::List* tables );
+
+ void slotTableScrolling(const QString&);
+
+ //! removes selected table or connection
+ void removeSelectedObject();
+
+
+ protected slots:
+ void containerMoved(KexiRelationViewTableContainer *c);
+ void slotListUpdate(QObject *s);
+ void slotTableViewEndDrag();
+ void slotTableViewGotFocus();
+
+ protected:
+// /*! executes popup menu at \a pos, or,
+// if \a pos not specified: at center of selected table view (if any selected),
+// or at center point of the relations view. */
+// void executePopup( QPoint pos = QPoint(-1,-1) );
+
+ void drawContents(QPainter *p, int cx, int cy, int cw, int ch);
+ void contentsMousePressEvent(QMouseEvent *ev);
+ virtual void keyPressEvent(QKeyEvent *ev);
+
+ void recalculateSize(int width, int height);
+ void stretchExpandSize();
+// void invalidateActions();
+// void clearTableSelection();
+// void clearConnSelection();
+
+ void hideTable(KexiRelationViewTableContainer* tableView);
+ void removeConnection(KexiRelationViewConnection *conn);
+
+ TablesDict m_tables;
+ bool m_readOnly;
+ ConnectionList m_connectionViews;
+ KexiRelationViewConnection* m_selectedConnection;
+ QGuardedPtr<KexiRelationViewTableContainer> m_focusedTableView;
+};
+
+#endif