kword
KWQtSqlSerialDataSource.h
00001 /* This file is part of the KDE project 00002 Copyright (C) 2001 Joseph Wenninger <jowenn@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 * Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef _SERIALLETTER_QtSql_PLUGIN_H_ 00021 #define _SERIALLETTER_QtSql_PLUGIN_H_ 00022 00023 #include <qdom.h> 00024 #include <qsqlcursor.h> 00025 #include "KWMailMergeDataSource.h" 00026 #include "KWQtSqlSerialDataSourceBase.h" 00027 #include "qtsqldatasourceeditor.h" 00028 00029 00030 /****************************************************************** 00031 * 00032 * Class: KWQtSqlSerialDataSource 00033 * 00034 ******************************************************************/ 00035 00036 class KWQtSqlSerialDataSource: public KWQtSqlSerialDataSourceBase 00037 { 00038 public: 00039 KWQtSqlSerialDataSource(KInstance *inst,QObject *parent); 00040 ~KWQtSqlSerialDataSource(); 00041 00042 virtual void save( QDomDocument &doc,QDomElement&); 00043 virtual void load( QDomElement& elem ); 00044 virtual class QString getValue( const class QString &name, int record = -1 ) const; 00045 virtual int getNumRecords() const { 00046 return (myquery?((myquery->size()<0)?0:myquery->size()):0); 00047 } 00048 virtual void refresh(bool); 00049 virtual bool showConfigDialog(QWidget *,int); 00050 00051 protected: 00052 friend class KWQtSqlDataSourceEditor; 00053 QString tableName; 00054 QString filter; 00055 QSqlCursor *myquery; 00056 }; 00057 00058 /****************************************************************** 00059 * 00060 * Class: KWQtSqlDataSourceEditor 00061 * 00062 ******************************************************************/ 00063 00064 class KWQtSqlDataSourceEditor : public KDialogBase 00065 { 00066 Q_OBJECT 00067 00068 public: 00069 KWQtSqlDataSourceEditor( QWidget *parent, KWQtSqlSerialDataSource *db_ ); 00070 ~KWQtSqlDataSourceEditor(){;} 00071 private: 00072 KWQtSqlSerialDataSource *db; 00073 QtSqlDataSourceEditor *widget; 00074 void updateTableCombo(); 00075 QString filter; 00076 QString tableName; 00077 00078 private slots: 00079 void tableChanged(int); 00080 void slotSetQuery(); 00081 void editFilter(); 00082 }; 00083 00084 00085 #endif