KWQtSqlPowerSerialDataSource.h
1/* This file is part of the KDE project
2 Copyright (C) 2001 Joseph Wenninger <jowenn@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#ifndef _SERIALLETTER_QtSql_POWER_PLUGIN_H_
21#define _SERIALLETTER_QtSql_POWER_PLUGIN_H_
22
23#include <tqdom.h>
24#include <tdelocale.h>
25#include <kiconloader.h>
26#include <kdialogbase.h>
27#include <tqsqldatabase.h>
28/* FOR THE DIRTY HACK */
29#include <tqsqlcursor.h>
30#include <tqsqldriver.h>
31/* END FOR THE DIRTY HACK */
32#include <tqguardedptr.h>
33
34#include "defs.h"
35#include "KWMailMergeDataSource.h"
36#include "KWQtSqlSerialDataSourceBase.h"
37#include "kwqtsqlpower.h"
38#include "KWMySqlCursor.h"
39
40/******************************************************************
41 *
42 * Class: KWQtSqlSerialDataSource
43 *
44 ******************************************************************/
45class KWQtSqlPowerSerialDataSource: public KWQtSqlSerialDataSourceBase
46{
47 TQ_OBJECT
48//
49 public:
50 KWQtSqlPowerSerialDataSource(TDEInstance *inst,TQObject *parent);
51 ~KWQtSqlPowerSerialDataSource();
52
53 virtual void save( TQDomDocument &doc,TQDomElement&);
54 virtual void load( TQDomElement& elem );
55 virtual class TQString getValue( const class TQString &name, int record = -1 ) const;
56 virtual int getNumRecords() const {
57 return (myquery?((myquery->size()<0)?0:myquery->size()):0);
58 }
59 virtual bool showConfigDialog(TQWidget *,int);
60 virtual void refresh(bool force);
61
62 protected:
63 friend class KWQtSqlPowerMailMergeEditor;
64 TQString query;
65 KWMySqlCursor *myquery;
66
67 void clearSampleRecord();
68 void addSampleRecordEntry(TQString name);
69
70};
71
72/******************************************************************
73 *
74 * Class: KWQtSqlPowerMailMergeEditor
75 *
76 ******************************************************************/
77
78class KWQtSqlPowerMailMergeEditor : public KDialogBase
79{
80 TQ_OBJECT
81//
82
83public:
84 KWQtSqlPowerMailMergeEditor( TQWidget *parent, KWQtSqlPowerSerialDataSource *db_ );
85 ~KWQtSqlPowerMailMergeEditor();
86private:
87 KWQtSqlPowerSerialDataSource *db;
88 KWQtSqlPowerWidget *widget;
89private slots:
90 void openSetup();
91 void updateDBViews();
92 void slotTableChanged ( TQListBoxItem * item );
93 void slotExecute();
94 void slotSetQuery();
95};
96
97
98#endif