kexi

kexialtertabledialog.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2004-2006 Jaroslaw Staniek <js@iidea.pl>
00003 
00004    This program is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this program; see the file COPYING.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef KEXIALTERTABLEDIALOG_H
00021 #define KEXIALTERTABLEDIALOG_H
00022 
00023 #include <kexidatatable.h>
00024 #include "kexitablepart.h"
00025 
00026 class KexiTableItem;
00027 class KexiAlterTableDialogPrivate;
00028 
00029 namespace KoProperty {
00030     class Set;
00031     class Property;
00032 }
00033 
00034 class KexiAlterTableDialog : public KexiDataTable
00035 {
00036     Q_OBJECT
00037 
00038     public:
00040         KexiAlterTableDialog(KexiMainWindow *win, QWidget *parent,
00041             const char *name = 0);
00042 
00043         virtual ~KexiAlterTableDialog();
00044 
00045         KexiTablePart::TempData* tempData() const;
00046 
00047 //      virtual QWidget* mainWidget();
00048 //      KexiDataTableView* tableView() const { return m_view; }
00049 
00050 //      virtual QSize minimumSizeHint() const;
00051 //      virtual QSize sizeHint() const;
00052 
00053     protected slots:
00056         void updateActions();
00057 
00058 //      void slotCellSelected(int col, int row);
00059         virtual void slotUpdateRowActions(int row);
00060 
00062         void slotBeforeCellChanged(KexiTableItem *item, int colnum,
00063             QVariant& newValue, KexiDB::ResultInfo* result);
00064 
00066         void slotRowUpdated(KexiTableItem *item);
00067 
00069         void slotAboutToInsertRow(KexiTableItem* item, KexiDB::ResultInfo* result, bool repaint);
00070 
00072         void slotAboutToDeleteRow(KexiTableItem& item, KexiDB::ResultInfo* result, bool repaint);
00073 
00076         void slotPropertyChanged(KoProperty::Set& set, KoProperty::Property& property);
00077 
00080         void slotTogglePrimaryKey();
00081 
00082 /*      //! Called before row updating in tableview.
00083         void slotAboutToUpdateRow(KexiTableItem* item,
00084             KexiDB::RowEditBuffer* buffer, KexiDB::ResultInfo* result);
00085 */
00086 //      void slotEmptyRowInserted(KexiTableItem*, uint index);
00087 
00088     protected:
00089         virtual void updateActions(bool activated);
00090 
00092         void initData();
00093 
00098         KoProperty::Set* createPropertySet( int row, KexiDB::Field *field, bool newOne = false );
00099 
00100         virtual tristate beforeSwitchTo(int mode, bool &dontStore);
00101         virtual tristate afterSwitchFrom(int mode);
00102 
00105         virtual KoProperty::Set *propertySet();
00106 
00107         void removeCurrentPropertySet();
00108 
00110         virtual KexiDB::SchemaData* storeNewData(const KexiDB::SchemaData& sdata, bool &cancel);
00111 
00113         virtual tristate storeData(bool dontAsk = false);
00114 
00115         tristate buildSchema(KexiDB::TableSchema &schema);
00116 
00117         QString messageForSavingChanges(bool &emptyTable);
00118 
00123         void setPrimaryKey(KoProperty::Set &propertySet, bool set, bool aWasPKey = false);
00124 
00126         void getSubTypeListData(KexiDB::Field::TypeGroup fieldTypeGroup, 
00127             QStringList& stringsList, QStringList& namesList);
00128 
00129     private:
00130         KexiAlterTableDialogPrivate *d;
00131 };
00132 
00133 #endif
00134 
KDE Home | KDE Accessibility Home | Description of Access Keys