kexitabledesignerview.h
1/* This file is part of the KDE project
2 Copyright (C) 2004-2007 Jaroslaw Staniek <js@iidea.pl>
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this program; see the file COPYING. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#ifndef KEXITABLEDESIGNERINTERVIEW_H
21#define KEXITABLEDESIGNERINTERVIEW_H
22
23#include <koproperty/property.h>
24#include <kexidb/alter.h>
25#include <core/kexitabledesignerinterface.h>
26
27#include <kexidatatable.h>
28#include "kexitablepart.h"
29
30class KexiTableItem;
31class KexiTableDesignerViewPrivate;
32class KCommand;
33class CommandGroup;
34
35namespace KoProperty {
36 class Set;
37}
38
40
57{
58 TQ_OBJECT
59
60
61 public:
63 KexiTableDesignerView(KexiMainWindow *win, TQWidget *parent);
64
65 virtual ~KexiTableDesignerView();
66
67 KexiTablePart::TempData* tempData() const;
68
72 virtual void clearRow(int row, bool addCommand = false);
73
76 virtual void insertField(int row, const TQString& caption, bool addCommand = false);
77
81 virtual void insertField(int row, KoProperty::Set& set, bool addCommand = false);
82
86 virtual void insertEmptyRow( int row, bool addCommand = false );
87
91 virtual void deleteRow( int row, bool addCommand = false );
92
95// virtual void deleteField( int row );
96
100 virtual void changeFieldPropertyForRow( int row,
101 const TQCString& propertyName, const TQVariant& newValue,
102 KoProperty::Property::ListData* const listData, bool addCommand );
103
107 void changeFieldProperty( int fieldUID, const TQCString& propertyName,
108 const TQVariant& newValue, KoProperty::Property::ListData* const listData = 0,
109 bool addCommand = false );
110
113 void changePropertyVisibility( int fieldUID, const TQCString& propertyName, bool visible );
114
116 KexiDB::Field * buildField( const KoProperty::Set &set ) const;
117
119 virtual TQString debugStringForCurrentTableSchema(tristate& result);
120
123 virtual tristate simulateAlterTableExecution(TQString *debugTarget);
124
125 public slots:
130
131 protected slots:
134 void updateActions();
135
136 virtual void slotUpdateRowActions(int row);
137
139
141 void slotBeforeCellChanged(KexiTableItem *item, int colnum,
142 TQVariant& newValue, KexiDB::ResultInfo* result);
143
145 void slotRowUpdated(KexiTableItem *item);
146
148 void slotRowInserted();
149// void slotAboutToInsertRow(KexiTableItem* item, KexiDB::ResultInfo* result, bool repaint);
150
152 void slotAboutToDeleteRow(KexiTableItem& item, KexiDB::ResultInfo* result, bool repaint);
153
156 void slotPropertyChanged(KoProperty::Set& set, KoProperty::Property& property);
157
161
163 void slotUndo();
164
166 void slotRedo();
167
169 void slotCommandExecuted(KCommand *command);
170
173
174 protected:
175 virtual void updateActions(bool activated);
176
178 void initData();
179
184 KoProperty::Set* createPropertySet( int row, const KexiDB::Field& field, bool newOne = false );
185
186 virtual tristate beforeSwitchTo(int mode, bool &dontStore);
187
188 virtual tristate afterSwitchFrom(int mode);
189
192 virtual KoProperty::Set *propertySet();
193
194// void removeCurrentPropertySet();
195
199 virtual KexiDB::SchemaData* storeNewData(const KexiDB::SchemaData& sdata, bool &cancel);
200
204 virtual tristate storeData(bool dontAsk = false);
205
212 tristate buildSchema(KexiDB::TableSchema &schema, bool beSilent = false);
213
217
223 void switchPrimaryKey(KoProperty::Set &propertySet, bool set, bool aWasPKey = false,
224 CommandGroup* commandGroup = 0);
225
227 void getSubTypeListData(KexiDB::Field::TypeGroup fieldTypeGroup,
228 TQStringList& stringsList, TQStringList& namesList);
229
232 void addHistoryCommand( KCommand* command, bool execute );
233
236
237#ifdef KEXI_DEBUG_GUI
238 void debugCommand( KCommand* command, int nestingLevel );
239#endif
240
244 void insertFieldInternal(int row, KoProperty::Set* set, const TQString& caption, bool addCommand);
245
247 virtual void propertySetSwitched();
248
254
255 private:
256 KexiTableDesignerViewPrivate *d;
257};
258
259#endif
TQPtrList< ActionBase > ActionList
Defines a type for action list.
Definition alter.h:151
Meta-data for a field.
Definition field.h:73
Provides a data-driven (record-based) tabular view.
Kexi's main window interface This interface is implemented by KexiMainWindowImpl class.
Interface for main Table Designer's commands.
Design view of the Table Designer.
void switchPrimaryKey(KoProperty::Set &propertySet, bool set, bool aWasPKey=false, CommandGroup *commandGroup=0)
virtual KoProperty::Set * propertySet()
void getSubTypeListData(KexiDB::Field::TypeGroup fieldTypeGroup, TQStringList &stringsList, TQStringList &namesList)
Gets subtype strings and names for type fieldType.
virtual KexiDB::SchemaData * storeNewData(const KexiDB::SchemaData &sdata, bool &cancel)
void slotAboutToDeleteRow(KexiTableItem &item, KexiDB::ResultInfo *result, bool repaint)
Called before row deleting in tableview.
virtual tristate afterSwitchFrom(int mode)
virtual void deleteRow(int row, bool addCommand=false)
void insertFieldInternal(int row, KoProperty::Set *set, const TQString &caption, bool addCommand)
void addHistoryCommand(KCommand *command, bool execute)
virtual void propertySetSwitched()
Reimplemented to pass the information also to the "Lookup" tab.
virtual void changeFieldPropertyForRow(int row, const TQCString &propertyName, const TQVariant &newValue, KoProperty::Property::ListData *const listData, bool addCommand)
tristate buildSchema(KexiDB::TableSchema &schema, bool beSilent=false)
virtual void insertField(int row, const TQString &caption, bool addCommand=false)
virtual TQString debugStringForCurrentTableSchema(tristate &result)
void initData()
called whenever data should be reloaded (on switching to this view mode)
void slotRowInserted()
Called before row inserting in tableview.
void slotBeforeCellChanged(KexiTableItem *item, int colnum, TQVariant &newValue, KexiDB::ResultInfo *result)
Called before cell change in tableview.
virtual tristate storeData(bool dontAsk=false)
virtual void clearRow(int row, bool addCommand=false)
virtual tristate executeRealAlterTable()
void slotCommandExecuted(KCommand *command)
void slotPropertyChanged(KoProperty::Set &set, KoProperty::Property &property)
void updateUndoRedoActions()
Updates undo/redo shared actions availability by looking at command history's action.
KoProperty::Set * createPropertySet(int row, const KexiDB::Field &field, bool newOne=false)
void changePropertyVisibility(int fieldUID, const TQCString &propertyName, bool visible)
KexiDB::Field * buildField(const KoProperty::Set &set) const
tristate buildAlterTableActions(KexiDB::AlterTableHandler::ActionList &actions)
virtual tristate simulateAlterTableExecution(TQString *debugTarget)
virtual tristate beforeSwitchTo(int mode, bool &dontStore)
void slotRowUpdated(KexiTableItem *item)
Called on row change in a tableview.
virtual void insertEmptyRow(int row, bool addCommand=false)
void changeFieldProperty(int fieldUID, const TQCString &propertyName, const TQVariant &newValue, KoProperty::Property::ListData *const listData=0, bool addCommand=false)
3-state logical type with three values: true, false and cancelled and convenient operators.
Definition tristate.h:100