kexitabledesignercommands.h
1/* This file is part of the KDE project
2 Copyright (C) 2006 Jaroslaw Staniek <js@iidea.pl>
3
4 This library 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 library 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 library; see the file COPYING.LIB. 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 KEXITABLEDESIGNER_COMMANDS_H
21#define KEXITABLEDESIGNER_COMMANDS_H
22
23#include <tqmap.h>
24#include <tqdict.h>
25#include <tqptrlist.h>
26#include <tqptrdict.h>
27#include <tqvariant.h>
28#include <tqguardedptr.h>
29
30#include <kcommand.h>
31#include <kexidb/alter.h>
32#include <koproperty/set.h>
33
34#include "kexitabledesignerview.h"
35
36class TQWidget;
37class TQRect;
38class TQPoint;
39class TQStringList;
40class TQCString;
41
42namespace KexiTableDesignerCommands {
43
45class Command : public KCommand
46{
47 public:
49 virtual ~Command();
50
54
55 virtual TQString debugString() { return name(); }
56
57 protected:
58 TQGuardedPtr<KexiTableDesignerView> m_view;
59};
60
63{
64 public:
73 const KoProperty::Set& set, const TQCString& propertyName,
74 const TQVariant& oldValue, const TQVariant& newValue,
75 KoProperty::Property::ListData* const oldListData = 0, KoProperty::Property::ListData* const newListData = 0);
76
78
79 virtual TQString name() const;
80 virtual void execute();
81 virtual void unexecute();
83 virtual TQString debugString();
84
85 protected:
87 TQVariant m_oldValue;
88// int m_fieldUID;
89 KoProperty::Property::ListData* m_oldListData, *m_listData;
90};
91
94{
95 public:
98 RemoveFieldCommand( KexiTableDesignerView* view, int fieldIndex,
99 const KoProperty::Set* set);
100
101 virtual ~RemoveFieldCommand();
102
103 virtual TQString name() const;
104 virtual void execute();
105 virtual void unexecute();
107
108 virtual TQString debugString();
109
110 protected:
112 KoProperty::Set* m_set;
113 int m_fieldIndex;
114};
115
118{
119 public:
121 int fieldIndex/*, const KexiDB::Field& field*/, const KoProperty::Set& set );
122 virtual ~InsertFieldCommand();
123
124 virtual TQString name() const;
125 virtual void execute();
126 virtual void unexecute();
128
129 virtual TQString debugString() {
130 return name() + "\nAT ROW " + TQString::number(m_alterTableAction->index()) //m_alterTableAction.index())
131 + ", FIELD: " + m_set["caption"].value().toString(); //m_alterTableAction.field().debugString();
132 }
133
134 protected:
136 KoProperty::Set m_set;
137};
138
139
140/* ---- Internal commands follow (not used for building performing ALTER TABLE ---- */
141
143
145{
146 public:
153 const KoProperty::Set& set, const TQCString& propertyName,
154 bool visible);
155
157
158 virtual TQString name() const;
159 virtual void execute();
160 virtual void unexecute();
161
162 protected:
164// int m_fieldUID;
165 bool m_oldVisibility;
166};
167
169
171{
172 public:
175 virtual ~InsertEmptyRowCommand();
176
177 virtual TQString name() const;
178 virtual void execute();
179 virtual void unexecute();
180
181 protected:
183 int m_row;
184};
185
186}
187
188#endif
Abstract base class used for implementing all the AlterTable actions.
Definition alter.h:157
Defines an action for inserting a single table field.
Definition alter.h:322
Defines an action for removing a single table field.
Definition alter.h:301
Undo/redo command used for when changing a property for a table field.
virtual KexiDB::AlterTableHandler::ActionBase * createAction()
Used to collect actions data for AlterTableHandler Can return 0 if the action should not be passed to...
Undo/redo command used when property visibility is changed.
Base class for all Table Designer's commands.
virtual KexiDB::AlterTableHandler::ActionBase * createAction()
Used to collect actions data for AlterTableHandler Can return 0 if the action should not be passed to...
Undo/redo command used when property visibility is changed.
Undo/redo command used when a new field is inserted into a table.
virtual KexiDB::AlterTableHandler::ActionBase * createAction()
Used to collect actions data for AlterTableHandler Can return 0 if the action should not be passed to...
Undo/redo command used when a field is removed from a table.
virtual KexiDB::AlterTableHandler::ActionBase * createAction()
Used to collect actions data for AlterTableHandler Can return 0 if the action should not be passed to...
Design view of the Table Designer.