kexi

kexiquerydesignerguieditor.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2004 Lucijan Busch <lucijan@kde.org>
00003    Copyright (C) 2004-2006 Jaroslaw Staniek <js@iidea.pl>
00004 
00005    This library 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 library 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 library; see the file COPYING.LIB.  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 KEXIQUERYDESIGNERGUIEDITOR_H
00022 #define KEXIQUERYDESIGNERGUIEDITOR_H
00023 
00024 #include <qguardedptr.h>
00025 #include <qsplitter.h>
00026 
00027 #include <kexiviewbase.h>
00028 #include "kexiquerypart.h"
00029 
00030 class KexiMainWindow;
00031 class KexiTableViewData;
00032 class KexiDataTable;
00033 class KexiTableItem;
00034 class KexiRelationWidget;
00035 class KexiSectionHeader;
00036 class KexiDataAwarePropertySet;
00037 class KexiRelationViewTableContainer;
00038 class KexiRelationViewConnection;
00039 
00040 namespace KexiPart
00041 {
00042     class Item;
00043 }
00044 
00045 namespace KoProperty {
00046     class Property;
00047     class Set;
00048 }
00049 
00050 namespace KexiDB
00051 {
00052     class Connection;
00053     class QuerySchema;
00054     class TableSchema;
00055     class ResultInfo;
00056 }
00057 
00058 class KexiQueryDesignerGuiEditorPrivate;
00059 
00060 class KexiQueryDesignerGuiEditor : public KexiViewBase
00061 {
00062     Q_OBJECT
00063 
00064     public:
00065         KexiQueryDesignerGuiEditor(KexiMainWindow *mainWin, QWidget *parent, const char *name = 0);
00066         virtual ~KexiQueryDesignerGuiEditor();
00067 
00068 //      KexiDB::QuerySchema *schema();
00069 
00070         KexiRelationWidget *relationView() const;
00071 
00072         virtual QSize sizeHint() const;
00073 
00074     public slots:
00075         virtual void setFocus();
00076 
00077     protected:
00078         void initTableColumns(); 
00079         void initTableRows(); 
00080 //unused        void addRow(const QString &tbl, const QString &field);
00081 //      void            restore();
00082         virtual tristate beforeSwitchTo(int mode, bool &dontStore);
00083         virtual tristate afterSwitchFrom(int mode);
00084 
00085         virtual KexiDB::SchemaData* storeNewData(const KexiDB::SchemaData& sdata, bool &cancel);
00086         virtual tristate storeData(bool dontAsk = false);
00087 
00090         void updateColumnsData();
00091 
00094         virtual KoProperty::Set *propertySet();
00095 
00096         KoProperty::Set* createPropertySet( int row,
00097             const QString& tableName, const QString& fieldName, bool newOne = false );
00098 
00103         bool buildSchema(QString *errMsg = 0);
00104 
00105         KexiQueryPart::TempData * tempData() const;
00106 
00110         KexiTableItem* createNewRow(const QString& tableName, const QString& fieldName,
00111             bool visible = true) const;
00112 
00113         KexiDB::BaseExpr* parseExpressionString(const QString& fullString, int& token,
00114             bool allowRelationalOperator);
00115 
00116         QCString generateUniqueAlias() const;
00117         void updatePropertiesVisibility(KoProperty::Set& buf);
00118 
00119     protected slots:
00120         void slotDragOverTableRow(KexiTableItem *item, int row, QDragMoveEvent* e);
00121         void slotDroppedAtRow(KexiTableItem *item, int row,
00122             QDropEvent *ev, KexiTableItem*& newItem);
00123         void slotTableAdded(KexiDB::TableSchema &t);
00124         void slotTableHidden(KexiDB::TableSchema &t);
00125 
00127         void slotBeforeCellChanged(KexiTableItem *item, int colnum,
00128             QVariant& newValue, KexiDB::ResultInfo* result);
00129 
00130         void slotRowInserted(KexiTableItem* item, uint row, bool repaint);
00131         void slotTablePositionChanged(KexiRelationViewTableContainer*);
00132         void slotAboutConnectionRemove(KexiRelationViewConnection*);
00133         void slotTableFieldDoubleClicked( KexiDB::TableSchema* table, const QString& fieldName );
00134 
00136         bool loadLayout();
00137 
00139         bool storeLayout();
00140 
00141         void showTablesForQuery(KexiDB::QuerySchema *query);
00143         void showFieldsOrRelationsForQueryInternal(
00144             KexiDB::QuerySchema *query, bool showFields, bool showRelations);
00146         void showFieldsAndRelationsForQuery(KexiDB::QuerySchema *query);
00148         void showFieldsForQuery(KexiDB::QuerySchema *query);
00150         void showRelationsForQuery(KexiDB::QuerySchema *query);
00151 
00152         void addConnection(KexiDB::Field *masterField, KexiDB::Field *detailsField);
00153 
00154         void slotPropertyChanged(KoProperty::Set& list, KoProperty::Property& property);
00155 
00156 //      void slotObjectCreated(const QCString &mime, const QCString& name);
00157         void slotNewItemStored(KexiPart::Item&);
00158         void slotItemRemoved(const KexiPart::Item& item);
00159         void slotItemRenamed(const KexiPart::Item& item, const QCString& oldName);
00160 
00161     private:
00162         KexiQueryDesignerGuiEditorPrivate *d;
00163 };
00164 
00165 #endif
00166 
KDE Home | KDE Accessibility Home | Description of Access Keys