1
1
/* This file is part of the KDE project
2
Copyright (C) 2004-2006 Jarosław Staniek <staniek@kde.org>
2
Copyright (C) 2004-2012 Jarosław Staniek <staniek@kde.org>
4
4
This program is free software; you can redistribute it and/or
5
5
modify it under the terms of the GNU Library General Public
23
23
#include "kexitabledesignerview.h"
25
#include <kundo2command.h>
26
26
#include <QByteArray>
28
28
class KexiDataAwarePropertySet;
30
namespace KexiTableDesignerCommands
30
35
//! @internal indices for table columns
31
36
#define COLUMN_ID_ICON 0
32
37
#define COLUMN_ID_CAPTION 1
33
38
#define COLUMN_ID_TYPE 2
34
39
#define COLUMN_ID_DESC 3
37
Command group, reimplemented to get access to commands().
38
We need it to iterate through commands so we can perform a set of ALTER TABLE atomic actions. */
39
class CommandGroup : public K3MacroCommand
42
CommandGroup(const QString & name)
43
: K3MacroCommand(name) {}
44
virtual ~CommandGroup() {}
45
const QList<K3Command*> commands() const {
46
return K3MacroCommand::commands();
51
Command history, reimplemented to get access to commands().
52
We need it to iterate through commands so we can perform a set of ALTER TABLE atomic actions. */
53
class CommandHistory : public K3CommandHistory
57
CommandHistory(KActionCollection *actionCollection, bool withMenus = true);
59
const QList<K3Command*>& commands() const {
60
return m_commandsToUndo;
63
void addCommand(K3Command *command, bool execute = true);
72
QList<K3Command*> m_commandsToUndo, m_commandsToRedo;
75
//----------------------------------------------
78
42
class KexiTableDesignerViewPrivate
102
66
addHistoryCommand_in_slotPropertyChanged_enabled is then set back to the original state.
104
68
void setPropertyValueIfNeeded(const KoProperty::Set& set, const QByteArray& propertyName,
105
const QVariant& newValue, CommandGroup* commandGroup,
69
const QVariant& newValue, KexiTableDesignerCommands::Command* commandGroup,
106
70
bool forceAddCommand = false, bool rememberOldValue = true,
107
71
QStringList* const slist = 0, QStringList* const nlist = 0);
109
73
/*! Like above but allows to specify \a oldValue. */
110
74
void setPropertyValueIfNeeded(
111
75
const KoProperty::Set& set, const QByteArray& propertyName,
112
const QVariant& newValue, const QVariant& oldValue, CommandGroup* commandGroup,
76
const QVariant& newValue, const QVariant& oldValue, KexiTableDesignerCommands::Command* commandGroup,
113
77
bool forceAddCommand = false, bool rememberOldValue = true,
114
78
QStringList* const slist = 0, QStringList* const nlist = 0);
119
83
otherwise sets changed to true and sets visibility of property \a prop to \a visible.
121
85
void setVisibilityIfNeeded(const KoProperty::Set& set, KoProperty::Property* prop,
122
bool visible, bool &changed, CommandGroup *commandGroup);
86
bool visible, bool &changed, KexiTableDesignerCommands::Command *commandGroup);
124
88
bool updatePropertiesVisibility(KexiDB::Field::Type fieldType, KoProperty::Set &set,
125
CommandGroup *commandGroup = 0);
89
KexiTableDesignerCommands::Command *commandGroup = 0);
127
91
/*! \return message used to ask user for accepting saving the design.
128
92
\a emptyTable is set to true if the table designed contains no rows.
176
140
bool slotBeforeCellChanged_enabled : 1;
178
142
//! @todo temp; remove this:
179
//! Temporary flag, used for testingu the Alter Table machinery. Affects storeData()
143
//! Temporary flag, used for testing the Alter Table machinery. Affects storeData()
180
144
//! Used in slotExecuteRealAlterTable() to switch on real alter table for a while.
181
145
bool tempStoreDataUsingRealAlterTable : 1;