Main Page | Class Hierarchy | Class List | Directories | File List | Class Members

hk_kdetabledesign.h

00001 // ****************************************************************************
00002 // copyright (c) 2000-2004 Horst Knorr <hk_classes@knoda.org>  
00003 // This file is part of the hk_kdeclasses library.
00004 // This file may be distributed and/or modified under the terms of the
00005 // GNU Library Public License version 2 as published by the Free Software
00006 // Foundation and appearing in the file LGPL included in the
00007 // packaging of this file.
00008 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00009 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00010 // ****************************************************************************
00011 
00012 #ifndef HK_KDETABLEDESIGN_H
00013 #define HK_KDETABLEDESIGN_H
00014 #include <hk_dsgrid.h>
00015 #include <hk_dsvisible.h>
00016 #include <qvariant.h>
00017 #include <qwidget.h>
00018 #include <hk_column.h>
00019 #include <qstring.h>
00020 #include <qstringlist.h>
00021 #include <list>
00022 class QVBoxLayout;
00023 class QHBoxLayout;
00024 class QGridLayout;
00025 class QButtonGroup;
00026 class QCheckBox;
00027 class QComboBox;
00028 class QLabel;
00029 class QLineEdit;
00030 class QListView;
00031 class QListViewItem;
00032 class QPushButton;
00033 class QSpinBox;
00034 class QToolButton;
00035 class hk_kdeindexwindow;
00047 class hk_kdetabledesign : public QWidget ,public hk_dsvisible
00048 {
00049     Q_OBJECT
00050 
00051         public:
00052         hk_kdetabledesign( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
00053         virtual    ~hk_kdetabledesign();
00054 
00055         virtual void set_datasource(hk_datasource* d);
00056         hk_datasource* datasource(void);
00057         bool has_changed() const;
00058         signals:
00059         void signal_has_changed();
00060     public slots:
00064         virtual bool alter_table(bool ask=true);
00065         virtual void load_fieldinfo();
00066         void set_designmode();
00067         virtual void alterbutton_clicked();
00068     protected slots:
00069         virtual void delete_clicked();
00070         virtual void index_clicked();
00071         virtual void name_changed();
00072         virtual void new_clicked();
00073         virtual void primary_changed();
00074         virtual void notnull_changed();
00075         virtual void selection_changed();
00076         virtual void indexselection_changed();
00077         virtual void size_changed();
00078         virtual void type_changed();
00079         virtual void new_index();
00080         virtual void alter_index();
00081         virtual void delete_index();
00082         virtual void set_indexlist(void);
00083 
00084     protected:
00085 
00086         virtual void showEvent(QShowEvent* e);
00087         virtual void    list_changes(listtype type);
00088         void set_fields_enabled(void);
00089         QGridLayout* hk_kdetabledesignLayout;
00090         QHBoxLayout* Layoutindexwindow;
00091         QVBoxLayout* buttonlayout;
00092         QHBoxLayout* Layout8;
00093         QHBoxLayout* Layout7;
00094         QVBoxLayout* Layout22;
00095         QHBoxLayout* Layout25;
00096         QVBoxLayout* Layout24;
00097         QHBoxLayout* Layout23;
00098         QVBoxLayout* editlayout;
00099         QVBoxLayout* fieldbuttonlayout;
00100         QHBoxLayout* fieldtoplayout;
00101 
00102         QListView* fieldlist;
00103         QPushButton* newbutton;
00104         QPushButton* deletebutton;
00105         QPushButton* alterbutton;
00106         QPushButton* indexdeletebutton;
00107         QPushButton* indexnewbutton;
00108         QPushButton* indexalterbutton;
00109         QLabel* fieldnamelabel;
00110         QLabel* columntypelabel;
00111         QLabel* sizelabel;
00112         QLabel* notnulllabel;
00113         QLabel* primaryindexlabel;
00114         QLineEdit* namefield;
00115         QComboBox* typefield;
00116         QSpinBox* sizefield;
00117         QCheckBox* primaryfield;
00118         QCheckBox* notnullfield;
00119         QListView* indexwindow;
00120 
00121         void create_columntypelist(void);
00122     private :
00123         void structure_changes(bool c);
00124         void clear_fieldlist(void);
00125         hk_column::enum_columntype ftype(const QString&);
00126         enum enum_state {unchanged,delfield,newfield,altered};
00127         int fieldname_count(const hk_string&);
00131         //bool is_keyword(const QString&);
00132         typedef  class  fieldstruct
00133         {
00134             public:
00135                 hk_string oldname;
00136                 bool   oldprimary;
00137                 bool   oldnotnull;
00138                 hk_column::enum_columntype oldtype;
00139                 long    oldsize;
00140                 hk_string newname;
00141                 bool   newprimary;
00142                 bool   newnotnull;
00143                 hk_column::enum_columntype newtype;
00144                 long    newsize;
00145                 enum_state state;
00146         };
00147         typedef class dictclass
00148         {
00149             public:
00150                 QString name;
00151                 hk_column::enum_columntype type;
00152         };
00153         void show_fieldinfos(fieldstruct*);
00154         list<dictclass>   columntype_dictionary;
00155         list<fieldstruct> fields;
00156         list<fieldstruct>::iterator actualfieldit;
00157         QListViewItem* lastmarkedItem;
00158         bool p_fieldlist_created;
00159         bool p_has_changed;
00160         bool fieldnamecheck;
00161 //        QStringList p_keywordlist;
00162 };
00163 #endif                                            // HK_KDETABLEdesign_H

Generated on Tue Mar 22 23:28:15 2005 for Databasehandlingdialogclasses by  doxygen 1.4.1