kexi

kexirelationwidget.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2002   Lucijan Busch <lucijan@gmx.at>
00003    Copyright (C) 2003-2004 Jaroslaw Staniek <js@iidea.pl>
00004 
00005    This program is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this program; see the file COPYING.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef KEXIRELATIONWIDGET_H
00022 #define KEXIRELATIONWIDGET_H
00023 
00024 //#include <qwidget.h>
00025 //#include "kexiactionproxy.h"
00026 #include "kexiviewbase.h"
00027 #include "kexirelationview.h"
00028 
00029 class KComboBox;
00030 class KPushButton;
00031 class KPopupMenu;
00032 class KAction;
00033 class QListViewItem;
00034 
00035 class KexiMainWindow;
00036 
00037 namespace KexiDB
00038 {
00039     class Connection;
00040     class TableSchema;
00041     class Reference;
00042 }
00043 
00044 class KEXIRELATIONSVIEW_EXPORT KexiRelationWidget : public KexiViewBase
00045 {
00046     Q_OBJECT
00047 
00048     public:
00049         KexiRelationWidget(KexiMainWindow *win, QWidget *parent, const char *name=0);
00050         virtual ~KexiRelationWidget();
00051 
00053         TablesDict* tables() const;
00054         KexiRelationViewTableContainer* table(const QString& name) const;
00055         const ConnectionList* connections() const;
00056 
00057 //      KexiRelationView    *relationView() const { return m_relationView; }
00058         void addTable(const QString& t);
00059 
00060 //      void openTable(KexiDB::TableSchema* table, bool designMode);
00061 
00062         virtual QSize sizeHint() const;
00063 
00065         void objectCreated(const QCString &mime, const QCString& name);
00066         void objectDeleted(const QCString &mime, const QCString& name);
00067         void objectRenamed(const QCString &mime, const QCString& name, const QCString& newName);
00068 
00069     signals:
00070         void tableAdded(KexiDB::TableSchema& t);
00071         void tableHidden(KexiDB::TableSchema& t);
00072         void tablePositionChanged(KexiRelationViewTableContainer*);
00073         void aboutConnectionRemove(KexiRelationViewConnection*);
00074         void tableFieldDoubleClicked( KexiDB::TableSchema* table, const QString& fieldName );
00075     
00076     public slots:
00080         void addTable(KexiDB::TableSchema *t, const QRect &rect = QRect());
00081 
00083         void addConnection(const SourceConnection& conn);
00084 
00085         void removeSelectedObject();
00086 
00088         void clear();
00089 
00091         void removeAllConnections();
00092 
00094         void hideAllTablesExcept( KexiDB::TableSchema::List* tables );
00095 
00096     protected slots:
00097         void slotAddTable();
00098         void tableViewGotFocus();
00099         void connectionViewGotFocus();
00100         void emptyAreaGotFocus();
00101         void tableContextMenuRequest(const QPoint& pos);
00102         void connectionContextMenuRequest(const QPoint& pos);
00103         void emptyAreaContextMenuRequest( const QPoint& pos );
00104         void openSelectedTable();
00105         void designSelectedTable();
00106         void slotTableHidden(KexiDB::TableSchema &table);
00107         void aboutToShowPopupMenu();
00108         void slotTableFieldDoubleClicked(QListViewItem *i,const QPoint&,int);
00109 
00110     protected:
00114         void executePopup( QPoint pos = QPoint(-1,-1) );
00115 
00117         void invalidateActions();
00118 
00120         void fillTablesCombo();
00121 
00122     private:
00123         KexiMainWindow *m_win;
00124         KComboBox *m_tableCombo;
00125         KPushButton *m_btnAdd;
00126         KexiRelationView *m_relationView;
00127         KexiDB::Connection *m_conn;
00128 
00129         KPopupMenu *m_tableQueryPopup //over table/query
00130             , *m_connectionPopup //over connection
00131             , *m_areaPopup; //over outer area
00132         KAction *m_openSelectedTableAction, *m_designSelectedTableAction;
00133 
00134         int m_tableQueryPopupTitleID, m_connectionPopupTitleID;
00135 };
00136 
00137 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys