00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef KEXITABLEDESIGNERINTERVIEW_H
00021 #define KEXITABLEDESIGNERINTERVIEW_H
00022
00023 #include <koproperty/property.h>
00024 #include <kexidb/alter.h>
00025 #include <core/kexitabledesignerinterface.h>
00026
00027 #include <kexidatatable.h>
00028 #include "kexitablepart.h"
00029
00030 class KexiTableItem;
00031 class KexiTableDesignerViewPrivate;
00032 class KCommand;
00033 class CommandGroup;
00034
00035 namespace KoProperty {
00036 class Set;
00037 }
00038
00040
00056 class KexiTableDesignerView : public KexiDataTable, public KexiTableDesignerInterface
00057 {
00058 Q_OBJECT
00059
00060 public:
00062 KexiTableDesignerView(KexiMainWindow *win, QWidget *parent);
00063
00064 virtual ~KexiTableDesignerView();
00065
00066 KexiTablePart::TempData* tempData() const;
00067
00071 virtual void clearRow(int row, bool addCommand = false);
00072
00075 virtual void insertField(int row, const QString& caption, bool addCommand = false);
00076
00080 virtual void insertField(int row, KoProperty::Set& set, bool addCommand = false);
00081
00085 virtual void insertEmptyRow( int row, bool addCommand = false );
00086
00090 virtual void deleteRow( int row, bool addCommand = false );
00091
00094
00095
00099 virtual void changeFieldPropertyForRow( int row,
00100 const QCString& propertyName, const QVariant& newValue,
00101 KoProperty::Property::ListData* const listData, bool addCommand );
00102
00106 void changeFieldProperty( int fieldUID, const QCString& propertyName,
00107 const QVariant& newValue, KoProperty::Property::ListData* const listData = 0,
00108 bool addCommand = false );
00109
00112 void changePropertyVisibility( int fieldUID, const QCString& propertyName, bool visible );
00113
00115 KexiDB::Field * buildField( const KoProperty::Set &set ) const;
00116
00118 virtual QString debugStringForCurrentTableSchema(tristate& result);
00119
00122 virtual tristate simulateAlterTableExecution(QString *debugTarget);
00123
00124 public slots:
00128 virtual tristate executeRealAlterTable();
00129
00130 protected slots:
00133 void updateActions();
00134
00135 virtual void slotUpdateRowActions(int row);
00136
00137 void slotAboutToShowContextMenu();
00138
00140 void slotBeforeCellChanged(KexiTableItem *item, int colnum,
00141 QVariant& newValue, KexiDB::ResultInfo* result);
00142
00144 void slotRowUpdated(KexiTableItem *item);
00145
00147 void slotRowInserted();
00148
00149
00151 void slotAboutToDeleteRow(KexiTableItem& item, KexiDB::ResultInfo* result, bool repaint);
00152
00155 void slotPropertyChanged(KoProperty::Set& set, KoProperty::Property& property);
00156
00159 void slotTogglePrimaryKey();
00160
00162 void slotUndo();
00163
00165 void slotRedo();
00166
00168 void slotCommandExecuted(KCommand *command);
00169
00171 void slotSimulateAlterTableExecution();
00172
00173 protected:
00174 virtual void updateActions(bool activated);
00175
00177 void initData();
00178
00183 KoProperty::Set* createPropertySet( int row, const KexiDB::Field& field, bool newOne = false );
00184
00185 virtual tristate beforeSwitchTo(int mode, bool &dontStore);
00186
00187 virtual tristate afterSwitchFrom(int mode);
00188
00191 virtual KoProperty::Set *propertySet();
00192
00193
00194
00198 virtual KexiDB::SchemaData* storeNewData(const KexiDB::SchemaData& sdata, bool &cancel);
00199
00203 virtual tristate storeData(bool dontAsk = false);
00204
00211 tristate buildSchema(KexiDB::TableSchema &schema, bool beSilent = false);
00212
00215 tristate buildAlterTableActions(KexiDB::AlterTableHandler::ActionList &actions);
00216
00222 void switchPrimaryKey(KoProperty::Set &propertySet, bool set, bool aWasPKey = false,
00223 CommandGroup* commandGroup = 0);
00224
00226 void getSubTypeListData(KexiDB::Field::TypeGroup fieldTypeGroup,
00227 QStringList& stringsList, QStringList& namesList);
00228
00231 void addHistoryCommand( KCommand* command, bool execute );
00232
00234 void updateUndoRedoActions();
00235
00236 #ifdef KEXI_DEBUG_GUI
00237 void debugCommand( KCommand* command, int nestingLevel );
00238 #endif
00239
00243 void insertFieldInternal(int row, KoProperty::Set* set, const QString& caption, bool addCommand);
00244
00246 virtual void propertySetSwitched();
00247
00252 bool isPhysicalAlteringNeeded();
00253
00254 private:
00255 KexiTableDesignerViewPrivate *d;
00256 };
00257
00258 #endif