~smartboyhw/ubuntu/raring/calligra/2.6.0-0ubuntu1

« back to all changes in this revision

Viewing changes to kexi/plugins/tables/kexitabledesignercommands.h

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac
  • Date: 2012-10-23 21:09:16 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20121023210916-m82w6zxnxhaxz7va
Tags: 1:2.5.90-0ubuntu1
* New upstream alpha release (LP: #1070436)
  - Add libkactivities-dev and libopenimageio-dev to build-depends
  - Add kubuntu_build_calligraactive.diff to build calligraactive by default
  - Add package for calligraauthor and move files that are shared between
    calligrawords and calligraauthor to calligrawords-common
* Document the patches
* Remove numbers from patches so they follow the same naming scheme as
  the rest of our patches.
* calligra-data breaks replaces krita-data (<< 1:2.5.3) (LP: #1071686)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* This file is part of the KDE project
2
 
   Copyright (C) 2006 Jarosław Staniek <staniek@kde.org>
 
2
   Copyright (C) 2006-2012 Jarosław Staniek <staniek@kde.org>
3
3
 
4
4
   This library is free software; you can redistribute it and/or
5
5
   modify it under the terms of the GNU Library General Public
22
22
 
23
23
#include <QPointer>
24
24
 
25
 
#include <k3command.h>
26
25
#include <kexidb/alter.h>
27
26
#include <koproperty/Set.h>
 
27
#include <kundo2command.h>
28
28
 
29
29
#include "kexitabledesignerview.h"
30
30
 
35
35
{
36
36
 
37
37
//! @short Base class for all Table Designer's commands
38
 
class Command : public K3Command
 
38
class Command : public KUndo2Command
39
39
{
40
40
public:
41
 
    Command(KexiTableDesignerView* view);
 
41
    Command(const QString &text, Command *parent, KexiTableDesignerView* view);
 
42
    Command(Command* parent, KexiTableDesignerView* view);
42
43
    virtual ~Command();
43
44
 
44
45
    //! Used to collect actions data for AlterTableHandler
45
46
    //! Can return 0 if the action should not be passed to AlterTableHandler
46
 
    virtual KexiDB::AlterTableHandler::ActionBase* createAction() {
 
47
    virtual KexiDB::AlterTableHandler::ActionBase* createAction() const {
47
48
        return 0;
48
49
    }
49
50
 
50
 
    virtual QString debugString() {
51
 
        return name();
 
51
    virtual QString debugString() const {
 
52
        return text();
52
53
    }
53
54
 
 
55
    virtual void redo();
 
56
    virtual void undo();
 
57
 
 
58
    //! Enables or disabled redo(). Needed for pushing action on stack without executing it.
 
59
    //! True by default.
 
60
    void setRedoEnabled(bool enabled);
54
61
protected:
 
62
    virtual void redoInternal();
 
63
    virtual void undoInternal();
55
64
    QPointer<KexiTableDesignerView> m_view;
 
65
    bool m_redoEnabled;
56
66
};
57
67
 
58
68
//! @short Undo/redo command used for when changing a property for a table field
66
76
     \a oldlistData and and \a newListData can be specified so Property::setListData() will be called
67
77
     on execute() and unexecute().
68
78
    */
69
 
    ChangeFieldPropertyCommand(KexiTableDesignerView* view,
 
79
    ChangeFieldPropertyCommand(Command* parent, KexiTableDesignerView* view,
70
80
                               const KoProperty::Set& set, const QByteArray& propertyName,
71
81
                               const QVariant& oldValue, const QVariant& newValue,
72
82
                               KoProperty::Property::ListData* const oldListData = 0,
74
84
 
75
85
    virtual ~ChangeFieldPropertyCommand();
76
86
 
77
 
    virtual QString name() const;
78
 
    virtual void execute();
79
 
    virtual void unexecute();
80
 
    virtual KexiDB::AlterTableHandler::ActionBase* createAction();
81
 
    virtual QString debugString();
 
87
    virtual void redoInternal();
 
88
    virtual void undoInternal();
 
89
    virtual KexiDB::AlterTableHandler::ActionBase* createAction() const;
 
90
    virtual QString debugString() const;
82
91
 
83
92
protected:
84
93
    KexiDB::AlterTableHandler::ChangeFieldPropertyAction m_alterTableAction;
93
102
public:
94
103
    /*! Constructs RemoveFieldCommand object.
95
104
     If \a set is 0, the action only means removing empty row (internal). */
96
 
    RemoveFieldCommand(KexiTableDesignerView* view, int fieldIndex,
 
105
    RemoveFieldCommand(Command* parent, KexiTableDesignerView* view, int fieldIndex,
97
106
                       const KoProperty::Set* set);
98
107
 
99
108
    virtual ~RemoveFieldCommand();
100
109
 
101
 
    virtual QString name() const;
102
 
    virtual void execute();
103
 
    virtual void unexecute();
104
 
    virtual KexiDB::AlterTableHandler::ActionBase* createAction();
 
110
    virtual void redoInternal();
 
111
    virtual void undoInternal();
 
112
    virtual KexiDB::AlterTableHandler::ActionBase* createAction() const;
105
113
 
106
 
    virtual QString debugString();
 
114
    virtual QString debugString() const;
107
115
 
108
116
protected:
109
117
    KexiDB::AlterTableHandler::RemoveFieldAction m_alterTableAction;
115
123
class InsertFieldCommand : public Command
116
124
{
117
125
public:
118
 
    InsertFieldCommand(KexiTableDesignerView* view,
 
126
    InsertFieldCommand(Command* parent, KexiTableDesignerView* view,
119
127
                       int fieldIndex/*, const KexiDB::Field& field*/, const KoProperty::Set& set);
120
128
    virtual ~InsertFieldCommand();
121
129
 
122
 
    virtual QString name() const;
123
 
    virtual void execute();
124
 
    virtual void unexecute();
125
 
    virtual KexiDB::AlterTableHandler::ActionBase* createAction();
 
130
    virtual void redoInternal();
 
131
    virtual void undoInternal();
 
132
    virtual KexiDB::AlterTableHandler::ActionBase* createAction() const;
126
133
 
127
 
    virtual QString debugString() {
128
 
        return name() + "\nAT ROW " + QString::number(m_alterTableAction->index()) //m_alterTableAction.index())
129
 
               + ", FIELD: " + m_set["caption"].value().toString(); //m_alterTableAction.field().debugString();
130
 
    }
 
134
    virtual QString debugString() const;
131
135
 
132
136
protected:
133
137
    KexiDB::AlterTableHandler::InsertFieldAction *m_alterTableAction;
147
151
     for field by name when more than one field exists with the same name
148
152
     (it's invalid but allowed in design time).
149
153
    */
150
 
    ChangePropertyVisibilityCommand(KexiTableDesignerView* view,
 
154
    ChangePropertyVisibilityCommand(Command* parent, KexiTableDesignerView* view,
151
155
                                    const KoProperty::Set& set, const QByteArray& propertyName,
152
156
                                    bool visible);
153
157
 
154
158
    virtual ~ChangePropertyVisibilityCommand();
155
159
 
156
 
    virtual QString name() const;
157
 
    virtual void execute();
158
 
    virtual void unexecute();
 
160
    virtual void redoInternal();
 
161
    virtual void undoInternal();
159
162
 
160
163
protected:
161
164
    KexiDB::AlterTableHandler::ChangeFieldPropertyAction m_alterTableAction;
169
172
{
170
173
public:
171
174
    /*! Creates the InsertEmptyRowCommand object. */
172
 
    InsertEmptyRowCommand(KexiTableDesignerView* view, int row);
 
175
    InsertEmptyRowCommand(Command* parent, KexiTableDesignerView* view, int row);
173
176
    virtual ~InsertEmptyRowCommand();
174
177
 
175
 
    virtual QString name() const;
176
 
    virtual void execute();
177
 
    virtual void unexecute();
 
178
    virtual void redoInternal();
 
179
    virtual void undoInternal();
178
180
 
179
181
protected:
180
182
    KexiDB::AlterTableHandler::ChangeFieldPropertyAction m_alterTableAction;