kexi

kexiquerydesignerguieditor.h
1/* This file is part of the KDE project
2 Copyright (C) 2004 Lucijan Busch <lucijan@kde.org>
3 Copyright (C) 2004-2006 Jaroslaw Staniek <js@iidea.pl>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19*/
20
21#ifndef KEXIQUERYDESIGNERGUIEDITOR_H
22#define KEXIQUERYDESIGNERGUIEDITOR_H
23
24#include <tqguardedptr.h>
25#include <tqsplitter.h>
26
27#include <kexiviewbase.h>
28#include "kexiquerypart.h"
29
30class KexiMainWindow;
32class KexiDataTable;
33class KexiTableItem;
34class KexiRelationWidget;
35class KexiSectionHeader;
37class KexiRelationViewTableContainer;
38class KexiRelationViewConnection;
39
40namespace KexiPart
41{
42 class Item;
43}
44
45namespace KoProperty {
46 class Property;
47 class Set;
48}
49
50namespace KexiDB
51{
52 class Connection;
53 class QuerySchema;
54 class TableSchema;
55 class ResultInfo;
56}
57
59class KexiQueryDesignerGuiEditor : public KexiViewBase
60{
61 TQ_OBJECT
62
63
64 public:
65 KexiQueryDesignerGuiEditor(KexiMainWindow *mainWin, TQWidget *parent, const char *name = 0);
66 virtual ~KexiQueryDesignerGuiEditor();
67
68// KexiDB::QuerySchema *schema();
69
70 KexiRelationWidget *relationView() const;
71
72 virtual TQSize sizeHint() const;
73
74 public slots:
75 virtual void setFocus();
76
77 protected:
78 void initTableColumns();
79 void initTableRows();
80//unused void addRow(const TQString &tbl, const TQString &field);
81// void restore();
82 virtual tristate beforeSwitchTo(int mode, bool &dontStore);
83 virtual tristate afterSwitchFrom(int mode);
84
85 virtual KexiDB::SchemaData* storeNewData(const KexiDB::SchemaData& sdata, bool &cancel);
86 virtual tristate storeData(bool dontAsk = false);
87
90 void updateColumnsData();
91
94 virtual KoProperty::Set *propertySet();
95
96 KoProperty::Set* createPropertySet( int row,
97 const TQString& tableName, const TQString& fieldName, bool newOne = false );
98
103 bool buildSchema(TQString *errMsg = 0);
104
105 KexiQueryPart::TempData * tempData() const;
106
110 KexiTableItem* createNewRow(const TQString& tableName, const TQString& fieldName,
111 bool visible) const;
112
113 KexiDB::BaseExpr* parseExpressionString(const TQString& fullString, int& token,
114 bool allowRelationalOperator);
115
116 TQCString generateUniqueAlias() const;
117 void updatePropertiesVisibility(KoProperty::Set& buf);
118
119 protected slots:
120 void slotDragOverTableRow(KexiTableItem *item, int row, TQDragMoveEvent* e);
121 void slotDroppedAtRow(KexiTableItem *item, int row,
122 TQDropEvent *ev, KexiTableItem*& newItem);
125 void slotTableAdded(KexiDB::TableSchema &t);
126 void slotTableHidden(KexiDB::TableSchema &t);
127
129 void slotBeforeCellChanged(KexiTableItem *item, int colnum,
130 TQVariant& newValue, KexiDB::ResultInfo* result);
131
132 void slotRowInserted(KexiTableItem* item, uint row, bool repaint);
133 void slotTablePositionChanged(KexiRelationViewTableContainer*);
134 void slotAboutConnectionRemove(KexiRelationViewConnection*);
135 void slotTableFieldDoubleClicked( KexiDB::TableSchema* table, const TQString& fieldName );
136
138 bool loadLayout();
139
141 bool storeLayout();
142
143 void showTablesForQuery(KexiDB::QuerySchema *query);
146 KexiDB::QuerySchema *query, bool showFields, bool showRelations, KexiDB::ResultInfo& result);
153
154 void addConnection(KexiDB::Field *masterField, KexiDB::Field *detailsField);
155
156 void slotPropertyChanged(KoProperty::Set& list, KoProperty::Property& property);
157
158// void slotObjectCreated(const TQCString &mime, const TQCString& name);
159 void slotNewItemStored(KexiPart::Item&);
160 void slotItemRemoved(const KexiPart::Item& item);
161 void slotItemRenamed(const KexiPart::Item& item, const TQCString& oldName);
162
163 private:
164 class Private;
165 Private *d;
166
167 friend class KexiQueryView; // for storeNewData() and storeData() only
168};
169
170#endif
171
A base class for all expressions.
Definition expression.h:67
Provides database connection, allowing queries and data modification.
Definition connection.h:62
Meta-data for a field.
Definition field.h:73
KexiDB::QuerySchema provides information about database query.
Provides a data-driven (record-based) tabular view.
Kexi's main window interface This interface is implemented by KexiMainWindowImpl class.
Information about a single object that can be instantiated using Kexi Part.
virtual KexiDB::SchemaData * storeNewData(const KexiDB::SchemaData &sdata, bool &cancel)
void slotBeforeCellChanged(KexiTableItem *item, int colnum, TQVariant &newValue, KexiDB::ResultInfo *result)
Called before cell change in tableview.
KexiDB::BaseExpr * parseExpressionString(const TQString &fullString, int &token, bool allowRelationalOperator)
void initTableRows()
Called to have all rows empty.
virtual tristate beforeSwitchTo(int mode, bool &dontStore)
void showFieldsAndRelationsForQuery(KexiDB::QuerySchema *query, KexiDB::ResultInfo &result)
convenience method equal to showFieldsOrRelationsForQueryInternal(query, true, true)
void showFieldsForQuery(KexiDB::QuerySchema *query, KexiDB::ResultInfo &result)
convenience method equal to showFieldsOrRelationsForQueryInternal(query, true, false)
KexiTableItem * createNewRow(const TQString &tableName, const TQString &fieldName, bool visible) const
virtual tristate storeData(bool dontAsk=false)
virtual tristate afterSwitchFrom(int mode)
void slotNewItemAppendedForAfterDeletingInSpreadSheetMode()
Reaction on appending a new item after deleting one.
virtual KoProperty::Set * propertySet()
void showRelationsForQuery(KexiDB::QuerySchema *query, KexiDB::ResultInfo &result)
convenience method equal to showFieldsOrRelationsForQueryInternal(query, false, true)
void showFieldsOrRelationsForQueryInternal(KexiDB::QuerySchema *query, bool showFields, bool showRelations, KexiDB::ResultInfo &result)
KoProperty::Set * createPropertySet(int row, const TQString &tableName, const TQString &fieldName, bool newOne=false)
Temporary data kept in memory while switching between Query Dialog's views.
KexiMainWindow * mainWin() const
3-state logical type with three values: true, false and cancelled and convenient operators.
Definition tristate.h:100
High-level database connectivity library with database backend drivers.