~ubuntu-branches/ubuntu/wily/tora/wily-proposed

« back to all changes in this revision

Viewing changes to doc/help/api/toresultcontent_h.html

  • Committer: Bazaar Package Importer
  • Author(s): Albin Tonnerre
  • Date: 2007-05-29 13:13:36 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070529131336-85ygaddivvmkd3xc
Tags: 1.3.21pre22-1ubuntu1
* Merge from Debian unstable. Remaining Ubuntu changes:
  - debian/rules: call dh_iconcache
  - Remove g++ build dependency
* Modify Maintainer value to match Debian-Maintainer-Field Spec

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<HTML>
 
2
<HEAD>
 
3
<TITLE>Source: toresultcontent.h</TITLE>
 
4
 
 
5
<META NAME="Generator" CONTENT="KDOC ">
 
6
</HEAD>
 
7
<BODY bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#000099" alink= "#ffffff">
 
8
<TABLE WIDTH="100%" BORDER="0">
 
9
<TR>
 
10
<TD>
 
11
        <TABLE BORDER="0">
 
12
                <TR><TD valign="top" align="left" cellspacing="10">
 
13
                <h1>Source: toresultcontent.h</h1>
 
14
                </TD>
 
15
                <TD valign="top" align="right" colspan="1"></TD></TR>
 
16
        </TABLE>
 
17
        <HR>
 
18
        <TABLE BORDER="0">
 
19
                
 
20
        </TABLE>
 
21
        </TD>
 
22
<TD align="right"><TABLE BORDER="0"><TR><TD><small><A HREF="index-long.html">Annotated List</A></small></TD></TR>
 
23
<TR><TD><small><A HREF="header-list.html">Files</A></small></TD></TR>
 
24
<TR><TD><small><A HREF="all-globals.html">Globals</A></small></TD></TR>
 
25
<TR><TD><small><A HREF="hier.html">Hierarchy</A></small></TD></TR>
 
26
<TR><TD><small><A HREF="index.html">Index</A></small></TD></TR>
 
27
</TABLE></TD></TR></TABLE>
 
28
<pre>
 
29
/*****
 
30
 *
 
31
 * TOra - An Oracle Toolkit for DBA's and developers
 
32
 * Copyright (C) 2003-2005 Quest Software, Inc
 
33
 * Portions Copyright (C) 2005 Other Contributors
 
34
 * 
 
35
 * This program is free software; you can redistribute it and/or
 
36
 * modify it under the terms of the GNU General Public License
 
37
 * as published by the Free Software Foundation;  only version 2 of
 
38
 * the License is valid for this program.
 
39
 * 
 
40
 * This program is distributed in the hope that it will be useful,
 
41
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
42
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
43
 * GNU General Public License for more details.
 
44
 * 
 
45
 * You should have received a copy of the GNU General Public License
 
46
 * along with this program; if not, write to the Free Software
 
47
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
48
 *
 
49
 *      As a special exception, you have permission to link this program
 
50
 *      with the Oracle Client libraries and distribute executables, as long
 
51
 *      as you follow the requirements of the GNU GPL in regard to all of the
 
52
 *      software in the executable aside from Oracle client libraries.
 
53
 *
 
54
 *      Specifically you are not permitted to link this program with the
 
55
 *      Qt/UNIX, Qt/Windows or Qt Non Commercial products of TrollTech.
 
56
 *      And you are not permitted to distribute binaries compiled against
 
57
 *      these libraries without written consent from Quest Software, Inc.
 
58
 *      Observe that this does not disallow linking to the Qt Free Edition.
 
59
 *
 
60
 *      You may link this product with any GPL'd Qt library such as Qt/Free
 
61
 *
 
62
 * All trademarks belong to their respective owners.
 
63
 *
 
64
 *****/
 
65
 
 
66
#ifndef TORESULTCONTENT_H
 
67
#define TORESULTCONTENT_H
 
68
 
 
69
#include "tobackground.h"
 
70
#include "toconnection.h"
 
71
#include "toeditwidget.h"
 
72
#include "tomemoeditor.h"
 
73
#include "toresult.h"
 
74
 
 
75
#include <list>
 
76
 
 
77
#include <qtable.h>
 
78
#include <qvbox.h>
 
79
 
 
80
class QChecBox;
 
81
class QCheckBox;
 
82
class QGrid;
 
83
class QLineEdit;
 
84
class toNoBlockQuery;
 
85
class toResultContent;
 
86
class toSearchReplace;
 
87
 
 
88
/** Implement memo editor in result content editor. Only for internal use.
 
89
 * @internal
 
90
 */
 
91
 
 
92
class toResultContentMemo : public toMemoEditor {
 
93
  Q_OBJECT
 
94
 
 
95
  toResultContentEditor *contentEditor();
 
96
public:
 
97
  toResultContentMemo(QWidget *parent,const QString &data,int row,int col,
 
98
                      bool sql=false);
 
99
public slots:
 
100
  virtual void firstColumn();
 
101
  virtual void nextColumn();
 
102
  virtual void previousColumn();
 
103
  virtual void lastColumn();
 
104
 
 
105
  virtual void changePosition(int row,int cols);
 
106
};
 
107
 
 
108
/** This widget is used for single record view in the content editor. Only for internal use.
 
109
 * @internal
 
110
 */
 
111
 
 
112
class toResultContentSingle : public QScrollView {
 
113
  Q_OBJECT
 
114
 
 
115
  int Row;
 
116
  QGrid *Container;
 
117
  std::list<QCheckBox *> Null;
 
118
  std::list<QLineEdit *> Value;
 
119
public:
 
120
  toResultContentSingle(QWidget *parent);
 
121
 
 
122
  void changeSource(QTable *table);
 
123
  void changeRow(QTable *table,int row);
 
124
  void saveRow(QTable *table,int row);
 
125
private slots:
 
126
  virtual void showMemo(int row);
 
127
};
 
128
 
 
129
/** This widget allows the user to browse the contents of a table and also edit
 
130
 * the content. The table is specified by the first and second parameter in the query.
 
131
 * The sql is not used in the query. Only for internal use.
 
132
 */
 
133
 
 
134
class toResultContentEditor : public QTable,public toEditWidget {
 
135
  Q_OBJECT
 
136
 
 
137
  /** Single record form.
 
138
   */
 
139
  toResultContentSingle *SingleEdit;
 
140
  /** Owner of table.
 
141
   */
 
142
  QString Owner;
 
143
  /** Tablename.
 
144
   */
 
145
  QString Table;
 
146
  /** The SQL used to read the data.
 
147
   */
 
148
  QString SQL;
 
149
  /** Original values of rows currently being edited.
 
150
   */
 
151
  std::list<QString> OrigValues;
 
152
  /** Original values of rows currently being edited.
 
153
   */
 
154
  bool *BinaryColumns;
 
155
  /** Stream to read data from.
 
156
   */
 
157
  toNoBlockQuery *Query;
 
158
 
 
159
  toQDescList Description;
 
160
  toBackground Poll;
 
161
  int MaxNumber;
 
162
  int SkipNumber;
 
163
  bool GotoEnd;
 
164
  /** Number of rows read from stream.
 
165
   */
 
166
  int Row;
 
167
  /** Current row of editing.
 
168
   */
 
169
  int CurrentRow;
 
170
  /** Current row of editing.
 
171
   */
 
172
  int NewRecordRow;
 
173
  /** Used to detect drag.
 
174
   */
 
175
  QPoint LastMove;
 
176
  
 
177
  /** Popup menu if available.
 
178
   */
 
179
  QPopupMenu *Menu;
 
180
  /** Column of item selected when popup menu displayed.
 
181
   */
 
182
  int MenuColumn;
 
183
  /** Row of item selected when popup menu displayed.
 
184
   */
 
185
  int MenuRow;
 
186
  
 
187
  /** Current sorting row.
 
188
   */
 
189
  int SortRow;
 
190
  /** Indicate if sorting ascending or descending.
 
191
   */
 
192
  bool SortRowAsc;
 
193
  
 
194
  /** Use filter for all tables.
 
195
   */
 
196
  bool AllFilter;
 
197
  /** Filter selection criteria
 
198
   */
 
199
  static std::map<QCString,QString> Criteria;
 
200
  /** Filter retrieve order
 
201
   */
 
202
  static std::map<QCString,QString> Order;
 
203
  /** Current filter name in map
 
204
   */
 
205
  QString FilterName;
 
206
  /** Never use returning.
 
207
   */
 
208
  bool NoUseReturning;
 
209
 
 
210
  /** Throw an exception about wrong usage.
 
211
   */
 
212
  void wrongUsage(void);
 
213
  
 
214
  void saveRow(int);
 
215
  /** Reimplemented for internal reasons.
 
216
   */
 
217
  virtual void drawContents(QPainter * p,int cx,int cy,int cw,int ch);
 
218
  /** Reimplemented for internal reasons.
 
219
   */
 
220
  virtual QWidget *beginEdit(int row,int col,bool replace);
 
221
  virtual void endEdit(int row,int col,bool accept,bool replace);
 
222
 
 
223
  /** Reimplemented for internal reasons.
 
224
   */
 
225
  virtual void paintCell(QPainter *p,int row,int col,const QRect &cr,bool selected);
 
226
  /** Reimplemented for internal reasons.
 
227
  */
 
228
  virtual bool eventFilter(QObject *o,QEvent *e);
 
229
  /** Reimplemented for internal reasons.
 
230
  */
 
231
  virtual void keyPressEvent(QKeyEvent *e);
 
232
  /** Reimplemented for internal reasons.
 
233
   */
 
234
  virtual void activateNextCell();
 
235
  
 
236
  /** Reimplemented for internal reasons.
 
237
   */
 
238
  virtual void dragEnterEvent(QDragEnterEvent *event);
 
239
  /** Reimplemented for internal reasons.
 
240
   */
 
241
  virtual void dropEvent(QDropEvent *event);
 
242
  /** Reimplemented for internal reasons.
 
243
   */
 
244
  virtual void contentsMousePressEvent(QMouseEvent *e);
 
245
  /** Reimplemented for internal reasons.
 
246
   */
 
247
  virtual void contentsMouseReleaseEvent(QMouseEvent *e);
 
248
  /** Reimplemented for internal reasons.
 
249
   */
 
250
  virtual void contentsMouseMoveEvent (QMouseEvent *e);
 
251
  /** Reimplemented for internal reasons.
 
252
   */
 
253
  virtual void focusInEvent (QFocusEvent *e);
 
254
  /** A setCurrentCell() replacement; makes sure that we have focus.
 
255
   */
 
256
  virtual void setCurrentCellFocus(int row, int col);
 
257
 
 
258
  int MaxColDisp;
 
259
 
 
260
  QString table(void);
 
261
 
 
262
  toConnection &connection();
 
263
  QLineEdit *CurrentEditor;
 
264
  int SearchStart;
 
265
  int SearchEnd;
 
266
 
 
267
  class contentItem : public QTableItem {
 
268
  public:
 
269
    contentItem(QTable *table,const QString &text);
 
270
    virtual QString key(void) const;
 
271
  };
 
272
 
 
273
  toListView *copySelection(bool);
 
274
public:
 
275
  /** Indicate that editor should never use returning clauses even if this is oracle.
 
276
   */
 
277
  void useNoReturning(bool use)
 
278
  { NoUseReturning=use; }
 
279
  /** Create the widget.
 
280
   * @param parent Parent widget.
 
281
   * @param name Name of widget.
 
282
   */
 
283
  toResultContentEditor(QWidget *parent,const char *name=NULL);
 
284
  /** Destruct object
 
285
   */
 
286
  ~toResultContentEditor();
 
287
  /** Reimplemented for internal reasons.
 
288
   */
 
289
  virtual void query(const QString &,const toQList &);
 
290
  /** Reimplemented for internal reasons.
 
291
   */
 
292
  virtual void changeParams(const QString &Param1,const QString &Param2)
 
293
  { toQList pars; pars.insert(pars.end(),Param1); pars.insert(pars.end(),Param2); query(QString::null,pars); }
 
294
  
 
295
  /** Print this editor.
 
296
   */
 
297
  virtual void editPrint(void);
 
298
  /** Reimplemented for internal reasons.
 
299
   */
 
300
  virtual bool editSave(bool ask);
 
301
  /** Reimplemented for internal reasons.
 
302
   */
 
303
  virtual void editReadAll(void);
 
304
  /** Select all contents. Default NOP.
 
305
   */
 
306
  virtual void editSelectAll(void);
 
307
 
 
308
  /** Reimplemented for internal reasons.
 
309
   */
 
310
  virtual void setText(int row,int col,const QString &text);
 
311
 
 
312
  /** Set a new filter setting.
 
313
   * @param all Apply filter to all tables, otherwise only for this table.
 
314
   * @param criteria Criteria to filter on.
 
315
   * @param order Order to read data on.
 
316
   */
 
317
  void changeFilter(bool all,const QString &criteria,const QString &order);
 
318
 
 
319
  /** Get information about if filter affect all tables.
 
320
   */
 
321
  bool allFilter()
 
322
  { return AllFilter; }
 
323
 
 
324
  friend class contentItem;
 
325
  friend class toResultContent;
 
326
 
 
327
  /** Export data to a map.
 
328
   * @param data A map that can be used to recreate the data of a chart.
 
329
   * @param prefix Prefix to add to the map.
 
330
   */
 
331
  virtual void exportData(std::map<QCString,QString> &data,const QCString &prefix);
 
332
  /** Import data
 
333
   * @param data Data to read from a map.
 
334
   * @param prefix Prefix to read data from.
 
335
   */
 
336
  virtual void importData(std::map<QCString,QString> &data,const QCString &prefix);
 
337
public slots:
 
338
  /** Erase last parameters
 
339
   */
 
340
  virtual void clearParams(void)
 
341
  { Owner=Table=QString::null; }
 
342
  /** Change sorting column
 
343
   * @param col Column selected to change as sorting.
 
344
   */
 
345
  virtual void changeSort(int col); 
 
346
  /** Current cell changed.
 
347
   * @param row New row.
 
348
   * @param col New column.
 
349
   */
 
350
  void changePosition(int row,int col);
 
351
  
 
352
  /** Display popup menu
 
353
   * @param p Point to display popup at.
 
354
   */
 
355
  virtual void displayMenu(const QPoint &p);
 
356
  /** Display editable memo viewer at current position.
 
357
   */
 
358
  virtual void displayMemo(void);
 
359
  /** Save unsaved changes in the editor
 
360
   */
 
361
  virtual void saveUnsaved(void);
 
362
  /** Delete the current row from the table.
 
363
   */
 
364
  virtual void deleteCurrent(void);
 
365
  /** Add a new record to the table.
 
366
   */
 
367
  virtual void addRecord(void);
 
368
  /** Duplicate a new record for editing.
 
369
   */
 
370
  virtual void duplicateRecord(void);
 
371
  /** Discard the changes made to the table.
 
372
   */
 
373
  virtual void cancelEdit(void);
 
374
  /** Goto the last record in the table.
 
375
   */
 
376
  virtual void gotoLastRecord(void);
 
377
  /** Goto the first record in the table.
 
378
   */
 
379
  virtual void gotoFirstRecord(void);
 
380
  /** Goto the previous record in the table.
 
381
   */
 
382
  virtual void gotoPreviousRecord(void);
 
383
  /** Goto the next record in the table.
 
384
   */
 
385
  virtual void gotoNextRecord(void);
 
386
  /** Display single record form.
 
387
   */
 
388
  virtual void singleRecordForm(bool display);
 
389
 
 
390
  /** Move to top of data
 
391
   */
 
392
  virtual void searchTop(void)
 
393
  { setCurrentCell(0,0); }
 
394
  /** Search for next entry
 
395
   * @return True if found, should select the found text.
 
396
   */
 
397
  virtual bool searchNext(toSearchReplace *search);
 
398
  /** Replace entry with new data
 
399
   */
 
400
  virtual void searchReplace(const QString &newData);
 
401
  /** Check if data can be modified by search
 
402
   * @param all If true can replace all, otherwise can replace right now.
 
403
   */
 
404
  virtual bool searchCanReplace(bool all);
 
405
signals:
 
406
  /** Emitted to indicate wether a filter is used.
 
407
   */
 
408
  void filterEnabled(bool);
 
409
  //* Emitted when changes were saved.
 
410
  void changesSaved();
 
411
protected slots:
 
412
  /** Callback from popup menu.
 
413
   * @param cmd Command ID.
 
414
   */
 
415
  virtual void menuCallback(int cmd);
 
416
  /** Change data at specified position.
 
417
   * @param row Row to change.
 
418
   * @param col Column to change.
 
419
   * @param data New contents of data.
 
420
   */ 
 
421
  virtual void changeData(int row,int col,const QString &data); 
 
422
private slots:
 
423
  virtual void poll(void);
 
424
};
 
425
 
 
426
/** This widget allows the user to browse the contents of a table and also edit
 
427
 * the content. The table is specified by the first and second parameter in the query.
 
428
 * The sql is not used in the query.
 
429
 */
 
430
 
 
431
class toResultContent : public QVBox, public toResult {
 
432
  Q_OBJECT
 
433
 
 
434
  toResultContentEditor *Editor;
 
435
public:
 
436
  /** Create the widget.
 
437
   * @param parent Parent widget.
 
438
   * @param name Name of widget.
 
439
   */
 
440
  toResultContent(QWidget *parent,const char *name=NULL);
 
441
 
 
442
  /** Get content editor table widget
 
443
   * @return Pointer to editor.
 
444
   */
 
445
  toResultContentEditor *editor(void)
 
446
  { return Editor; }
 
447
 
 
448
  /** Read all rows from the table.
 
449
   */
 
450
  virtual void editReadAll(void)
 
451
  { Editor->editReadAll(); }
 
452
  /** Print the contents.
 
453
   */
 
454
  virtual void editPrint(void)
 
455
  { Editor->editPrint(); }
 
456
  /** Export contents to file.
 
457
   */
 
458
  virtual void editSave(bool ask)
 
459
  { Editor->editSave(ask); }
 
460
 
 
461
  /** Export data to a map.
 
462
   * @param data A map that can be used to recreate the data of a chart.
 
463
   * @param prefix Prefix to add to the map.
 
464
   */
 
465
  virtual void exportData(std::map<QCString,QString> &data,const QCString &prefix)
 
466
  { Editor->exportData(data,prefix); }
 
467
  /** Import data
 
468
   * @param data Data to read from a map.
 
469
   * @param prefix Prefix to read data from.
 
470
   */
 
471
  virtual void importData(std::map<QCString,QString> &data,const QCString &prefix)
 
472
  { Editor->importData(data,prefix); }
 
473
  /** Indicate that editor should never use returning clauses even if this is oracle.
 
474
   */
 
475
  void useNoReturning(bool use)
 
476
  { Editor->useNoReturning(use); }
 
477
private slots:
 
478
  void changeFilter(void);
 
479
  void removeFilter(void);
 
480
signals:
 
481
  //* Emitted when changes were saved.
 
482
  void changesSaved(void);
 
483
public slots:
 
484
  /** Erase last parameters
 
485
   */
 
486
  virtual void clearParams(void)
 
487
  { toResult::clearParams(); Editor->clearParams(); }
 
488
  /** Reimplemented for internal reasons.
 
489
   */
 
490
  virtual void refresh(void)
 
491
  { toResult::refresh(); }
 
492
  /** Reimplemented for internal reasons.
 
493
   */
 
494
  virtual void query(const QString &sql,const toQList &param)
 
495
  { if (!setSQLParams(sql,param)) return; Editor->query(sql,param); }
 
496
  /** Reimplemented for internal reasons.
 
497
   */
 
498
  virtual void changeParams(const QString &Param1)
 
499
  { toResult::changeParams(Param1); }
 
500
  /** Reimplemented for internal reasons.
 
501
   */
 
502
  virtual void changeParams(const QString &Param1,const QString &Param2)
 
503
  { toResult::changeParams(Param1,Param2); }
 
504
  /** Reimplemented for internal reasons.
 
505
   */
 
506
  virtual void changeParams(const QString &Param1,const QString &Param2,const QString &Param3)
 
507
  { toResult::changeParams(Param1,Param2,Param3); }
 
508
  /** Save unsaved changes in the editor
 
509
   */
 
510
  virtual void saveUnsaved(void)
 
511
  { Editor->saveUnsaved(); }
 
512
  /** Commit connection
 
513
   * @param conn Connection commit is made on.
 
514
   * @param cmt If commit or rollback
 
515
   */
 
516
  virtual void saveUnsaved(toConnection &conn,bool cmt);
 
517
 
 
518
  /** Handle all databases
 
519
   */
 
520
  virtual bool canHandle(toConnection &);
 
521
};
 
522
 
 
523
#endif
 
524
</pre>
 
525
<HR>
 
526
        <table>
 
527
        <tr><td><small>Generated by: nneul on skyhawk on Wed Feb 23 19:49:58 2005, using kdoc 2.0a54.</small></td></tr>
 
528
        </table>
 
529
</BODY>
 
530
</HTML>