Databasehandlingdialogclasses  0.5.3
hk_kdedblistview.h
1 // ****************************************************************************
2 // copyright (c) 2000-2005 Horst Knorr <hk_classes@knoda.org>
3 // This file is part of the hk_kdeclasses library.
4 // This file may be distributed and/or modified under the terms of the
5 // GNU Library Public License version 2 as published by the Free Software
6 // Foundation and appearing in the file LGPL included in the
7 // packaging of this file.
8 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
9 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
10 // ****************************************************************************
11  //$Revision: 1.12 $
12 
13 #ifndef HK_KDEDBLISTVIEW_H
14 #define HK_KDEDBLISTVIEW_H
15 #include <klistview.h>
16 #include <qdialog.h>
17 #include <qdragobject.h>
18 
19 #include <hk_dbvisible.h>
20 
22 class QProgressDialog;
23 class hk_kdeschemadialog;
24 class QVBoxLayout;
25 class QHBoxLayout;
26 class QGridLayout;
27 class QButtonGroup;
28 class QLabel;
29 class QPushButton;
30 class QRadioButton;
31 class KAction;
32 class KActionMenu;
33 class QPopupMenu;
34 
35 
36 
37 
38 class hk_dbviewerdrag : public QStoredDrag
39 {
40 public:
41 
42 hk_dbviewerdrag(objecttype type,const QString& object,hk_database* db,QWidget* dragsource=0);
43 static bool canDecode(const QMimeSource* s);
44 const char* format(int i) const;
45 
46 private:
47 void create_draginfo(objecttype type,const QString& object,hk_database* db);
48 };
49 
50 
51 class hk_kdedblistview: public KListView, public hk_dbvisible
52 {
53 Q_OBJECT
54 public:
55 hk_kdedblistview (QWidget* parent=0L, const char* name=0L);
56 virtual ~hk_kdedblistview();
57 void set_database(hk_database*);
58 bool is_tableitem(QListViewItem*,bool includingheader=false);
59 bool is_queryitem(QListViewItem*,bool includingheader=false);
60 bool is_viewitem(QListViewItem*,bool includingheader=false);
61 bool is_formitem(QListViewItem*,bool includingheader=false);
62 bool is_reportitem(QListViewItem*,bool includingheader=false);
63 bool is_moduleitem(QListViewItem*,bool includingheader=false);
64 bool is_databaseitem(QListViewItem*);
65 bool is_headeritem(QListViewItem*);
66 bool is_tableitem(bool includingheader=false);
67 bool is_queryitem(bool includingheader=false);
68 bool is_viewitem(bool includingheader=false);
69 bool is_formitem(bool includingheader=false);
70 bool is_reportitem(bool includingheader=false);
71 bool is_moduleitem(bool includingheader=false);
72 bool is_databaseitem(void);
73 bool is_headeritem(void);
74 bool is_tableheader(void);
75 bool is_queryheader(void);
76 bool is_viewheader(void);
77 bool is_formheader(void);
78 bool is_reportheader(void);
79 bool is_tableheader(QListViewItem*);
80 bool is_queryheader(QListViewItem*);
81 bool is_viewheader(QListViewItem*);
82 bool is_formheader(QListViewItem*);
83 bool is_reportheader(QListViewItem*);
84 bool is_moduleheader(QListViewItem*);
85 bool cancel(void){return p_cancelcopying;}
86 void reload_lists(void);
87 enum enum_showmode {sm_all,sm_central,sm_local};
88 
89 void set_showmode(enum_showmode);
90 enum_showmode showmode(void) const;
91 
92 static void set_use_singleclick(bool);
93 static bool use_singleclick(void) ;
94 
95 
96 
97 signals:
98 
99  void signal_new_database(void);
100  void signal_delete_database(const QString&);
101  void signal_reload_databases(void);
102 
103  void signal_new_table(void);
104  void signal_delete_table(const QString&);
105  void signal_designmode_table(const QString&);
106  void signal_viewmode_table(const QString&);
107 
108  void signal_new_view(void);
109  void signal_delete_view(const QString&);
110  void signal_designmode_view(const QString&);
111  void signal_viewmode_view(const QString&);
112 
113  void signal_new_query(void);
114  void signal_delete_query(const QString&);
115  void signal_designmode_query(const QString&);
116  void signal_viewmode_query(const QString&);
117 
118  void signal_new_form(void);
119  void signal_delete_form(const QString&);
120  void signal_designmode_form(const QString&);
121  void signal_viewmode_form(const QString&);
122 
123  void signal_new_report(void);
124  void signal_delete_report(const QString&);
125  void signal_designmode_report(const QString&);
126  void signal_viewmode_report(const QString&);
127 
128 
129  void signal_new_module(void);
130  void signal_delete_module(const QString&);
131  void signal_designmode_module(const QString&);
132 
133 public slots:
134 virtual void new_clicked();
135 virtual void start_clicked();
136 virtual void alter_clicked();
137 virtual void delete_clicked();
138  void copy(void);
139  void paste(void);
140  void copying_cancelled();
141 
142 
143 protected slots:
144 
145 void item_clicked(QListViewItem*);
146 void item_doubleclicked(QListViewItem*);
147 void slot_drop(QDropEvent*);
148 
149 
150 protected:
151 static bool set_progress(long int,long int,const hk_string&);
152  QDragObject* dragObject ();
153 
154  void item_selected(QListViewItem* );
155 virtual void list_changes(listtype type);
156 
157 // virtual void contentsmouseReleaseEvent(QMouseEvent*);
158 // virtual void contentsmouseMoveEvent(QMouseEvent*);
159  virtual bool acceptDrag(QDropEvent*) const;
160  //void dragEnterEvent(QDragEnterEvent*);
161 
162  bool decode_action(QMimeSource* event);
163  bool copy_presentationfile(void);
164  bool copy_table(void);
165  bool copy_view(void);
166  bool copy_database(void);
167  hk_connection* find_connection(void);
168 
169 private:
170 objecttype current_objecttype();
171 void init_listview(void);
172 void set_databasename(void);
173 void set_tables(void);
174 void set_views(void);
175 void set_queries(void);
176 void set_forms(void);
177 void set_reports(void);
178 void set_modules(void);
179 bool execute_action(void);
180 hk_kdedblistviewprivate* p_private;
181 static QProgressDialog* p_progressdialog;
182 static bool p_cancelcopying;
183 static bool p_use_singleclick;
184 };
185 
186 class hk_kdeschemadialog : public QDialog
187 {
188  Q_OBJECT
189 
190  public:
191  hk_kdeschemadialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
193 
194  QButtonGroup* ButtonGroup1;
195  QRadioButton* schemaonlyfield;
196  QRadioButton* datafield;
197  QPushButton* buttonOk;
198  QPushButton* buttonCancel;
199 
200  protected:
201  QHBoxLayout* hk_kdeschemadialogLayout;
202  QVBoxLayout* ButtonGroup1Layout;
203  QVBoxLayout* Layout2;
204 };
205 
206 
207 #endif //HK_KDEDBLISTVIEW_H
Definition: hk_kdedblistview.h:51
Definition: hk_kdedblistview.h:186
Definition: hk_kdedblistview.cpp:159
Definition: hk_kdedblistview.h:38