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

« back to all changes in this revision

Viewing changes to src/totemplate.h

  • Committer: Bazaar Package Importer
  • Author(s): Michael Meskes
  • Date: 2009-04-07 13:16:05 UTC
  • mfrom: (1.2.7 upstream) (3.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20090407131605-u422yigfv7jgg0l0
Tags: 2.0.0-3
* Cleaned up packaging a little bit.
* Added homepage information to control file.
* Bumped Standards-Version to 3.8.1.
* Released to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*****
2
 
*
3
 
* TOra - An Oracle Toolkit for DBA's and developers
4
 
* Copyright (C) 2003-2005 Quest Software, Inc
5
 
* Portions Copyright (C) 2005 Other Contributors
6
 
7
 
* This program is free software; you can redistribute it and/or
8
 
* modify it under the terms of the GNU General Public License
9
 
* as published by the Free Software Foundation;  only version 2 of
10
 
* the License is valid for this program.
11
 
12
 
* This program is distributed in the hope that it will be useful,
13
 
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 
* GNU General Public License for more details.
16
 
17
 
* You should have received a copy of the GNU General Public License
18
 
* along with this program; if not, write to the Free Software
19
 
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20
 
*
21
 
*      As a special exception, you have permission to link this program
22
 
*      with the Oracle Client libraries and distribute executables, as long
23
 
*      as you follow the requirements of the GNU GPL in regard to all of the
24
 
*      software in the executable aside from Oracle client libraries.
25
 
*
26
 
*      Specifically you are not permitted to link this program with the
27
 
*      Qt/UNIX, Qt/Windows or Qt Non Commercial products of TrollTech.
28
 
*      And you are not permitted to distribute binaries compiled against
29
 
*      these libraries without written consent from Quest Software, Inc.
30
 
*      Observe that this does not disallow linking to the Qt Free Edition.
31
 
*
32
 
*      You may link this product with any GPL'd Qt library such as Qt/Free
33
 
*
34
 
* All trademarks belong to their respective owners.
35
 
*
36
 
*****/
 
1
 
 
2
/* BEGIN_COMMON_COPYRIGHT_HEADER
 
3
 *
 
4
 * TOra - An Oracle Toolkit for DBA's and developers
 
5
 * 
 
6
 * Shared/mixed copyright is held throughout files in this product
 
7
 * 
 
8
 * Portions Copyright (C) 2000-2001 Underscore AB
 
9
 * Portions Copyright (C) 2003-2005 Quest Software, Inc.
 
10
 * Portions Copyright (C) 2004-2008 Numerous Other Contributors
 
11
 * 
 
12
 * This program is free software; you can redistribute it and/or
 
13
 * modify it under the terms of the GNU General Public License
 
14
 * as published by the Free Software Foundation;  only version 2 of
 
15
 * the License is valid for this program.
 
16
 * 
 
17
 * This program is distributed in the hope that it will be useful,
 
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
20
 * GNU General Public License for more details.
 
21
 * 
 
22
 * You should have received a copy of the GNU General Public License
 
23
 * along with this program; if not, write to the Free Software
 
24
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
25
 * 
 
26
 *      As a special exception, you have permission to link this program
 
27
 *      with the Oracle Client libraries and distribute executables, as long
 
28
 *      as you follow the requirements of the GNU GPL in regard to all of the
 
29
 *      software in the executable aside from Oracle client libraries.
 
30
 * 
 
31
 *      Specifically you are not permitted to link this program with the
 
32
 *      Qt/UNIX, Qt/Windows or Qt Non Commercial products of TrollTech.
 
33
 *      And you are not permitted to distribute binaries compiled against
 
34
 *      these libraries. 
 
35
 * 
 
36
 *      You may link this product with any GPL'd Qt library.
 
37
 * 
 
38
 * All trademarks belong to their respective owners.
 
39
 *
 
40
 * END_COMMON_COPYRIGHT_HEADER */
37
41
 
38
42
#ifndef TOTEMPLATE_H
39
43
#define TOTEMPLATE_H
42
46
#include "tobackground.h"
43
47
#include "tohelp.h"
44
48
#include "toresultview.h"
 
49
// due the TODock
 
50
#include "utils.h"
45
51
 
46
52
#include <list>
47
53
#include <map>
48
54
 
49
 
#include <qvbox.h>
50
 
 
51
 
class QListView;
52
 
class QListViewItem;
 
55
#include <QWidget>
 
56
#include <QString>
 
57
#include <QShowEvent>
 
58
#include <QHideEvent>
 
59
 
 
60
#include "ui_totemplateeditui.h"
 
61
#include "ui_totemplateaddfileui.h"
 
62
#include "ui_totemplatesetupui.h"
 
63
 
 
64
class toTreeWidget;
 
65
class toTreeWidgetItem;
53
66
class QSplitter;
54
 
class QTextView;
55
67
class QToolBar;
56
68
class toConnection;
57
69
class toListView;
63
75
 * @internal
64
76
 */
65
77
 
66
 
class toTemplate : public QVBox, public toHelpContext
 
78
class toTemplate : public QWidget, public toHelpContext
67
79
{
68
 
    Q_OBJECT
 
80
    Q_OBJECT;
69
81
 
70
 
    QToolBar *Toolbar;
 
82
    QToolBar   *Toolbar;
71
83
    toListView *List;
72
 
    QWidget *WidgetExtra;
73
 
    QWidget *Result;
74
 
    QVBox *Frame;
 
84
    QWidget    *WidgetExtra;
 
85
    QWidget    *Result;
 
86
    QWidget    *Frame;
 
87
 
75
88
public:
76
89
    toTemplate(TODock *parent);
77
90
    virtual ~toTemplate();
82
95
    }
83
96
    QWidget *frame(void);
84
97
 
85
 
    static QWidget *parentWidget(QListViewItem *item);
86
 
    static toTemplate *templateWidget(QListViewItem *item);
87
 
    static toTemplate *templateWidget(QListView *obj);
 
98
    static QWidget *parentWidget(toTreeWidgetItem *item);
 
99
    static toTemplate *templateWidget(toTreeWidgetItem *item);
 
100
    static toTemplate *templateWidget(toTreeWidget *obj);
88
101
    static bool templateShown();
89
102
 
90
103
    virtual bool canHandle(toConnection &)
97
110
 
98
111
    void hideEvent(QHideEvent *);
99
112
    void showEvent(QShowEvent *);
 
113
 
100
114
public slots:
101
 
    void expand(QListViewItem *item);
102
 
    void collapse(QListViewItem *item);
103
 
    void selected(QListViewItem *item);
 
115
    void expand(toTreeWidgetItem *item);
 
116
    void collapse(toTreeWidgetItem *item);
 
117
    void selected(toTreeWidgetItem *item);
104
118
    void hideTemplates();
105
119
};
106
120
 
116
130
     */
117
131
    static std::list<toTemplateProvider *> *Providers;
118
132
    static bool Shown;
119
 
    static QCString *ToolKey;
120
 
    ;
121
 
    QCString Name;
 
133
    static QString *ToolKey;
 
134
 
 
135
    QString Name;
122
136
    bool Open;
 
137
 
123
138
public:
124
 
    toTemplateProvider(const QCString &name);
 
139
    toTemplateProvider(const QString &name);
125
140
    virtual ~toTemplateProvider()
126
141
    { }
127
142
 
128
143
    /** Get name of this template provider.
129
144
     */
130
 
    const QCString name()
 
145
    const QString name()
131
146
    {
132
147
        return Name;
133
148
    }
136
151
     * @param parent The list into which to insert the item.
137
152
     * @param toolbar The template toolbar if any buttons are to be added on it.
138
153
     */
139
 
    virtual void insertItems(QListView *parent, QToolBar *toolbar) = 0;
 
154
    virtual void insertItems(toTreeWidget *parent, QToolBar *toolbar) = 0;
140
155
 
141
156
    /** Save settings for this template provider.
142
157
     * @param data Map of data.
143
158
     * @param prefix Prefix of where to save info.
144
159
     */
145
 
    virtual void exportData(std::map<QCString, QString> &data, const QCString &prefix);
 
160
    virtual void exportData(std::map<QString, QString> &data, const QString &prefix);
146
161
    /** Save settings for all template providers.
147
162
     * @param data Map of data.
148
163
     * @param prefix Prefix of where to save info.
149
164
     */
150
 
    static void exportAllData(std::map<QCString, QString> &data, const QCString &prefix);
 
165
    static void exportAllData(std::map<QString, QString> &data, const QString &prefix);
151
166
    /** Import data
152
167
     * @param data Data to read from a map.
153
168
     * @param prefix Prefix to read data from.
154
169
     */
155
 
    virtual void importData(std::map<QCString, QString> &data, const QCString &prefix);
 
170
    virtual void importData(std::map<QString, QString> &data, const QString &prefix);
156
171
    /** Import data for all template providers.
157
172
     * @param data Data to read from a map.
158
173
     * @param prefix Prefix to read data from.
159
174
     */
160
 
    static void importAllData(std::map<QCString, QString> &data, const QCString &prefix);
 
175
    static void importAllData(std::map<QString, QString> &data, const QString &prefix);
161
176
 
162
177
    /** Used internally to indicate if template help is shown.
163
178
     */
164
179
    static void setShown(bool shown);
165
180
    /** Used internally to indicate tool key string
166
181
     */
167
 
    static void setToolKey(const QCString &key);
 
182
    static void setToolKey(const QString &key);
168
183
 
169
184
    friend class toTemplate;
170
185
};
184
199
     * @param parent Parent of this item.
185
200
     * @param name Contents of the first column of the item.
186
201
     */
187
 
    toTemplateItem(toTemplateProvider &prov, QListView *parent, const QString &name)
 
202
    toTemplateItem(toTemplateProvider &prov, toTreeWidget *parent, const QString &name)
188
203
            : toResultViewItem(parent, NULL, name), Provider(prov)
189
204
    { }
190
205
    /** Create an item.
192
207
     * @param name Contents of the first column of the item.
193
208
     * @param after The item to put this item after.
194
209
     */
195
 
    toTemplateItem(toTemplateItem *parent, const QString &name, QListViewItem *after = NULL)
 
210
    toTemplateItem(toTemplateItem *parent, const QString &name, toTreeWidgetItem *after = NULL)
196
211
            : toResultViewItem(parent, after, name), Provider(parent->provider())
197
212
    { }
198
213
    /** Get a reference to the provider of this item.
256
271
 
257
272
class toTemplateSQLObject : public QObject
258
273
{
259
 
    Q_OBJECT
 
274
    Q_OBJECT;
260
275
 
261
276
    toNoBlockQuery *Query;
262
277
    toBackground Poll;
284
299
    /** Statement to run.
285
300
     */
286
301
    QString SQL;
 
302
 
287
303
protected:
288
304
    /** Create an item.
289
305
     * @param conn Connection to query.
293
309
     */
294
310
    toTemplateSQL(toTemplateItem *parent,
295
311
                  const QString &name, const QString &sql);
 
312
 
296
313
public:
297
314
    /** Create an item.
298
315
     * @param conn Connection to query.
331
348
    friend class toTemplateSQLObject;
332
349
};
333
350
 
 
351
 
 
352
class toTemplatePrefs : public QWidget,
 
353
            public Ui::toTemplateSetupUI,
 
354
            public toSettingTab
 
355
{
 
356
 
 
357
    Q_OBJECT;
 
358
 
 
359
    toTool *Tool;
 
360
 
 
361
public:
 
362
    toTemplatePrefs(toTool *tool, QWidget *parent, const char *name = 0);
 
363
 
 
364
public slots:
 
365
    virtual void saveSetting(void);
 
366
    virtual void addFile(void);
 
367
    virtual void editFile(void);
 
368
    virtual void delFile(void);
 
369
};
 
370
 
 
371
 
 
372
class toTemplateAddFile : public QDialog, public Ui::toTemplateAddFileUI
 
373
{
 
374
    Q_OBJECT;
 
375
 
 
376
public:
 
377
    toTemplateAddFile(QWidget *parent, const char *name = 0);
 
378
 
 
379
public slots:
 
380
    virtual void browse(void);
 
381
    virtual void valid(void);
 
382
};
 
383
 
 
384
class toTemplateEdit : public QDialog,
 
385
            public Ui::toTemplateEditUI,
 
386
            public toHelpContext
 
387
{
 
388
    Q_OBJECT;
 
389
 
 
390
    std::map<QString, QString> &TemplateMap;
 
391
    std::map<QString, QString>::iterator LastTemplate;
 
392
 
 
393
public:
 
394
    void connectList(bool conn);
 
395
    toTreeWidgetItem *findLast(void);
 
396
    void allocateItem(void);
 
397
    bool clearUnused(toTreeWidgetItem *first, const QString &pre);
 
398
    toTemplateEdit(std::map<QString, QString> &pairs, QWidget *parent, const char *name = 0);
 
399
    QString name(toTreeWidgetItem *item);
 
400
 
 
401
public slots:
 
402
    virtual void updateFromMap(void);
 
403
    virtual void remove(void);
 
404
    virtual void preview(void);
 
405
    virtual void newTemplate(void);
 
406
    virtual void changeSelection(void);
 
407
 
 
408
};
 
409
 
334
410
#endif